[ipxe-devel] Converting a Driver

Michael Brown mbrown at fensystems.co.uk
Fri Jul 22 12:58:04 UTC 2011


On Wednesday 20 Jul 2011 20:32:14 John Julien wrote:
> Can this code from a Kernel Module:
> rxr->rx_desc_ring[j] =  pci_alloc_consistent(bp->pdev, RXBD_RING_SIZE,
> &rxr->rx_desc_mapping[j]);
> 
> Be translated into this code in an iPXE driver?
> rxr->rx_desc_ring[j] = malloc_dma(RXBD_RING_SIZE, RXBD_RING_SIZE);
> rxr->rx_desc_mapping[j] = virt_to_bus(rxr->rx_desc_ring[j]);

From the kernel code, I don't think you need the memory to be aligned on its 
own size.  It should work, but you would get more efficient use of memory by 
specifying no particular alignment:

rxr->rx_desc_ring[j] = malloc_dma(RXBD_RING_SIZE, 0);
rxr->rx_desc_mapping[j] = virt_to_bus(rxr->rx_desc_ring[j]);

Michael



More information about the ipxe-devel mailing list