Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-6485

PATCH: scsiport: PCI function enumeration doesn't work properly on some chips

    XMLWordPrintable

Details

    Description

      there is a serious bug which prevents detection of storage controllers in some chipsets. Now problem confirmed with some of Intel ICH8, ICH9, ICH10 chipsets in any working mode (RAID, AHCI, Native IDE and Legacy).

      When storage driver tries to setup and initialize controller resources on a PCI/PCIe bus it calls SCSIPORT.ScsiPortInitialize() from its DriverEntry() for each detected controller. This function scans all buses and tries to find and initialize controller with given device/vendor id. It scans sequental first for buses, second for devices (from 0 to 31), third for functions (from 0 to 7). When it sees that there is no given function, it breaks loop and scans for next device/bus.


      PCI Busses, Devices and Device Functions Tree
      ....................
      ¦ L--> Bus 5
      +-- Device 29
      ¦ +-- Function 0 - 8086h:2830h 82801H (ICH8 Family) USB UHCI #1
      ¦ +-- Function 1 - 8086h:2831h 82801H (ICH8 Family) USB UHCI #2
      ¦ +-- Function 2 - 8086h:2832h 82801H (ICH8 Family) USB UHCI #3
      ¦ L-- Function 7 - 8086h:2836h 82801H (ICH8 Family) USB2 EHCI #1
      +-- Device 30 - 8086h:244Eh 82801HB Hub Interface to PCI Bridge (ICH8 B0 step)
      ¦ L--> Bus 6
      L-- Device 31
      +-- Function 0 - 8086h:2810h 82801HB/HR (ICH8/R) LPC Interface Controller
      +-- Function 2 - 8086h:2824h 82801HR/HO/HH (ICH8R/DO/DH) SATA AHCI Controller
      L-- Function 3 - 8086h:283Eh 82801H (ICH8 Family) SMBus Controller
      ....................

      It is a PCI dump from ICH8 AHCI system. Look above at Device 29, Device 31. In Device 29 there is NO Function 3, in Device 31 there is NO Function 1. So all function below this absent one will be skipped due to bug in SCSIPORT.SYS. Skipped Device 31 Function 2 is a SATA Controller!


      This can be fixed by changing the following condition in
      trunk/reactos/drivers/storage/scsiport/scsiport.c
      SpiGetPciConfigData()
      2355 if (PciConfig.VendorID == PCI_INVALID_VENDORID)

      • 2356 break;
        + 2356 continue;
        Also it is necessary to check amount of transferred data.
        if(busDataRead < (ULONG)PCI_COMMON_HDR_LENGTH) { NeedPciAltInit = TRUE; continue; }


        Such fix is implemented in PCI scan code in
        trunk/reactos/drivers/storage/ide/uniata/id_probe.cpp
        UniataEnumBusMasterController__()
        Line 301 (revision 54721)

      Attachments

        Issue Links

          Activity

            People

              fireball fireball
              alter-1 alter-1
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: