[AMD Official Use Only - AMD Internal Distribution Only]

Reviewed-by: Abner Chang <abner.ch...@amd.com>

> -----Original Message-----
> From: Abdul Lateef Attar <abdullateef.at...@amd.com>
> Sent: Tuesday, May 28, 2024 10:08 PM
> To: devel@edk2.groups.io
> Cc: Attar, AbdulLateef (Abdul Lateef) <abdullateef.at...@amd.com>; Chang,
> Abner <abner.ch...@amd.com>; Grimes, Paul <paul.gri...@amd.com>
> Subject: [edk2-platforms 1/3] AmdPlatformPkg: Removes unused
> gBoardBdsBootFromDevicePathProtocolGuid
>
> Removes unused gBoardBdsBootFromDevicePathProtocolGuid protocol,
> and its corresponding code changes.
> Adds missing Pcd/SmbiosPcd.h file.
>
> Cc: Abner Chang <abner.ch...@amd.com>
> Cc: Paul Grimes <paul.gri...@amd.com>
> Signed-off-by: Abdul Lateef Attar <abdullateef.at...@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/DefaultLom
> DevicePath.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_CONNETOR
> S];
> +} 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_DEVIC
> ES];
> +} SMBIOS_ONBOARD_DEV_EXT_INFO_ARRAY;
> +
> +#endif // AMD_SMBIOS_PCD_H_
> diff --git
> a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/DefaultLo
> mDevicePath.c
> b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/DefaultLo
> mDevicePath.c
> deleted file mode 100644
> index 92c7aa5e07..0000000000
> ---
> a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/DefaultLo
> mDevicePath.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/SmbiosCo
> mmon.h
> b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCo
> mmon.h
> index 770053e42b..0ea3434916 100644
> ---
> a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCo
> mmon.h
> +++
> b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCo
> mmon.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/SmbiosCo
> mmonDxe.inf
> b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCo
> mmonDxe.inf
> index fc407c3bec..548a6b0af4 100644
> ---
> a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCo
> mmonDxe.inf
> +++
> b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCo
> mmonDxe.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/SmbiosCo
> mmonEntryPoint.c
> b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCo
> mmonEntryPoint.c
> index eaa66be454..eb3635ca34 100644
> ---
> a/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCo
> mmonEntryPoint.c
> +++
> b/Platform/AMD/AmdPlatformPkg/Universal/SmbiosCommonDxe/SmbiosCo
> mmonEntryPoint.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 (#119333): https://edk2.groups.io/g/devel/message/119333
Mute This Topic: https://groups.io/mt/106349078/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to