Subject: PCI driver help ...
To: None <>
From: Phil Nelson <>
List: tech-kern
Date: 05/24/2001 14:43:40

  I've been working on a pci driver for a Measurement Computing
A to D board.  (PCI-DAS08)

  I'm having trouble talking to the card.  First, since I don't
have a PCI spec and I haven't done any previous PCI work, I
had to guess at some things.  Specifically, their documentation says
that two of the six base address regions are implemented:  BADR1
and BADR2.  They say "All software must interrogate BADR1 at run-time
with a READ_CONFIGURATION_WORD instruction to determine the BADRn
values."  I'm not quite sure what they mean.  They also say:

   BADR1:  32 bit words, PCI Controller Operation Registers
   BADR2:  16 bit words, General Control/Status Registers

I currently map the registers with the following code:

       /* Map register sets. */
        if (pci_mapreg_map(pa, PCI_BADR1, PCI_MAPREG_TYPE_MEM, 0,
            &iot, &ioh, NULL, NULL)) {
                printf("das: can't map BADR1 space\n");
        sc->das_badr1_tag  = iot;
        sc->das_badr1_hand = ioh;

        if (pci_mapreg_map(pa, PCI_BADR2, PCI_MAPREG_TYPE_IO, 0,
            &iot, &ioh, NULL, NULL)) {
                printf("das: can't map BADR2 space\n");
        sc->das_badr2_tag  = iot;
        sc->das_badr2_hand = ioh;

Where PCI_BADR1 is 0x10 and PCI_BADR2 is 0x14.   The BADR2 is the
primary registers (and these look the same as their ISA card).

Currently all bus_space_read_{1,4} operations appear to just
mirror the bus_space_write_{1,4} values for most of these 
registers.  I don't get the usual interactions.

I'm assuming that for some reason I don't have the BADR2 section
mapped correctly and was wondering if someone with more PCI
experience could help me understand where I went wrong.


Phil Nelson
e-mail:  (Work: