diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDeviceSupport.c b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDeviceSupport.c index b1cee26c0a..df69078e77 100644 --- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDeviceSupport.c +++ b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDeviceSupport.c @@ -283,28 +283,29 @@ RegisterPciDevice ( Routine Description: - This function is used to register the PCI device to the EFI, - create a handle for this PCI device,then attach apporpriate protocols - onto the handle. + This function registers the PCI IO device. It creates a handle for this PCI IO device + (if the handle does not exist), attaches appropriate protocols onto the handle, does + necessary initialization, and sets up parent/child relationship with its bus controller. Arguments: - Controller - An efi handle. - PciIoDevice - A pointer to the PCI_IO_DEVICE. - Handle - A pointer to a efi handle. + Controller - An EFI handle for the PCI bus controller. + PciIoDevice - A PCI_IO_DEVICE pointer to the PCI IO device to be registered. + Handle - A pointer to hold the EFI handle for the PCI IO device. 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; VOID *PlatformOpRomBuffer; UINTN PlatformOpRomSize; UINT8 PciExpressCapRegOffset; EFI_PCI_IO_PROTOCOL *PciIo; + UINT8 Data8; // // Install the pciio protocol, device path protocol @@ -326,21 +327,22 @@ Returns: // PciExpressCapRegOffset = 0; Status = LocateCapabilityRegBlock ( - PciIoDevice, - EFI_PCI_CAPABILITY_ID_PCIEXP, - &PciExpressCapRegOffset, - NULL - ); + PciIoDevice, + EFI_PCI_CAPABILITY_ID_PCIEXP, + &PciExpressCapRegOffset, + NULL + ); if (!EFI_ERROR (Status)) { 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->Pci.Write (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &gAllZero); - + Data8 = PCI_INT_LINE_UNKNOWN; + PciIo->Pci.Write (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &Data8); + // // Process Platform OpRom // @@ -348,11 +350,11 @@ Returns: PciIoDevice->AllOpRomProcessed = TRUE; Status = gPciPlatformProtocol->GetPciRom ( - gPciPlatformProtocol, - PciIoDevice->Handle, - &PlatformOpRomBuffer, - &PlatformOpRomSize - ); + gPciPlatformProtocol, + PciIoDevice->Handle, + &PlatformOpRomBuffer, + &PlatformOpRomSize + ); if (!EFI_ERROR (Status)) { @@ -382,13 +384,13 @@ Returns: ); if (EFI_ERROR (Status)) { gBS->UninstallMultipleProtocolInterfaces ( - &PciIoDevice->Handle, - &gEfiDevicePathProtocolGuid, - PciIoDevice->DevicePath, - &gEfiPciIoProtocolGuid, - &PciIoDevice->PciIo, - NULL - ); + &PciIoDevice->Handle, + &gEfiDevicePathProtocolGuid, + PciIoDevice->DevicePath, + &gEfiPciIoProtocolGuid, + &PciIoDevice->PciIo, + NULL + ); return Status; }