]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDeviceSupport.c
Set 0xff to both bridge & non-bridge device in case of unknown device.
[mirror_edk2.git] / EdkModulePkg / Bus / Pci / PciBus / Dxe / PciDeviceSupport.c
index b1cee26c0a3e6c1b01da8517fb5bef1e3b1054d1..df69078e77e4acc638072ba62a04c20e5d14d01e 100644 (file)
@@ -283,28 +283,29 @@ RegisterPciDevice (
 \r
 Routine Description:\r
 \r
-  This function is used to register the PCI device to the EFI,\r
-  create a handle for this PCI device,then attach apporpriate protocols\r
-  onto the handle.\r
+  This function registers the PCI IO device. It creates a handle for this PCI IO device \r
+  (if the handle does not exist), attaches appropriate protocols onto the handle, does\r
+  necessary initialization, and sets up parent/child relationship with its bus controller.\r
 \r
 Arguments:\r
 \r
-  Controller    - An efi handle.\r
-  PciIoDevice   - A pointer to the PCI_IO_DEVICE.\r
-  Handle        - A pointer to a efi handle.\r
+  Controller    - An EFI handle for the PCI bus controller.\r
+  PciIoDevice   - A PCI_IO_DEVICE pointer to the PCI IO device to be registered.\r
+  Handle        - A pointer to hold the EFI handle for the PCI IO device.\r
 \r
 Returns:\r
 \r
-  None\r
+  EFI_SUCCESS   - The PCI device is successfully registered.\r
+  Others        - An error occurred when registering the PCI device.\r
 \r
 --*/\r
-// TODO:    EFI_SUCCESS - add return value to function comment\r
 {\r
   EFI_STATUS          Status;\r
   VOID                *PlatformOpRomBuffer;\r
   UINTN               PlatformOpRomSize;\r
   UINT8               PciExpressCapRegOffset;\r
   EFI_PCI_IO_PROTOCOL *PciIo;\r
+  UINT8               Data8;\r
 \r
   //\r
   // Install the pciio protocol, device path protocol\r
@@ -326,21 +327,22 @@ Returns:
   //\r
   PciExpressCapRegOffset = 0;\r
   Status = LocateCapabilityRegBlock (\r
-            PciIoDevice,\r
-            EFI_PCI_CAPABILITY_ID_PCIEXP,\r
-            &PciExpressCapRegOffset,\r
-            NULL\r
-            );\r
+             PciIoDevice,\r
+             EFI_PCI_CAPABILITY_ID_PCIEXP,\r
+             &PciExpressCapRegOffset,\r
+             NULL\r
+             );\r
   if (!EFI_ERROR (Status)) {\r
     PciIoDevice->IsPciExp = TRUE;\r
   }\r
   \r
   //\r
-  // Force Interrupt line to zero for cards that come up randomly\r
+  // Force Interrupt line to "Unknown" or "No Connection"\r
   //\r
   PciIo = &(PciIoDevice->PciIo);\r
-  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &gAllZero);\r
-  \r
+  Data8 = PCI_INT_LINE_UNKNOWN;\r
+  PciIo->Pci.Write (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &Data8);\r
+\r
   //\r
   // Process Platform OpRom\r
   //\r
@@ -348,11 +350,11 @@ Returns:
     PciIoDevice->AllOpRomProcessed = TRUE;\r
 \r
     Status = gPciPlatformProtocol->GetPciRom (\r
-                                    gPciPlatformProtocol,\r
-                                    PciIoDevice->Handle,\r
-                                    &PlatformOpRomBuffer,\r
-                                    &PlatformOpRomSize\r
-                                    );\r
+                                     gPciPlatformProtocol,\r
+                                     PciIoDevice->Handle,\r
+                                     &PlatformOpRomBuffer,\r
+                                     &PlatformOpRomSize\r
+                                     );\r
 \r
     if (!EFI_ERROR (Status)) {\r
 \r
@@ -382,13 +384,13 @@ Returns:
                     );\r
     if (EFI_ERROR (Status)) {\r
       gBS->UninstallMultipleProtocolInterfaces (\r
-            &PciIoDevice->Handle,\r
-            &gEfiDevicePathProtocolGuid,\r
-            PciIoDevice->DevicePath,\r
-            &gEfiPciIoProtocolGuid,\r
-            &PciIoDevice->PciIo,\r
-            NULL\r
-            );\r
+             &PciIoDevice->Handle,\r
+             &gEfiDevicePathProtocolGuid,\r
+             PciIoDevice->DevicePath,\r
+             &gEfiPciIoProtocolGuid,\r
+             &PciIoDevice->PciIo,\r
+             NULL\r
+             );\r
 \r
       return Status;\r
     }\r