Changes in uspace/drv/nic/e1k/e1k.c [1ae74c6:7de1988c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/e1k/e1k.c
r1ae74c6 r7de1988c 129 129 130 130 /** Physical tx ring address */ 131 void *tx_ring_phys;131 uintptr_t tx_ring_phys; 132 132 /** Virtual tx ring address */ 133 133 void *tx_ring_virt; 134 134 135 135 /** Ring of TX frames, physical address */ 136 void **tx_frame_phys;136 uintptr_t *tx_frame_phys; 137 137 /** Ring of TX frames, virtual address */ 138 138 void **tx_frame_virt; 139 139 140 140 /** Physical rx ring address */ 141 void *rx_ring_phys;141 uintptr_t rx_ring_phys; 142 142 /** Virtual rx ring address */ 143 143 void *rx_ring_virt; 144 144 145 145 /** Ring of RX frames, physical address */ 146 void **rx_frame_phys;146 uintptr_t *rx_frame_phys; 147 147 /** Ring of RX frames, virtual address */ 148 148 void **rx_frame_virt; … … 293 293 assert(info); 294 294 295 bzero(info, sizeof(nic_device_info_t));295 memset(info, 0, sizeof(nic_device_info_t)); 296 296 297 297 info->vendor_id = 0x8086; … … 1377 1377 int rc = dmamem_map_anonymous( 1378 1378 E1000_RX_FRAME_COUNT * sizeof(e1000_rx_descriptor_t), 1379 AS_AREA_READ | AS_AREA_WRITE, 0, &e1000->rx_ring_phys,1380 &e1000->rx_ring_ virt);1379 DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, 1380 &e1000->rx_ring_phys, &e1000->rx_ring_virt); 1381 1381 if (rc != EOK) 1382 1382 return rc; … … 1387 1387 (uint32_t) PTR_TO_U64(e1000->rx_ring_phys)); 1388 1388 1389 e1000->rx_frame_phys = 1390 calloc(E1000_RX_FRAME_COUNT, sizeof( void *));1389 e1000->rx_frame_phys = (uintptr_t *) 1390 calloc(E1000_RX_FRAME_COUNT, sizeof(uintptr_t)); 1391 1391 e1000->rx_frame_virt = 1392 1392 calloc(E1000_RX_FRAME_COUNT, sizeof(void *)); 1393 if ( e1000->rx_frame_phys == NULL || e1000->rx_frame_virt == NULL) {1393 if ((e1000->rx_frame_phys == NULL) || (e1000->rx_frame_virt == NULL)) { 1394 1394 rc = ENOMEM; 1395 1395 goto error; … … 1397 1397 1398 1398 size_t i; 1399 uintptr_t frame_phys; 1399 1400 void *frame_virt; 1400 void *frame_phys;1401 1401 1402 1402 for (i = 0; i < E1000_RX_FRAME_COUNT; i++) { 1403 rc = dmamem_map_anonymous( 1404 E1000_MAX_SEND_FRAME_SIZE, AS_AREA_READ | AS_AREA_WRITE,1405 0,&frame_phys, &frame_virt);1403 rc = dmamem_map_anonymous(E1000_MAX_SEND_FRAME_SIZE, 1404 DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, 1405 &frame_phys, &frame_virt); 1406 1406 if (rc != EOK) 1407 1407 goto error; 1408 1408 1409 e1000->rx_frame_phys[i] = frame_phys; 1409 1410 e1000->rx_frame_virt[i] = frame_virt; 1410 e1000->rx_frame_phys[i] = frame_phys;1411 1411 } 1412 1412 … … 1424 1424 if (e1000->rx_frame_virt[i] != NULL) { 1425 1425 dmamem_unmap_anonymous(e1000->rx_frame_virt[i]); 1426 e1000->rx_frame_phys[i] = 0; 1426 1427 e1000->rx_frame_virt[i] = NULL; 1427 e1000->rx_frame_phys[i] = NULL;1428 1428 } 1429 1429 } … … 1436 1436 if (e1000->rx_frame_virt != NULL) { 1437 1437 free(e1000->rx_frame_virt); 1438 e1000->rx_frame_ phys= NULL;1438 e1000->rx_frame_virt = NULL; 1439 1439 } 1440 1440 … … 1454 1454 for (unsigned int offset = 0; offset < E1000_RX_FRAME_COUNT; offset++) { 1455 1455 dmamem_unmap_anonymous(e1000->rx_frame_virt[offset]); 1456 e1000->rx_frame_phys[offset] = 0; 1456 1457 e1000->rx_frame_virt[offset] = NULL; 1457 e1000->rx_frame_phys[offset] = NULL;1458 1458 } 1459 1459 1460 1460 free(e1000->rx_frame_virt); 1461 free(e1000->rx_frame_phys); 1461 1462 e1000->rx_frame_phys = NULL; 1462 1463 e1000->rx_frame_virt = NULL; 1463 e1000->rx_frame_phys = NULL;1464 1464 1465 dmamem_unmap_anonymous(e1000->rx_ring_virt); 1465 1466 } … … 1569 1570 fibril_mutex_lock(&e1000->tx_lock); 1570 1571 1571 e1000->tx_ring_phys = NULL;1572 e1000->tx_ring_phys = 0; 1572 1573 e1000->tx_ring_virt = NULL; 1574 1573 1575 e1000->tx_frame_phys = NULL; 1574 1576 e1000->tx_frame_virt = NULL; … … 1576 1578 int rc = dmamem_map_anonymous( 1577 1579 E1000_TX_FRAME_COUNT * sizeof(e1000_tx_descriptor_t), 1578 AS_AREA_READ | AS_AREA_WRITE, 0, &e1000->tx_ring_phys,1579 &e1000->tx_ring_ virt);1580 DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, 1581 &e1000->tx_ring_phys, &e1000->tx_ring_virt); 1580 1582 if (rc != EOK) 1581 1583 goto error; 1582 1584 1583 bzero(e1000->tx_ring_virt,1585 memset(e1000->tx_ring_virt, 0, 1584 1586 E1000_TX_FRAME_COUNT * sizeof(e1000_tx_descriptor_t)); 1585 1587 1586 e1000->tx_frame_phys = calloc(E1000_TX_FRAME_COUNT, sizeof(void *)); 1587 e1000->tx_frame_virt = calloc(E1000_TX_FRAME_COUNT, sizeof(void *)); 1588 1589 if (e1000->tx_frame_phys == NULL || e1000->tx_frame_virt == NULL) { 1588 e1000->tx_frame_phys = (uintptr_t *) 1589 calloc(E1000_TX_FRAME_COUNT, sizeof(uintptr_t)); 1590 e1000->tx_frame_virt = 1591 calloc(E1000_TX_FRAME_COUNT, sizeof(void *)); 1592 1593 if ((e1000->tx_frame_phys == NULL) || (e1000->tx_frame_virt == NULL)) { 1590 1594 rc = ENOMEM; 1591 1595 goto error; … … 1593 1597 1594 1598 for (i = 0; i < E1000_TX_FRAME_COUNT; i++) { 1595 rc = dmamem_map_anonymous( 1596 E1000_MAX_SEND_FRAME_SIZE, AS_AREA_READ | AS_AREA_WRITE,1599 rc = dmamem_map_anonymous(E1000_MAX_SEND_FRAME_SIZE, 1600 DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 1597 1601 0, &e1000->tx_frame_phys[i], &e1000->tx_frame_virt[i]); 1598 1602 if (rc != EOK) … … 1616 1620 } 1617 1621 1618 if ( e1000->tx_frame_phys != NULL && e1000->tx_frame_virt != NULL) {1622 if ((e1000->tx_frame_phys != NULL) && (e1000->tx_frame_virt != NULL)) { 1619 1623 for (i = 0; i < E1000_TX_FRAME_COUNT; i++) { 1620 1624 if (e1000->tx_frame_virt[i] != NULL) { 1621 1625 dmamem_unmap_anonymous(e1000->tx_frame_virt[i]); 1626 e1000->tx_frame_phys[i] = 0; 1622 1627 e1000->tx_frame_virt[i] = NULL; 1623 e1000->tx_frame_phys[i] = NULL;1624 1628 } 1625 1629 } … … 1633 1637 if (e1000->tx_frame_virt != NULL) { 1634 1638 free(e1000->tx_frame_virt); 1635 e1000->tx_frame_ phys= NULL;1639 e1000->tx_frame_virt = NULL; 1636 1640 } 1637 1641 … … 1650 1654 for (i = 0; i < E1000_TX_FRAME_COUNT; i++) { 1651 1655 dmamem_unmap_anonymous(e1000->tx_frame_virt[i]); 1656 e1000->tx_frame_phys[i] = 0; 1652 1657 e1000->tx_frame_virt[i] = NULL; 1653 e1000->tx_frame_phys[i] = NULL;1654 1658 } 1655 1659 … … 1661 1665 if (e1000->tx_frame_virt != NULL) { 1662 1666 free(e1000->tx_frame_virt); 1663 e1000->tx_frame_ phys= NULL;1667 e1000->tx_frame_virt = NULL; 1664 1668 } 1665 1669 … … 1872 1876 } 1873 1877 1874 bzero(e1000, sizeof(e1000_t));1878 memset(e1000, 0, sizeof(e1000_t)); 1875 1879 1876 1880 nic_set_specific(nic, e1000); … … 1937 1941 e1000->irq = hw_resources->irqs.irqs[0]; 1938 1942 e1000->reg_base_phys = 1939 MEMADDR_TO_PTR( hw_resources->mem_ranges.ranges[0].address);1943 MEMADDR_TO_PTR(RNGABS(hw_resources->mem_ranges.ranges[0])); 1940 1944 1941 1945 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.