[parisc-linux] GSC & EISA devices and pci_alloc_consistent

Matthew Wilcox willy@debian.org
Tue, 16 Oct 2001 21:32:34 +0100


Looking at the 3c59x driver, it attempts to allocate host memory that
the card can access by DMA with:

        vp->rx_ring = pci_alloc_consistent(pdev, sizeof(struct boom_rx_desc) * RX_RING_SIZE
                                           + sizeof(struct boom_tx_desc) * TX_RING_SIZE,
                                           &vp->rx_ring_dma);

For EISA devices, pdev is NULL.  So pci_alloc_consistent (on EISA-capable
boxes; Astro-based boxes can ignore all this) can check for pdev being
NULL and set up the I/O Map so that the EISA bus can access this chunk
of ram.

But there's a problem.  Currently our specific drivers (lasi_82596, sim700,
et al) call pci_alloc_consistent with a NULL pci_dev.  And that causes a
different problem.  On machines with ccio (C, J, D, K, R) we need to know
which IOC the device is under (currently we assume the first... which is why
some machines HPMC early on).

I think the solution to this is to create a fake struct pci_dev that our
drivers hand to pci_alloc_consistent.  Then we have:

PCXL, L2:
	if (pci_dev == NULL) return wax_alloc_consistent();
	else kmalloc()

ccio:
	if (pci_dev == NULL) return wax_alloc_consistent();
	ioc = find_ioc(pci_dev);
	...

astro/elroy systems remain unchanged.

The only question is how/where to obtain this pci_dev, and how to give
it to the drivers which need it.

-- 
Revolutions do not require corporate support.