public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Kubacki, Michael A" <michael.a.kubacki@intel.com>
To: devel@edk2.groups.io
Cc: Eric Dong <eric.dong@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: [edk2-platforms][PATCH V1 22/49] DebugFeaturePkg: Remove the ACPI Debug feature
Date: Tue, 12 Nov 2019 19:27:48 -0800	[thread overview]
Message-ID: <20191113032816.4056-23-michael.a.kubacki@intel.com> (raw)
In-Reply-To: <20191113032816.4056-1-michael.a.kubacki@intel.com>

Removes the S3 feature from DebugFeaturePkg. The feature does
not follow the advanced feature design. A future change will add
the feature back following the advanced feature design.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
 Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc        |  10 -
 Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf |  57 ---
 Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf |  59 ---
 Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.c      | 523 --------------------
 Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.asl    | 103 ----
 Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt       |  31 --
 6 files changed, 783 deletions(-)

diff --git a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc b/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
index efe705bd76..c43dd63a06 100644
--- a/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
+++ b/Platform/Intel/DebugFeaturePkg/DebugFeaturePkg.dsc
@@ -71,14 +71,6 @@
   MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
   UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
 
-[LibraryClasses.common.DXE_SMM_DRIVER]
-  #######################################
-  # Edk2 Packages
-  #######################################
-  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
-  MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
-  SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
-
 ###################################################################################################
 #
 # Components Section - list of the modules and components that will be processed by compilation
@@ -113,8 +105,6 @@
   DebugFeaturePkg/Library/Usb3DebugPortParameterLibPcd/Usb3DebugPortParameterLibPcd.inf
 
   # Add components here that should be included in the package build.
-  DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf
-  DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf
 
 [BuildOptions]
   *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
