EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;\r
EFI_DEV_PATH *Node;\r
EFI_IDE_CONTROLLER_INIT_PROTOCOL *IdeInit;\r
+ EFI_PCI_IO_PROTOCOL *PciIo;\r
+ PCI_TYPE00 PciData;\r
\r
if (RemainingDevicePath != NULL) {\r
Node = (EFI_DEV_PATH *) RemainingDevicePath;\r
//\r
// Verify the Ide Controller Init Protocol, which installed by the\r
// IdeController module.\r
- // Note 1: PciIo protocol has been opened BY_DRIVER by ide_init, so We can't\r
- // open BY_DRIVER here) That's why we don't check pciio protocol\r
- // Note 2: ide_init driver check ide controller's pci config space, so we dont\r
- // check here any more to save code size\r
//\r
Status = gBS->OpenProtocol (\r
Controller,\r
Controller\r
);\r
\r
+ //\r
+ // Get the EfiPciIoProtocol\r
+ //\r
+ Status = gBS->OpenProtocol (\r
+ Controller,\r
+ &gEfiPciIoProtocolGuid,\r
+ (VOID **) &PciIo,\r
+ This->DriverBindingHandle,\r
+ Controller,\r
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+ );\r
+ \r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ \r
+ //\r
+ // Now further check the PCI header: Base class (offset 0x0B) and\r
+ // Sub Class (offset 0x0A). This controller should be an IDE controller\r
+ //\r
+ Status = PciIo->Pci.Read (\r
+ PciIo,\r
+ EfiPciIoWidthUint8,\r
+ 0,\r
+ sizeof (PciData),\r
+ &PciData\r
+ );\r
+\r
+ if (!EFI_ERROR (Status)) {\r
+ //\r
+ // Examine if it is IDE mode by class code\r
+ //\r
+ if ((PciData.Hdr.ClassCode[2] != PCI_CLASS_MASS_STORAGE) || (PciData.Hdr.ClassCode[1] != PCI_SUB_CLASS_IDE)) { \r
+ Status = EFI_UNSUPPORTED;\r
+ } else { \r
+ Status = EFI_SUCCESS;\r
+ } \r
+ }\r
+\r
return Status;\r
}\r
\r