Index: uspace/drv/nic/e1k/e1k.c
===================================================================
--- uspace/drv/nic/e1k/e1k.c	(revision 1df224ccbae558e600a430b5444e2dcf4de6657d)
+++ uspace/drv/nic/e1k/e1k.c	(revision e2856569931d46faeef218ba7da9518954f12638)
@@ -58,5 +58,5 @@
 #define NAME  "e1k"
 
-#define E1000_DEFAULT_INTERRUPT_INTEVAL_USEC  250
+#define E1000_DEFAULT_INTERRUPT_INTERVAL_USEC  250
 
 /* Must be power of 8 */
@@ -116,9 +116,9 @@
 	void *virt_reg_base;
 	/** Tx ring */
-	dma_mem_t tx_ring;
+	dmamem_t tx_ring;
 	/** Packets in tx ring  */
 	packet_t **tx_ring_packets;
 	/** Rx ring */
-	dma_mem_t rx_ring;
+	dmamem_t rx_ring;
 	/** Packets in rx ring  */
 	packet_t **rx_ring_packets;
@@ -188,9 +188,9 @@
 static ddf_dev_ops_t e1000_dev_ops;
 
-static int e1000_add_device(ddf_dev_t *);
+static int e1000_dev_add(ddf_dev_t *);
 
 /** Basic driver operations for E1000 driver */
 static driver_ops_t e1000_driver_ops = {
-	.add_device = e1000_add_device
+	.dev_add = e1000_dev_add
 };
 
