Re: How to allocate PCI bus address space?

From: Jeff Garzik (jgarzik@mandrakesoft.com)
Date: Tue May 30 2000 - 15:21:20 EST


"Scott C. Karlin" wrote:
>
> My host system is a PC running Intel/Linux (2.2.x).
>
> I am working with a Ramix PMC694 Intelligent Network Card.
> It is a PMC (PCI Mezzanine Card) but we are using a simple
> adapter to plug it into a traditional PCI slot. The card
> has a Power PC (MPC8240) processor with two 10/100 Mbit/s
> ethernet controllers (82559) behind a non-transparent
> PCI-to-PCI bridge (21554).
>
> The 21554 only responds to type-0 configuration cycles and
> therefore hides the devices behind the bridge. By default,
> the board only exposes a small address space (the scratch-pad
> registers of the bridge). The boot code in ROM for the PPC
> allows one to load application code into the board using
> a simple handshake protocol through the scratch-pad registers.
>
> As part of the downloaded application (and associated driver)
> initialization process, I would like to "open up" the window
> through the bridge to map some of the 32 Mbytes of RAM on this
> board to the PCI bus.
>
> This brings me to my question:
> How can I "allocate" PCI memory space in Linux for this
> new window? (And then "free" the space when the application
> shuts down.)
>
> One of the complicating factors is that the slot that the
> PMC694 is plugged into may be behind a standard bridge.
> I may need increase the window of the bridge for the bus that
> the PMC694 is in. Note that I don't plan to let the Intel
> host processor have direct access to the 82559 ethernet
> controllers. That is, Linux doesn't need to know that
> there is a bus behind the bridge--only that there is now
> some memory back there.

For 2.2.x you must use the "hope and pray" system. There isn't any MMIO
resource management at all, so your best bet is probably to scan all PCI
devices (either hardware scanning or, preferably, pci_devices list
scanning), and pick an unused region. PCMCIA package from David Hinds
probably has some sort of code to do this.

For 2.3.x there is infrastructure in place for a precise allocation, and
example code exists in the kernel for this.

        Jeff

-- 
Jeff Garzik              | Liberty is always dangerous, but
Building 1024            | it is the safest thing we have.
MandrakeSoft, Inc.       |      -- Harry Emerson Fosdick

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:25 EST