\r
Copyright (C) 2016, Linaro Ltd. All rights reserved.<BR>\r
\r
- This program and the accompanying materials are licensed and made available\r
- under the terms and conditions of the BSD License which accompanies this\r
- distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r
- WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
\r
#include <Protocol/DriverBinding.h>\r
\r
+#define MAX_NON_DISCOVERABLE_PCI_DEVICE_ID (32 * 256)\r
+\r
+STATIC UINTN mUniqueIdCounter = 0;\r
EFI_CPU_ARCH_PROTOCOL *mCpu;\r
\r
//\r
//\r
STATIC\r
CONST EFI_GUID * CONST\r
-SupportedNonDiscoverableDevices [] = {\r
+SupportedNonDiscoverableDevices[] = {\r
&gEdkiiNonDiscoverableAhciDeviceGuid,\r
&gEdkiiNonDiscoverableEhciDeviceGuid,\r
&gEdkiiNonDiscoverableNvmeDeviceGuid,\r
NON_DISCOVERABLE_PCI_DEVICE *Dev;\r
EFI_STATUS Status;\r
\r
+ ASSERT (mUniqueIdCounter < MAX_NON_DISCOVERABLE_PCI_DEVICE_ID);\r
+ if (mUniqueIdCounter >= MAX_NON_DISCOVERABLE_PCI_DEVICE_ID) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
Dev = AllocateZeroPool (sizeof *Dev);\r
if (Dev == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
goto CloseProtocol;\r
}\r
\r
+ Dev->UniqueId = mUniqueIdCounter++;\r
+\r
return EFI_SUCCESS;\r
\r
CloseProtocol:\r