mirror of https://github.com/acidanthera/audk.git
Set 0xff to both bridge & non-bridge device in case of unknown device.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2123 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
fa67a8b221
commit
e53a7e1bc9
|
@ -283,28 +283,29 @@ RegisterPciDevice (
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
This function is used to register the PCI device to the EFI,
|
This function registers the PCI IO device. It creates a handle for this PCI IO device
|
||||||
create a handle for this PCI device,then attach apporpriate protocols
|
(if the handle does not exist), attaches appropriate protocols onto the handle, does
|
||||||
onto the handle.
|
necessary initialization, and sets up parent/child relationship with its bus controller.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Controller - An efi handle.
|
Controller - An EFI handle for the PCI bus controller.
|
||||||
PciIoDevice - A pointer to the PCI_IO_DEVICE.
|
PciIoDevice - A PCI_IO_DEVICE pointer to the PCI IO device to be registered.
|
||||||
Handle - A pointer to a efi handle.
|
Handle - A pointer to hold the EFI handle for the PCI IO device.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
None
|
EFI_SUCCESS - The PCI device is successfully registered.
|
||||||
|
Others - An error occurred when registering the PCI device.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
// TODO: EFI_SUCCESS - add return value to function comment
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
VOID *PlatformOpRomBuffer;
|
VOID *PlatformOpRomBuffer;
|
||||||
UINTN PlatformOpRomSize;
|
UINTN PlatformOpRomSize;
|
||||||
UINT8 PciExpressCapRegOffset;
|
UINT8 PciExpressCapRegOffset;
|
||||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||||
|
UINT8 Data8;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Install the pciio protocol, device path protocol
|
// Install the pciio protocol, device path protocol
|
||||||
|
@ -326,21 +327,22 @@ Returns:
|
||||||
//
|
//
|
||||||
PciExpressCapRegOffset = 0;
|
PciExpressCapRegOffset = 0;
|
||||||
Status = LocateCapabilityRegBlock (
|
Status = LocateCapabilityRegBlock (
|
||||||
PciIoDevice,
|
PciIoDevice,
|
||||||
EFI_PCI_CAPABILITY_ID_PCIEXP,
|
EFI_PCI_CAPABILITY_ID_PCIEXP,
|
||||||
&PciExpressCapRegOffset,
|
&PciExpressCapRegOffset,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
PciIoDevice->IsPciExp = TRUE;
|
PciIoDevice->IsPciExp = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Force Interrupt line to zero for cards that come up randomly
|
// Force Interrupt line to "Unknown" or "No Connection"
|
||||||
//
|
//
|
||||||
PciIo = &(PciIoDevice->PciIo);
|
PciIo = &(PciIoDevice->PciIo);
|
||||||
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &gAllZero);
|
Data8 = PCI_INT_LINE_UNKNOWN;
|
||||||
|
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &Data8);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Process Platform OpRom
|
// Process Platform OpRom
|
||||||
//
|
//
|
||||||
|
@ -348,11 +350,11 @@ Returns:
|
||||||
PciIoDevice->AllOpRomProcessed = TRUE;
|
PciIoDevice->AllOpRomProcessed = TRUE;
|
||||||
|
|
||||||
Status = gPciPlatformProtocol->GetPciRom (
|
Status = gPciPlatformProtocol->GetPciRom (
|
||||||
gPciPlatformProtocol,
|
gPciPlatformProtocol,
|
||||||
PciIoDevice->Handle,
|
PciIoDevice->Handle,
|
||||||
&PlatformOpRomBuffer,
|
&PlatformOpRomBuffer,
|
||||||
&PlatformOpRomSize
|
&PlatformOpRomSize
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
|
|
||||||
|
@ -382,13 +384,13 @@ Returns:
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
gBS->UninstallMultipleProtocolInterfaces (
|
gBS->UninstallMultipleProtocolInterfaces (
|
||||||
&PciIoDevice->Handle,
|
&PciIoDevice->Handle,
|
||||||
&gEfiDevicePathProtocolGuid,
|
&gEfiDevicePathProtocolGuid,
|
||||||
PciIoDevice->DevicePath,
|
PciIoDevice->DevicePath,
|
||||||
&gEfiPciIoProtocolGuid,
|
&gEfiPciIoProtocolGuid,
|
||||||
&PciIoDevice->PciIo,
|
&PciIoDevice->PciIo,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue