mirror of https://github.com/acidanthera/audk.git
Enhance IdeBusDxe to check the class code for IDE mode only.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11147 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
5091b4759f
commit
e519401bd5
|
@ -148,6 +148,8 @@ IDEBusDriverBindingSupported (
|
||||||
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
|
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
|
||||||
EFI_DEV_PATH *Node;
|
EFI_DEV_PATH *Node;
|
||||||
EFI_IDE_CONTROLLER_INIT_PROTOCOL *IdeInit;
|
EFI_IDE_CONTROLLER_INIT_PROTOCOL *IdeInit;
|
||||||
|
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||||
|
PCI_TYPE00 PciData;
|
||||||
|
|
||||||
if (RemainingDevicePath != NULL) {
|
if (RemainingDevicePath != NULL) {
|
||||||
Node = (EFI_DEV_PATH *) RemainingDevicePath;
|
Node = (EFI_DEV_PATH *) RemainingDevicePath;
|
||||||
|
@ -171,10 +173,6 @@ IDEBusDriverBindingSupported (
|
||||||
//
|
//
|
||||||
// Verify the Ide Controller Init Protocol, which installed by the
|
// Verify the Ide Controller Init Protocol, which installed by the
|
||||||
// IdeController module.
|
// IdeController module.
|
||||||
// Note 1: PciIo protocol has been opened BY_DRIVER by ide_init, so We can't
|
|
||||||
// open BY_DRIVER here) That's why we don't check pciio protocol
|
|
||||||
// Note 2: ide_init driver check ide controller's pci config space, so we dont
|
|
||||||
// check here any more to save code size
|
|
||||||
//
|
//
|
||||||
Status = gBS->OpenProtocol (
|
Status = gBS->OpenProtocol (
|
||||||
Controller,
|
Controller,
|
||||||
|
@ -228,6 +226,45 @@ IDEBusDriverBindingSupported (
|
||||||
Controller
|
Controller
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the EfiPciIoProtocol
|
||||||
|
//
|
||||||
|
Status = gBS->OpenProtocol (
|
||||||
|
Controller,
|
||||||
|
&gEfiPciIoProtocolGuid,
|
||||||
|
(VOID **) &PciIo,
|
||||||
|
This->DriverBindingHandle,
|
||||||
|
Controller,
|
||||||
|
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||||
|
);
|
||||||
|
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Now further check the PCI header: Base class (offset 0x0B) and
|
||||||
|
// Sub Class (offset 0x0A). This controller should be an IDE controller
|
||||||
|
//
|
||||||
|
Status = PciIo->Pci.Read (
|
||||||
|
PciIo,
|
||||||
|
EfiPciIoWidthUint8,
|
||||||
|
0,
|
||||||
|
sizeof (PciData),
|
||||||
|
&PciData
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
//
|
||||||
|
// Examine if it is IDE mode by class code
|
||||||
|
//
|
||||||
|
if ((PciData.Hdr.ClassCode[2] != PCI_CLASS_MASS_STORAGE) || (PciData.Hdr.ClassCode[1] != PCI_SUB_CLASS_IDE)) {
|
||||||
|
Status = EFI_UNSUPPORTED;
|
||||||
|
} else {
|
||||||
|
Status = EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue