Ignore:
Timestamp:
Nov 3, 2005, 2:59:18 AM (14 years ago)
Author:
Till Straumann <strauman@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
e131ac0
Parents:
ebedf31
Message:

2005-11-02 straumanatslacdotstanford.edu

  • shared/pci/pcibios.c: replaced pci_find_device implementation by a pcibios call which already provides the functionality
File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/i386/shared/pci/pcibios.c

    rebedf31 r05a2cc4b  
    274274                   int instance, int *pbus, int *pdev, int *pfun )
    275275{
    276   int sig;
    277   unsigned int d = 0;
    278   unsigned short s = 0;
    279   unsigned char bus;
    280   unsigned char dev;
    281   unsigned char fun;
    282   unsigned char hd = 0;
    283 
    284   for (bus=0; bus<pci_bus_count(); bus++) {
    285     for (dev=0; dev<PCI_MAX_DEVICES; dev++) {
    286       sig = PCIB_DEVSIG_MAKE(bus,dev,0);
    287 
    288       /* pci_read_config_byte(bus,dev,0, PCI_HEADER_TYPE, &hd); */
    289       pcib_conf_read8(sig, 0xe, &hd);
    290 
    291       hd = (hd & PCI_MULTI_FUNCTION ? PCI_MAX_FUNCTIONS : 1);
    292 
    293       for (fun=0; fun<hd; fun++) {
    294         /*
    295          * The last devfn id/slot is special; must skip it
    296          */
    297         if ( PCI_MAX_DEVICES-1 == dev && PCI_MAX_FUNCTIONS-1 == fun )
    298           break;
    299 
    300         /*pci_read_config_dword(bus,dev,fun,PCI_VENDOR_ID,&d); */
    301         pcib_conf_read32(sig, 0, &d);
    302         if ( d == -1 )
    303           continue;
    304 #ifdef PCI_DEBUG
    305         printk("BSP_pciFindDevice: found 0x%08x at %d/%d/%d\n",d,bus,dev,fun);
    306 #endif
    307         /* pci_read_config_word(bus,dev,fun,PCI_VENDOR_ID,&s); */
    308         pcib_conf_read16(sig, 0, &s);
    309         if (vendorid != s)
    310           continue;
    311 
    312         /* pci_read_config_word(bus,dev,fun,PCI_DEVICE_ID,&s); */
    313         pcib_conf_read16(sig, 0x2, &s);
    314         if (deviceid == s) {
    315           if (instance--) continue;
    316           *pbus=bus;
    317           *pdev=dev;
    318           *pfun=fun;
    319           return 0;
    320         }
    321       }
    322     }
    323   }
    324   return -1;
     276   int sig, rval;
     277
     278   rval = pcib_find_by_devid(vendorid, deviceid, instance, &sig);
     279
     280   if ( PCIB_ERR_SUCCESS == rval ) {
     281                *pbus = PCIB_DEVSIG_BUS(sig);
     282                *pdev = PCIB_DEVSIG_DEV(sig);
     283                *pfun = PCIB_DEVSIG_FUNC(sig);
     284   }
     285
     286   return rval;
    325287}
    326288
Note: See TracChangeset for help on using the changeset viewer.