+++ /dev/null
-/** @file\r
-\r
- Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
- \r\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
- \r\r
-\r
-Module Name:\r
-\r
- SlotConfig.c\r
-\r
-Abstract:\r
-\r
- Sets platform/SKU specific expansion slot information.\r
-\r
-\r
-\r
---*/\r
-#include "SlotConfig.h"\r
-\r
-//\r
-// Implementation\r
-//\r
-VOID\r
-InitializeSlotInfo (\r
- )\r
-{\r
- UINT16 BusSaveState;\r
- UINT16 Vendor;\r
- UINT8 CurrentBus;\r
- UINTN i;\r
- UINTN j;\r
- EFI_HANDLE Handle;\r
- EFI_STATUS Status;\r
- BOOLEAN RunNext;\r
-\r
- //\r
- // Loop through the slot table and see if any slots have cards in them\r
- //\r
- for (i = 0; i < mSlotBridgeTableSize; i++) {\r
- //\r
- // Initialize variable\r
- //\r
- RunNext = FALSE;\r
-\r
- //\r
- // Hide mini PCIe slots per SKU\r
- //\r
- for (j = 0; j < mSlotInformation.NumberOfEntries; j++) {\r
- if (mSlotInformation.SlotEntries[j].SmbiosSlotId == mSlotBridgeTable[i].SmbiosSlotId) {\r
- if ((mSlotInformation.SlotEntries[j].SmbiosSlotId == 0x02) &&\r
- (mBoardFeatures & B_BOARD_FEATURES_NO_MINIPCIE)\r
- ) {\r
- mSlotInformation.SlotEntries[j].Disabled = TRUE;\r
- RunNext = TRUE;\r
- }\r
- break;\r
- }\r
- }\r
-\r
- if (RunNext) {\r
- //\r
- // Skip slot device detection since the slot is disabled.\r
- //\r
- continue;\r
- }\r
-\r
- //\r
- // Check to see if the bridge has a bus number and assign one if not\r
- //\r
- BusSaveState = MmPci16 (\r
- 0,\r
- mSlotBridgeTable[i].Bus,\r
- mSlotBridgeTable[i].Dev,\r
- mSlotBridgeTable[i].Function,\r
- PCI_BRIDGE_SECONDARY_BUS_REGISTER_OFFSET\r
- );\r
- if (BusSaveState == 0) {\r
- //\r
- // Assign temp bus number\r
- //\r
- MmPci16 (\r
- 0,\r
- mSlotBridgeTable[i].Bus,\r
- mSlotBridgeTable[i].Dev,\r
- mSlotBridgeTable[i].Function,\r
- PCI_BRIDGE_SECONDARY_BUS_REGISTER_OFFSET\r
- ) = DEF_BUS_CONFIG;\r
- CurrentBus = DEF_BUS;\r
- } else if (BusSaveState == 0xFFFF) {\r
- //\r
- // Bridge is disabled so continue with next entry in the table\r
- //\r
- continue;\r
- } else {\r
- //\r
- // Use existing bus number\r
- //\r
- CurrentBus = (UINT8) BusSaveState & 0xFF;\r
- }\r
-\r
- //\r
- // Check to see if a device is behind the bridge\r
- //\r
- Vendor = MmPci16 (\r
- 0,\r
- CurrentBus,\r
- mSlotBridgeTable[i].TargetDevice,\r
- 0,\r
- 0\r
- );\r
- if (Vendor != 0xFFFF) {\r
- //\r
- // Device found so make sure the slot is marked that way\r
- //\r
- for (j = 0; j < mSlotInformation.NumberOfEntries; j++) {\r
- if (mSlotInformation.SlotEntries[j].SmbiosSlotId == mSlotBridgeTable[i].SmbiosSlotId) {\r
- mSlotInformation.SlotEntries[j].InUse = TRUE;\r
- break;\r
- }\r
- }\r
- }\r
-\r
- //\r
- // Restore previous bus information\r
- //\r
- if (BusSaveState == 0) {\r
- MmPci16 (\r
- 0,\r
- mSlotBridgeTable[i].Bus,\r
- mSlotBridgeTable[i].Dev,\r
- mSlotBridgeTable[i].Function,\r
- PCI_BRIDGE_SECONDARY_BUS_REGISTER_OFFSET\r
- ) = 0;\r
- }\r
- }\r
-\r
- Handle = NULL;\r
- Status = gBS->InstallProtocolInterface (\r
- &Handle,\r
- &gEfiSmbiosSlotPopulationGuid,\r
- EFI_NATIVE_INTERFACE,\r
- &mSlotInformation\r
- );\r
- ASSERT_EFI_ERROR(Status);\r
-\r
-}\r