public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Abdul Lateef Attar via groups.io" <AbdulLateef.Attar=amd.com@groups.io>
To: <devel@edk2.groups.io>
Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>,
	Abner Chang <abner.chang@amd.com>,
	Paul Grimes <paul.grimes@amd.com>
Subject: [edk2-devel] [edk2-platforms 1/3] AmdPlatformPkg: Removes unused\r gBoardBdsBootFromDevicePathProtocolGuid
Date: Tue, 28 May 2024 19:37:50 +0530	[thread overview]
Message-ID: <d253a8c94eca5cf93202348eb1bbac934088eff8.1716905162.git.AbdulLateef.Attar@amd.com> (raw)
In-Reply-To: <cover.1716905162.git.AbdulLateef.Attar@amd.com>

Removes unused gBoardBdsBootFromDevicePathProtocolGuid protocol,
and its corresponding code changes.
Adds missing Pcd/SmbiosPcd.h file.

Cc: Abner Chang <abner.chang@amd.com>
Cc: Paul Grimes <paul.grimes@amd.com>
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
---
 .../AmdPlatformPkg/Include/Pcd/SmbiosPcd.h    |  58 ++++++++
 .../SmbiosCommonDxe/DefaultLomDevicePath.c    | 130 ------------------
 .../Universal/SmbiosCommonDxe/SmbiosCommon.h  |  12 --
 .../SmbiosCommonDxe/SmbiosCommonDxe.inf       |   3 -
 .../SmbiosCommonDxe/SmbiosCommonEntryPoint.c  |   2 -
 5 files changed, 58 insertions(+), 147 deletions(-)
 create mode 100644 Platform/AMD/AmdPlatformPkg/Include/Pcd/SmbiosPcd.h
 delete mode 100644 Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/DefaultLomDevicePath.c

diff --git a/Platform/AMD/AmdPlatformPkg/Include/Pcd/SmbiosPcd.h b/Platform/AMD/AmdPlatformPkg/Include/Pcd/SmbiosPcd.h
new file mode 100644
index 0000000000..2dd0480df9
--- /dev/null
+++ b/Platform/AMD/AmdPlatformPkg/Include/Pcd/SmbiosPcd.h
@@ -0,0 +1,58 @@
+/** @file
+  Miscellaneous smbios data structures.
+
+  Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef AMD_SMBIOS_PCD_H_
+#define AMD_SMBIOS_PCD_H_
+
+#include <IndustryStandard/SmBios.h>
+#include <Uefi.h>
+
+#define AMD_SMBIOS_TYPE8_MAX_PORT_CONNETORS    16
+#define AMD_SMBIOS_TYPE41_MAX_ONBOARD_DEVICES  16
+
+typedef struct {
+  CHAR8    IntDesignatorStr[SMBIOS_STRING_MAX_LENGTH];
+  CHAR8    ExtDesignatorStr[SMBIOS_STRING_MAX_LENGTH];
+} PORT_CONNECTOR_STR;
+
+//
+// AMD SMBIOS type 8 record structure.
+//
+typedef struct {
+  SMBIOS_TABLE_TYPE8    Type8Data;
+  PORT_CONNECTOR_STR    DesinatorStr;
+} SMBIOS_PORT_CONNECTOR_RECORD;
+
+//
+// AMD SMBIOS type 8 record structure array.
+//
+typedef struct {
+  SMBIOS_PORT_CONNECTOR_RECORD    SmbiosPortConnectorRecords[AMD_SMBIOS_TYPE8_MAX_PORT_CONNETORS];
+} SMBIOS_PORT_CONNECTOR_RECORD_ARRAY;
+
+//
+// AMD SMBIOS type 41 record structure
+//
+typedef struct {
+  SMBIOS_TABLE_STRING    ReferenceDesignation;
+  UINT8                  DeviceType;
+  UINT8                  DeviceEnabled;
+  UINT8                  DeviceTypeInstance;
+  UINT16                 VendorId;
+  UINT16                 DeviceId;
+  CHAR8                  RefDesignationStr[SMBIOS_STRING_MAX_LENGTH];
+} SMBIOS_ONBOARD_DEV_EXT_INFO_RECORD;
+
+//
+// AMD SMBIOS type 41 record structure array.
+//
+typedef struct {
+  SMBIOS_ONBOARD_DEV_EXT_INFO_RECORD    SmbiosOnboardDevExtInfos[AMD_SMBIOS_TYPE41_MAX_ONBOARD_DEVICES];
+} SMBIOS_ONBOARD_DEV_EXT_INFO_ARRAY;
+
+#endif // AMD_SMBIOS_PCD_H_
diff --git a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/DefaultLomDevicePath.c b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/DefaultLomDevicePath.c
deleted file mode 100644
index 92c7aa5e07..0000000000
--- a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/DefaultLomDevicePath.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/** @file
-  This file contains the implementation of the DefaultLomDevicePath protocol.
-  The DefaultLomDevicePath protocol is used to identify the default LOM device
-  path for the system. The protocol is installed by the SmbiosCommonDxe driver
-  and is used by the BDS to identify the default LOM device path for the system.
-
-  Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc. All rights reserved.
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#include <Library/IoLib.h>
-#include <Library/PciLib.h>
-#include <Protocol/PciEnumerationComplete.h>
-#include <IndustryStandard/Ipmi.h>
-#include <Bus/Pci/PciBusDxe/PciBus.h>
-#include <Pcd/SmbiosPcd.h>
-#include <Library/PciSegmentLib.h>
-#include <Pcd/SmbiosPcd.h>
-#include "SmbiosCommon.h"
-#include <IndustryStandard/Ipmi.h>
-#include <Library/BoardBdsHookLib.h>
-
-EFI_HANDLE                                mBoardBdsHandle = NULL;
-BOARD_BDS_BOOT_FROM_DEVICE_PATH_PROTOCOL  mBootDevicePathProtocol;
-
-/**
-  Find the Lan-On-Motherboard device path. Installs BOARD_BDS_BOOT_FROM_DEVICE_PATH_PROTOCOL
-  with the LOM device path protocol
-
-  @retval EFI NOT_FOUND         LOM device path is not found
-  @retval EFI_SUCCESS           LOM device path found
-**/
-EFI_STATUS
-EFIAPI
-InstallLomDevicePath (
-  )
-{
-  SMBIOS_ONBOARD_DEV_EXT_INFO_RECORD  *DevExtInfoRecord;
-  EFI_STATUS                          Status;
-  EFI_HANDLE                          *PciHandles;
-  UINTN                               PciHandlesSize;
-  UINTN                               Index;
-  EFI_PCI_IO_PROTOCOL                 *PciProtocol;
-  PCI_IO_DEVICE                       *PciIoDevice;
-  UINT8                               NumberOfDevices;
-  UINT8                               DevIdx;
-  UINTN                               SegmentNumber;
-  UINTN                               BusNumber;
-  UINTN                               DeviceNumber;
-  UINTN                               FunctionNumber;
-
-  NumberOfDevices  = PcdGet8 (PcdAmdSmbiosType41Number);
-  DevExtInfoRecord = (SMBIOS_ONBOARD_DEV_EXT_INFO_RECORD *)PcdGetPtr (PcdAmdSmbiosType41);
-
-  // No device entries found
-  if (NumberOfDevices == 0) {
-    DEBUG ((DEBUG_INFO, "No onboard devices found.\n"));
-    return EFI_NOT_FOUND;
-  }
-
-  // search through present on board devices, look for onboard ethernet
-  for (DevIdx = 0; DevIdx < NumberOfDevices; DevIdx++) {
-    if (AsciiStrCmp (DevExtInfoRecord->RefDesignationStr, "Onboard Ethernet") == 0) {
-      break;
-    }
-
-    DevExtInfoRecord++;
-  }
-
-  // edge case, no Onboard Ethernet designator
-  if (AsciiStrCmp (DevExtInfoRecord->RefDesignationStr, "Onboard Ethernet") != 0) {
-    DEBUG ((DEBUG_INFO, "No Onboard ethernet SMBIOS designator found!\n"));
-    return EFI_NOT_FOUND;
-  }
-
-  Status = gBS->LocateHandleBuffer (
-                  ByProtocol,
-                  &gEfiPciIoProtocolGuid,
-                  NULL,
-                  &PciHandlesSize,
-                  &PciHandles
-                  );
-
-  if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_INFO, "Can't locate gEfiPciIoProtocolGuid Protocol: Status = %r\n\n", Status));
-    return Status;
-  }
-
-  for (Index = 0; Index < PciHandlesSize; Index++) {
-    Status = gBS->HandleProtocol (
-                    PciHandles[Index],
-                    &gEfiPciIoProtocolGuid,
-                    (VOID **)&PciProtocol
-                    );
-    if (EFI_ERROR (Status)) {
-      DEBUG ((DEBUG_INFO, "ERROR - Status = %r when locating PciIoProtocol\n", Status));
-      continue;
-    }
-
-    PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (PciProtocol);
-    Status      = PciIoDevice->PciIo.GetLocation (&PciIoDevice->PciIo, &SegmentNumber, &BusNumber, &DeviceNumber, &FunctionNumber);
-
-    if ((PciSegmentRead16 (PCI_SEGMENT_LIB_ADDRESS (SegmentNumber, BusNumber, DeviceNumber, FunctionNumber, 2)) == DevExtInfoRecord->DeviceId) &&
-        (PciSegmentRead16 (PCI_SEGMENT_LIB_ADDRESS (SegmentNumber, BusNumber, DeviceNumber, FunctionNumber, 0)) == DevExtInfoRecord->VendorId))
-    {
-      // Making Lan0 default for systems with two LANs
-      if (FunctionNumber == 0) {
-        DEBUG ((DEBUG_INFO, "Found Onboard Device with DeviceID=0x%X, VendorID=0x%X\n", DevExtInfoRecord->DeviceId, DevExtInfoRecord->VendorId));
-        Status = EFI_SUCCESS;
-        // install device path protocol here
-        mBootDevicePathProtocol.Device                     = PciIoDevice->DevicePath;
-        mBootDevicePathProtocol.IpmiBootDeviceSelectorType = IPMI_BOOT_DEVICE_SELECTOR_PXE;
-        Status                                             = gBS->InstallProtocolInterface (
-                                                                    &mBoardBdsHandle,
-                                                                    &gBoardBdsBootFromDevicePathProtocolGuid,
-                                                                    EFI_NATIVE_INTERFACE,
-                                                                    &mBootDevicePathProtocol
-                                                                    );
-        if (!EFI_ERROR (Status)) {
-          DEBUG ((DEBUG_INFO, "BoardBdsBootFromDevicePathProtocol installed successfully\n"));
-        }
-
-        break;
-      }
-    }
-  }
-
-  return Status;
-}
diff --git a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCommon.h b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCommon.h
index 770053e42b..0ea3434916 100644
--- a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCommon.h
+++ b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCommon.h
@@ -186,18 +186,6 @@ OnboardDevExtInfoFunction (
   IN EFI_SMBIOS_PROTOCOL  *Smbios
   );
 