@@ -654,5 +654,5 @@
 	for (unsigned int ra_num = E1000_RECEIVE_ADDRESS - 1;
 	    ra_num >= first_multicast_ra_num;
-	    ra_num-- {
+	    ra_num--) {
 		e1000_write_receive_address(e1000_data, ra_num, addr_iterator, true);
 		addr_iterator++;
@@ -1062,5 +1062,5 @@
 	*(e1000_data->rx_ring_packets + offset) = packet;
 	e1000_rx_descriptor_t * rx_descriptor = (e1000_rx_descriptor_t *)
-	    (e1000_data->rx_ring.virtual +
+	    (e1000_data->rx_ring.virt +
 	    offset * sizeof(e1000_rx_descriptor_t));
 	
@@ -1089,5 +1089,5 @@
 {
 	e1000_rx_descriptor_t *rx_descriptor = (e1000_rx_descriptor_t *)
-	    (e1000_data->rx_ring.virtual +
+	    (e1000_data->rx_ring.virt +
 	    offset * sizeof(e1000_rx_descriptor_t));
 	
@@ -1110,5 +1110,5 @@
 	
 	e1000_tx_descriptor_t * tx_descriptor = (e1000_tx_descriptor_t *)
-	    (e1000_data->tx_ring.virtual + 
+	    (e1000_data->tx_ring.virt +
 	    offset * sizeof(e1000_tx_descriptor_t));
 	
@@ -1159,5 +1159,5 @@
 	
 	e1000_rx_descriptor_t *rx_descriptor = (e1000_rx_descriptor_t *)
-	    (e1000_data->rx_ring.virtual +
+	    (e1000_data->rx_ring.virt +
 	    next_tail * sizeof(e1000_rx_descriptor_t));
 	
@@ -1177,5 +1177,5 @@
 		
 		rx_descriptor = (e1000_rx_descriptor_t *)
-		    (e1000_data->rx_ring.virtual +
+		    (e1000_data->rx_ring.virt +
 		    next_tail * sizeof(e1000_rx_descriptor_t));
 	}
@@ -1364,17 +1364,14 @@
 	fibril_mutex_lock(&e1000_data->rx_lock);
 	
-	e1000_data->rx_ring.size =
-	    ALIGN_UP(E1000_RX_PACKETS_COUNT * sizeof(e1000_rx_descriptor_t),
-	    PAGE_SIZE) / PAGE_SIZE;
-	e1000_data->rx_ring.mapping_flags = AS_AREA_READ | AS_AREA_WRITE;
-	
-	int rc = dma_allocate_anonymous(&e1000_data->rx_ring, 0);
+	int rc = dmamem_map(&e1000_data->rx_ring,
+	    SIZE2PAGES(E1000_RX_PACKETS_COUNT * sizeof(e1000_rx_descriptor_t)),
+	    AS_AREA_READ | AS_AREA_WRITE, 0);
 	if (rc != EOK)
 		return rc;
 	
 	E1000_REG_WRITE(e1000_data, E1000_RDBAH,
-	    (uint32_t) (PTR_TO_U64(e1000_data->rx_ring.physical) >> 32));
+	    (uint32_t) (PTR_TO_U64(e1000_data->rx_ring.phys) >> 32));
 	E1000_REG_WRITE(e1000_data, E1000_RDBAL,
-	    (uint32_t) PTR_TO_U64(e1000_data->rx_ring.physical));
+	    (uint32_t) PTR_TO_U64(e1000_data->rx_ring.phys));
 	
 	e1000_data->rx_ring_packets =
@@ -1413,5 +1410,5 @@
 	
 	free(e1000_data->rx_ring_packets);
-	dma_free(&e1000_data->rx_ring);
+	dmamem_unmap(&e1000_data->rx_ring);
 }
 
@@ -1478,5 +1475,5 @@
 	E1000_REG_WRITE(e1000_data, E1000_ITR,
 	    e1000_calculate_itr_interval_from_usecs(
-	    E1000_DEFAULT_INTERRUPT_INTEVAL_USEC));
+	    E1000_DEFAULT_INTERRUPT_INTERVAL_USEC));
 	E1000_REG_WRITE(e1000_data, E1000_FCAH, 0);
 	E1000_REG_WRITE(e1000_data, E1000_FCAL, 0);
@@ -1518,20 +1515,17 @@
 	fibril_mutex_lock(&e1000_data->tx_lock);
 	
-	e1000_data->tx_ring.size =
-	    ALIGN_UP(E1000_TX_PACKETS_COUNT * sizeof(e1000_tx_descriptor_t),
-	    PAGE_SIZE) / PAGE_SIZE;
-	e1000_data->tx_ring.mapping_flags = AS_AREA_READ | AS_AREA_WRITE;
-	
-	int rc = dma_allocate_anonymous(&e1000_data->tx_ring, 0);
+	int rc = dmamem_map(&e1000_data->tx_ring,
+	    SIZE2PAGES(E1000_TX_PACKETS_COUNT * sizeof(e1000_tx_descriptor_t)),
+	    AS_AREA_READ | AS_AREA_WRITE, 0);
 	if (rc != EOK)
 		return rc;
 	
-	bzero(e1000_data->tx_ring.virtual,
+	bzero(e1000_data->tx_ring.virt,
 	    E1000_TX_PACKETS_COUNT * sizeof(e1000_tx_descriptor_t));
 	
 	E1000_REG_WRITE(e1000_data, E1000_TDBAH,
-	    (uint32_t) (PTR_TO_U64(e1000_data->tx_ring.physical) >> 32));
+	    (uint32_t) (PTR_TO_U64(e1000_data->tx_ring.phys) >> 32));
 	E1000_REG_WRITE(e1000_data, E1000_TDBAL,
-	    (uint32_t) PTR_TO_U64(e1000_data->tx_ring.physical));
+	    (uint32_t) PTR_TO_U64(e1000_data->tx_ring.phys));
 	
 	e1000_data->tx_ring_packets =
@@ -1553,5 +1547,5 @@
 {
 	free(e1000_data->tx_ring_packets);
-	dma_free(&e1000_data->tx_ring);
+	dmamem_unmap(&e1000_data->tx_ring);
 }
 
@@ -1889,5 +1883,5 @@
 	
 	/* Obtain and fill hardware resources info */
-	rc = e1000_get_resource_info(dev);
+	int rc = e1000_get_resource_info(dev);
 	if (rc != EOK) {
 		e1000_dev_cleanup(dev);
@@ -1925,12 +1919,10 @@
 }
 
-/** The add_device callback of E1000 callback
- *
- * Probe and initialize the newly added device.
+/** Probe and initialize the newly added device.
  *
  * @param dev E1000 device.
  *
  */
-int e1000_add_device(ddf_dev_t *dev)
+int e1000_dev_add(ddf_dev_t *dev)
 {
 	assert(dev);
@@ -2114,5 +2106,5 @@
 	int rc = nic_report_address(nic_data, addr);
 	if (rc == EOK)
-		e1000_write_receive_address(e1000_data, 0, addr, false)
+		e1000_write_receive_address(e1000_data, 0, addr, false);
 	
 	fibril_mutex_unlock(&e1000_data->tx_lock);
@@ -2152,5 +2144,5 @@
 	uint32_t tdt = E1000_REG_READ(e1000_data, E1000_TDT);
 	e1000_tx_descriptor_t *tx_descriptor_addr = (e1000_tx_descriptor_t *)
-	    (e1000_data->tx_ring.virtual + tdt * sizeof(e1000_tx_descriptor_t));
+	    (e1000_data->tx_ring.virt + tdt * sizeof(e1000_tx_descriptor_t));
 	
 	bool descriptor_available = false;
@@ -2219,10 +2211,9 @@
 int main(void)
 {
-	int rc = dma_allocator_init();
+	int rc = nic_driver_init(NAME);
 	if (rc != EOK)
 		return rc;
 	
 	nic_driver_implement(&e1000_driver_ops, &e1000_dev_ops, &e1000_nic_iface);
-	e1000_driver_init();
 	return ddf_driver_main(&e1000_driver);
 }
