Ignore:
Timestamp:
Jul 28, 2010, 8:05:20 AM (15 years ago)
Author:
David Azarewicz
Message:

Incorporate fixed from the trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud32-2.1.x/lib32/pci.c

    r523 r532  
    4141#include <osspci.h>
    4242
    43 #define MAX_PCI_BUSSES          16
     43#define MAX_PCI_BUSSES          256
    4444#define MAX_PCI_DEVICES         16
    4545
    4646struct pci_dev pci_devices[MAX_PCI_DEVICES] = {0};
    47 struct pci_bus pci_busses[MAX_PCI_BUSSES] = {0};
     47//struct pci_bus pci_busses[MAX_PCI_BUSSES] = {0};
    4848
    4949BOOL    fSuspended = FALSE;
     
    158158        u8              headerType;
    159159
    160         busNr = (ulLast >> 8) & 0x1f;
     160        busNr = (ulLast >> 8) & 0xff;
    161161        devNr = PCI_SLOT(ulLast);
    162162        funcNr = PCI_FUNC(ulLast);
     
    200200                                pcidev->vendor          = detectedId & 0xffff;
    201201                                pcidev->device          = detectedId >> 16;
    202                                 pcidev->bus             = &pci_busses[busNr];
     202                                //pcidev->bus           = &pci_busses[busNr];
     203                                pcidev->bus             = kmalloc(sizeof(struct pci_bus), GFP_KERNEL);
     204                                if (pcidev->bus == NULL) return 0;
     205                                memset (pcidev->bus, 0, sizeof(struct pci_bus));
    203206                                pcidev->bus->number = busNr;
    204207                                pcidev->devfn           = PCI_DEVFN(devNr, funcNr);
     
    507510                while( (ulLast = pci_query_device(&driver->id_table[iTableIx], pcidev, ulLast)) ) {
    508511
    509 
    510512                        RMInit();
    511513                        dprintf(("pci_register_driver: found=%x:%x searching for %x:%x\n",
     
    526528                                if (iTmp >= MAX_PCI_DEVICES) break;
    527529                                pcidev = &pci_devices[iTmp];
    528                         } else pcidev->devfn = 0;
     530                        } else {
     531                                kfree(pcidev->bus);
     532                                pcidev->devfn = 0;
     533                        }
    529534
    530535                        RMDone(0);
     
    553558                        pcidev = &pci_devices[j];
    554559                        if (pcidev->devfn == 0) continue;
    555                         if(pcidev->vendor != driver->id_table[i].vendor) continue;
     560                        if (pcidev->vendor != driver->id_table[i].vendor) continue;
    556561                        if ( (driver->id_table[i].device != PCI_ANY_ID) && (pcidev->device != driver->id_table[i].device) ) continue;
    557562                        dprintf(("pci unreg match: %x:%x %x:%x", pci_devices[j].vendor, pci_devices[j].device, driver->id_table[i].vendor, driver->id_table[i].device));
    558                         if(!driver->remove) continue;
    559                         driver->remove(pcidev);
     563                        if (driver->remove) driver->remove(pcidev);
     564                        kfree(pcidev->bus);
     565                        pcidev->devfn = 0;
    560566                }
    561567        }
Note: See TracChangeset for help on using the changeset viewer.