Changeset 0ffa407 in rtems


Ignore:
Timestamp:
Jul 18, 2003, 3:52:41 PM (18 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
35f93740
Parents:
3584398a
Message:

2003-07-16 Greg Menke <gregory.menke@…>

PR 428/bsps
PR 432/bsps

  • pci/pcibios.c, pci/pcibios.h: Added BSP_pci_Find_Device() which is copied from motorola_shared.
Location:
c/src/lib/libbsp/i386/shared
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/i386/shared/ChangeLog

    r3584398a r0ffa407  
     12003-07-16      Greg Menke <gregory.menke@gsfc.nasa.gov>
     2
     3        PR 428/bsps
     4        PR 432/bsps
     5        * pci/pcibios.c, pci/pcibios.h: Added BSP_pci_Find_Device() which
     6        is copied from motorola_shared.
     7
    182003-03-18      Joel Sherrill <joel@OARcorp.com>
    29
  • c/src/lib/libbsp/i386/shared/pci/pcibios.c

    r3584398a r0ffa407  
    212212}
    213213 
     214 
     215
     216
     217#define PCI_MULTI_FUNCTION       0x80
     218#define PCI_MAX_DEVICES          16
     219#define PCI_MAX_FUNCTIONS        8
     220
     221
     222int
     223BSP_pciFindDevice( unsigned short vendorid, unsigned short deviceid,
     224                   int instance, int *pbus, int *pdev, int *pfun )
     225{
     226   int sig;
     227   unsigned int d;
     228   unsigned short s;
     229   unsigned char bus,dev,fun,hd;
     230
     231   for (bus=0; bus<BusCountPCI(); bus++)
     232   {
     233      for (dev=0; dev<PCI_MAX_DEVICES; dev++)
     234      {
     235         sig = PCIB_DEVSIG_MAKE(bus,dev,0);
     236
     237         /* pci_read_config_byte(bus,dev,0, PCI_HEADER_TYPE, &hd); */
     238         pcib_conf_read8(sig, 0xe, &hd);
     239
     240         hd = (hd & PCI_MULTI_FUNCTION ? PCI_MAX_FUNCTIONS : 1);
     241
     242         for (fun=0; fun<hd; fun++) {
     243            /*
     244             * The last devfn id/slot is special; must skip it
     245             */
     246            if( PCI_MAX_DEVICES-1 == dev && PCI_MAX_FUNCTIONS-1 == fun )
     247               break;
     248
     249            /*pci_read_config_dword(bus,dev,fun,PCI_VENDOR_ID,&d); */
     250            pcib_conf_read32(sig, 0, &d);
     251            if( d == -1 )
     252               continue;
     253#ifdef PCI_DEBUG
     254            printk("BSP_pciFindDevice: found 0x%08x at %d/%d/%d\n",d,bus,dev,fun);
     255#endif
     256            /* pci_read_config_word(bus,dev,fun,PCI_VENDOR_ID,&s); */
     257            pcib_conf_read16(sig, 0, &s);
     258            if (vendorid != s)
     259               continue;
     260
     261            /* pci_read_config_word(bus,dev,fun,PCI_DEVICE_ID,&s); */
     262            pcib_conf_read16(sig, 0x2, &s);
     263            if (deviceid == s) {
     264               if (instance--) continue;
     265               *pbus=bus;
     266               *pdev=dev;
     267               *pfun=fun;
     268               return 0;
     269            }
     270         }
     271      }
     272   }
     273   return -1;
     274}
     275
     276
    214277 
    215278
  • c/src/lib/libbsp/i386/shared/pci/pcibios.h

    r3584398a r0ffa407  
    4242int pcib_conf_write32(int sig, int off, unsigned int data);
    4343
     44int
     45BSP_pciFindDevice( unsigned short vendorid, unsigned short deviceid,
     46                   int instance, int *pbus, int *pdev, int *pfun );
     47
    4448
    4549#endif /* _PCIB_H */
Note: See TracChangeset for help on using the changeset viewer.