diff --git a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf b/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf
deleted file mode 100644
index 7473126b11..0000000000
--- a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugDxe.inf
+++ /dev/null
@@ -1,57 +0,0 @@
-### @file
-# Component description file for Acpi debug module.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
-  INF_VERSION                    = 0x00010005
-  BASE_NAME                      = AcpiDebugDxe
-  FILE_GUID                      = EC98FF95-242C-4513-B1BC-69FA24111C58
-  MODULE_TYPE                    = DXE_DRIVER
-  VERSION_STRING                 = 1.0
-  ENTRY_POINT                    = InitializeAcpiDebugDxe
-#
-# The following information is for reference only and not required by the build tools.
-#
-#  VALID_ARCHITECTURES           = IA32 X64 IPF
-#
-
-[LibraryClasses]
-  BaseLib
-  BaseMemoryLib
-  UefiBootServicesTableLib
-  UefiDriverEntryPoint
-  DebugLib
-  PcdLib
-  DxeServicesLib
-
-[Packages]
-  MdePkg/MdePkg.dec
-  MdeModulePkg/MdeModulePkg.dec
-  DebugFeaturePkg/DebugFeaturePkg.dec
-
-[Pcd]
-  gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugEnable      ## CONSUMES
-  gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugBufferSize  ## CONSUMES
-  gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddress     ## PRODUCES
-
-[Sources]
-  AcpiDebug.c
-  AcpiDebug.asl
-
-[Protocols]
-  gEfiAcpiTableProtocolGuid         ## CONSUMES
-  gEfiSmmBase2ProtocolGuid          ## CONSUMES # only for SMM version
-  gEfiSmmSwDispatch2ProtocolGuid    ## CONSUMES # only for SMM version
-  gEfiSmmEndOfDxeProtocolGuid       ## NOTIFY # only for SMM version
-
-[Guids]
-  gEfiEndOfDxeEventGroupGuid        ## CONSUMES ## Event
-
-[Depex]
-  gEfiAcpiTableProtocolGuid
-
diff --git a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf b/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf
deleted file mode 100644
index 679f9eb014..0000000000
--- a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebugSmm.inf
+++ /dev/null
@@ -1,59 +0,0 @@
-### @file
-# Component description file for Acpi Debug module.
-#
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-###
-
-[Defines]
-  INF_VERSION                    = 0x00010005
-  BASE_NAME                      = AcpiDebugSmm
-  FILE_GUID                      = 9069C144-0A7E-41ef-9C07-418BCA9BF939
-  MODULE_TYPE                    = DXE_SMM_DRIVER
-  VERSION_STRING                 = 1.0
-  PI_SPECIFICATION_VERSION       = 0x0001000A
-  ENTRY_POINT                    = InitializeAcpiDebugSmm
-#
-# The following information is for reference only and not required by the build tools.
-#
-#  VALID_ARCHITECTURES           = IA32 X64 IPF
-#
-
-[LibraryClasses]
-  BaseLib
-  BaseMemoryLib
-  UefiBootServicesTableLib
-  UefiDriverEntryPoint
-  DebugLib
-  PcdLib
-  DxeServicesLib
-
-[Packages]
-  MdePkg/MdePkg.dec
-  MdeModulePkg/MdeModulePkg.dec
-  DebugFeaturePkg/DebugFeaturePkg.dec
-
-[Pcd]
-  gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugEnable      ## CONSUMES
-  gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugBufferSize  ## CONSUMES
-  gDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddress     ## PRODUCES
-
-[Sources]
-  AcpiDebug.c
-  AcpiDebug.asl
-
-[Protocols]
-  gEfiAcpiTableProtocolGuid         ## CONSUMES
-  gEfiSmmBase2ProtocolGuid          ## CONSUMES
-  gEfiSmmSwDispatch2ProtocolGuid    ## CONSUMES
-  gEfiSmmEndOfDxeProtocolGuid       ## NOTIFY
-
-[Guids]
-  gEfiEndOfDxeEventGroupGuid        ## CONSUMES ## Event # only for DXE version
-
-[Depex]
-  gEfiAcpiTableProtocolGuid AND
-  gEfiSmmBase2ProtocolGuid AND
-  gEfiSmmSwDispatch2ProtocolGuid
diff --git a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.c b/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.c
deleted file mode 100644
index f99d80f687..0000000000
--- a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.c
+++ /dev/null
@@ -1,523 +0,0 @@
-/** @file
-  Acpi Debug driver code.
-
-Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-
-#include <Uefi.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-#include <Library/DxeServicesLib.h>
-#include <Protocol/AcpiTable.h>
-#include <IndustryStandard/Acpi.h>
-
-#include <Protocol/SmmBase2.h>
-#include <Protocol/SmmEndOfDxe.h>
-#include <Protocol/SmmSwDispatch2.h>
-
-#define ACPI_DEBUG_STR      "INTEL ACPI DEBUG"
-
-//
-// ASL NAME structure
-//
-#pragma pack(1)
-typedef struct {
-  UINT8  NameOp;            // Byte [0]=0x08:NameOp.
-  UINT32 NameString;        // Byte [4:1]=Name of object.
-  UINT8  DWordPrefix;       // Byte [5]=0x0C:DWord Prefix.
-  UINT32 Value;             // 0 ; Value of named object.
-} NAME_LAYOUT;
-#pragma pack()
-
-#pragma pack(1)
-typedef struct {
-  UINT8  Signature[16];     // "INTEL ACPI DEBUG"
-  UINT32 BufferSize;        // Total size of Acpi Debug buffer including header structure
-  UINT32 Head;              // Current buffer pointer for SMM to print out
-  UINT32 Tail;              // Current buffer pointer for ASL to input
-  UINT8  SmiTrigger;        // Value to trigger the SMI via B2 port
-  UINT8  Wrap;              // If current Tail < Head
-  UINT8  SmmVersion;        // If SMM version
-  UINT8  Truncate;          // If the input from ASL > MAX_BUFFER_SIZE
-} ACPI_DEBUG_HEAD;
-#pragma pack()
-
-#define AD_SIZE             sizeof (ACPI_DEBUG_HEAD) // This is 0x20
-
-#define MAX_BUFFER_SIZE     32
-
-UINT32                      mBufferEnd = 0;
-ACPI_DEBUG_HEAD             *mAcpiDebug = NULL;
-
-EFI_SMM_SYSTEM_TABLE2       *mSmst = NULL;
-
-/**
-  Patch and load ACPI table.
-
-  @param[in] AcpiDebugAddress   Address of Acpi debug memory buffer.
-  @param[in] BufferIndex        Index that starts after the Acpi Debug head.
-  @param[in] BufferEnd          End of Acpi debug memory buffer.
-
-**/
-VOID
-PatchAndLoadAcpiTable (
-  IN ACPI_DEBUG_HEAD            *AcpiDebugAddress,
-  IN UINT32                     BufferIndex,
-  IN UINT32                     BufferEnd
-  )
-{
-  EFI_STATUS                    Status;
-  EFI_ACPI_TABLE_PROTOCOL       *AcpiTable;
-  UINTN                         Size;
-  EFI_ACPI_DESCRIPTION_HEADER   *TableHeader;
-  UINTN                         TableKey;
-  UINT8                         *CurrPtr;
-  UINT32                        *Signature;
-  NAME_LAYOUT                   *NamePtr;
-  UINT8                         UpdateCounter;
-
-  Status = GetSectionFromFv (
-             &gEfiCallerIdGuid,
-             EFI_SECTION_RAW,
-             0,
-             (VOID **) &TableHeader,
-             &Size
-             );
-  ASSERT_EFI_ERROR (Status);
-  if (EFI_ERROR (Status)) {
-    return;
-  }
-
-  //
-  // This is Acpi Debug SSDT. Acpi Debug should be enabled if we reach here so load the table.
-  //
-  ASSERT (((EFI_ACPI_DESCRIPTION_HEADER *) TableHeader)->OemTableId == SIGNATURE_64 ('A', 'D', 'e', 'b', 'T', 'a', 'b', 'l'));
-
-  //
-  // Patch some pointers for the ASL code before loading the SSDT.
-  //
-
-  //
-  // Count pointer updates, so we can stop after all three pointers are patched.
-  //
-  UpdateCounter = 1;
-  for (CurrPtr = (UINT8 *) TableHeader; CurrPtr <= ((UINT8 *) TableHeader + TableHeader->Length) && UpdateCounter < 4; CurrPtr++) {
-    Signature = (UINT32 *) (CurrPtr + 1);
-    //
-    // patch DPTR (address of Acpi debug memory buffer)
-    //
-    if ((*CurrPtr == AML_NAME_OP) && *Signature == SIGNATURE_32 ('D', 'P', 'T', 'R')) {
-      NamePtr = (NAME_LAYOUT *) CurrPtr;
-      NamePtr->Value  = (UINT32) (UINTN) AcpiDebugAddress;
-      UpdateCounter++;
-    }
-    //
-    // patch EPTR (end of Acpi debug memory buffer)
-    //
-    if ((*CurrPtr == AML_NAME_OP) && *Signature == SIGNATURE_32 ('E', 'P', 'T', 'R')) {
-      NamePtr = (NAME_LAYOUT *) CurrPtr;
-      NamePtr->Value  = BufferEnd;
-      UpdateCounter++;
-    }
-    //
-    // patch CPTR (used as an index that starts after the Acpi Debug head)
-    //
-    if ((*CurrPtr == AML_NAME_OP) && *Signature == SIGNATURE_32 ('C', 'P', 'T', 'R')) {
-      NamePtr = (NAME_LAYOUT *) CurrPtr;
-      NamePtr->Value  = BufferIndex;
-      UpdateCounter++;
-    }
-  }
-
-  //
-  // Add the table
-  //
-  Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTable);
-  ASSERT_EFI_ERROR (Status);
-  if (EFI_ERROR (Status)) {
-    goto Done;
-  }
-
-  TableKey = 0;
-  Status = AcpiTable->InstallAcpiTable (
-                        AcpiTable,
-                        TableHeader,
-                        Size,
-                        &TableKey
-                        );
-  ASSERT_EFI_ERROR (Status);
-  if (EFI_ERROR (Status)) {
-    goto Done;
-  }
-
-Done:
-  gBS->FreePool (TableHeader);
-  return ;
-}
-
-/**
-  Allocate Acpi Debug memory.
-
-  @param[out] BufferSize    Pointer to Acpi debug memory buffer size.
-
-  @return Address of Acpi debug memory buffer. 0 if PcdAcpiDebugEnable is FALSE.
-
-**/
-EFI_PHYSICAL_ADDRESS
-AllocateAcpiDebugMemory (
-  OUT UINT32           *BufferSize
-  )
-{
-  EFI_STATUS           Status;
-  EFI_PHYSICAL_ADDRESS AcpiDebugAddress;
-  UINTN                PagesNum;
-
-  AcpiDebugAddress = 0;
-  *BufferSize = 0;
-
-  if (PcdGetBool (PcdAcpiDebugEnable)) {
-    //
-    // Reserve memory to store Acpi Debug data.
-    //
-    AcpiDebugAddress = 0xFFFFFFFF;
-    PagesNum = EFI_SIZE_TO_PAGES (PcdGet32 (PcdAcpiDebugBufferSize));
-    Status = gBS->AllocatePages (
-                    AllocateMaxAddress,
-                    EfiReservedMemoryType,
-                    PagesNum,
-                    &AcpiDebugAddress
-                    );
-    ASSERT_EFI_ERROR (Status);
-    if (EFI_ERROR (Status)) {
-      return 0;
-    }
-
-    DEBUG ((DEBUG_INFO, "AcpiDebugAddress - 0x%08x\n", AcpiDebugAddress));
-
-    Status = PcdSet32S (PcdAcpiDebugAddress, (UINT32) AcpiDebugAddress);
-    ASSERT_EFI_ERROR (Status);
-
-    if (EFI_ERROR (Status)) {
-      gBS->FreePages (AcpiDebugAddress, PagesNum);
-      return 0;
-    }
-
-    *BufferSize = PcdGet32 (PcdAcpiDebugBufferSize);
-  }
-
-  return AcpiDebugAddress;
-}
-
-/**
-  Acpi Debug EndOfDxe notification.
-
-  @param[in] Event      Event whose notification function is being invoked.
-  @param[in] Context    Pointer to the notification function's context.
-
-**/
-VOID
-EFIAPI
-AcpiDebugEndOfDxeNotification (
-  IN EFI_EVENT  Event,
-  IN VOID       *Context
-  )
-{
-  UINT32        BufferSize;
-  UINT32        BufferIndex;
-
-  mAcpiDebug = (ACPI_DEBUG_HEAD *) (UINTN) AllocateAcpiDebugMemory (&BufferSize);
-  if (mAcpiDebug != NULL) {
-    //
-    // Init ACPI DEBUG buffer to lower case 'x'.
-    //
-    SetMem ((VOID *) mAcpiDebug, BufferSize, 0x78);
-
-    //
-    // Clear header of AD_SIZE bytes.
-    //
-    ZeroMem ((VOID *) mAcpiDebug, AD_SIZE);
-
-    //
-    // Write a signature to the first line of the buffer, "INTEL ACPI DEBUG".
-    //
-    CopyMem ((VOID *) mAcpiDebug, ACPI_DEBUG_STR, sizeof (ACPI_DEBUG_STR) - 1);
-
-    BufferIndex = (UINT32) (UINTN) mAcpiDebug;
-    mBufferEnd = BufferIndex + BufferSize;
-
-    //
-    // Leave the Index after the Acpi Debug head.
-    //
-    BufferIndex += AD_SIZE;
-
-    //
-    // Patch and Load the SSDT ACPI Tables.
-    //
-    PatchAndLoadAcpiTable (mAcpiDebug, BufferIndex, mBufferEnd);
-
-    mAcpiDebug->Head = BufferIndex;
-    mAcpiDebug->Tail = BufferIndex;
-    mAcpiDebug->BufferSize = BufferSize;
-  }
-
-  //
-  // Close event, so it will not be invoked again.
-  //
-  gBS->CloseEvent (Event);
-
-  return ;
-}
-
-/**
-  Initialize ACPI Debug.
-
-  @param[in] ImageHandle    The firmware allocated handle for the EFI image.
-  @param[in] SystemTable    A pointer to the EFI System Table.
-
-  @retval EFI_SUCCESS       The driver initializes correctly.
-
-**/
-EFI_STATUS
-EFIAPI
-InitializeAcpiDebugDxe (
-  IN EFI_HANDLE         ImageHandle,
-  IN EFI_SYSTEM_TABLE   *SystemTable
-  )
-{
-  EFI_STATUS            Status;
-  EFI_EVENT             EndOfDxeEvent;
-
-  //
-  // Register EndOfDxe notification
-  // that point could ensure the Acpi Debug related PCDs initialized.
-  //
-  Status = gBS->CreateEventEx (
-                  EVT_NOTIFY_SIGNAL,
-                  TPL_CALLBACK,
-                  AcpiDebugEndOfDxeNotification,
-                  NULL,
-                  &gEfiEndOfDxeEventGroupGuid,
-                  &EndOfDxeEvent
-                  );
-  ASSERT_EFI_ERROR (Status);
-
-  return Status;
-}
-
-/**
-  Software SMI callback for ACPI Debug which is called from ACPI method.
-
-  @param[in]      DispatchHandle    The unique handle assigned to this handler by SmiHandlerRegister().
-  @param[in]      Context           Points to an optional handler context which was specified when the
-                                    handler was registered.
-  @param[in, out] CommBuffer        A pointer to a collection of data in memory that will
-                                    be conveyed from a non-SMM environment into an SMM environment.
-  @param[in, out] CommBufferSize    The size of the CommBuffer.
-
-  @retval EFI_SUCCESS               The interrupt was handled successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-AcpiDebugSmmCallback (
-  IN EFI_HANDLE     DispatchHandle,
-  IN CONST VOID     *Context,
-  IN OUT VOID       *CommBuffer,
-  IN OUT UINTN      *CommBufferSize
-  )
-{
-  UINT8             Buffer[MAX_BUFFER_SIZE];
-
-  //
-  // Validate the fields in mAcpiDebug to ensure there is no harm to SMI handler.
-  // mAcpiDebug is below 4GB and the start address of whole buffer.
-  //
-  if ((mAcpiDebug->BufferSize != (mBufferEnd - (UINT32) (UINTN) mAcpiDebug)) ||
-      (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + AD_SIZE)) ||
-      (mAcpiDebug->Head > mBufferEnd) ||
-      (mAcpiDebug->Tail < (UINT32) ((UINTN) mAcpiDebug + AD_SIZE)) ||
-      (mAcpiDebug->Tail > mBufferEnd)) {
-    //
-    // If some fields in mAcpiDebug are invaid, return directly.
-    //
-    return EFI_SUCCESS;
-  }
-
-  if (!(BOOLEAN)mAcpiDebug->Wrap && ((mAcpiDebug->Head >= (UINT32) ((UINTN) mAcpiDebug + AD_SIZE))
-    && (mAcpiDebug->Head < mAcpiDebug->Tail))){
-    //
-    // If curent ----- buffer + 020
-    //                 ...
-    //                 ... Head
-    //                 ... Data for SMM print
-    //                 ... Tail
-    //                 ... Vacant for ASL input
-    //           ----- buffer end
-    //
-    // skip NULL block
-    //
-    while ((*(CHAR8 *) (UINTN) mAcpiDebug->Head == '\0') && (mAcpiDebug->Head < mAcpiDebug->Tail)) {
-      mAcpiDebug->Head ++;
-    }
-
-    if (mAcpiDebug->Head < mAcpiDebug->Tail) {
-      ZeroMem (Buffer, MAX_BUFFER_SIZE);
-      AsciiStrnCpyS ((CHAR8 *) Buffer, MAX_BUFFER_SIZE, (CHAR8 *) (UINTN) mAcpiDebug->Head, MAX_BUFFER_SIZE - 1);
-
-      DEBUG ((DEBUG_INFO | DEBUG_ERROR, "%a%a\n", Buffer, (BOOLEAN) mAcpiDebug->Truncate ? "..." : ""));
-      mAcpiDebug->Head += MAX_BUFFER_SIZE;
-
-      if (mAcpiDebug->Head >= (mAcpiDebug->Tail)) {
-        //
-        // When head == tail, we do nothing in handler.
-        //
-        mAcpiDebug->Head = mAcpiDebug->Tail;
-      }
-    }
-  } else if ((BOOLEAN) mAcpiDebug->Wrap && ((mAcpiDebug->Head > mAcpiDebug->Tail)
-    && (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->BufferSize)))){
-    //
-    // If curent ----- buffer + 020
-    //                 ... Tail
-    //                 ... Vacant for ASL input
-    //                 ... Head
-    //                 ... Data for SMM print
-    //           ----- buffer end
-    //
-    while ((*(CHAR8 *) (UINTN) mAcpiDebug->Head == '\0') && (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->BufferSize))) {
-      mAcpiDebug->Head ++;
-    }
-    if (mAcpiDebug->Head < (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->BufferSize)){
-      ZeroMem (Buffer, MAX_BUFFER_SIZE);
-      AsciiStrnCpyS ((CHAR8 *) Buffer, MAX_BUFFER_SIZE, (CHAR8 *) (UINTN) mAcpiDebug->Head, MAX_BUFFER_SIZE - 1);
-      DEBUG ((DEBUG_INFO | DEBUG_ERROR, "%a%a\n", Buffer, (BOOLEAN) mAcpiDebug->Truncate ? "..." : ""));
-      mAcpiDebug->Head += MAX_BUFFER_SIZE;
-
-      if (mAcpiDebug->Head >= (UINT32) ((UINTN) mAcpiDebug + mAcpiDebug->BufferSize)) {
-        //
-        // We met end of buffer.
-        //
-        mAcpiDebug->Wrap = 0;
-        mAcpiDebug->Head = (UINT32) ((UINTN) mAcpiDebug + AD_SIZE);
-      }
-    }
-  }
-
-  return EFI_SUCCESS;
-}
-
-/**
-  Acpi Debug SmmEndOfDxe notification.
-
-  @param[in] Protocol   Points to the protocol's unique identifier.
-  @param[in] Interface  Points to the interface instance.
-  @param[in] Handle     The handle on which the interface was installed.
-
-  @retval EFI_SUCCESS   Notification runs successfully.
-
- **/
-EFI_STATUS
-EFIAPI
-AcpiDebugSmmEndOfDxeNotification (
-  IN CONST EFI_GUID     *Protocol,
-  IN VOID               *Interface,
-  IN EFI_HANDLE         Handle
-  )
-{
-  EFI_STATUS                        Status;
-  EFI_SMM_SW_DISPATCH2_PROTOCOL     *SwDispatch;
-  EFI_SMM_SW_REGISTER_CONTEXT       SwContext;
-  EFI_HANDLE                        SwHandle;
-
-  AcpiDebugEndOfDxeNotification (NULL, NULL);
-
-  if (mAcpiDebug != NULL) {
-    //
-    // Get the Sw dispatch protocol and register SMI callback function.
-    //
-    SwDispatch = NULL;
-    Status = mSmst->SmmLocateProtocol (&gEfiSmmSwDispatch2ProtocolGuid, NULL, (VOID **) &SwDispatch);
-    ASSERT_EFI_ERROR (Status);
-    if (EFI_ERROR (Status)) {
-      return Status;
-    }
-
-    SwContext.SwSmiInputValue = (UINTN) -1;
-    Status = SwDispatch->Register (SwDispatch, AcpiDebugSmmCallback, &SwContext, &SwHandle);
-    ASSERT_EFI_ERROR (Status);
-    if (EFI_ERROR (Status)) {
-      return Status;
-    }
-
-    mAcpiDebug->SmiTrigger = (UINT8) SwContext.SwSmiInputValue;
-    mAcpiDebug->SmmVersion = 1;
-  }
-
-  return EFI_SUCCESS;
-}
-
-/**
-  Initialize ACPI Debug.
-
-  @param[in] ImageHandle    The firmware allocated handle for the EFI image.
-  @param[in] SystemTable    A pointer to the EFI System Table.
-
-  @retval EFI_SUCCESS       The driver initializes correctly.
-
-**/
-EFI_STATUS
-EFIAPI
-InitializeAcpiDebugSmm (
-  IN EFI_HANDLE         ImageHandle,
-  IN EFI_SYSTEM_TABLE   *SystemTable
-  )
-{
-  EFI_STATUS                Status;
-  VOID                      *Registration;
-  EFI_SMM_BASE2_PROTOCOL    *SmmBase2;
-  BOOLEAN                   InSmm;
-
-  Status = gBS->LocateProtocol (&gEfiSmmBase2ProtocolGuid, NULL, (VOID **) &SmmBase2);
-  ASSERT_EFI_ERROR (Status);
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  Status = SmmBase2->InSmm (SmmBase2, &InSmm);
-  ASSERT_EFI_ERROR (Status);
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  ASSERT (InSmm);
-
-  if (!InSmm) {
-    return EFI_UNSUPPORTED;
-  }
-
-  Status = SmmBase2->GetSmstLocation (SmmBase2, &mSmst);
-  ASSERT_EFI_ERROR (Status);
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  //
-  // Register SmmEndOfDxe notification
-  // that point could ensure the Acpi Debug related PCDs initialized.
-  //
-  Registration = NULL;
-  Status = mSmst->SmmRegisterProtocolNotify (
-                    &gEfiSmmEndOfDxeProtocolGuid,
-                    AcpiDebugSmmEndOfDxeNotification,
-                    &Registration
-                    );
-  ASSERT_EFI_ERROR (Status);
-
-  return Status;
-}
diff --git a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.asl b/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.asl
deleted file mode 100644
index cbfe085b56..0000000000
--- a/Platform/Intel/DebugFeaturePkg/AcpiDebug/AcpiDebug.asl
+++ /dev/null
@@ -1,103 +0,0 @@
-/** @file
-  Acpi Debug ASL code.
-
-Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-DefinitionBlock (
-  "AcpiDebug.aml",
-  "SSDT",
-  2,
-  "Intel ",
-  "ADebTabl",
-  0x1000
-  )
-{
-  Scope(\)
-  {
-    //
-    // These pointers are patched during POST.
-    //
-    Name (DPTR, 0x80000000) // Address of Acpi debug memory buffer, fixed up during POST
-    Name (EPTR, 0x80000000) // End of Acpi debug memory buffer, fixed up during POST
-    Name (CPTR, 0x80000000) // Current pointer used as an index into the buffer(starts after the Acpi Debug head), fixed up during POST
-
-    //
-    // Use a Mutex to prevent multiple calls from simutaneously writing to the same memory.
-    //
-    Mutex (MMUT, 0)
-
-    //
-    // Operational region for SMI port access
-    //
-    OperationRegion (ADBP, SystemIO, 0xB2, 2)
-    Field (ADBP, ByteAcc, NoLock, Preserve)
-    {
-        B2PT, 8,
-        B3PT, 8,
-    }
-
-    //
-    // Write a string to a memory buffer
-    //
-    Method (MDBG, 1, Serialized)
-    {
-      OperationRegion (ADHD, SystemMemory, DPTR, 32) // Operation region for Acpi Debug buffer first 0x20 bytes
-      Field (ADHD, ByteAcc, NoLock, Preserve)
-      {
-        Offset (0x0),
-        ASIG, 128,      // 16 bytes is Signature
-        Offset (0x10),
-        ASIZ, 32,       // 4 bytes is buffer size
-        ACHP, 32,       // 4 bytes is current head pointer, normally is DPTR + 0x20,
-                        //   if there's SMM handler to print, then it's the starting of the info hasn't been printed yet.
-        ACTP, 32,       // 4 bytes is current tail pointer, is the same as CPTR
-        SMIN, 8,        // 1 byte of SMI Number for trigger callback
-        WRAP, 8,        // 1 byte of wrap status
-        SMMV, 8,        // 1 byte of SMM version status
-        TRUN, 8         // 1 byte of truncate status
-      }
-
-      Store (Acquire (MMUT, 1000), Local0) // save Acquire result so we can check for Mutex acquired
-      If (LEqual (Local0, Zero)) // check for Mutex acquired
-      {
-        OperationRegion (ABLK, SystemMemory, CPTR, 32) // Operation region to allow writes to ACPI debug buffer
-        Field (ABLK, ByteAcc, NoLock, Preserve)
-        {
-          Offset (0x0),
-          AAAA, 256 // 32 bytes is max size for string or data
-        }
-        ToHexString (Arg0, Local1) // convert argument to Hexadecimal String
-        Store (0, TRUN)
-        If (LGreaterEqual (SizeOf (Local1), 32))
-        {
-          Store (1, TRUN) // the input from ASL >= 32
-        }
-        Mid (Local1, 0, 31, AAAA) // extract the input to current buffer
-
-        Add (CPTR, 32, CPTR) // advance current pointer to next string location in memory buffer
-        If (LGreaterEqual (CPTR, EPTR) ) // check for end of 64kb Acpi debug buffer
-        {
-          Add (DPTR, 32, CPTR) // wrap around to beginning of buffer if the end has been reached
-          Store (1, WRAP)
-        }
-        Store (CPTR, ACTP)
-
-        If (SMMV)
-        {
-          //
-          // Trigger the SMI to print
-          //
-          Store (SMIN, B2PT)
-        }
-        Release (MMUT)
-      }
-
-      Return (Local0) // return error code indicating whether Mutex was acquired
-    }
-
-  } // End Scope
-} // End SSDT
-
diff --git a/Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt b/Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt
deleted file mode 100644
index 71284ec77f..0000000000
--- a/Platform/Intel/DebugFeaturePkg/AcpiDebug/Readme.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-ACPI Debug feature - an alternative to Port 80 and WinDBG
-
-How it works:
-  Acpi Debug does this:
-  Opens a 64kb memory buffer during POST.
-  Patches the buffer address in SSDT ASL code.
-  Save the address in gAdvancedFeaturePkgTokenSpaceGuid.PcdAcpiDebugAddress for user reference.
-  Write strings or numbers to the buffer from ASL code with the ADBG method.
-
-How to use it:
-  1. Enable it by set gAdvancedFeaturePkgTokenSpaceGuid.PcdAcpiDebugEnable to TRUE.
-  2. The ACPI ASL code must be instrumented with the debug method.
-     Strings up to 32 characters (shorter strings will be padded with Zero's, longer strings will be truncated)
-     Examples:
-       ADBG("This is a test.")
-       ADBG(Arg0)
-
-  DXE version: The bios engineer will read the strings from the buffer on the target machine with read/write memory utility.
-  SMM version: Check debug serial that would show debug strings.
-
-  Sample code for ADBG:
-    External (MDBG, MethodObj)
-    Method (ADBG, 1, Serialized)
-    {
-      If (CondRefOf (MDBG)) // Check if ACPI Debug SSDT is loaded
-      {
-        Return (MDBG (Arg0))
-      }
-      Return (0)
-    }
-
-- 
2.16.2.windows.1


  parent reply	other threads:[~2019-11-13  3:29 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-13  3:27 [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Kubacki, Michael A
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 01/49] AdvancedFeaturePkg: Package DSC style cleanup Kubacki, Michael A
2019-11-14  2:00   ` Chaganty, Rangasai V
2019-11-15 23:47   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 02/49] DebugFeaturePkg: " Kubacki, Michael A
2019-11-15 23:47   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 03/49] UserInterfaceFeaturePkg: " Kubacki, Michael A
2019-11-15 23:47   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 04/49] Features/Intel: Add Readme.md Kubacki, Michael A
2019-11-15 23:47   ` Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 05/49] Features/Intel/PowerManagement: " Kubacki, Michael A
2019-11-15 23:47   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 06/49] Features/Intel/OutOfBandManagement: " Kubacki, Michael A
2019-11-15 23:47   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 07/49] Features/Intel/SystemInformation: " Kubacki, Michael A
2019-11-15 23:47   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 08/49] Features/Intel/Debug: " Kubacki, Michael A
2019-11-15 23:47   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 09/49] Features/Intel/UserInterface: " Kubacki, Michael A
2019-11-15 23:47   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 10/49] Features/Intel/Network: " Kubacki, Michael A
2019-11-15 23:47   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 11/49] TemplateFeaturePkg: Add initial package Kubacki, Michael A
2019-11-15 23:48   ` Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 12/49] SimicsOpenBoardPkg: Remove advanced feature references Kubacki, Michael A
2019-11-15 23:48   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 13/49] AdvancedFeaturePkg: Remove the S3 feature Kubacki, Michael A
2019-11-15 23:48   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 14/49] Features/Intel: Add S3FeaturePkg Kubacki, Michael A
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 15/49] AdvancedFeaturePkg: Remove the IPMI feature Kubacki, Michael A
2019-11-15 23:48   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 16/49] Features/Intel/IpmiFeaturePkg: Add initial package Kubacki, Michael A
2019-11-15 23:48   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 17/49] Features/Intel/IpmiFeaturePkg: Add libraries Kubacki, Michael A
2019-11-15 23:49   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 18/49] Features/Intel/IpmiFeaturePkg: Add modules Kubacki, Michael A
2019-11-15 23:49   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 19/49] AdvancedFeaturePkg: Remove the SMBIOS feature Kubacki, Michael A
2019-11-15 23:49   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 20/49] Features/Intel/SmbiosFeaturePkg: Add initial package Kubacki, Michael A
2019-11-15 23:49   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 21/49] Features/Intel/SmbiosFeaturePkg: Update default strings Kubacki, Michael A
2019-11-15 23:49   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` Kubacki, Michael A [this message]
2019-11-15 23:49   ` [edk2-devel] [edk2-platforms][PATCH V1 22/49] DebugFeaturePkg: Remove the ACPI Debug feature Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 23/49] Features/Intel/AcpiDebugFeaturePkg: Add initial package Kubacki, Michael A
2019-11-15 23:49   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 25/49] Features/Intel/Usb3DebugFeaturePkg: " Kubacki, Michael A
2019-11-15 23:50   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 26/49] UserInterfaceFeaturePkg: Remove the User Authentication feature Kubacki, Michael A
2019-11-15 23:50   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 27/49] Features/Intel/UserAuthFeaturePkg: Add initial package Kubacki, Michael A
2019-11-15 23:50   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 28/49] Features/Intel/NetworkFeaturePkg: " Kubacki, Michael A
2019-11-15 23:50   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 29/49] AdvancedFeaturePkg: Remove remaining contents Kubacki, Michael A
2019-11-15 23:50   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 30/49] AdvancedFeaturePkg: Move to Features/Intel Kubacki, Michael A
2019-11-15 23:50   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 31/49] AdvancedFeaturePkg: Add feature build support Kubacki, Michael A
2019-11-15 23:50   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 32/49] AdvancedFeaturePkg: Add temporary build workaround Kubacki, Michael A
2019-11-15 23:50   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:27 ` [edk2-platforms][PATCH V1 33/49] AdvancedFeaturePkg: Add FDF include files Kubacki, Michael A
2019-11-15 23:50   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:28 ` [edk2-platforms][PATCH V1 34/49] KabylakeOpenBoardPkg/KabylakeRvp3: Add PEI_ARCH and DXE_ARCH Kubacki, Michael A
2019-11-15 23:51   ` Nate DeSimone
2019-11-13  3:28 ` [edk2-platforms][PATCH V1 35/49] KabylakeOpenBoardPkg/GalagoPro3: " Kubacki, Michael A
2019-11-15 23:51   ` Nate DeSimone
2019-11-13  3:28 ` [edk2-platforms][PATCH V1 36/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: " Kubacki, Michael A
2019-11-15 23:51   ` Nate DeSimone
2019-11-13  3:28 ` [edk2-platforms][PATCH V1 37/49] SimicsOpenBoardPkg/BoardX58Ich10: Use " Kubacki, Michael A
2019-11-15 23:51   ` [edk2-devel] " Nate DeSimone
2019-11-13  3:28 ` [edk2-platforms][PATCH V1 38/49] MinPlatformPkg: Add FvAdvancedPreMemory Kubacki, Michael A
2019-11-15 23:51   ` Nate DeSimone
2019-11-13  3:28 ` [edk2-platforms][PATCH V1 39/49] KabylakeOpenBoardPkg/KabylakeRvp3: " Kubacki, Michael A
2019-11-16  0:34   ` Nate DeSimone
2019-11-13  3:28 ` [edk2-platforms][PATCH V1 40/49] KabylakeOpenBoardPkg/GalagoPro3: " Kubacki, Michael A
2019-11-16  0:34   ` Nate DeSimone
2019-11-15 23:47 ` [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Nate DeSimone
     [not found] ` <20191113032816.4056-42-michael.a.kubacki@intel.com>
2019-11-16  0:34   ` [edk2-platforms][PATCH V1 41/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: Add FvAdvancedPreMemory Nate DeSimone
     [not found] ` <20191113032816.4056-43-michael.a.kubacki@intel.com>
2019-11-16  0:34   ` [edk2-platforms][PATCH V1 42/49] Platform/Intel: Add advanced feature build support Nate DeSimone
     [not found] ` <20191113032816.4056-44-michael.a.kubacki@intel.com>
2019-11-16  0:34   ` [edk2-platforms][PATCH V1 43/49] Platform/Intel/Readme.md Content update Nate DeSimone
     [not found] ` <20191113032816.4056-45-michael.a.kubacki@intel.com>
2019-11-16  0:34   ` [edk2-platforms][PATCH V1 44/49] KabylakeOpenBoardPkg/GalagoPro3: Enable advanced features Nate DeSimone
     [not found] ` <20191113032816.4056-46-michael.a.kubacki@intel.com>
2019-11-16  0:34   ` [edk2-platforms][PATCH V1 45/49] KabylakeOpenBoardPkg/KabylakeRvp3: " Nate DeSimone
     [not found] ` <20191113032816.4056-47-michael.a.kubacki@intel.com>
2019-11-16  0:34   ` [edk2-platforms][PATCH V1 46/49] WhiskeylakeOpenBoardPkg/WhiskeylakeURvp: " Nate DeSimone
     [not found] ` <20191113032816.4056-49-michael.a.kubacki@intel.com>
2019-11-16  0:34   ` [edk2-platforms][PATCH V1 48/49] MinPlatformPkg: Install advanced feature FVs by stage enabled Nate DeSimone
2019-11-18  8:40 ` [edk2-platforms][PATCH V1 00/49] Intel Advanced Feature Refactor Dandan Bi
2019-11-27 20:54   ` Kubacki, Michael A

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=20191113032816.4056-23-michael.a.kubacki@intel.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