-/**
-  Find the Lan-On-Motherboard device path. Installs BOARD_BDS_BOOT_FROM_DEVICE_PATH_PROTOCOL
-  with the LOM device path protocol
-
-  @retval EFI NOT_FOUND         LOM device path is not found
-  @retval EFI_SUCCESS           LOM device path found
-**/
-EFI_STATUS
-EFIAPI
-InstallLomDevicePath (
-  );
-
 typedef
 EFI_STATUS
 (EFIAPI EFI_COMMON_SMBIOS_DATA_FUNCTION)(
diff --git a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCommonDxe.inf b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCommonDxe.inf
index fc407c3bec..548a6b0af4 100644
--- a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCommonDxe.inf
+++ b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCommonDxe.inf
@@ -30,13 +30,11 @@
   Type12SystemCfgOptionsFunction.c
   Type13BiosLanguageInfoFunction.c
   Type41OnboardDevExtInfoFunction.c
-  DefaultLomDevicePath.c
 
 [Packages]
   MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
   AmdPlatformPkg/AmdPlatformPkg.dec
-  BoardModulePkg/BoardModulePkg.dec
 
 [LibraryClasses]
   BaseLib
@@ -54,7 +52,6 @@
   gEfiSmbiosProtocolGuid                       ## PROTOCOL ALWAYS_CONSUMED
   gEfiPciEnumerationCompleteProtocolGuid       ## CONSUMES
   gEfiPciIoProtocolGuid                        ## CONSUMES
-  gBoardBdsBootFromDevicePathProtocolGuid      ## PRODUCES
 
 [Pcd]
   gAmdPlatformPkgTokenSpaceGuid.PcdAmdSmbiosType8                       ## CONSUMES
diff --git a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCommonEntryPoint.c b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCommonEntryPoint.c
index eaa66be454..eb3635ca34 100644
--- a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCommonEntryPoint.c
+++ b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCommonEntryPoint.c
@@ -80,8 +80,6 @@ OnPciEnumerationComplete (
       EfiStatus
       ));
   }
-
-  EfiStatus = InstallLomDevicePath ();
 }
 
 /**
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#119305): https://edk2.groups.io/g/devel/message/119305
Mute This Topic: https://groups.io/mt/106349078/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2024-05-28 14:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-28 14:07 [edk2-devel] [edk2-platforms 0/3] AmdPlatformPkg: SmbiosDxe and SPI supporting libraries Abdul Lateef Attar via groups.io
2024-05-28 14:07 ` Abdul Lateef Attar via groups.io [this message]
2024-05-29  8:56   ` [edk2-devel] [edk2-platforms 1/3] AmdPlatformPkg: Removes unused gBoardBdsBootFromDevicePathProtocolGuid Chang, Abner via groups.io
2024-05-28 14:07 ` [edk2-devel] [edk2-platforms 2/3] AmdPlatformPkg: Implements SmmCorePlatformHookLib library Abdul Lateef Attar via groups.io
2024-05-29  8:57   ` Chang, Abner via groups.io
2024-05-28 14:07 ` [edk2-devel] [edk2-platforms 3/3] AmdPlatformPkg: Adds SPI smm core platform hook Abdul Lateef Attar via groups.io
2024-05-29  8:57   ` Chang, Abner via groups.io

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d253a8c94eca5cf93202348eb1bbac934088eff8.1716905162.git.AbdulLateef.Attar@amd.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox