public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-platforms][PATCH 0/6] Support NVMe Hot Plug feature for Ampere Altra and Ampere Altra Max
@ 2023-05-11  8:10 Minh Nguyen
  2023-05-11  8:10 ` [edk2-platforms][PATCH 1/6] AmpereAltraPkg: Add PCIe Hot Plug library Minh Nguyen
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Minh Nguyen @ 2023-05-11  8:10 UTC (permalink / raw)
  To: devel; +Cc: patches, quic_llindhol, ardb+tianocore, nhi, tinhnguyen,
	Minh Nguyen

These patches support NVMe Hot Plug feature for Ampere Altra and Ampere Altra Max.

Minh Nguyen (2):
  AmpereAltraPkg: Add Hot Plug Slot Capable during PCIe port
    initialization
  AmpereAltraPkg: Change PCIe Amba Link Timeout value

Vu Nguyen (4):
  AmpereAltraPkg: Add PCIe Hot Plug library
  JadePkg: Support ACPI tables for Hot Plug of Ampere Altra
  JadePkg: Support ACPI tables for Hot Plug of Ampere Altra Max
  AmpereAltraPkg: Enable NVMe Hot Plug feature

 Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec                        |    8 +-
 Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec                    |   13 +
 Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc                    |    1 +
 Platform/Ampere/JadePkg/Jade.dsc                                        |   66 ++
 Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf       |    3 +-
 Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.inf |   37 +
 Silicon/Ampere/AmpereAltraPkg/Include/Library/PcieHotPlugLib.h          |  162 +++
 Silicon/Ampere/AmpereSiliconPkg/Include/Library/PcieHotPlugPortMapLib.h |   81 ++
 Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.c         |    3 +
 Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c            |   13 +-
 Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.c   |  397 ++++++++
 Platform/Ampere/JadePkg/Ac02AcpiTables/CommonDevices.asi                |   24 +
 Platform/Ampere/JadePkg/Ac02AcpiTables/Dsdt.asl                         |  511 ++++++++++
 Platform/Ampere/JadePkg/Ac02AcpiTables/MHPP.asi                         |   92 ++
 Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S0.asi                       |  545 ++++++++++
 Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S1.asi                       | 1072 +++++++++++++++++++
 Platform/Ampere/JadePkg/AcpiTables/Dsdt.asl                             |  499 ++++++++-
 Platform/Ampere/JadePkg/AcpiTables/MHPP.asi                             |  127 +++
 Platform/Ampere/JadePkg/AcpiTables/PCI-S0.asi                           |  548 +++++++++-
 Platform/Ampere/JadePkg/AcpiTables/PCI-S1.asi                           | 1074 +++++++++++++++++++-
 20 files changed, 5269 insertions(+), 7 deletions(-)
 create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.inf
 create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/Library/PcieHotPlugLib.h
 create mode 100644 Silicon/Ampere/AmpereSiliconPkg/Include/Library/PcieHotPlugPortMapLib.h
 create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.c
 create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/MHPP.asi
 create mode 100644 Platform/Ampere/JadePkg/AcpiTables/MHPP.asi

-- 
2.39.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [edk2-platforms][PATCH 1/6] AmpereAltraPkg: Add PCIe Hot Plug library
  2023-05-11  8:10 [edk2-platforms][PATCH 0/6] Support NVMe Hot Plug feature for Ampere Altra and Ampere Altra Max Minh Nguyen
@ 2023-05-11  8:10 ` Minh Nguyen
  2023-05-11  8:10 ` [edk2-platforms][PATCH 2/6] AmpereAltraPkg: Add Hot Plug Slot Capable during PCIe port initialization Minh Nguyen
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Minh Nguyen @ 2023-05-11  8:10 UTC (permalink / raw)
  To: devel
  Cc: patches, quic_llindhol, ardb+tianocore, nhi, tinhnguyen,
	Vu Nguyen, Minh Nguyen

From: Vu Nguyen <vunguyen@os.amperecomputing.com>

This adds PCIe Hot Plug library to support Hot Plug
feature and specific procedures for setting different
Portmap tables (GPIO pins used for PCIe reset).

Signed-off-by: Minh Nguyen <minhnguyen1@os.amperecomputing.com>
---
 Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec                        |   8 +-
 Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec                    |  13 +
 Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc                    |   1 +
 Platform/Ampere/JadePkg/Jade.dsc                                        |  66 ++++
 Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.inf |  37 ++
 Silicon/Ampere/AmpereAltraPkg/Include/Library/PcieHotPlugLib.h          | 162 ++++++++
 Silicon/Ampere/AmpereSiliconPkg/Include/Library/PcieHotPlugPortMapLib.h |  81 ++++
 Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.c   | 397 ++++++++++++++++++++
 8 files changed, 764 insertions(+), 1 deletion(-)

diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec
index d795c9229691..d4881eaed692 100644
--- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec
+++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec
@@ -1,6 +1,6 @@
 ## @file
 #
-# Copyright (c) 2020-2021, Ampere Computing LLC. All rights reserved.<BR>
+# Copyright (c) 2020-2023, Ampere Computing LLC. All rights reserved.<BR>
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -49,6 +49,9 @@ [LibraryClasses]
   ##  @libraryclass  Defines a set of methods to initialize Pcie
   Ac01PcieLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/Ac01PcieLib.h
 
+  ##  @libraryclass  Defines a set of methods to start Hot plug feature
+  PcieHotPlugLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/PcieHotPlugLib.h
+
 [Guids]
   ## NVParam MM GUID
   gNVParamMmGuid               = { 0xE4AC5024, 0x29BE, 0x4ADC, { 0x93, 0x36, 0x87, 0xB5, 0xA0, 0x76, 0x23, 0x2D } }
@@ -70,3 +73,6 @@ [Guids]
 
   ## Include/Guid/AcpiConfigHii.h
   gAcpiConfigFormSetGuid = { 0x0ceb6764, 0xd415, 0x4b01, { 0xa8, 0x43, 0xd1, 0x01, 0xbc, 0xb0, 0xd8, 0x29 } }
+
+  ## PCIe Hot Plug GUID
+  gPcieHotPlugGuid = { 0x5598273c, 0x11ea, 0xa496, { 0x42, 0x02, 0x37, 0xbb, 0x02, 0x00, 0x13, 0xac } }
diff --git a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec b/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec
index 625a9b2b1e89..9259956c7caa 100644
--- a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec
+++ b/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec
@@ -80,3 +80,16 @@ [PcdsFixedAtBuild, PcdsDynamic, PcdsDynamicEx]
   #
   # SMBIOS Type 0 - BIOS Information
   gAmpereTokenSpaceGuid.PcdSmbiosTables0BiosReleaseDate|"MM/DD/YYYY"|VOID*|0xB0000002 # Must follow this MM/DD/YYYY SMBIOS date format
+
+  # Pcie HotPlug reset map
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugGpioResetMap|0x0|UINT8|0xB000000A
+
+  #
+  # Pcie HotPlug Port Map table
+  #
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable|{0x00}|PCIE_HOT_PLUG_PORT_MAP_TABLE|0xB000000B {
+    <HeaderFiles>
+      Library/PcieHotPlugPortMapLib.h
+    <Packages>
+      Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec
+  }
diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc
index 9275e0053af6..8cb2a3fe6422 100644
--- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc
+++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc
@@ -81,6 +81,7 @@ [LibraryClasses.common]
   NVParamLib|Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.inf
   MailboxInterfaceLib|Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfaceLib/MailboxInterfaceLib.inf
   SystemFirmwareInterfaceLib|Silicon/Ampere/AmpereAltraPkg/Library/SystemFirmwareInterfaceLib/SystemFirmwareInterfaceLib.inf
+  PcieHotPlugLib|Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.inf
   PciePhyLib|Silicon/Ampere/AmpereAltraBinPkg/Library/PciePhyLib/PciePhyLib.inf
   Ac01PcieLib|Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/Ac01PcieLib.inf
   AmpereCpuLib|Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib.inf
diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jade.dsc
index f14d286cdfb8..a6b5fa3ca2d3 100644
--- a/Platform/Ampere/JadePkg/Jade.dsc
+++ b/Platform/Ampere/JadePkg/Jade.dsc
@@ -100,7 +100,73 @@ [PcdsFeatureFlag.common]
   #
   gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
 
+  #
+  # Flag to indicate option of using default or specific platform Port Map table
+  #
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.UseDefaultConfig|TRUE
+
 [PcdsFixedAtBuild]
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugGpioResetMap|0x3F
+
+  #
+  # Setting Portmap table
+  #
+  #   * Elements of array:
+  #     - 0:  Index of Portmap entry in Portmap table structure (Vport).
+  #     - 1:  Socket number (Socket).
+  #     - 2:  Root complex port for each Portmap entry (RcaPort).
+  #     - 3:  Root complex sub-port for each Portmap entry (RcaSubPort).
+  #     - 4:  Select output port of IO expander (PinPort).
+  #     - 5:  I2C address of IO expander that CPLD backplane simulates (I2cAddress).
+  #     - 6:  Address of I2C switch between CPU and CPLD backplane (MuxAddress).
+  #     - 7:  Channel of I2C switch (MuxChannel).
+  #     - 8:  It is set from PcieHotPlugSetGPIOMapCmd () function to select GPIO[16:21] (PcdPcieHotPlugGpioResetMap) or I2C for PCIe reset purpose.
+  #     - 9:  Segment of root complex (Segment).
+  #     - 10: SSD slot index on the front panel of backplane (DriveIndex).
+  #
+  #   * Caution:
+  #     - The last array ({ 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF }) require if no fully structured used.
+  #     - Size of Portmap table: PortMap[MAX_PORT_MAP_ENTRY][sizeof(PCIE_HOT_PLUG_PORTMAP_ENTRY)] <=> PortMap[96][11].
+  #   * Example: Bellow configuration is the configuration for Portmap table of Mt. Jade 2U platform.
+  #
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[0]|{ 0, 0, 2, 0, 0, 0x00, 0x00, 0x0, 0, 1, 0xFF }   # S0 RCA2.0
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[1]|{ 1, 0, 3, 0, 1, 0x00, 0x00, 0x0, 0, 0, 0xFF }   # S0 RCA3.0
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[2]|{ 2, 0, 4, 0, 2, 0x27, 0x70, 0x1, 0, 2, 6 }      # S0 RCB0.0 - SSD6
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[3]|{ 3, 0, 4, 2, 3, 0x27, 0x70, 0x1, 0, 2, 7 }      # S0 RCB0.2 - SSD7
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[4]|{ 4, 0, 4, 4, 0, 0x25, 0x70, 0x1, 0, 2, 2 }      # S0 RCB0.4 - SSD2
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[5]|{ 5, 0, 4, 6, 1, 0x25, 0x70, 0x1, 0, 2, 3 }      # S0 RCB0.6 - SSD3
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[6]|{ 6, 0, 5, 0, 0, 0x24, 0x70, 0x1, 0, 3, 0 }      # S0 RCB1.0 - SSD0
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[7]|{ 7, 0, 5, 2, 1, 0x24, 0x70, 0x1, 0, 3, 1 }      # S0 RCB1.2 - SSD1
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[8]|{ 8, 0, 5, 4, 2, 0x26, 0x70, 0x1, 0, 3, 4 }      # S0 RCB1.4 - SSD4
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[9]|{ 9, 0, 5, 6, 3, 0x26, 0x70, 0x1, 0, 3, 5 }      # S0 RCB1.6 - SSD5
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[10]|{ 10, 0, 6, 0, 2, 0x00, 0x00, 0x0, 0, 4, 0xFF } # S0 RCB2.0
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[11]|{ 11, 0, 6, 2, 3, 0x00, 0x00, 0x0, 0, 4, 0xFF } # S0 RCB2.2
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[12]|{ 12, 0, 6, 4, 0, 0x00, 0x00, 0x0, 0, 4, 0xFF } # S0 RCB2.4
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[13]|{ 13, 0, 7, 0, 1, 0x00, 0x00, 0x0, 0, 5, 0xFF } # S0 RCB3.0
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[14]|{ 14, 0, 7, 4, 2, 0x00, 0x00, 0x0, 0, 5, 0xFF } # S0 RCB3.4
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[15]|{ 15, 0, 7, 6, 3, 0x00, 0x00, 0x0, 0, 5, 0xFF } # S0 RCB3.6
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[16]|{ 16, 1, 2, 0, 0, 0x26, 0x70, 0x2, 0, 6, 20 }   # S1 RCA2.0 - SSD20
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[17]|{ 17, 1, 2, 1, 1, 0x26, 0x70, 0x2, 0, 6, 21 }   # S1 RCA2.1 - SSD21
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[18]|{ 18, 1, 2, 2, 2, 0x27, 0x70, 0x2, 0, 6, 22 }   # S1 RCA2.2 - SSD22
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[19]|{ 19, 1, 2, 3, 3, 0x27, 0x70, 0x2, 0, 6, 23 }   # S1 RCA2.3 - SSD23
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[20]|{ 20, 1, 3, 0, 0, 0x00, 0x00, 0x0, 0, 7, 0xFF } # S1 RCA3.0
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[21]|{ 21, 1, 3, 2, 1, 0x00, 0x00, 0x0, 0, 7, 0xFF } # S1 RCA3.2
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[22]|{ 22, 1, 4, 0, 0, 0x00, 0x00, 0x0, 0, 8, 0xFF } # S1 RCB0.0
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[23]|{ 23, 1, 4, 4, 2, 0x25, 0x70, 0x2, 0, 8, 18 }   # S1 RCB0.4 - SSD18
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[24]|{ 24, 1, 4, 6, 3, 0x25, 0x70, 0x2, 0, 8, 19 }   # S1 RCB0.6 - SSD19
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[25]|{ 25, 1, 5, 0, 0, 0x24, 0x70, 0x2, 0, 9, 16 }   # S1 RCB1.0 - SSD16
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[26]|{ 26, 1, 5, 2, 1, 0x24, 0x70, 0x2, 0, 9, 17 }   # S1 RCB1.2 - SSD17
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[27]|{ 27, 1, 5, 4, 2, 0x00, 0x00, 0x0, 0, 9, 0xFF } # S1 RCB1.4
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[28]|{ 28, 1, 6, 0, 3, 0x25, 0x70, 0x4, 0, 10, 11 }  # S1 RCB2.0 - SSD11
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[29]|{ 29, 1, 6, 2, 2, 0x25, 0x70, 0x4, 0, 10, 10 }  # S1 RCB2.2 - SSD10
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[30]|{ 30, 1, 6, 4, 1, 0x27, 0x70, 0x4, 0, 10, 15 }  # S1 RCB2.4 - SSD15
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[31]|{ 31, 1, 6, 6, 0, 0x27, 0x70, 0x4, 0, 10, 14 }  # S1 RCB2.6 - SSD14
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[32]|{ 32, 1, 7, 0, 3, 0x26, 0x70, 0x4, 0, 11, 13 }  # S1 RCB3.0 - SSD13
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[33]|{ 33, 1, 7, 2, 2, 0x26, 0x70, 0x4, 0, 11, 12 }  # S1 RCB3.2 - SSD12
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[34]|{ 34, 1, 7, 4, 1, 0x24, 0x70, 0x4, 0, 11, 9 }   # S1 RCB3.4 - SSD9
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[35]|{ 35, 1, 7, 6, 0, 0x24, 0x70, 0x4, 0, 11, 8 }   # S1 RCB3.6 - SSD8
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable.PortMap[36]|{ 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF }       # Require if no fully structure used
+
 !ifdef $(FIRMWARE_VER)
   gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"$(FIRMWARE_VER)"
 !endif
diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.inf
new file mode 100644
index 000000000000..faeb74ecc0bf
--- /dev/null
+++ b/Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.inf
@@ -0,0 +1,37 @@
+## @file
+#
+# Copyright (c) 2023, Ampere Computing LLC. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x0001001B
+  BASE_NAME                      = PcieHotPlugLib
+  FILE_GUID                      = 6C0C1D32-CB51-4236-AC33-A7A6D4B638E2
+  MODULE_TYPE                    = BASE
+  VERSION_STRING                 = 1.0
+  LIBRARY_CLASS                  = PcieHotPlugLib
+
+[Sources]
+  PcieHotPlugLib.c
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  MdePkg/MdePkg.dec
+  Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec
+  Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec
+
+[LibraryClasses]
+  ArmSmcLib
+  BaseMemoryLib
+  DebugLib
+  PcdLib
+
+[Pcd]
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugGpioResetMap
+  gAmpereTokenSpaceGuid.PcdPcieHotPlugPortMapTable
+
+[Guids]
+  gPcieHotPlugGuid
diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/PcieHotPlugLib.h b/Silicon/Ampere/AmpereAltraPkg/Include/Library/PcieHotPlugLib.h
new file mode 100644
index 000000000000..e2f17d366a58
--- /dev/null
+++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/PcieHotPlugLib.h
@@ -0,0 +1,162 @@
+/** @file
+
+   Copyright (c) 2023, Ampere Computing LLC. All rights reserved.<BR>
+
+   SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ **/
+
+#ifndef PCIE_HOT_PLUG_H_
+#define PCIE_HOT_PLUG_H_
+
+#define PCIE_HOT_PLUG_SPCI_CMD_ALERT_IRQ       1  // Alert IRQ
+#define PCIE_HOT_PLUG_SPCI_CMD_START           2  // Stat monitor event
+#define PCIE_HOT_PLUG_SPCI_CMD_CHG             3  // Indicate PCIE port change state explicitly
+#define PCIE_HOT_PLUG_SPCI_CMD_LED             4  // Control LED state
+#define PCIE_HOT_PLUG_SPCI_CMD_PORT_MAP_CLR    5  // Clear all port map
+#define PCIE_HOT_PLUG_SPCI_CMD_PORT_MAP_SET    6  // Set port map
+#define PCIE_HOT_PLUG_SPCI_CMD_PORT_MAP_LOCK   7  // Lock port map
+#define PCIE_HOT_PLUG_SPCI_CMD_GPIO_MAP        8  // Set GPIO reset map
+
+#define LED_FAULT      1  // LED_CMD: LED type - Fault
+#define LED_ATT        2  // LED_CMD: LED type - Attention
+
+#define LED_SET_ON     1
+#define LED_SET_OFF    2
+#define LED_SET_BLINK  3
+
+// DEN0077A Arm Secure Partition Client Interface Specification 1.0 Beta_0_0
+
+// Client ID used for SPCI calls
+#define SPCI_CLIENT_ID  0x0000ACAC
+
+// SPCI error codes.
+#define SPCI_SUCCESS            0
+#define SPCI_NOT_SUPPORTED      -1
+#define SPCI_INVALID_PARAMETER  -2
+#define SPCI_NO_MEMORY          -3
+#define SPCI_BUSY               -4
+#define SPCI_QUEUED             -5
+#define SPCI_DENIED             -6
+#define SPCI_NOT_PRESENT        -7
+
+// Bit definitions inside the function id as per the SMC calling convention
+#define FUNCID_CC_SHIFT    30
+#define FUNCID_OEN_SHIFT   24
+
+#define SMC_64         1
+#define SMC_32         0
+
+// Definitions to build the complete SMC ID
+#define SPCI_FID_MISC_FLAG   (0 << 27)
+#define SPCI_FID_MISC_SHIFT  20
+#define SPCI_FID_TUN_FLAG    (1 << 27)
+#define SPCI_FID_TUN_SHIFT   24
+
+#define OEN_SPCI_START  0x30
+#define OEN_SPCI_END    0x3F
+
+#define SPCI_SMC(spci_fid)      ((OEN_SPCI_START << FUNCID_OEN_SHIFT) | \
+                                 (1U << 31) | (spci_fid))
+#define SPCI_MISC_32(misc_fid)  ((SMC_32 << FUNCID_CC_SHIFT) |  \
+                                 SPCI_FID_MISC_FLAG |           \
+                                 SPCI_SMC ((misc_fid) << SPCI_FID_MISC_SHIFT))
+#define SPCI_MISC_64(misc_fid)  ((SMC_64 << FUNCID_CC_SHIFT) |  \
+                                 SPCI_FID_MISC_FLAG |           \
+                                 SPCI_SMC ((misc_fid) << SPCI_FID_MISC_SHIFT))
+#define SPCI_TUN_64(tun_fid)    ((SMC_64 << FUNCID_CC_SHIFT) |  \
+                                 SPCI_FID_TUN_FLAG |            \
+                                 SPCI_SMC ((tun_fid) << SPCI_FID_TUN_SHIFT))
+
+// SPCI miscellaneous functions
+#define SPCI_FID_SERVICE_HANDLE_OPEN         0x2
+#define SPCI_FID_SERVICE_HANDLE_CLOSE        0x3
+#define SPCI_FID_SERVICE_REQUEST_BLOCKING    0x7
+#define SPCI_FID_SERVICE_REQUEST_START       0x8
+
+// SPCI tunneling functions
+#define SPCI_FID_SERVICE_TUN_REQUEST_BLOCKING  0x2
+
+// Complete SMC IDs and associated values
+#define SPCI_SERVICE_HANDLE_OPEN                   \
+                            SPCI_MISC_32 (SPCI_FID_SERVICE_HANDLE_OPEN)
+#define SPCI_SERVICE_HANDLE_CLOSE                  \
+                            SPCI_MISC_32 (SPCI_FID_SERVICE_HANDLE_CLOSE)
+#define SPCI_SERVICE_REQUEST_BLOCKING_AARCH64      \
+                            SPCI_MISC_64 (SPCI_FID_SERVICE_REQUEST_BLOCKING)
+#define SPCI_SERVICE_REQUEST_START_AARCH64         \
+                            SPCI_MISC_64 (SPCI_FID_SERVICE_REQUEST_START)
+#define SPCI_SERVICE_TUN_REQUEST_BLOCKING_AARCH64  \
+                            SPCI_TUN_64 (SPCI_FID_SERVICE_TUN_REQUEST_BLOCKING)
+
+#pragma pack(1)
+
+typedef struct {
+  UINT64    Token;
+  UINT32    HandleId;
+  UINT64    SpciCommand;
+  UINT64    SpciParam1;
+  UINT64    SpciParam2;
+  UINT64    SpciParam3;
+  UINT64    SpciParam4;
+  UINT64    SpciParam5;
+} AMPERE_SPCI_ARGS;
+
+#pragma pack()
+
+/**
+  Set GPIO pins used for PCIe reset. This command
+  limits the number of GPIO[16:21] for reset purpose.
+**/
+VOID
+PcieHotPlugSetGpioMap (
+  VOID
+  );
+
+/**
+  Lock current Portmap table.
+**/
+VOID
+PcieHotPlugSetLockPortMap (
+  VOID
+  );
+
+/**
+  Start Hot plug service.
+**/
+VOID
+PcieHotPlugSetStart (
+  VOID
+  );
+
+/**
+  Clear current configuration of Portmap table.
+**/
+VOID
+PcieHotPlugSetClear (
+  VOID
+  );
+
+/**
+  Set configuration for Portmap table.
+**/
+VOID
+PcieHotPlugSetPortMap (
+  VOID
+  );
+
+/**
+  This function will start Hotplug service after following steps:
+  - Open handle to make a SPCI call.
+  - Set GPIO pins for PCIe reset.
+  - Set configuration for Portmap table.
+  - Lock current Portmap table.
+  - Start Hot plug service.
+  - Close handle.
+**/
+VOID
+PcieHotPlugStart (
+  VOID
+  );
+
+#endif
diff --git a/Silicon/Ampere/AmpereSiliconPkg/Include/Library/PcieHotPlugPortMapLib.h b/Silicon/Ampere/AmpereSiliconPkg/Include/Library/PcieHotPlugPortMapLib.h
new file mode 100644
index 000000000000..4889f0891c47
--- /dev/null
+++ b/Silicon/Ampere/AmpereSiliconPkg/Include/Library/PcieHotPlugPortMapLib.h
@@ -0,0 +1,81 @@
+/** @file
+
+  Copyright (c) 2023, Ampere Computing LLC. All rights reserved.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef PCIE_HOT_PLUG_PORT_MAP_H_
+#define PCIE_HOT_PLUG_PORT_MAP_H_
+
+// "PCIe Bifurcation Mapping" spec just reserve 24x48 bytes (48 ports)
+#define MAX_NUMBER_PROCESSORS  2
+#define NUMBER_OF_PCIE_PORTS   48
+#define MAX_PORT_MAP_ENTRY     (NUMBER_OF_PCIE_PORTS * MAX_NUMBER_PROCESSORS)
+
+//
+// - Macro to create value for PCIe Hot Plug configuration from PcieHotPlugPortMapEntry structure.
+// - Value structure:
+//     Bit [0:7]:    Vport
+//     Bit [8:11]:   Socket
+//     Bit [12:15]:  RcaPort
+//     Bit [16:19]:  RcaSubPort
+//     Bit [20:23]:  PinPort
+//     Bit [24:31]:  I2cAddress
+//     Bit [32:39]:  MuxAddress
+//     Bit [40:43]:  MuxChannel
+//     Bit [44:51]:  GpioResetNumber
+//     Bit [52:55]:  Segment
+//     Bit [56: 63]: DriveIndexGpioResetNumber
+//
+#define PCIE_HOT_PLUG_DECODE_VPORT(Value)              ((((UINTN)(Value).Vport)           & 0xFF) << 0)
+#define PCIE_HOT_PLUG_DECODE_SOCKET(Value)             ((((UINTN)(Value).Socket)          & 0x0F) << 8)
+#define PCIE_HOT_PLUG_DECODE_RCA_PORT(Value)           ((((UINTN)(Value).RcaPort)         & 0x0F) << 12)
+#define PCIE_HOT_PLUG_DECODE_RCA_SUB_PORT(Value)       ((((UINTN)(Value).RcaSubPort)      & 0x0F) << 16)
+#define PCIE_HOT_PLUG_DECODE_PIN_PORT(Value)           ((((UINTN)(Value).PinPort)         & 0x0F) << 20)
+#define PCIE_HOT_PLUG_DECODE_I2C_ADDRESS(Value)        ((((UINTN)(Value).I2cAddress)      & 0xFF) << 24)
+#define PCIE_HOT_PLUG_DECODE_MUX_ADDRESS(Value)        ((((UINTN)(Value).MuxAddress)      & 0xFF) << 32)
+#define PCIE_HOT_PLUG_DECODE_MUX_CHANNEL(Value)        ((((UINTN)(Value).MuxChannel)      & 0x0F) << 40)
+#define PCIE_HOT_PLUG_DECODE_GPIO_RESET_NUMBER(Value)  ((((UINTN)(Value).GpioResetNumber) & 0xFF) << 44)
+#define PCIE_HOT_PLUG_DECODE_SEGMENT(Value)            ((((UINTN)(Value).Segment)         & 0x0F) << 52)
+#define PCIE_HOT_PLUG_DECODE_DRIVE_INDEX(Value)        ((((UINTN)(Value).DriveIndex)      & 0xFF) << 56)
+
+#define PCIE_HOT_PLUG_GET_CONFIG_VALUE(Value)  (  \
+  PCIE_HOT_PLUG_DECODE_VPORT(Value)             | \
+  PCIE_HOT_PLUG_DECODE_SOCKET(Value)            | \
+  PCIE_HOT_PLUG_DECODE_RCA_PORT(Value)          | \
+  PCIE_HOT_PLUG_DECODE_RCA_SUB_PORT(Value)      | \
+  PCIE_HOT_PLUG_DECODE_PIN_PORT(Value)          | \
+  PCIE_HOT_PLUG_DECODE_I2C_ADDRESS(Value)       | \
+  PCIE_HOT_PLUG_DECODE_MUX_ADDRESS(Value)       | \
+  PCIE_HOT_PLUG_DECODE_MUX_CHANNEL(Value)       | \
+  PCIE_HOT_PLUG_DECODE_GPIO_RESET_NUMBER(Value) | \
+  PCIE_HOT_PLUG_DECODE_SEGMENT(Value)           | \
+  PCIE_HOT_PLUG_DECODE_DRIVE_INDEX(Value)         \
+)
+
+#pragma pack(1)
+
+typedef struct {
+  UINT8    Vport;
+  UINT8    Socket;
+  UINT8    RcaPort;
+  UINT8    RcaSubPort;
+  UINT8    PinPort;
+  UINT8    I2cAddress;
+  UINT8    MuxAddress;
+  UINT8    MuxChannel;
+  UINT8    GpioResetNumber;
+  UINT8    Segment;
+  UINT8    DriveIndex;
+} PCIE_HOT_PLUG_PORT_MAP_ENTRY;
+
+typedef struct {
+  BOOLEAN    UseDefaultConfig;
+  UINT8      PortMap[MAX_PORT_MAP_ENTRY][sizeof (PCIE_HOT_PLUG_PORT_MAP_ENTRY)];
+} PCIE_HOT_PLUG_PORT_MAP_TABLE;
+
+#pragma pack()
+
+#endif
diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.c
new file mode 100644
index 000000000000..10de5d17d2b9
--- /dev/null
+++ b/Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.c
@@ -0,0 +1,397 @@
+/** @file
+
+   Copyright (c) 2023, Ampere Computing LLC. All rights reserved.<BR>
+
+   SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ **/
+
+#include <Uefi.h>
+
+#include <Library/ArmSmcLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/PcdLib.h>
+#include <Library/PcieHotPlugLib.h>
+#include <Library/PcieHotPlugPortMapLib.h>
+
+#define END_PORT_MAP_ENTRY  0xFF
+
+// SPM takes up to 4 arguments as value for SPCI call (Args.SpciParam1->Args.SpciParam4).
+#define MAX_MSG_CMD_ARGS  4
+
+UINT32    HandleId;
+
+STATIC
+EFI_STATUS
+SpciStatusMap (
+  UINTN  SpciStatus
+  )
+{
+  switch (SpciStatus) {
+    case SPCI_SUCCESS:
+      return EFI_SUCCESS;
+
+    case SPCI_NOT_SUPPORTED:
+      return EFI_UNSUPPORTED;
+
+    case SPCI_INVALID_PARAMETER:
+      return EFI_INVALID_PARAMETER;
+
+    case SPCI_NO_MEMORY:
+      return EFI_OUT_OF_RESOURCES;
+
+    case SPCI_BUSY:
+    case SPCI_QUEUED:
+      return EFI_NOT_READY;
+
+    case SPCI_DENIED:
+      return EFI_ACCESS_DENIED;
+
+    case SPCI_NOT_PRESENT:
+      return EFI_NOT_FOUND;
+
+    default:
+      return EFI_DEVICE_ERROR;
+  }
+}
+
+EFI_STATUS
+EFIAPI
+SpciServiceHandleOpen (
+  UINT16    ClientId,
+  UINT32    *HandleId,
+  EFI_GUID  Guid
+  )
+{
+  ARM_SMC_ARGS  SmcArgs;
+  EFI_STATUS    Status;
+  UINT32        X1;
+  UINT64        Uuid1, Uuid2, Uuid3, Uuid4;
+
+  if (HandleId == NULL) {
+    DEBUG ((DEBUG_ERROR, "%a HandleId is NULL \n", __func__));
+    return EFI_INVALID_PARAMETER;
+  }
+
+  Uuid1 = Guid.Data1;
+  Uuid2 = Guid.Data3 << 16 | Guid.Data2;
+  Uuid3 = Guid.Data4[3] << 24 | Guid.Data4[2] << 16 | Guid.Data4[1] << 8 | Guid.Data4[0];
+  Uuid4 = Guid.Data4[7] << 24 | Guid.Data4[6] << 16 | Guid.Data4[5] << 8 | Guid.Data4[4];
+
+  SmcArgs.Arg0 = SPCI_SERVICE_HANDLE_OPEN;
+  SmcArgs.Arg1 = Uuid1;
+  SmcArgs.Arg2 = Uuid2;
+  SmcArgs.Arg3 = Uuid3;
+  SmcArgs.Arg4 = Uuid4;
+  SmcArgs.Arg5 = 0;
+  SmcArgs.Arg6 = 0;
+  SmcArgs.Arg7 = ClientId;
+  ArmCallSmc (&SmcArgs);
+
+  Status = SpciStatusMap (SmcArgs.Arg0);
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  X1 = SmcArgs.Arg1;
+
+  if ((X1 & 0x0000FFFF) != 0) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "%a: SpciServiceHandleOpen returned X1 = 0x%08x\n",
+      __func__,
+      X1
+      ));
+    return EFI_DEVICE_ERROR;
+  }
+
+  // Combine of returned handle and clientid
+  *HandleId = (UINT32)X1 | ClientId;
+
+  return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+SpciServiceHandleClose (
+  UINT32  HandleId
+  )
+{
+  ARM_SMC_ARGS  SmcArgs;
+  EFI_STATUS    Status;
+
+  SmcArgs.Arg0 = SPCI_SERVICE_HANDLE_CLOSE;
+  SmcArgs.Arg1 = HandleId;
+  ArmCallSmc (&SmcArgs);
+
+  Status = SpciStatusMap (SmcArgs.Arg0);
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+SpciServiceRequestStart (
+  AMPERE_SPCI_ARGS  *Args
+  )
+{
+  ARM_SMC_ARGS  SmcArgs;
+  EFI_STATUS    Status;
+
+  if (Args == NULL) {
+    DEBUG ((DEBUG_ERROR, "%a: Invalid parameter\n", __func__));
+    return EFI_INVALID_PARAMETER;
+  }
+
+  SmcArgs.Arg0 = SPCI_SERVICE_REQUEST_START_AARCH64;
+  SmcArgs.Arg1 = Args->SpciCommand;
+  SmcArgs.Arg2 = Args->SpciParam1;
+  SmcArgs.Arg3 = Args->SpciParam2;
+  SmcArgs.Arg4 = Args->SpciParam3;
+  SmcArgs.Arg5 = Args->SpciParam4;
+  SmcArgs.Arg6 = Args->SpciParam5;
+  SmcArgs.Arg7 = (UINT64)Args->HandleId;
+  ArmCallSmc (&SmcArgs);
+
+  Status = SpciStatusMap (SmcArgs.Arg0);
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  // Return Token
+  Args->Token = SmcArgs.Arg1;
+
+  return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+SpciServiceRequestBlocking (
+  AMPERE_SPCI_ARGS  *Args
+  )
+{
+  ARM_SMC_ARGS  SmcArgs;
+  EFI_STATUS    Status;
+
+  if (Args == NULL) {
+    DEBUG ((DEBUG_ERROR, "%a: Invalid parameter\n", __func__));
+    return EFI_INVALID_PARAMETER;
+  }
+
+  SmcArgs.Arg0 = SPCI_SERVICE_REQUEST_BLOCKING_AARCH64;
+  SmcArgs.Arg1 = Args->SpciCommand;
+  SmcArgs.Arg2 = Args->SpciParam1;
+  SmcArgs.Arg3 = Args->SpciParam2;
+  SmcArgs.Arg4 = Args->SpciParam3;
+  SmcArgs.Arg5 = Args->SpciParam4;
+  SmcArgs.Arg6 = Args->SpciParam5;
+  SmcArgs.Arg7 = (UINT64)Args->HandleId;
+  ArmCallSmc (&SmcArgs);
+
+  Status = SpciStatusMap (SmcArgs.Arg0);
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  Args->SpciCommand = SmcArgs.Arg1;
+  Args->SpciParam1  = SmcArgs.Arg2;
+  Args->SpciParam2  = SmcArgs.Arg3;
+
+  return EFI_SUCCESS;
+}
+
+/**
+  Set GPIO pins used for PCIe reset. This command
+  limits the number of GPIO[16:21] for reset purpose.
+**/
+VOID
+PcieHotPlugSetGpioMap (
+  VOID
+  )
+{
+  AMPERE_SPCI_ARGS  Args;
+  EFI_STATUS        Status;
+
+  Args.HandleId    = HandleId;
+  Args.SpciCommand = PCIE_HOT_PLUG_SPCI_CMD_GPIO_MAP;
+  Args.SpciParam1  = (UINTN)PcdGet8 (PcdPcieHotPlugGpioResetMap);
+
+  Status = SpciServiceRequestBlocking (&Args);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "SPM HotPlug GPIO reset map failed. Returned: %r\n", Status));
+  }
+}
+
+/**
+  Lock current Portmap table.
+**/
+VOID
+PcieHotPlugSetLockPortMap (
+  VOID
+  )
+{
+  AMPERE_SPCI_ARGS  Args;
+  EFI_STATUS        Status;
+
+  Args.HandleId    = HandleId;
+  Args.SpciCommand = PCIE_HOT_PLUG_SPCI_CMD_PORT_MAP_LOCK;
+
+  Status = SpciServiceRequestBlocking (&Args);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "SPM HotPlug port map lock failed. Returned: %r\n", Status));
+  }
+}
+
+/**
+  Start Hot plug service.
+**/
+VOID
+PcieHotPlugSetStart (
+  VOID
+  )
+{
+  AMPERE_SPCI_ARGS  Args;
+  EFI_STATUS        Status;
+
+  Args.HandleId    = HandleId;
+  Args.SpciCommand = PCIE_HOT_PLUG_SPCI_CMD_START;
+
+  Status = SpciServiceRequestBlocking (&Args);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "SPM HotPlug start failed. Returned: %r\n", Status));
+  }
+}
+
+/**
+  Clear current configuration of Portmap table.
+**/
+VOID
+PcieHotPlugSetClear (
+  VOID
+  )
+{
+  AMPERE_SPCI_ARGS  Args;
+  EFI_STATUS        Status;
+
+  Args.HandleId    = HandleId;
+  Args.SpciCommand = PCIE_HOT_PLUG_SPCI_CMD_PORT_MAP_CLR;
+
+  Status = SpciServiceRequestBlocking (&Args);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "SPM HotPlug clear port map failed. Returned: %r\n", Status));
+  }
+}
+
+/**
+  Set configuration for Portmap table.
+**/
+VOID
+PcieHotPlugSetPortMap (
+  VOID
+  )
+{
+  AMPERE_SPCI_ARGS  Args;
+  EFI_STATUS        Status;
+
+  PCIE_HOT_PLUG_PORT_MAP_TABLE  *PortMapTable;
+  PCIE_HOT_PLUG_PORT_MAP_ENTRY  PortMapEntry;
+  UINT8                         Index;
+  UINT8                         PortMapEntryIndex;
+  BOOLEAN                       IsEndPortMapEntry;
+  UINTN                         ConfigValue;
+  UINTN                         *ConfigLegacy;
+
+  // Retrieves PCD of Portmap table.
+  PortMapTable = (PCIE_HOT_PLUG_PORT_MAP_TABLE *)PcdGetPtr (PcdPcieHotPlugPortMapTable);
+
+  //
+  // Check whether specific platform configuration is used?
+  // Otherwise, keep default configuration (Mt. Jade 2U).
+  //
+  if (!PortMapTable->UseDefaultConfig) {
+    IsEndPortMapEntry = FALSE;
+    PortMapEntryIndex = 0;
+
+    // Clear old Port Map table first.
+    PcieHotPlugSetClear ();
+
+    while (!IsEndPortMapEntry) {
+      ZeroMem (&Args, sizeof (Args));
+      Args.HandleId    = HandleId;
+      Args.SpciCommand = PCIE_HOT_PLUG_SPCI_CMD_PORT_MAP_SET;
+
+      // Pointer will get configuration value for Args.SpciParam1->Args.SpciParam5
+      ConfigLegacy = &Args.SpciParam1;
+
+      for (Index = 0; Index < MAX_MSG_CMD_ARGS; Index++) {
+        PortMapEntry  = *((PCIE_HOT_PLUG_PORT_MAP_ENTRY *)PortMapTable->PortMap[PortMapEntryIndex]);
+        ConfigValue   = PCIE_HOT_PLUG_GET_CONFIG_VALUE (PortMapEntry);
+        *ConfigLegacy = ConfigValue;
+
+        if (PortMapTable->PortMap[PortMapEntryIndex][0] == END_PORT_MAP_ENTRY) {
+          IsEndPortMapEntry = TRUE;
+          break;
+        }
+
+        PortMapEntryIndex++;
+        ConfigLegacy++;
+      }
+
+      Status = SpciServiceRequestBlocking (&Args);
+      if (EFI_ERROR (Status)) {
+        DEBUG ((DEBUG_ERROR, "SPM HotPlug set port map failed. Returned: %r\n", Status));
+      }
+    }
+  }
+}
+
+/**
+  This function will start Hotplug service after following steps:
+  - Open handle to make a SPCI call.
+  - Set GPIO pins for PCIe reset.
+  - Set configuration for Portmap table.
+  - Lock current Portmap table.
+  - Start Hot plug service.
+  - Close handle.
+**/
+VOID
+PcieHotPlugStart (
+  VOID
+  )
+{
+  EFI_STATUS  Status;
+
+  // Open handle
+  Status = SpciServiceHandleOpen (SPCI_CLIENT_ID, &HandleId, gPcieHotPlugGuid);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "SPM failed to return invalid handle. Returned: %r\n",
+      Status
+      ));
+
+    return;
+  }
+
+  // Set GPIO pins for PCIe reset
+  PcieHotPlugSetGpioMap ();
+
+  // Set Portmap table
+  PcieHotPlugSetPortMap ();
+
+  // Lock current Portmap table
+  PcieHotPlugSetLockPortMap ();
+
+  // Start Hot plug service
+  PcieHotPlugSetStart ();
+
+  // Close handle
+  Status = SpciServiceHandleClose (HandleId);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "SPM HotPlug close handle failed. Returned: %r\n", Status));
+  }
+}
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [edk2-platforms][PATCH 2/6] AmpereAltraPkg: Add Hot Plug Slot Capable during PCIe port initialization
  2023-05-11  8:10 [edk2-platforms][PATCH 0/6] Support NVMe Hot Plug feature for Ampere Altra and Ampere Altra Max Minh Nguyen
  2023-05-11  8:10 ` [edk2-platforms][PATCH 1/6] AmpereAltraPkg: Add PCIe Hot Plug library Minh Nguyen
@ 2023-05-11  8:10 ` Minh Nguyen
  2023-05-11  8:10 ` [edk2-platforms][PATCH 3/6] AmpereAltraPkg: Change PCIe Amba Link Timeout value Minh Nguyen
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Minh Nguyen @ 2023-05-11  8:10 UTC (permalink / raw)
  To: devel; +Cc: patches, quic_llindhol, ardb+tianocore, nhi, tinhnguyen,
	Minh Nguyen

In order to detect the NVMe after OS boots successfully but
that NVMe's not present previously. Hot Plug Slot Capable
will help PCI Linux driver to initialize its slot iomem resource
which is used for detecting the disk when it's inserted.

Signed-off-by: Minh Nguyen <minhnguyen1@os.amperecomputing.com>
---
 Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c
index f7c8defc1906..c5a299cca6c5 100644
--- a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c
+++ b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c
@@ -1093,6 +1093,11 @@ Ac01PcieCoreSetupRC (
     // Program the power limit
     TargetAddress = CfgBase + PCIE_CAPABILITY_BASE + SLOT_CAPABILITIES_REG;
     Val = MmioRead32 (TargetAddress);
+    // In order to detect the NVMe after OS boots successfully but
+    // that NVMe's not present previously. Hot Plug Slot Capable
+    // will help PCI Linux driver to initialize its slot iomem resource
+    // which is used for detecting the disk when it's inserted.
+    Val = SLOT_HPC_SET(Val, 1);
     Val = SLOT_CAP_SLOT_POWER_LIMIT_VALUE_SET (Val, SLOT_POWER_LIMIT_75W);
     MmioWrite32 (TargetAddress, Val);
 
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [edk2-platforms][PATCH 3/6] AmpereAltraPkg: Change PCIe Amba Link Timeout value
  2023-05-11  8:10 [edk2-platforms][PATCH 0/6] Support NVMe Hot Plug feature for Ampere Altra and Ampere Altra Max Minh Nguyen
  2023-05-11  8:10 ` [edk2-platforms][PATCH 1/6] AmpereAltraPkg: Add PCIe Hot Plug library Minh Nguyen
  2023-05-11  8:10 ` [edk2-platforms][PATCH 2/6] AmpereAltraPkg: Add Hot Plug Slot Capable during PCIe port initialization Minh Nguyen
@ 2023-05-11  8:10 ` Minh Nguyen
  2023-05-11  8:10 ` [edk2-platforms][PATCH 4/6] JadePkg: Support ACPI tables for Hot Plug of Ampere Altra Minh Nguyen
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Minh Nguyen @ 2023-05-11  8:10 UTC (permalink / raw)
  To: devel; +Cc: patches, quic_llindhol, ardb+tianocore, nhi, tinhnguyen,
	Minh Nguyen

As AMBA_LINK_TIMEOUT_OFF spec, it impacts OS Hot Plug removal delay.
The greater value the longer delay it is. Per experiments, set it 2
from beginning of Root Port initialization for stable operation.

Signed-off-by: Minh Nguyen <minhnguyen1@os.amperecomputing.com>
---
 Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c
index c5a299cca6c5..d71f56d5fcf1 100644
--- a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c
+++ b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c
@@ -1159,8 +1159,12 @@ Ac01PcieCoreSetupRC (
       }
     }
 
-    // Link timeout after 1ms
-    SetLinkTimeout (RootComplex, PcieIndex, 1);
+    //
+    // As AMBA_LINK_TIMEOUT_OFF spec, it impacts OS HP removal delay.
+    // The greater value the longer delay it is. Per discussion,
+    // set it 2 from beginning of RP initialization.
+    //
+    SetLinkTimeout (RootComplex, PcieIndex, 2);
 
     DisableCompletionTimeOut (RootComplex, PcieIndex, TRUE);
 
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [edk2-platforms][PATCH 4/6] JadePkg: Support ACPI tables for Hot Plug of Ampere Altra
  2023-05-11  8:10 [edk2-platforms][PATCH 0/6] Support NVMe Hot Plug feature for Ampere Altra and Ampere Altra Max Minh Nguyen
                   ` (2 preceding siblings ...)
  2023-05-11  8:10 ` [edk2-platforms][PATCH 3/6] AmpereAltraPkg: Change PCIe Amba Link Timeout value Minh Nguyen
@ 2023-05-11  8:10 ` Minh Nguyen
  2023-05-11  8:10 ` [edk2-platforms][PATCH 5/6] JadePkg: Support ACPI tables for Hot Plug of Ampere Altra Max Minh Nguyen
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Minh Nguyen @ 2023-05-11  8:10 UTC (permalink / raw)
  To: devel
  Cc: patches, quic_llindhol, ardb+tianocore, nhi, tinhnguyen,
	Vu Nguyen, Minh Nguyen

From: Vu Nguyen <vunguyen@os.amperecomputing.com>

This adds necessary changes of ACPI tables and defines the memory
region between OS and Trusted Firmware-A for supporting Hot Plug
of Ampere Altra.

Signed-off-by: Minh Nguyen <minhnguyen1@os.amperecomputing.com>
---
 Platform/Ampere/JadePkg/AcpiTables/Dsdt.asl   |  499 ++++++++-
 Platform/Ampere/JadePkg/AcpiTables/MHPP.asi   |  127 +++
 Platform/Ampere/JadePkg/AcpiTables/PCI-S0.asi |  548 +++++++++-
 Platform/Ampere/JadePkg/AcpiTables/PCI-S1.asi | 1074 +++++++++++++++++++-
 4 files changed, 2245 insertions(+), 3 deletions(-)

diff --git a/Platform/Ampere/JadePkg/AcpiTables/Dsdt.asl b/Platform/Ampere/JadePkg/AcpiTables/Dsdt.asl
index d7d2df8c3dce..9ee215a26a09 100644
--- a/Platform/Ampere/JadePkg/AcpiTables/Dsdt.asl
+++ b/Platform/Ampere/JadePkg/AcpiTables/Dsdt.asl
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR>
+  Copyright (c) 2020 - 2023, Ampere Computing LLC. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -11,6 +11,9 @@ DefinitionBlock("Dsdt.aml", "DSDT", 0x02, "Ampere", "Jade", 1) {
   // Board Model
   Name(\BDMD, "Jade Board")
   Name(AERF, 0)  // PCIe AER Firmware-First
+
+  Include ("MHPP.asi")
+
   Scope(\_SB) {
 
     //
@@ -181,12 +184,506 @@ DefinitionBlock("Dsdt.aml", "DSDT", 0x02, "Ampere", "Jade", 1) {
         }
         Name(_CRS, ResourceTemplate () {
           Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 84 } // GHES
+          Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 44 } // PCIe Hot Plug Doorbell Insertion & Ejection (DBNS4 -> GIC-IRQS44)
         })
+
+        // @DBN4 agent base address for HP PCIe insertion/ejection event: 0x1000.0054.4000
+        OperationRegion(DBN4, SystemMemory, 0x100000544010, 20)
+        Field (DBN4, DWordAcc, NoLock, Preserve) {
+          DOUT, 32, // event and PCIe port information at offset 0x10
+          offset (0x10),
+          STA4, 32, // interrupt status at offset 0x20
+        }
+
         Method(_EVT, 1, Serialized) {
           Switch (ToInteger(Arg0)) {
             Case (84) { // GHES interrupt
               Notify (HED0, 0x80)
             }
+
+            Case (44) { // doorbell notification (Insertion/ejection)
+              local0 = DOUT & 0x00FF0000
+              if (local0 == 0x00010000) {
+                local0 = STA4 & 0xFFFFFFFF
+                if (local0) {
+                  Store(local0, STA4) // clear interrupt
+                }
+                local0 = A120 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P1, 1) // insertion action
+                }
+                local0 = A121 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P2, 1) // insertion action
+                }
+                local0 = A122 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P3, 1) // insertion action
+                }
+                local0 = A123 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P4, 1) // insertion action
+                }
+                local0 = B000 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P1, 1) // insertion action
+                }
+                local0 = B002 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P3, 1) // insertion action
+                }
+                local0 = B004 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P5, 1) // insertion action
+                }
+                local0 = B006 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P7, 1) // insertion action
+                }
+                local0 = B010 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P1, 1) // insertion action
+                }
+                local0 = B012 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P3, 1) // insertion action
+                }
+                local0 = B014 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P5, 1) // insertion action
+                }
+                local0 = B016 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P7, 1) // insertion action
+                }
+                local0 = B104 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIC.P2P5, 1) // insertion action
+                }
+                local0 = B106 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIC.P2P7, 1) // insertion action
+                }
+                local0 = B110 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCID.P2P1, 1) // insertion action
+                }
+                local0 = B112 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCID.P2P3, 1) // insertion action
+                }
+                local0 = B120 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P1, 1) // insertion action
+                }
+                local0 = B122 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P3, 1) // insertion action
+                }
+                local0 = B124 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P5, 1) // insertion action
+                }
+                local0 = B126 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P7, 1) // insertion action
+                }
+                local0 = B130 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P1, 1) // insertion action
+                }
+                local0 = B132 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P3, 1) // insertion action
+                }
+                local0 = B134 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P5, 1) // insertion action
+                }
+                local0 = B136 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P7, 1) // insertion action
+                }
+              }
+              elseif (local0 == 0x00000000) {
+                local0 = STA4 & 0xFFFFFFFF
+                if (local0) {
+                  Store(local0, STA4) // clear interrupt
+                }
+                local0 = A120 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIA.P2P1, 1) // ejection action
+                  A120 = 0x10000201 // inprogress remove
+                }
+                local0 = A121 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIA.P2P2, 1) // ejection action
+                  A121 = 0x10010201 // inprogress remove
+                }
+                local0 = A122 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIA.P2P3, 1) // ejection action
+                  A122 = 0x10020201 // inprogress remove
+                }
+                local0 = A123 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIA.P2P4, 1) // ejection action
+                  A123 = 0x10030201 // inprogress remove
+                }
+                local0 = B000 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCI4.P2P1, 1) // ejection action
+                  B000 = 0x10000400 // inprogress remove
+                }
+                local0 = B002 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCI4.P2P3, 1) // ejection action
+                  B002 = 0x10020400 // inprogress remove
+                }
+                local0 = B004 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCI4.P2P5, 1) // ejection action
+                  B004 = 0x10040400 // inprogress remove
+                }
+                local0 = B006 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCI4.P2P7, 1) // ejection action
+                  B006 = 0x10060400 // inprogress remove
+                }
+                local0 = B010 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCI5.P2P1, 1) // ejection action
+                  B010 = 0x10000500 // inprogress remove
+                }
+                local0 = B012 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCI5.P2P3, 1) // ejection action
+                  B012 = 0x10020500 // inprogress remove
+                }
+                local0 = B014 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCI5.P2P5, 1) // ejection action
+                  B014 = 0x10040500 // inprogress remove
+                }
+                local0 = B016 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCI5.P2P7, 1) // ejection action
+                  B016 = 0x10060500 // inprogress remove
+                }
+                local0 = B104 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIC.P2P5, 1) // ejection action
+                  B104 = 0x10040401 // inprogress remove
+                }
+                local0 = B106 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIC.P2P7, 1) // ejection action
+                  B106 = 0x10060401 // inprogress remove
+                }
+                local0 = B110 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCID.P2P1, 1) // ejection action
+                  B110 = 0x10000501 // inprogress remove
+                }
+                local0 = B112 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCID.P2P3, 1) // ejection action
+                  B112 = 0x10020501 // inprogress remove
+                }
+                local0 = B120 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIE.P2P1, 1) // ejection action
+                  B120 = 0x10000601 // inprogress remove
+                }
+                local0 = B122 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIE.P2P3, 1) // ejection action
+                  B122 = 0x10020601 // inprogress remove
+                }
+                local0 = B124 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIE.P2P5, 1) // ejection action
+                  B124 = 0x10040601 // inprogress remove
+                }
+                local0 = B126 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIE.P2P7, 1) // ejection action
+                  B126 = 0x10060601 // inprogress remove
+                }
+                local0 = B130 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIF.P2P1, 1) // ejection action
+                  B130 = 0x10000701 // inprogress remove
+                }
+                local0 = B132 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIF.P2P3, 1) // ejection action
+                  B132 = 0x10020701 // inprogress remove
+                }
+                local0 = B134 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIF.P2P5, 1) // ejection action
+                  B134 = 0x10040701 // inprogress remove
+                }
+                local0 = B136 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIF.P2P7, 1) // ejection action
+                  B136 = 0x10060701 // inprogress remove
+                }
+              }
+              elseif (local0 == 0x00020000) { // is either unstable link or too fast insertion?
+                local0 = STA4 & 0xFFFFFFFF
+                if (local0) {
+                    Store(local0, STA4) // clear interrupt
+                }
+                local0 = A120 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P1, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIA.P2P1, 1) // insertion action
+                }
+                local0 = A121 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P2, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIA.P2P2, 1) // insertion action
+                }
+                local0 = A122 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P3, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIA.P2P3, 1) // insertion action
+                }
+                local0 = A123 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P4, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIA.P2P4, 1) // insertion action
+                }
+                local0 = B000 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P1, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCI4.P2P1, 1) // insertion action
+                }
+                local0 = B002 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P3, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCI4.P2P3, 1) // insertion action
+                }
+                local0 = B004 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P5, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCI4.P2P5, 1) // insertion action
+                }
+                local0 = B006 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P7, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCI4.P2P7, 1) // insertion action
+                }
+                local0 = B010 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P1, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCI5.P2P1, 1) // insertion action
+                }
+                local0 = B012 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P3, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCI5.P2P3, 1) // insertion action
+                }
+                local0 = B014 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P5, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCI5.P2P5, 1) // insertion action
+                }
+                local0 = B016 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P7, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCI5.P2P7, 1) // insertion action
+                }
+                local0 = B104 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIC.P2P5, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIC.P2P5, 1) // insertion action
+                }
+                local0 = B106 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIC.P2P7, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIC.P2P7, 1) // insertion action
+                }
+                local0 = B110 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCID.P2P1, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCID.P2P1, 1) // insertion action
+                }
+                local0 = B112 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCID.P2P3, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCID.P2P3, 1) // insertion action
+                }
+                local0 = B120 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P1, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIE.P2P1, 1) // insertion action
+                }
+                local0 = B122 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P3, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIE.P2P3, 1) // insertion action
+                }
+                local0 = B124 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P5, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIE.P2P5, 1) // insertion action
+                }
+                local0 = B126 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P7, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIE.P2P7, 1) // insertion action
+                }
+                local0 = B130 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P1, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIF.P2P1, 1) // insertion action
+                }
+                local0 = B132 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P3, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIF.P2P3, 1) // insertion action
+                }
+                local0 = B134 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P5, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIF.P2P5, 1) // insertion action
+                }
+                local0 = B136 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P7, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIF.P2P7, 1) // insertion action
+                }
+              }
+              elseif (local0 == 0x00030000) { // got incomplete remove before?
+                local0 = STA4 & 0xFFFFFFFF
+                if (local0) {
+                    Store(local0, STA4) // clear interrupt
+                }
+                local0 = A120 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P1.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIA.P2P1, 1) // insertion action
+                }
+                local0 = A121 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P2.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIA.P2P2, 1) // insertion action
+                }
+                local0 = A122 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P3.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIA.P2P3, 1) // insertion action
+                }
+                local0 = A123 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P4.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIA.P2P4, 1) // insertion action
+                }
+                local0 = B000 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P1.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCI4.P2P1, 1) // insertion action
+                }
+                local0 = B002 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P3.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCI4.P2P3, 1) // insertion action
+                }
+                local0 = B004 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P5.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCI4.P2P5, 1) // insertion action
+                }
+                local0 = B006 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P7.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCI4.P2P7, 1) // insertion action
+                }
+                local0 = B010 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P1.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCI5.P2P1, 1) // insertion action
+                }
+                local0 = B012 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P3.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCI5.P2P3, 1) // insertion action
+                }
+                local0 = B014 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P5.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCI5.P2P5, 1) // insertion action
+                }
+                local0 = B016 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P7.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCI5.P2P7, 1) // insertion action
+                }
+                local0 = B104 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIC.P2P5.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIC.P2P5, 1) // insertion action
+                }
+                local0 = B106 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIC.P2P7.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIC.P2P7, 1) // insertion action
+                }
+                local0 = B110 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCID.P2P1.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCID.P2P1, 1) // insertion action
+                }
+                local0 = B112 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCID.P2P3.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCID.P2P3, 1) // insertion action
+                }
+                local0 = B120 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P1.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIE.P2P1, 1) // insertion action
+                }
+                local0 = B122 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P3.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIE.P2P3, 1) // insertion action
+                }
+                local0 = B124 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P5.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIE.P2P5, 1) // insertion action
+                }
+                local0 = B126 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P7.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIE.P2P7, 1) // insertion action
+                }
+                local0 = B130 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P1.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIF.P2P1, 1) // insertion action
+                }
+                local0 = B132 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P3.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIF.P2P3, 1) // insertion action
+                }
+                local0 = B134 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P5.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIF.P2P5, 1) // insertion action
+                }
+                local0 = B136 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P7.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIF.P2P7, 1) // insertion action
+                }
+              }
+            }
           }
         }
     }
diff --git a/Platform/Ampere/JadePkg/AcpiTables/MHPP.asi b/Platform/Ampere/JadePkg/AcpiTables/MHPP.asi
new file mode 100644
index 000000000000..27987b7c7489
--- /dev/null
+++ b/Platform/Ampere/JadePkg/AcpiTables/MHPP.asi
@@ -0,0 +1,127 @@
+/** @file
+
+  Copyright (c) 2023, Ampere Computing LLC. All rights reserved.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+// @DRAM base address 0x88970000
+// Regarding updating the status of hotplug PCIe ports, a shared DRAM
+// memory region between Arm Trusted Firmware and UEFI is used to indicate
+// PCIe hotplug event action. An item of MHPP table is used to reflect hotplug
+// event of each PCIe port. There is a maximum of 48 PCIe hotplug ports in Altra
+// Family processor, the definition in this table should be aligned with hotplug
+// port map of a specific platform. For example, in Ampere Mt. Jade platform,
+// there are 40 PCIe hotplug ports. Hence, this table defines 36 entries corresponding
+// to Ampere Mt. Jade PCIe hotplug port map.
+OperationRegion(MHPP, SystemMemory, 0x88970000, 960)
+Field (MHPP, DWordAcc, NoLock, Preserve) {
+    A020, 32, // 0. S0 RCA2.0
+    A00I, 8,  // incomplete remove
+    offset (24),
+    A030, 32, // 1. S0 RCA3.0
+    A01I, 8,  // incomplete remove
+    offset (48),
+    B000, 32, // 2. S0 RCB0.0
+    B02I, 8,  // incomplete remove
+    offset (72),
+    B002, 32, // 3. S0 RCB0.2
+    B03I, 8,  // incomplete remove
+    offset (96),
+    B004, 32, // 4. S0 RCB0.4
+    B04I, 8,  // incomplete remove
+    offset (120),
+    B006, 32, // 5. S0 RCB0.6
+    B05I, 8,  // incomplete remove
+    offset (144),
+    B010, 32, // 6. S0 RCB1.0
+    B06I, 8,  // incomplete remove
+    offset (168),
+    B012, 32, // 7. S0 RCB1.2
+    B07I, 8,  // incomplete remove
+    offset (192),
+    B014, 32, // 8. S0 RCB1.4
+    B08I, 8,  // incomplete remove
+    offset (216),
+    B016, 32, // 9. S0 RCB1.6
+    B09I, 8,  // incomplete remove
+    offset (240),
+    B020, 32, // 10. S0 RCB2.0
+    B10I, 8,  // incomplete remove
+    offset (264),
+    B022, 32, // 11. S0 RCB2.2
+    B11I, 8,  // incomplete remove
+    offset (288),
+    B024, 32, // 12. S0 RCB2.4
+    B12I, 8,  // incomplete remove
+    offset (312),
+    B030, 32, // 13. S0 RCB3.0
+    B13I, 8,  // incomplete remove
+    offset (336),
+    B034, 32, // 14. S0 RCB3.4
+    B14I, 8,  // incomplete remove
+    offset (360),
+    B036, 32, // 15. S0 RCB3.6
+    B15I, 8,  // incomplete remove
+    offset (384),
+    A120, 32, // 16. S1 RCA2.0
+    A16I, 8,  // incomplete remove
+    offset (408),
+    A121, 32, // 17. S1 RCA2.1
+    A17I, 8,  // incomplete remove
+    offset (432),
+    A122, 32, // 18. S1 RCA2.2
+    A18I, 8,  // incomplete remove
+    offset (456),
+    A123, 32, // 19. S1 RCA2.3
+    A19I, 8,  // incomplete remove
+    offset (480),
+    A130, 32, // 20. S1 RCA3.0
+    A20I, 8,  // incomplete remove
+    offset (504),
+    A132, 32, // 21. S1 RCA3.2
+    A21I, 8,  // incomplete remove
+    offset (528),
+    B100, 32, // 22. S1 RCB0.0
+    B22I, 8,  // incomplete remove
+    offset (552),
+    B104, 32, // 23. S1 RCB0.4
+    B23I, 8,  // incomplete remove
+    offset (576),
+    B106, 32, // 24. S1 RCB0.6
+    B24I, 8,  // incomplete remove
+    offset (600),
+    B110, 32, // 25. S1 RCB1.0
+    B25I, 8,  // incomplete remove
+    offset (624),
+    B112, 32, // 26. S1 RCB1.2
+    B26I, 8,  // incomplete remove
+    offset (648),
+    B114, 32, // 27. S1 RCB1.4
+    B27I, 8,  // incomplete remove
+    offset (672),
+    B120, 32, // 28. S1 RCB2.0
+    B28I, 8,  // incomplete remove
+    offset (696),
+    B122, 32, // 29. S1 RCB2.2
+    B29I, 8,  // incomplete remove
+    offset (720),
+    B124, 32, // 30. S1 RCB2.4
+    B30I, 8,  // incomplete remove
+    offset (744),
+    B126, 32, // 31. S1 RCB2.6
+    B31I, 8,  // incomplete remove
+    offset (768),
+    B130, 32, // 32. S1 RCB3.0
+    B32I, 8,  // incomplete remove
+    offset (792),
+    B132, 32, // 33. S1 RCB3.2
+    B33I, 8,  // incomplete remove
+    offset (816),
+    B134, 32, // 34. S1 RCB3.4
+    B34I, 8,  // incomplete remove
+    offset (840),
+    B136, 32, // 35. S1 RCB3.6
+    B35I, 8   // incomplete remove
+}
diff --git a/Platform/Ampere/JadePkg/AcpiTables/PCI-S0.asi b/Platform/Ampere/JadePkg/AcpiTables/PCI-S0.asi
index f6d788cd99b0..452baf18e720 100644
--- a/Platform/Ampere/JadePkg/AcpiTables/PCI-S0.asi
+++ b/Platform/Ampere/JadePkg/AcpiTables/PCI-S0.asi
@@ -1,11 +1,21 @@
 /** @file
 
-  Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR>
+  Copyright (c) 2020 - 2023, Ampere Computing LLC. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
+  Include("MHPP.asi")
+
+  // @DoorBellNS1 0x1000.0054.1000. Out-Offset: 0x10
+  OperationRegion(DNS1, SystemMemory, 0x100000541010 , 8)
+
+  Field (DNS1, DWordAcc, NoLock, Preserve) {
+    OUTV, 32,
+    DIN0, 32,
+  }
+
   // PCI2 RCA2
   Device (PCI2) {
     //
@@ -1016,6 +1026,274 @@
       Name (_ADR, 0x00000000)
     }
 
+    //
+    // Root Port 1
+    //
+    Device (P2P1) {
+      //
+      // Device 1, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00010000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 1 ([01])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (B000 == 0xF0000400) { // SW ejected ?
+            Store(0x02000400, B000) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000212, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000212 to DBNS1_10
+            Return(0xF)
+          }
+          elseif (B000 == 0x10000400) { // ejected complete ?
+            Store(0x02000400, B000) // clear action value
+            Return(0x0)
+          }
+          elseif ((B000 == 0x01000400) || (B000 == 0x0F000400)) { // inserted ?
+            if (B02I == 0x00) {
+              Store(0x02000400, B000) // clear action value
+            }
+            Return(0xF)
+          }
+          elseif ((B000 == 0x0E000400) || (B000 == 0x0F000400)) { // inprogress inserted ?
+            if (B02I == 0x00) {
+              Store(0x02000400, B000) // clear action value
+            }
+            Return(0xF)
+          }
+          else {
+            Return(0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (B000 == 0x02000400) { // really sw ejection call?
+            Store(0xF0000400, B000) // set SW ejection action
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000212, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000212 to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000001)
+      }
+    }
+
+    //
+    // Root Port 3
+    //
+    Device (P2P3) {
+      //
+      // Device 3, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00030000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 2 ([02])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (B002 == 0xF0020400) { // SW ejected ?
+            Store(0x02020400, B002) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000232, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000232 to DBNS1_10
+            Return(0xF)
+          }
+          elseif (B002 == 0x10020400) { // ejected complete ?
+            Store(0x02020400, B002) // clear action value
+            Return(0x0)
+          }
+          elseif ((B002 == 0x01020400) || (B002 == 0x0F020400)) { // inserted ?
+            if (B03I == 0x00) {
+              Store(0x02020400, B002) // clear action value
+            }
+            Return(0xF)
+          }
+          elseif ((B002 == 0x0E020400) || (B002 == 0x0F020400)) { // inprogress inserted ?
+            if (B03I == 0x00) {
+              Store(0x02020400, B002) // clear action value
+            }
+            Return(0xF)
+          }
+          else {
+            Return(0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (B002 == 0x02020400) { // really sw ejection call?
+            Store(0xF0020400, B002) // set SW ejection action
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000232, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000232 to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000002)
+      }
+    }
+
+    //
+    // Root Port 5
+    //
+    Device (P2P5) {
+      //
+      // Device 5, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00050000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 3 [03])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (B004 == 0xF0040400) { // SW ejected ?
+            Store(0x02040400, B004) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000252, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000252 to DBNS1_10
+            Return(0xF)
+          }
+          elseif (B004 == 0x10040400) { // ejected complete ?
+            Store(0x02040400, B004) // clear action value
+            Return(0x0)
+          }
+          elseif ((B004 == 0x01040400) || (B004 == 0x0F040400)) { // inserted?
+            if (B04I == 0x00) {
+              Store(0x02040400, B004) // clear action value
+            }
+            Return(0xF)
+          }
+          elseif ((B004 == 0x0E040400) || (B004 == 0x0F040400)) { // inprogress inserted?
+            if (B04I == 0x00) {
+              Store(0x02040400, B004) // clear action value
+            }
+            Return(0xF)
+          }
+          else {
+            Return(0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (B004 == 0x02040400) { // really sw ejection call?
+            Store(0xF0040400, B004) // set SW ejection action
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000252, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000252 to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000003)
+      }
+    }
+
+    //
+    // Root Port 7
+    //
+    Device (P2P7) {
+      //
+      // Device 7, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00070000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 4 ([04])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (B006 == 0xF0060400) { // SW ejected ?
+            Store(0x02060400, B006) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000272, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000272 to DBNS1_10
+            Return(0xF)
+          }
+          elseif(B006 == 0x10060400) { // ejected complete ?
+            Store(0x02060400, B006) // clear action value
+            Return(0x0)
+          }
+          elseif((B006 == 0x01060400) || (B006 == 0x0F060400)) { // inserted ?
+            if (B05I == 0x00) {
+              Store(0x02060400, B006) // clear action value
+            }
+            Return(0xF)
+          }
+          elseif((B006 == 0x0E060400) || (B006 == 0x0F060400)) { // inprogress inserted ?
+            if (B05I == 0x00) {
+              Store(0x02060400, B006) // clear action value
+            }
+            Return(0xF)
+          }
+          else {
+            Return(0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (B006 == 0x02060400) { // really sw ejection call?
+            Store(0xF0060400, B006) // set SW ejection value
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000272, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000272 to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000004)
+      }
+    }
+
     Method (_PXM, 0, NotSerialized) {
       // Patch by code
       Return(0xFF)
@@ -1366,6 +1644,274 @@
       Name (_ADR, 0x00000000)
     }
 
+    //
+    // Root Port 1
+    //
+    Device (P2P1) {
+      //
+      // Device 1, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00010000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 1 ([01])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (B010 == 0xF0000500) { // SW ejected before ?
+            Store(0x02000500, B010) // Set back action event
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000213, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000213 to DBNS1_10
+            Return(0xF)
+          }
+          elseif (B010 == 0x10000500) { // ejected complete ?
+            Store(0x02000500, B010) // Set back action event
+            Return (0x0)
+          }
+          elseif ((B010 == 0x01000500) || (B010 == 0x0F000500)) { // inserted ?
+            if (B06I == 0x00) {
+              Store(0x02000500, B010) // Set back action event
+            }
+            Return (0xF)
+          }
+          elseif ((B010 == 0x0E000500) || (B010 == 0x0F000500)) { // inprogress inserted ?
+            if (B06I == 0x00) {
+              Store(0x02000500, B010) // Set back action event
+            }
+            Return (0xF)
+          }
+          else {
+            Return (0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (B010 == 0x02000500) { // really sw ejection call?
+            Store(0xF0000500, B010) // Set SW ejection event
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000213, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000213 to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000001)
+      }
+    }
+
+    //
+    // Root Port 3
+    //
+    Device (P2P3) {
+      //
+      // Device 3, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00030000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 2 ([02])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (B012 == 0xF0020500) { // SW ejected before ?
+            Store(0x02020500, B012) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000233, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000233 to DBNS1_10
+            Return(0xF)
+          }
+          elseif (B012 == 0x10020500) { // ejected complete ?
+            Store(0x02020500, B012) // clear action value
+            Return (0x0)
+          }
+          elseif ((B012 == 0x01020500) || (B012 == 0x0F020500)) { // inserted ?
+            if (B07I == 0x00) {
+              Store(0x02020500, B012) // clear action value
+            }
+            Return (0xF)
+          }
+          elseif ((B012 == 0x0E020500) || (B012 == 0x0F020500)) { // inprogress inserted ?
+            if (B07I == 0x00) {
+              Store(0x02020500, B012) // clear action value
+            }
+            Return (0xF)
+          }
+          else {
+            Return (0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (B012 == 0x02020500) { // really sw ejection call?
+            Store(0xF0020500, B012) // set SW ejection event
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000233, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000233 to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000002)
+      }
+    }
+
+    //
+    // Root Port 5
+    //
+    Device (P2P5) {
+      //
+      // Device 5, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00050000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 3 [03])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (B014 == 0xF0040500) { // SW ejected before ?
+            Store(0x02040500, B014) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000253, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000253 to DBNS1_10
+            Return (0xF)
+          }
+          elseif (B014 == 0x10040500) { // ejected complete ?
+            Store(0x02040500, B014) // clear action value
+            Return (0x0)
+          }
+          elseif ((B014 == 0x01040500) || (B014 == 0x0F040500)){ // inserted ?
+            if (B08I == 0x00) {
+              Store(0x02040500, B014) // clear action value
+            }
+            Return (0xF)
+          }
+          elseif ((B014 == 0x0E040500) || (B014 == 0x0F040500)) { // inprogress inserted ?
+            if (B08I == 0x00) {
+              Store(0x02040500, B014) // clear action value
+            }
+            Return (0xF)
+          }
+          else {
+            Return (0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (B014 == 0x02040500) { // really sw ejection call?
+            Store(0xF0040500, B014) // set SW ejection event
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000253, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000253 to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000003)
+      }
+    }
+
+    //
+    // Root Port 7
+    //
+    Device (P2P7) {
+      //
+      // Device 7, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00070000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 4 ([04])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (B016 == 0xF0060500) { // SW ejected before ?
+            Store(0x02060500, B016) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000273, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000273 to DBNS1_10
+            Return(0xF)
+          }
+          elseif (B016 == 0x10060500) { // ejected complete ?
+            Store(0x02060500, B016) // clear action value
+            Return (0x0)
+          }
+          elseif ((B016 == 0x01060500) || (B016 == 0x0F060500)) { // inserted ?
+            if (B09I == 0x00) {
+              Store(0x02060500, B016) // clear action value
+            }
+            Return (0xF)
+          }
+          elseif ((B016 == 0x0E060500) || (B016 == 0x0F060500)) { // inprogress inserted ?
+            if (B09I == 0x00) {
+              Store(0x02060500, B016) // clear action value
+            }
+            Return (0xF)
+          }
+          else {
+            Return (0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (B016 == 0x02060500) { // really sw ejection call?
+            Store(0xF0060500, B016) // set SW ejection event
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000273, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000273 to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000004)
+      }
+    }
+
     Method (_PXM, 0, NotSerialized) {
       // Patch by code
       Return(0xFF)
diff --git a/Platform/Ampere/JadePkg/AcpiTables/PCI-S1.asi b/Platform/Ampere/JadePkg/AcpiTables/PCI-S1.asi
index 2757f3124b83..49dec357abfb 100644
--- a/Platform/Ampere/JadePkg/AcpiTables/PCI-S1.asi
+++ b/Platform/Ampere/JadePkg/AcpiTables/PCI-S1.asi
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR>
+  Copyright (c) 2020 - 2023, Ampere Computing LLC. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -336,6 +336,274 @@
       Name (_ADR, 0x00000000)
     }
 
+    //
+    // Root Port 1
+    //
+    Device (P2P1) {
+      //
+      // Device 1, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00010000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 1 ([01])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (A120 == 0xF0000201) { // SW ejected before ?
+            Store(0x02000201, A120) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000216, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000216 to DBNS1_10
+            Return (0xF)
+          }
+          elseif (A120 == 0x10000201) { // ejected completed ?
+            Store(0x02000201, A120) // clear action value
+            Return (0x0)
+          }
+          elseif ((A120 == 0x01000201) || (A120 == 0x0F000201)) { // inserted ?
+            if (A16I == 0x00) {
+              Store(0x02000201, A120) // clear action value
+            }
+            Return (0xF)
+          }
+          elseif ((A120 == 0x0E000201) || (A120 == 0x0F000201)) { // inprogress inserted ?
+            if (A16I == 0x00) {
+              Store(0x02000201, A120) // clear action value
+            }
+            Return (0xF)
+          }
+          else {
+            Return (0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (A120 == 0x02000201) { // is sw ejection?
+            Store(0xF0000201, A120) // set SW ejection event
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000216, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000216 to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000001)
+      }
+    }
+
+    //
+    // Root Port 2
+    //
+    Device (P2P2) {
+      //
+      // Device 2, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00020000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 2 ([02])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (A121 == 0xF0010201) { // SW ejected before ?
+            Store(0x02010201, A121) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000226, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000226 to DBNS1_10
+            Return(0xF)
+          }
+          elseif (A121 == 0x10010201) { // ejected completed ?
+            Store(0x02010201, A121) // clear action value
+            Return(0x0)
+          }
+          elseif ((A121 == 0x01010201) || (A121 == 0x0F010201)) { // inserted ?
+            if (A17I == 0x00) {
+              Store(0x02010201, A121) // clear action value
+            }
+            Return(0xF)
+          }
+          elseif ((A121 == 0x0E010201) || (A121 == 0x0F010201)) { // inprogress inserted ?
+            if (A17I == 0x00) {
+              Store(0x02010201, A121) // clear action value
+            }
+            Return(0xF)
+          }
+          else {
+            Return (0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (A121 == 0x02010201) { // is sw ejection?
+            Store(0xF0010201, A121) // set SW ejection event
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000226, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000226 to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000002)
+      }
+    }
+
+    //
+    // Root Port 3
+    //
+    Device (P2P3) {
+      //
+      // Device 3, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00030000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 3 [03])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (A122 == 0xF0020201) { // SW ejected before ?
+            Store(0x02020201, A122) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000236, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000236 to DBNS1_10
+            Return(0xF)
+          }
+          elseif (A122 == 0x10020201) { // ejected complete ?
+            Store(0x02020201, A122) // clear action value
+            Return (0x0)
+          }
+          elseif ((A122 == 0x01020201) || (A122 == 0x0F020201)) { // inserted ?
+            if (A18I == 0x00) {
+              Store(0x02020201, A122) // clear action value
+            }
+            Return (0xF)
+          }
+          elseif ((A122 == 0x0E020201) || (A122 == 0x0F020201)) { // inprogess inserted ?
+            if (A18I == 0x00) {
+              Store(0x02020201, A122) // clear action value
+            }
+            Return (0xF)
+          }
+          else {
+            Return (0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (A122 == 0x02020201) { // is sw ejection?
+            Store(0xF0020201, A122) // set SW ejection event
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000236, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000236 to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000003)
+      }
+    }
+
+    //
+    // Root Port 4
+    //
+    Device (P2P4) {
+      //
+      // Device 4, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00040000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 4 [04])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (A123 == 0xF0030201) { // SW ejected before ?
+            Store(0x02030201, A123) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000246, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000246 to DBNS1_10
+            Return(0xF)
+          }
+          elseif (A123 == 0x10030201) { // ejected complete ?
+            Store(0x02030201, A123) // clear action value
+            Return (0x0)
+          }
+          elseif ((A123 == 0x01030201) || (A123 == 0x0F030201)) { // inserted ?
+            if (A19I == 0x00) {
+              Store(0x02030201, A123) // clear action value
+            }
+            Return (0xF)
+          }
+          elseif ((A123 == 0x0E030201) || (A123 == 0x0F030201)) { // inprogress inserted ?
+            if (A19I == 0x00) {
+              Store(0x02030201, A123) // clear action value
+            }
+            Return (0xF)
+          }
+          else {
+            Return (0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (A123 == 0x02030201) { // is sw ejection?
+            Store(0xF0030201, A123) // set ejection event
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000246, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000246 to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000004)
+      }
+    }
+
     Method (_PXM, 0, NotSerialized) {
       // Patch by code
       Return(0xFF)
@@ -1021,6 +1289,140 @@
       Name (_ADR, 0x00000000)
     }
 
+    //
+    // Root Port 5
+    //
+    Device (P2P5) {
+      //
+      // Device 5, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00050000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 2 [02])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (B104 == 0xF0040401) { // SW ejected before ?
+            Store(0x02040401, B104) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000258, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000258 to DBNS1_10
+            Return(0xF)
+          }
+          elseif (B104 == 0x10040401) { // ejected complete ?
+            Store(0x02040401, B104) // clear action value
+            Return (0x0)
+          }
+          elseif ((B104 == 0x01040401) || (B104 == 0x0F040401)) { // inserted ?
+            if (B23I == 0x00) {
+              Store(0x02040401, B104) // clear action value
+            }
+            Return (0xF)
+          }
+          elseif ((B104 == 0x0E040401) || (B104 == 0x0F040401)) { // inprogress inserted ?
+            if (B23I == 0x00) {
+              Store(0x02040401, B104) // clear action value
+            }
+            Return (0xF)
+          }
+          else {
+            Return (0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (B104 == 0x02040401) { // is sw ejection?
+            Store(0xF0040401, B104) // set SW ejection event
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000258, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000258 to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000002)
+      }
+    }
+
+    //
+    // Root Port 7
+    //
+    Device (P2P7) {
+      //
+      // Device 7, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00070000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 3 ([03])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (B106 == 0xF0060401) { // SW ejected before ?
+            Store(0x02060401, B106) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000278, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000278 to DBNS1_10
+            Return(0xF)
+          }
+          elseif (B106 == 0x10060401) { // ejected complete ?
+            Store(0x02060401, B106) // clear action value
+            Return (0x0)
+          }
+          elseif ((B106 == 0x01060401) || (B106 == 0x0F060401)) { // inserted ?
+            if (B24I == 0x00) {
+              Store(0x02060401, B106) // clear action value
+            }
+            Return (0xF)
+          }
+          elseif ((B106 == 0x0E060401) || (B106 == 0x0F060401)) { // inprogress inserted ?
+            if (B24I == 0x00) {
+              Store(0x02060401, B106) // clear action value
+            }
+            Return (0xF)
+          }
+          else {
+            Return (0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (B106 == 0x02060401) { // is sw ejection?
+            Store(0xF0060401, B106) // set SW ejection event
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000278, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000278 to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000003)
+      }
+    }
+
     Method (_PXM, 0, NotSerialized) {
       // Patch by code
       Return(0xFF)
@@ -1374,6 +1776,140 @@
       Name (_ADR, 0x00000000)
     }
 
+    //
+    // Root Port 1
+    //
+    Device (P2P1) {
+      //
+      // Device 1, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00010000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 1 ([01])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (B110 == 0xF0000501) { // SW ejected before?
+            Store(0x02000501, B110) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000219, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000219 to DBNS1_10
+            Return(0xF)
+          }
+          elseif (B110 == 0x10000501) { // ejected complete ?
+            Store(0x02000501, B110) // clear action value
+            Return (0x0)
+          }
+          elseif ((B110 == 0x01000501) || (B110 == 0x0F000501)) { // inserted ?
+            if (B25I == 0x00) {
+              Store(0x02000501, B110) // clear action value
+            }
+            Return (0xF)
+          }
+          elseif ((B110 == 0x0E000501) || (B110 == 0x0F000501)) { // inprogress inserted ?
+            if (B25I == 0x00) {
+              Store(0x02000501, B110) // clear action value
+            }
+            Return (0xF)
+          }
+          else {
+            Return (0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (B110 == 0x02000501) { // is sw ejection?
+            Store(0xF0000501, B110) // set SW ejection event
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000219, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000219 to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000001)
+      }
+    }
+
+    //
+    // Root Port 3
+    //
+    Device (P2P3) {
+      //
+      // Device 3, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00030000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 2 [02])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (B112 == 0xF0020501) { // SW ejected before ?
+            Store(0x02020501, B112) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000239, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000239 to DBNS1_10
+            Return(0xF)
+          }
+          elseif (B112 == 0x10020501) { // ejected complete ?
+            Store(0x02020501, B112) // clear action value
+            Return (0x0)
+          }
+          elseif ((B112 == 0x01020501) || (B112 == 0x0F020501)) { // inserted ?
+            if (B26I == 0x00) {
+              Store(0x02020501, B112) // clear action value
+            }
+            Return (0xF)
+          }
+          elseif ((B112 == 0x0E020501) || (B112 == 0x0F020501)) { // inprogress inserted ?
+            if (B26I == 0x00) {
+              Store(0x02020501, B112) // clear action value
+            }
+            Return (0xF)
+          }
+          else {
+            Return (0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (B112 == 0x02020501) { // is sw ejection?
+            Store(0xF0020501, B112) // set SW ejection event
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x68000239, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x68000239 to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000002)
+      }
+    }
+
     Method (_PXM, 0, NotSerialized) {
       // Patch by code
       Return(0xFF)
@@ -1727,6 +2263,274 @@
       Name (_ADR, 0x00000000)
     }
 
+    //
+    // Root Port 1
+    //
+    Device (P2P1) {
+      //
+      // Device 1, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00010000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 1 ([01])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (B120 == 0xF0000601) { // SW ejected before ?
+            Store(0x02000601, B120) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x6800021A, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x6800021A to DBNS1_10
+            Return(0xF)
+          }
+          elseif (B120 == 0x10000601) { // ejected complete ?
+            Store(0x02000601, B120) // clear action value
+            Return (0x0)
+          }
+          elseif ((B120 == 0x01000601) || (B120 == 0x0F000601)){ // inserted ?
+            if (B28I == 0x00) {
+              Store(0x02000601, B120) // clear action value
+            }
+            Return (0xF)
+          }
+          elseif ((B120 == 0x0E000601) || (B120 == 0x0F000601)) { // inprogress inserted ?
+            if (B28I == 0x00) {
+              Store(0x02000601, B120) // clear action value
+            }
+            Return (0xF)
+          }
+          else {
+            Return (0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (B120 == 0x02000601) { // is sw ejection?
+            Store(0xF0000601, B120) // set SW ejection event
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x6800021A, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x6800021A to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000001)
+      }
+    }
+
+    //
+    // Root Port 3
+    //
+    Device (P2P3) {
+      //
+      // Device 3, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00030000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 2 [02])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (B122 == 0xF0020601) { // SW ejected before ?
+            Store(0x02020601, B122) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x6800023A, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x6800023A to DBNS1_10
+            Return(0xF)
+          }
+          elseif (B122 == 0x10020601) { // ejected completed ?
+            Store(0x02020601, B122) // clear action value
+            Return (0x0)
+          }
+          elseif ((B122 == 0x01020601) || (B122 == 0x0F020601)){ // inserted ?
+            if (B29I == 0x00) {
+              Store(0x02020601, B122) // clear action value
+            }
+            Return (0xF)
+          }
+          elseif ((B122 == 0x0E020601) || (B122 == 0x0F020601)) { // inprogress inserted ?
+            if (B29I == 0x00) {
+              Store(0x02020601, B122) // clear action value
+            }
+            Return (0xF)
+          }
+          else {
+            Return (0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (B122 == 0x02020601) { // is sw ejection?
+            Store(0xF0020601, B122) // set SW ejection event
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x6800023A, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x6800023A to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000002)
+      }
+    }
+
+    //
+    // Root Port 5
+    //
+    Device (P2P5) {
+      //
+      // Device 5, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00050000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 3 [03])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (B124 == 0xF0040601) { // SW ejected before ?
+            Store(0x02040601, B124) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x6800025A, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x6800025A to DBNS1_10
+            Return(0xF)
+          }
+          elseif (B124 == 0x10040601) { // ejected complete ?
+            Store(0x02040601, B124) // clear action value
+            Return (0x0)
+          }
+          elseif ((B124 == 0x01040601) || (B124 == 0x0F040601)) { // inserted ?
+            if (B30I == 0x00) {
+              Store(0x02040601, B124) // clear action value
+            }
+            Return (0xF)
+          }
+          elseif ((B124 == 0x0E040601) || (B124 == 0x0F040601)) { // inprogress inserted ?
+            if (B30I == 0x00) {
+              Store(0x02040601, B124) // clear action value
+            }
+            Return (0xF)
+          }
+          else {
+            Return (0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (B124 == 0x02040601) { // is sw ejection?
+            Store(0xF0040601, B124) // set SW ejection event
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x6800025A, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x6800025A to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000003)
+      }
+    }
+
+    //
+    // Root Port 7
+    //
+    Device (P2P7) {
+      //
+      // Device 7, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00070000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 4 ([04])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (B126 == 0xF0060601) { // SW ejected before ?
+            Store(0x02060601, B126) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x6800027A, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x6800027A to DBNS1_10
+            Return(0xF)
+          }
+          elseif (B126 == 0x10060601) { // ejected complete ?
+            Store(0x02060601, B126) // clear action value
+            Return (0x0)
+          }
+          elseif ((B126 == 0x01060601) || (B126 == 0x0F060601)) { // inserted ?
+            if (B31I == 0x00) {
+              Store(0x02060601, B126) // clear action value
+            }
+            Return (0xF)
+          }
+          elseif ((B126 == 0x0E060601) || (B126 == 0x0F060601)) { // inprogress inserted ?
+            if (B31I == 0x00) {
+              Store(0x02060601, B126) // clear action value
+            }
+            Return (0xF)
+          }
+          else {
+            Return (0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (B126 == 0x02060601) { // is sw ejection?
+            Store(0xF0060601, B126) // set SW ejection event
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x6800027A, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x6800027A to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000004)
+      }
+    }
+
     Method (_PXM, 0, NotSerialized) {
       // Patch by code
       Return(0xFF)
@@ -2080,6 +2884,274 @@
       Name (_ADR, 0x00000000)
     }
 
+    //
+    // Root Port 1
+    //
+    Device (P2P1) {
+      //
+      // Device 1, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00010000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 1 ([01])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (B130 == 0xF0000701) { // SW ejected before ?
+            Store(0x02000701, B130) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x6800021B, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x6800021B to DBNS1_10
+            Return (0xF)
+          }
+          elseif (B130 == 0x10000701) { // ejected complete ?
+            Store(0x02000701, B130) // clear action value
+            Return (0x0)
+          }
+          elseif ((B130 == 0x01000701) || (B130 == 0x0F000701)) { // inserted ?
+            if (B32I == 0x00) {
+              Store(0x02000701, B130) // clear action value
+            }
+            Return (0xF)
+          }
+          elseif ((B130 == 0x0E000701) || (B130 == 0x0F000701)) { // inprogress inserted ?
+            if (B32I == 0x00) {
+              Store(0x02000701, B130) // clear action value
+            }
+            Return (0xF)
+          }
+          else {
+            Return (0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (B130 == 0x02000701) { // is sw ejection?
+            Store(0xF0000701, B130) // set SW ejection event
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x6800021B, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x6800021B to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000001)
+      }
+    }
+
+    //
+    // Root Port 3
+    //
+    Device (P2P3) {
+      //
+      // Device 3, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00030000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 2 [02])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (B132 == 0xF0020701) { // SW ejected before ?
+            Store(0x02020701, B132) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x6800023B, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x6800023B to DBNS1_10
+            Return (0xF)
+          }
+          elseif (B132 == 0x10020701) { // ejected complete ?
+            Store(0x02020701, B132) // clear action value
+            Return (0x0)
+          }
+          elseif ((B132 == 0x01020701) || (B132 == 0x0F020701)) { // inserted ?
+            if (B33I == 0x00) {
+              Store(0x02020701, B132) // clear action value
+            }
+            Return (0xF)
+          }
+          elseif ((B132 == 0x0E020701) || (B132 == 0x0F020701)) { // inprogress inserted ?
+            if (B33I == 0x00) {
+              Store(0x02020701, B132) // clear action value
+            }
+            Return (0xF)
+          }
+          else {
+            Return (0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (B132 == 0x02020701) { // is sw ejection?
+            Store(0xF0020701, B132) // set SW ejection event
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x6800023B, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x6800023B to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000002)
+      }
+    }
+
+    //
+    // Root Port 5
+    //
+    Device (P2P5) {
+      //
+      // Device 5, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00050000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 3 [03])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (B134 == 0xF0040701) { // SW ejected before ?
+            Store(0x02040701, B134) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x6800025B, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x6800025B to DBNS1_10
+            Return (0xF)
+          }
+          elseif (B134 == 0x10040701) { // ejected completed ?
+            Store(0x02040701, B134) // clear action value
+            Return (0x0)
+          }
+          elseif ((B134 == 0x01040701) || (B134 == 0x0F040701)) { // inserted ?
+            if (B34I == 0x00) {
+              Store(0x02040701, B134) // clear action value
+            }
+            Return (0xF)
+          }
+          elseif ((B134 == 0x0E040701) || (B134 == 0x0F040701)) { // inprogress inserted ?
+            if (B34I == 0x00) {
+              Store(0x02040701, B134) // clear action value
+            }
+            Return (0xF)
+          }
+          else {
+            Return (0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (B134 == 0x02040701) { // is sw ejection?
+            Store(0xF0040701, B134) // set SW ejection event
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x6800025B, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x6800025B to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000003)
+      }
+    }
+
+    //
+    // Root Port 7
+    //
+    Device (P2P7) {
+      //
+      // Device 7, Function 0 (Bus 0).
+      //
+
+      Name (_ADR, 0x00070000)
+      Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+      Device (S0F0) {
+        //
+        // On Bus 4 ([04])
+        // Slot 0 (Device 0), Function 0
+        //
+
+        Name (_ADR, 0x00000000)
+
+        Method (_STA, 0) {
+          if (B136 == 0xF0060701) { // SW ejected before ?
+            Store(0x02060701, B136) // clear action value
+            Store(0x680000A4, DIN0) // Off RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x6800027B, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x6800027B to DBNS1_10
+            Return (0xF)
+          }
+          elseif (B136 == 0x10060701) { // ejected completed ?
+            Store(0x02060701, B136) // clear action value
+            Return (0x0)
+          }
+          elseif ((B136 == 0x01060701) || (B136 == 0x0F060701)) { // inserted ?
+            if (B35I == 0x00) {
+              Store(0x02060701, B136) // clear action value
+            }
+            Return (0xF)
+          }
+          elseif ((B136 == 0x0E060701) || (B136 == 0x0F060701)) { // inprogress inserted ?
+            if (B35I == 0x00) {
+              Store(0x02060701, B136) // clear action value
+            }
+            Return (0xF)
+          }
+          else {
+            Return (0xF)
+          }
+        }
+
+        Method (_EJ0, 1) {
+          if (B136 == 0x02060701) { // is sw ejection?
+            Store(0xF0060701, B136) // set SW ejection event
+            Store(0x680000B4, DIN0) // Blink RED LED
+                                    // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                    // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+            Store(0x6800027B, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                    // action: Insert = 1 & Remove = 2
+                                    // 0x6800027B to DBNS1_10
+          }
+        }
+
+        Name(_SUN, 0x00000004)
+      }
+    }
+
     Method (_PXM, 0, NotSerialized) {
       // Patch by code
       Return(0xFF)
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [edk2-platforms][PATCH 5/6] JadePkg: Support ACPI tables for Hot Plug of Ampere Altra Max
  2023-05-11  8:10 [edk2-platforms][PATCH 0/6] Support NVMe Hot Plug feature for Ampere Altra and Ampere Altra Max Minh Nguyen
                   ` (3 preceding siblings ...)
  2023-05-11  8:10 ` [edk2-platforms][PATCH 4/6] JadePkg: Support ACPI tables for Hot Plug of Ampere Altra Minh Nguyen
@ 2023-05-11  8:10 ` Minh Nguyen
  2023-05-11  8:10 ` [edk2-platforms][PATCH 6/6] AmpereAltraPkg: Enable NVMe Hot Plug feature Minh Nguyen
  2023-06-02 12:37 ` [edk2-platforms][PATCH 0/6] Support NVMe Hot Plug feature for Ampere Altra and Ampere Altra Max Ard Biesheuvel
  6 siblings, 0 replies; 8+ messages in thread
From: Minh Nguyen @ 2023-05-11  8:10 UTC (permalink / raw)
  To: devel
  Cc: patches, quic_llindhol, ardb+tianocore, nhi, tinhnguyen,
	Vu Nguyen, Minh Nguyen

From: Vu Nguyen <vunguyen@os.amperecomputing.com>

This adds necessary changes of ACPI tables and defines the memory
region between OS and Trusted Firmware-A for supporting Hot Plug
of Ampere Altra Max.

Signed-off-by: Minh Nguyen <minhnguyen1@os.amperecomputing.com>
---
 Platform/Ampere/JadePkg/Ac02AcpiTables/CommonDevices.asi |   24 +
 Platform/Ampere/JadePkg/Ac02AcpiTables/Dsdt.asl          |  511 ++++++++++
 Platform/Ampere/JadePkg/Ac02AcpiTables/MHPP.asi          |   92 ++
 Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S0.asi        |  545 ++++++++++
 Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S1.asi        | 1072 ++++++++++++++++++++
 5 files changed, 2244 insertions(+)

diff --git a/Platform/Ampere/JadePkg/Ac02AcpiTables/CommonDevices.asi b/Platform/Ampere/JadePkg/Ac02AcpiTables/CommonDevices.asi
index 17ecd52a553f..73804cab81b5 100644
--- a/Platform/Ampere/JadePkg/Ac02AcpiTables/CommonDevices.asi
+++ b/Platform/Ampere/JadePkg/Ac02AcpiTables/CommonDevices.asi
@@ -174,7 +174,16 @@ Device(GED0) {
     }
     Name(_CRS, ResourceTemplate () {
         Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 84 } // GHES
+        Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 44 } // PCIe Hot Plug Doorbell Insertion & Ejection (DBNS4 -> GIC-IRQS44)
     })
+
+    // @DBN4 agent base address for HP PCIe insertion/ejection event: 0x1000.0054.4000
+    OperationRegion(DBN4, SystemMemory, 0x100000544010, 20)
+    Field (DBN4, DWordAcc, NoLock, Preserve) {
+        DOUT, 32, // event and PCIe port information at offset 0x10
+        offset (0x10),
+        STA4, 32, // interrupt status at offset 0x20
+    }
 }
 
 // Shutdown button using GED.
@@ -511,3 +520,18 @@ Device(NVDR) {
      }
    }
 }
+
+//
+// LED Device
+Device(LED) {
+  Name(_HID, "AMPC0008")
+  Name(_CCA, ONE)
+  Name(_STR, Unicode("Altra LED Device"))
+
+  Name (_DSD, Package () {
+    ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
+    Package () {
+      Package () { "uuid", Package (4) { 0x5598273c, 0xa49611ea, 0xbb370242, 0xac130002 }},
+    }
+  })
+}
diff --git a/Platform/Ampere/JadePkg/Ac02AcpiTables/Dsdt.asl b/Platform/Ampere/JadePkg/Ac02AcpiTables/Dsdt.asl
index ce12272f961d..f2977d4e58a8 100644
--- a/Platform/Ampere/JadePkg/Ac02AcpiTables/Dsdt.asl
+++ b/Platform/Ampere/JadePkg/Ac02AcpiTables/Dsdt.asl
@@ -12,8 +12,519 @@ DefinitionBlock("Dsdt.aml", "DSDT", 0x02, "Ampere", "Jade", 1) {
   Name(\BDMD, "Altra Max Jade Board")
   Name(AERF, 0)  // PCIe AER Firmware-First
 
+  Include ("MHPP.asi")
+
   Scope(\_SB) {
+
     Include ("CommonDevices.asi")
+
+    Scope(\_SB.GED0) {
+        Method(_EVT, 1, Serialized) {
+          Switch (ToInteger(Arg0)) {
+            Case (84) { // GHES interrupt
+              Notify (HED0, 0x80)
+            }
+
+            Case (44) { // doorbell notification (Insertion/ejection)
+              local0 = DOUT & 0x00FF0000
+              if (local0 == 0x00010000) {
+                local0 = STA4 & 0xFFFFFFFF
+                if (local0) {
+                  Store(local0, STA4) // clear interrupt
+                }
+                local0 = A050 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P1, 1) // insertion action
+                }
+                local0 = A051 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P2, 1) // insertion action
+                }
+                local0 = A052 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P3, 1) // insertion action
+                }
+                local0 = A053 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P4, 1) // insertion action
+                }
+                local0 = A040 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P1, 1) // insertion action
+                }
+                local0 = A041 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P2, 1) // insertion action
+                }
+                local0 = A042 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P3, 1) // insertion action
+                }
+                local0 = A043 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P4, 1) // insertion action
+                }
+                local0 = A160 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P1, 1) // insertion action
+                }
+                local0 = A161 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P2, 1) // insertion action
+                }
+                local0 = A162 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P3, 1) // insertion action
+                }
+                local0 = A163 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P4, 1) // insertion action
+                }
+
+                local0 = A170 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P1, 1) // insertion action
+                }
+                local0 = A171 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P2, 1) // insertion action
+                }
+                local0 = A172 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P3, 1) // insertion action
+                }
+                local0 = A173 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P4, 1) // insertion action
+                }
+
+                local0 = A150 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCID.P2P1, 1) // insertion action
+                }
+                local0 = A151 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCID.P2P2, 1) // insertion action
+                }
+                local0 = A152 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCID.P2P3, 1) // insertion action
+                }
+                local0 = A153 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCID.P2P4, 1) // insertion action
+                }
+
+
+                local0 = A120 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P1, 1) // insertion action
+                }
+                local0 = A121 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P2, 1) // insertion action
+                }
+                local0 = A122 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P3, 1) // insertion action
+                }
+                local0 = A123 & 0xFF000000
+                if ((local0 == 0x01000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P4, 1) // insertion action
+                }
+              }
+              elseif (local0 == 0x00000000) {
+                local0 = STA4 & 0xFFFFFFFF
+                if (local0) {
+                  Store(local0, STA4) // clear interrupt
+                }
+                local0 = A050 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCI5.P2P1, 1) // ejection action
+                  A050 = 0x10000500 // inprogress remove
+                }
+                local0 = A051 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCI5.P2P2, 1) // ejection action
+                  A051 = 0x10010500 // inprogress remove
+                }
+                local0 = A052 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCI5.P2P3, 1) // ejection action
+                  A052 = 0x10020500 // inprogress remove
+                }
+                local0 = A053 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCI5.P2P4, 1) // ejection action
+                  A053 = 0x10030500 // inprogress remove
+                }
+                local0 = A040 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCI4.P2P1, 1) // ejection action
+                  A040 = 0x10000400 // inprogress remove
+                }
+                local0 = A041 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCI4.P2P2, 1) // ejection action
+                  A041 = 0x10010400 // inprogress remove
+                }
+                local0 = A042 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCI4.P2P3, 1) // ejection action
+                  A042 = 0x10020400 // inprogress remove
+                }
+                local0 = A043 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCI4.P2P4, 1) // ejection action
+                  A043 = 0x10030400 // inprogress remove
+                }
+                local0 = A160 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIE.P2P1, 1) // ejection action
+                  A160 = 0x10000601 // inprogress remove
+                }
+                local0 = A161 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIE.P2P2, 1) // ejection action
+                  A161 = 0x10010601 // inprogress remove
+                }
+                local0 = A162 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIE.P2P3, 1) // ejection action
+                  A162 = 0x10020601 // inprogress remove
+                }
+                local0 = A163 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIE.P2P4, 1) // ejection action
+                  A163 = 0x10030601 // inprogress remove
+                }
+
+                local0 = A170 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIF.P2P1, 1) // ejection action
+                  A170 = 0x10000701 // inprogress remove
+                }
+                local0 = A171 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIF.P2P2, 1) // ejection action
+                  A171 = 0x10010701 // inprogress remove
+                }
+                local0 = A172 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIF.P2P3, 1) // ejection action
+                  A172 = 0x10020701 // inprogress remove
+                }
+                local0 = A173 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIF.P2P4, 1) // ejection action
+                  A173 = 0x10030701 // inprogress remove
+                }
+
+                local0 = A150 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCID.P2P1, 1) // ejection action
+                  A150 = 0x10000501 // inprogress remove
+                }
+                local0 = A151 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCID.P2P2, 1) // ejection action
+                  A151 = 0x10010501 // inprogress remove
+                }
+                local0 = A152 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCID.P2P3, 1) // ejection action
+                  A152 = 0x10020501 // inprogress remove
+                }
+                local0 = A153 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCID.P2P4, 1) // ejection action
+                  A153 = 0x10030501 // inprogress remove
+                }
+
+                local0 = A120 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIA.P2P1, 1) // ejection action
+                  A120 = 0x10000201 // inprogress remove
+                }
+                local0 = A121 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIA.P2P2, 1) // ejection action
+                  A121 = 0x10010201 // inprogress remove
+                }
+                local0 = A122 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIA.P2P3, 1) // ejection action
+                  A122 = 0x10020201 // inprogress remove
+                }
+                local0 = A123 & 0xFF000000
+                if (local0 == 0x00000000) {
+                  Notify (\_SB.PCIA.P2P4, 1) // ejection action
+                  A123 = 0x10030201 // inprogress remove
+                }
+              }
+              elseif (local0 == 0x00020000) { // is either unstable link or too fast insertion?
+                local0 = STA4 & 0xFFFFFFFF
+                if (local0) {
+                  Store(local0, STA4) // clear interrupt
+                }
+                local0 = A050 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P1, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCI5.P2P1, 1) // insertion action
+                }
+                local0 = A051 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P2, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCI5.P2P2, 1) // insertion action
+                }
+                local0 = A052 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P3, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCI5.P2P3, 1) // insertion action
+                }
+                local0 = A053 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P4, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCI5.P2P4, 1) // insertion action
+                }
+                local0 = A040 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P1, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCI4.P2P1, 1) // insertion action
+                }
+                local0 = A041 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P2, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCI4.P2P2, 1) // insertion action
+                }
+                local0 = A042 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P3, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCI4.P2P3, 1) // insertion action
+                }
+                local0 = A043 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P4, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCI4.P2P4, 1) // insertion action
+                }
+                local0 = A160 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P1, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIE.P2P1, 1) // insertion action
+                }
+                local0 = A161 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P2, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIE.P2P2, 1) // insertion action
+                }
+                local0 = A162 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P3, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIE.P2P3, 1) // insertion action
+                }
+                local0 = A163 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P4, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIE.P2P4, 1) // insertion action
+                }
+
+                local0 = A170 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P1, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIF.P2P1, 1) // insertion action
+                }
+                local0 = A171 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P2, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIF.P2P2, 1) // insertion action
+                }
+                local0 = A172 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P3, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIF.P2P3, 1) // insertion action
+                }
+                local0 = A173 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P4, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIF.P2P4, 1) // insertion action
+                }
+
+                local0 = A150 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCID.P2P1, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCID.P2P1, 1) // insertion action
+                }
+                local0 = A151 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCID.P2P2, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCID.P2P2, 1) // insertion action
+                }
+                local0 = A152 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCID.P2P3, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCID.P2P3, 1) // insertion action
+                }
+                local0 = A153 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCID.P2P4, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCID.P2P4, 1) // insertion action
+                }
+
+                local0 = A120 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P1, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIA.P2P1, 1) // insertion action
+                }
+                local0 = A121 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P2, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIA.P2P2, 1) // insertion action
+                }
+                local0 = A122 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P3, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIA.P2P3, 1) // insertion action
+                }
+                local0 = A123 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P4, 3) // force remove bridge port and port itself
+                  Notify (\_SB.PCIA.P2P4, 1) // insertion action
+                }
+              }
+              elseif (local0 == 0x00030000) { // got incomplete remove before?
+                local0 = STA4 & 0xFFFFFFFF
+                if (local0) {
+                  Store(local0, STA4) // clear interrupt
+                }
+                local0 = A050 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P1.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCI5.P2P1, 1) // insertion action
+                }
+                local0 = A051 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P2.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCI5.P2P2, 1) // insertion action
+                }
+                local0 = A052 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P3.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCI5.P2P3, 1) // insertion action
+                }
+                local0 = A053 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI5.P2P4.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCI5.P2P4, 1) // insertion action
+                }
+                local0 = A040 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P1.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCI4.P2P1, 1) // insertion action
+                }
+                local0 = A041 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P2.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCI4.P2P2, 1) // insertion action
+                }
+                local0 = A042 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P3.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCI4.P2P3, 1) // insertion action
+                }
+                local0 = A043 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCI4.P2P4.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCI4.P2P4, 1) // insertion action
+                }
+                local0 = A160 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P1.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIE.P2P1, 1) // insertion action
+                }
+                local0 = A161 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P2.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIE.P2P2, 1) // insertion action
+                }
+                local0 = A162 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P3.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIE.P2P3, 1) // insertion action
+                }
+                local0 = A163 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIE.P2P4.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIE.P2P4, 1) // insertion action
+                }
+
+                local0 = A170 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P1.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIF.P2P1, 1) // insertion action
+                }
+                local0 = A171 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P2.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIF.P2P2, 1) // insertion action
+                }
+                local0 = A172 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P3.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIF.P2P3, 1) // insertion action
+                }
+                local0 = A173 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIF.P2P4.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIF.P2P4, 1) // insertion action
+                }
+
+                local0 = A150 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCID.P2P1.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCID.P2P1, 1) // insertion action
+                }
+                local0 = A151 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCID.P2P2.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCID.P2P2, 1) // insertion action
+                }
+                local0 = A152 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCID.P2P3.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCID.P2P3, 1) // insertion action
+                }
+                local0 = A153 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCID.P2P4.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCID.P2P4, 1) // insertion action
+                }
+
+                local0 = A120 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P1.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIA.P2P1, 1) // insertion action
+                }
+                local0 = A121 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P2.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIA.P2P2, 1) // insertion action
+                }
+                local0 = A122 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P3.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIA.P2P3, 1) // insertion action
+                }
+                local0 = A123 & 0xFF000000
+                if ((local0 == 0x0E000000) || (local0 == 0x0F000000)) {
+                  Notify (\_SB.PCIA.P2P4.S0F0, 3) // remove port itself
+                  Notify (\_SB.PCIA.P2P4, 1) // insertion action
+                }
+              }
+            }
+          }
+        }
+    }
+
     Include ("PCI-S0.Rca01.asi")
     Include ("PCI-S0.asi")
     Include ("PCI-S1.asi")
diff --git a/Platform/Ampere/JadePkg/Ac02AcpiTables/MHPP.asi b/Platform/Ampere/JadePkg/Ac02AcpiTables/MHPP.asi
new file mode 100644
index 000000000000..ae166fd33a92
--- /dev/null
+++ b/Platform/Ampere/JadePkg/Ac02AcpiTables/MHPP.asi
@@ -0,0 +1,92 @@
+/** @file
+
+  Copyright (c) 2023, Ampere Computing LLC. All rights reserved.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+// @DRAM base address 0x88970000
+// Regarding updating the status of hotplug PCIe ports, a shared DRAM
+// memory region between Arm Trusted Firmware and UEFI is used to indicate
+// PCIe hotplug event action. An item of MHPP table is used to reflect hotplug
+// event of each PCIe port. There is a maximum of 48 PCIe hotplug ports in Altra
+// Family processor, the definition in this table should be aligned with hotplug
+// port map of a specific platform. For example, in Ampere Mt. Jade platform,
+// there are 36 PCIe hotplug ports. Hence, this table defines 40 entries corresponding
+// to Ampere Mt. Jade PCIe hotplug port map.
+OperationRegion(MHPP, SystemMemory, 0x88970000, 960)
+Field (MHPP, DWordAcc, NoLock, Preserve) {
+    A050, 32, // 0. S0 RCA5.0
+    A00I, 8,  // incomplete remove
+    offset (24),
+    A051, 32, // 1. S0 RCA5.1
+    A01I, 8,  // incomplete remove
+    offset (48),
+    A052, 32, // 2. S0 RCA5.2
+    A02I, 8,  // incomplete remove
+    offset (72),
+    A053, 32, // 3. S0 RCA5.3
+    A03I, 8,  // incomplete remove
+    offset (96),
+    A040, 32, // 4. S0 RCA4.0
+    A04I, 8,  // incomplete remove
+    offset (120),
+    A041, 32, // 5. S0 RCA4.1
+    A05I, 8,  // incomplete remove
+    offset (144),
+    A042, 32, // 6. S0 RCA4.0
+    A06I, 8,  // incomplete remove
+    offset (168),
+    A043, 32, // 7. S0 RCA4.1
+    A07I, 8,  // incomplete remove
+    offset (192),
+    A163, 32, // 8. S1 RCA6.3
+    A08I, 8,  // incomplete remove
+    offset (216),
+    A162, 32, // 9 S1 RCA6.2
+    A09I, 8,  // incomplete remove
+    offset (240),
+    A161, 32, // 10. S1 RCA6.1
+    A10I, 8,  // incomplete remove
+    offset (264),
+    A160, 32, // 11. S1 RCA6.0
+    A11I, 8,  // incomplete remove
+    offset (288),
+    A173, 32, // 12. S1 RCA7.3
+    A12I, 8,  // incomplete remove
+    offset (312),
+    A172, 32, // 13. S1 RCA7.2
+    A13I, 8,  // incomplete remove
+    offset (336),
+    A171, 32, // 14. S1 RCA7.1
+    A14I, 8,  // incomplete remove
+    offset (360),
+    A170, 32, // 15. S1 RCA7.0
+    A15I, 8,  // incomplete remove
+    offset (384),
+    A150, 32, // 16. S1 RCA5.0
+    A16I, 8,  // incomplete remove
+    offset (408),
+    A151, 32, // 17. S1 RCA5.1
+    A17I, 8,  // incomplete remove
+    offset (432),
+    A152, 32, // 18. S1 RCA5.2
+    A18I, 8,  // incomplete remove
+    offset (456),
+    A153, 32, // 19. S1 RCA5.3
+    A19I, 8,  // incomplete remove
+    offset (480),
+    A120, 32, // 20. S1 RCA2.0
+    A20I, 8,  // incomplete remove
+    offset (504),
+    A121, 32, // 21 S1 RCA2.1
+    A21I, 8,  // incomplete remove
+    offset (528),
+    A122, 32, // 22. S1 RCA2.2
+    A22I, 8,  // incomplete remove
+    offset (552),
+    A123, 32, // 23. S1 RCA2.3
+    A23I, 8,  // incomplete remove
+    offset (576)
+  }
diff --git a/Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S0.asi b/Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S0.asi
index b6cf18fb2218..e57a2a9ffd63 100644
--- a/Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S0.asi
+++ b/Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S0.asi
@@ -6,6 +6,15 @@
 
 **/
 
+Include ("MHPP.asi")
+
+// @DoorBellNS1 0x1000.0054.1000. Out-Offset: 0x10
+OperationRegion(DNS1, SystemMemory, 0x100000541010 , 8)
+Field (DNS1, DWordAcc, NoLock, Preserve) {
+  OUTV, 32,
+  DIN0, 32,
+}
+
 // PCI2 RCA2
 Device (PCI2) {
   //
@@ -997,6 +1006,274 @@ Device (PCI4) {
     Name (_ADR, 0x00000000)
   }
 
+  //
+  // Root Port 1
+  //
+  Device (P2P1) {
+    //
+    // Device 1, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00010000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 1 [01])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A040 == 0xF0000400) { // SW ejected ?
+          Store(0x02000400, A040) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000212, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000212 to DBNS1_10
+          Return(0xF)
+        }
+        elseif (A040 == 0x10000400) { // ejected complete ?
+          Store(0x02000400, A040) // clear action value
+          Return(0x0)
+        }
+        elseif ((A040 == 0x01000400) || (A040 == 0x0F000400)) { // inserted?
+          if (A04I == 0x00) {
+            Store(0x02000400, A040) // clear action value
+          }
+          Return(0xF)
+        }
+        elseif ((A040 == 0x0E000400) || (A040 == 0x0F000400)) { // inprogress inserted?
+          if (A04I == 0x00) {
+            Store(0x02000400, A040) // clear action value
+          }
+          Return(0xF)
+        }
+        else {
+          Return(0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A040 == 0x02000400) { // really sw ejection call?
+          Store(0xF0000400, A040) // set SW ejection action
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000212, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000212 to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000001)
+    }
+  }
+
+  //
+  // Root Port 2
+  //
+  Device (P2P2) {
+    //
+    // Device 2, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00020000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 2 [02])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A041 == 0xF0010400) { // SW ejected ?
+          Store(0x02010400, A041) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000222, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000222 to DBNS1_10
+          Return(0xF)
+        }
+        elseif (A041 == 0x10010400) { // ejected complete ?
+          Store(0x02010400, A041) // clear action value
+          Return(0x0)
+        }
+        elseif ((A041 == 0x01010400) || (A041 == 0x0F010400)) { // inserted?
+          if (A04I == 0x00) {
+            Store(0x02010400, A041) // clear action value
+          }
+          Return(0xF)
+        }
+        elseif ((A041 == 0x0E010400) || (A041 == 0x0F010400)) { // inprogress inserted?
+          if (A04I == 0x00) {
+            Store(0x02010400, A041) // clear action value
+          }
+          Return(0xF)
+        }
+        else {
+          Return(0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A041 == 0x02010400) { // really sw ejection call?
+          Store(0xF0010400, A041) // set SW ejection action
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000222, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000222 to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000002)
+    }
+  }
+
+  //
+  // Root Port 3
+  //
+  Device (P2P3) {
+    //
+    // Device 3, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00030000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 3 [03])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A042 == 0xF0020400) { // SW ejected ?
+          Store(0x02020400, A042) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000232, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000232 to DBNS1_10
+          Return(0xF)
+        }
+        elseif (A042 == 0x10020400) { // ejected complete ?
+          Store(0x02020400, A042) // clear action value
+          Return(0x0)
+        }
+        elseif ((A042 == 0x01020400) || (A042 == 0x0F020400)) { // inserted?
+          if (A06I == 0x00) {
+            Store(0x02020400, A042) // clear action value
+          }
+          Return(0xF)
+        }
+        elseif ((A042 == 0x0E020400) || (A042 == 0x0F020400)) { // inprogress inserted?
+          if (A06I == 0x00) {
+            Store(0x02020400, A042) // clear action value
+          }
+          Return(0xF)
+        }
+        else {
+          Return(0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A042 == 0x02020400) { // really sw ejection call?
+          Store(0xF0020400, A042) // set SW ejection action
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000232, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000232 to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000003)
+    }
+  }
+
+  //
+  // Root Port 4
+  //
+  Device (P2P4) {
+    //
+    // Device 4, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00040000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 4 ([04])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A043 == 0xF0030400) { // SW ejected ?
+          Store(0x02030400, A043) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000242, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000242 to DBNS1_10
+          Return(0xF)
+        }
+        elseif(A043 == 0x10030400) { // ejected complete ?
+          Store(0x02030400, A043) // clear action value
+          Return(0x0)
+        }
+        elseif((A043 == 0x01030400) || (A043 == 0x0F030400)) { // inserted ?
+          if (A07I == 0x00) {
+            Store(0x02030400, A043) // clear action value
+          }
+          Return(0xF)
+        }
+        elseif((A043 == 0x0E030400) || (A043 == 0x0F030400)) { // inprogress inserted ?
+          if (A07I == 0x00) {
+            Store(0x02030400, A043) // clear action value
+          }
+          Return(0xF)
+        }
+        else {
+          Return(0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A043 == 0x02030400) { // really sw ejection call?
+          Store(0xF0030400, A043) // set SW ejection value
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000242, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000242 to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000004)
+    }
+  }
+
   Method (_PXM, 0, NotSerialized) {
     // Patch by code
     Return(0xFF)
@@ -1341,6 +1618,274 @@ Device (PCI5) {
     Name (_ADR, 0x00000000)
   }
 
+  //
+  // Root Port 1
+  //
+  Device (P2P1) {
+    //
+    // Device 1, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00010000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 1 [01])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A050 == 0xF0000500) { // SW ejected ?
+          Store(0x02000500, A050) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000213, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000213 to DBNS1_10
+          Return(0xF)
+        }
+        elseif (A050 == 0x10000500) { // ejected complete ?
+          Store(0x02000500, A050) // clear action value
+          Return(0x0)
+        }
+        elseif ((A050 == 0x01000500) || (A050 == 0x0F000500)) { // inserted?
+          if (A00I == 0x00) {
+            Store(0x02000500, A050) // clear action value
+          }
+          Return(0xF)
+        }
+        elseif ((A050 == 0x0E000500) || (A050 == 0x0F000500)) { // inprogress inserted?
+          if (A00I == 0x00) {
+            Store(0x02000500, A050) // clear action value
+          }
+          Return(0xF)
+        }
+        else {
+          Return(0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A050 == 0x02000500) { // really sw ejection call?
+          Store(0xF0000500, A050) // set SW ejection action
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000213, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000213 to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000001)
+    }
+  }
+
+  //
+  // Root Port 2
+  //
+  Device (P2P2) {
+    //
+    // Device 2, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00020000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 2 [02])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A051 == 0xF0010500) { // SW ejected ?
+          Store(0x02010500, A051) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000223, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000223 to DBNS1_10
+          Return(0xF)
+        }
+        elseif (A051 == 0x10010500) { // ejected complete ?
+          Store(0x02010500, A051) // clear action value
+          Return(0x0)
+        }
+        elseif ((A051 == 0x01010500) || (A051 == 0x0F010500)) { // inserted?
+          if (A01I == 0x00) {
+            Store(0x02010500, A051) // clear action value
+          }
+          Return(0xF)
+        }
+        elseif ((A051 == 0x0E010500) || (A051 == 0x0F010500)) { // inprogress inserted?
+          if (A01I == 0x00) {
+            Store(0x02010500, A051) // clear action value
+          }
+          Return(0xF)
+        }
+        else {
+          Return(0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A051 == 0x02010500) { // really sw ejection call?
+          Store(0xF0010500, A051) // set SW ejection action
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000223, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000223 to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000002)
+    }
+  }
+
+  //
+  // Root Port 3
+  //
+  Device (P2P3) {
+    //
+    // Device 3, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00030000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 3 [03])
+      // Slot 0 (Device 0), Function 0
+  //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A052 == 0xF0020500) { // SW ejected ?
+          Store(0x02020500, A052) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000233, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000233 to DBNS1_10
+          Return(0xF)
+        }
+        elseif (A052 == 0x10020500) { // ejected complete ?
+          Store(0x02020500, A052) // clear action value
+          Return(0x0)
+        }
+        elseif ((A052 == 0x01020500) || (A052 == 0x0F020500)) { // inserted?
+          if (A02I == 0x00) {
+            Store(0x02020500, A052) // clear action value
+          }
+          Return(0xF)
+        }
+        elseif ((A052 == 0x0E020500) || (A052 == 0x0F020500)) { // inprogress inserted?
+          if (A02I == 0x00) {
+            Store(0x02020500, A052) // clear action value
+          }
+          Return(0xF)
+        }
+        else {
+          Return(0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A052 == 0x02020500) { // really sw ejection call?
+          Store(0xF0020500, A052) // set SW ejection action
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000233, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000233 to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000003)
+    }
+  }
+
+  //
+  // Root Port 4
+  //
+  Device (P2P4) {
+    //
+    // Device 4, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00040000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 4 ([04])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A053 == 0xF0030500) { // SW ejected ?
+          Store(0x02030500, A053) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000243, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000243 to DBNS1_10
+          Return(0xF)
+        }
+        elseif(A053 == 0x10030500) { // ejected complete ?
+          Store(0x02030500, A053) // clear action value
+          Return(0x0)
+        }
+        elseif((A053 == 0x01030500) || (A053 == 0x0F030500)) { // inserted ?
+          if (A03I == 0x00) {
+            Store(0x02030500, A053) // clear action value
+          }
+          Return(0xF)
+        }
+        elseif((A053 == 0x0E030500) || (A053 == 0x0F030500)) { // inprogress inserted ?
+          if (A03I == 0x00) {
+            Store(0x02030500, A053) // clear action value
+          }
+          Return(0xF)
+        }
+        else {
+          Return(0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A053 == 0x02030500) { // really sw ejection call?
+          Store(0xF0030500, A053) // set SW ejection value
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000243, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000243 to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000004)
+    }
+  }
+
   Method (_PXM, 0, NotSerialized) {
     // Patch by code
     Return(0xFF)
diff --git a/Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S1.asi b/Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S1.asi
index cb03247895a6..72548fc8030a 100644
--- a/Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S1.asi
+++ b/Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S1.asi
@@ -330,6 +330,274 @@ Device (PCIA) {
     Name (_ADR, 0x00000000)
   }
 
+  //
+  // Root Port 1
+  //
+  Device (P2P1) {
+    //
+    // Device 1, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00010000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 1 ([01])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A120 == 0xF0000201) { // SW ejected before ?
+          Store(0x02000201, A120) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000216, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000216 to DBNS1_10
+          Return (0xF)
+        }
+        elseif (A120 == 0x10000201) { // ejected completed ?
+          Store(0x02000201, A120) // clear action value
+          Return (0x0)
+        }
+        elseif ((A120 == 0x01000201) || (A120 == 0x0F000201)) { // inserted ?
+          if (A20I == 0x00) {
+            Store(0x02000201, A120) // clear action value
+          }
+          Return (0xF)
+        }
+        elseif ((A120 == 0x0E000201) || (A120 == 0x0F000201)) { // inprogress inserted ?
+          if (A20I == 0x00) {
+            Store(0x02000201, A120) // clear action value
+          }
+          Return (0xF)
+        }
+        else {
+          Return (0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A120 == 0x02000201) { // is sw ejection?
+          Store(0xF0000201, A120) // set SW ejection event
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000216, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000216 to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000001)
+    }
+  }
+
+  //
+  // Root Port 2
+  //
+  Device (P2P2) {
+    //
+    // Device 2, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00020000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 2 ([02])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A121 == 0xF0010201) { // SW ejected before ?
+          Store(0x02010201, A121) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000226, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000226 to DBNS1_10
+          Return(0xF)
+        }
+        elseif (A121 == 0x10010201) { // ejected completed ?
+          Store(0x02010201, A121) // clear action value
+          Return(0x0)
+        }
+        elseif ((A121 == 0x01010201) || (A121 == 0x0F010201)) { // inserted ?
+          if (A21I == 0x00) {
+            Store(0x02010201, A121) // clear action value
+          }
+          Return(0xF)
+        }
+        elseif ((A121 == 0x0E010201) || (A121 == 0x0F010201)) { // inprogress inserted ?
+          if (A21I == 0x00) {
+            Store(0x02010201, A121) // clear action value
+          }
+          Return(0xF)
+        }
+        else {
+          Return (0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A121 == 0x02010201) { // is sw ejection?
+          Store(0xF0010201, A121) // set SW ejection event
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000226, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000226 to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000002)
+    }
+  }
+
+  //
+  // Root Port 3
+  //
+  Device (P2P3) {
+    //
+    // Device 3, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00030000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 3 [03])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A122 == 0xF0020201) { // SW ejected before ?
+          Store(0x02020201, A122) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000236, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000236 to DBNS1_10
+          Return(0xF)
+        }
+        elseif (A122 == 0x10020201) { // ejected complete ?
+          Store(0x02020201, A122) // clear action value
+          Return (0x0)
+        }
+        elseif ((A122 == 0x01020201) || (A122 == 0x0F020201)) { // inserted ?
+          if (A22I == 0x00) {
+            Store(0x02020201, A122) // clear action value
+          }
+          Return (0xF)
+        }
+        elseif ((A122 == 0x0E020201) || (A122 == 0x0F020201)) { // inprogess inserted ?
+          if (A22I == 0x00) {
+            Store(0x02020201, A122) // clear action value
+          }
+          Return (0xF)
+        }
+        else {
+          Return (0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A122 == 0x02020201) { // is sw ejection?
+          Store(0xF0020201, A122) // set SW ejection event
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000236, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000236 to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000003)
+    }
+  }
+
+  //
+  // Root Port 4
+  //
+  Device (P2P4) {
+    //
+    // Device 4, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00040000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 4 [04])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A123 == 0xF0030201) { // SW ejected before ?
+          Store(0x02030201, A123) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000246, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000246 to DBNS1_10
+          Return(0xF)
+        }
+        elseif (A123 == 0x10030201) { // ejected complete ?
+          Store(0x02030201, A123) // clear action value
+          Return (0x0)
+        }
+        elseif ((A123 == 0x01030201) || (A123 == 0x0F030201)) { // inserted ?
+          if (A23I == 0x00) {
+            Store(0x02030201, A123) // clear action value
+          }
+          Return (0xF)
+        }
+        elseif ((A123 == 0x0E030201) || (A123 == 0x0F030201)) { // inprogress inserted ?
+          if (A23I == 0x00) {
+            Store(0x02030201, A123) // clear action value
+          }
+          Return (0xF)
+        }
+        else {
+          Return (0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A123 == 0x02030201) { // is sw ejection?
+          Store(0xF0030201, A123) // set ejection event
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000246, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000246 to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000004)
+    }
+  }
+
   Method (_PXM, 0, NotSerialized) {
     // Patch by code
     Return(0xFF)
@@ -1350,6 +1618,274 @@ Device (PCID) {
     Name (_ADR, 0x00000000)
   }
 
+  //
+  // Root Port 1
+  //
+  Device (P2P1) {
+    //
+    // Device 1, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00010000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 1 [01])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A150 == 0xF0000501) { // SW ejected ?
+          Store(0x02000501, A150) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000219, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000219 to DBNS1_10
+          Return(0xF)
+        }
+        elseif (A150 == 0x10000501) { // ejected complete ?
+          Store(0x02000501, A150) // clear action value
+          Return(0x0)
+        }
+        elseif ((A150 == 0x01000501) || (A150 == 0x0F000501)) { // inserted?
+          if (A16I == 0x00) {
+            Store(0x02000501, A150) // clear action value
+          }
+          Return(0xF)
+        }
+        elseif ((A150 == 0x0E000501) || (A150 == 0x0F000501)) { // inprogress inserted?
+          if (A16I == 0x00) {
+            Store(0x02000501, A150) // clear action value
+          }
+          Return(0xF)
+        }
+        else {
+          Return(0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A150 == 0x02000501) { // really sw ejection call?
+          Store(0xF0000501, A150) // set SW ejection action
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000219, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000219 to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000001)
+    }
+  }
+
+  //
+  // Root Port 2
+  //
+  Device (P2P2) {
+    //
+    // Device 2, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00020000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 2 [02])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A151 == 0xF0010501) { // SW ejected ?
+          Store(0x02010501, A151) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000229, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000229 to DBNS1_10
+          Return(0xF)
+        }
+        elseif (A151 == 0x10010501) { // ejected complete ?
+          Store(0x02010501, A151) // clear action value
+          Return(0x0)
+        }
+        elseif ((A151 == 0x01010501) || (A151 == 0x0F010501)) { // inserted?
+          if (A17I == 0x00) {
+            Store(0x02010501, A151) // clear action value
+          }
+          Return(0xF)
+        }
+        elseif ((A151 == 0x0E010501) || (A151 == 0x0F010501)) { // inprogress inserted?
+          if (A17I == 0x00) {
+            Store(0x02010501, A151) // clear action value
+          }
+          Return(0xF)
+        }
+        else {
+          Return(0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A151 == 0x02010501) { // really sw ejection call?
+          Store(0xF0010501, A151) // set SW ejection action
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000229, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000229 to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000002)
+    }
+  }
+
+  //
+  // Root Port 3
+  //
+  Device (P2P3) {
+    //
+    // Device 3, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00030000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 3 [03])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A152 == 0xF0020501) { // SW ejected ?
+          Store(0x02020501, A152) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000239, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000239 to DBNS1_10
+          Return(0xF)
+        }
+        elseif (A152 == 0x10020501) { // ejected complete ?
+          Store(0x02020501, A152) // clear action value
+          Return(0x0)
+        }
+        elseif ((A152 == 0x01020501) || (A152 == 0x0F020501)) { // inserted?
+          if (A18I == 0x00) {
+            Store(0x02020501, A152) // clear action value
+          }
+          Return(0xF)
+        }
+        elseif ((A152 == 0x0E020501) || (A152 == 0x0F020501)) { // inprogress inserted?
+          if (A18I == 0x00) {
+            Store(0x02020501, A152) // clear action value
+          }
+          Return(0xF)
+        }
+        else {
+          Return(0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A152 == 0x02020501) { // really sw ejection call?
+          Store(0xF0020501, A152) // set SW ejection action
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000239, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000239 to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000003)
+    }
+  }
+
+  //
+  // Root Port 4
+  //
+  Device (P2P4) {
+    //
+    // Device 4, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00040000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 4 ([04])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A153 == 0xF0030501) { // SW ejected ?
+          Store(0x02030501, A153) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000249, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000249 to DBNS1_10
+          Return(0xF)
+        }
+        elseif(A153 == 0x10030501) { // ejected complete ?
+          Store(0x02030501, A153) // clear action value
+          Return(0x0)
+        }
+        elseif((A153 == 0x01030501) || (A153 == 0x0F030501)) { // inserted ?
+          if (A19I == 0x00) {
+            Store(0x02030501, A153) // clear action value
+          }
+          Return(0xF)
+        }
+        elseif((A153 == 0x0E030501) || (A153 == 0x0F030501)) { // inprogress inserted ?
+          if (A19I == 0x00) {
+            Store(0x02030501, A153) // clear action value
+          }
+          Return(0xF)
+        }
+        else {
+          Return(0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A153 == 0x02030501) { // really sw ejection call?
+          Store(0xF0030501, A153) // set SW ejection value
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x68000249, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x68000249 to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000004)
+    }
+  }
+
   Method (_PXM, 0, NotSerialized) {
     // Patch by code
     Return(0xFF)
@@ -1697,6 +2233,274 @@ Device (PCIE) {
     Name (_ADR, 0x00000000)
   }
 
+  //
+  // Root Port 1
+  //
+  Device (P2P1) {
+    //
+    // Device 1, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00010000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 1 ([01])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A160 == 0xF0000601) { // SW ejected before ?
+          Store(0x02000601, A160) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x6800021A, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x6800021A to DBNS1_10
+          Return(0xF)
+        }
+        elseif (A160 == 0x10000601) { // ejected complete ?
+          Store(0x02000601, A160) // clear action value
+          Return (0x0)
+        }
+        elseif ((A160 == 0x01000601) || (A160 == 0x0F000601)){ // inserted ?
+          if (A11I == 0x00) {
+            Store(0x02000601, A160) // clear action value
+          }
+          Return (0xF)
+        }
+        elseif ((A160 == 0x0E000601) || (A160 == 0x0F000601)) { // inprogress inserted ?
+          if (A11I == 0x00) {
+            Store(0x02000601, A160) // clear action value
+          }
+          Return (0xF)
+        }
+        else {
+          Return (0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A160 == 0x02000601) { // is sw ejection?
+          Store(0xF0000601, A160) // set SW ejection event
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x6800021A, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x6800021A to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000001)
+    }
+  }
+
+  //
+  // Root Port 2
+  //
+  Device (P2P2) {
+    //
+    // Device 2, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00020000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 2 [02])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A161 == 0xF0010601) { // SW ejected before ?
+          Store(0x02010601, A161) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x6800022A, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x6800022A to DBNS1_10
+          Return(0xF)
+        }
+        elseif (A161 == 0x10010601) { // ejected completed ?
+          Store(0x02010601, A161) // clear action value
+          Return (0x0)
+        }
+        elseif ((A161 == 0x01010601) || (A161 == 0x0F010601)){ // inserted ?
+          if (A10I == 0x00) {
+            Store(0x02010601, A161) // clear action value
+          }
+          Return (0xF)
+        }
+        elseif ((A161 == 0x0E010601) || (A161 == 0x0F010601)) { // inprogress inserted ?
+          if (A10I == 0x00) {
+            Store(0x02010601, A161) // clear action value
+          }
+          Return (0xF)
+        }
+        else {
+          Return (0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A161 == 0x02010601) { // is sw ejection?
+          Store(0xF0010601, A161) // set SW ejection event
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x6800022A, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x6800022A to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000002)
+    }
+  }
+
+  //
+  // Root Port 3
+  //
+  Device (P2P3) {
+    //
+    // Device 3, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00030000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 3 [03])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A162 == 0xF0020601) { // SW ejected before ?
+          Store(0x02020601, A162) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x6800023A, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x6800023A to DBNS1_10
+          Return(0xF)
+        }
+        elseif (A162 == 0x10020601) { // ejected complete ?
+          Store(0x02020601, A162) // clear action value
+          Return (0x0)
+        }
+        elseif ((A162 == 0x01020601) || (A162 == 0x0F020601)) { // inserted ?
+          if (A09I == 0x00) {
+            Store(0x02020601, A162) // clear action value
+          }
+          Return (0xF)
+        }
+        elseif ((A162 == 0x0E020601) || (A162 == 0x0F020601)) { // inprogress inserted ?
+          if (A09I == 0x00) {
+            Store(0x02020601, A162) // clear action value
+          }
+          Return (0xF)
+        }
+        else {
+          Return (0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A162 == 0x02020601) { // is sw ejection?
+          Store(0xF0020601, A162) // set SW ejection event
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x6800023A, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x6800023A to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000003)
+    }
+  }
+
+  //
+  // Root Port 4
+  //
+  Device (P2P4) {
+    //
+    // Device 4, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00040000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 4 ([04])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A163 == 0xF0030601) { // SW ejected before ?
+          Store(0x02030601, A163) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x6800024A, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x6800024A to DBNS1_10
+          Return(0xF)
+        }
+        elseif (A163 == 0x10030601) { // ejected complete ?
+          Store(0x02030601, A163) // clear action value
+          Return (0x0)
+        }
+        elseif ((A163 == 0x01030601) || (A163 == 0x0F030601)) { // inserted ?
+          if (A08I == 0x00) {
+            Store(0x02030601, A163) // clear action value
+          }
+          Return (0xF)
+        }
+        elseif ((A163 == 0x0E030601) || (A163 == 0x0F030601)) { // inprogress inserted ?
+          if (A08I == 0x00) {
+            Store(0x02030601, A163) // clear action value
+          }
+          Return (0xF)
+        }
+        else {
+          Return (0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A163 == 0x02030601) { // is sw ejection?
+          Store(0xF0030601, A163) // set SW ejection event
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x6800024A, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x6800024A to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000004)
+    }
+  }
+
   Method (_PXM, 0, NotSerialized) {
     // Patch by code
     Return(0xFF)
@@ -2044,6 +2848,274 @@ Device (PCIF) {
     Name (_ADR, 0x00000000)
   }
 
+  //
+  // Root Port 1
+  //
+  Device (P2P1) {
+    //
+    // Device 1, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00010000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 1 ([01])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A170 == 0xF0000701) { // SW ejected before ?
+          Store(0x02000701, A170) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x6800021B, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x6800021B to DBNS1_10
+          Return(0xF)
+        }
+        elseif (A170 == 0x10000701) { // ejected complete ?
+          Store(0x02000701, A170) // clear action value
+          Return (0x0)
+        }
+        elseif ((A170 == 0x01000701) || (A170 == 0x0F000701)){ // inserted ?
+          if (A15I == 0x00) {
+            Store(0x02000701, A170) // clear action value
+          }
+          Return (0xF)
+        }
+        elseif ((A170 == 0x0E000701) || (A170 == 0x0F000701)) { // inprogress inserted ?
+          if (A15I == 0x00) {
+            Store(0x02000701, A170) // clear action value
+          }
+          Return (0xF)
+        }
+        else {
+          Return (0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A170 == 0x02000701) { // is sw ejection?
+          Store(0xF0000701, A170) // set SW ejection event
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x6800021B, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x6800021B to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000001)
+    }
+  }
+
+  //
+  // Root Port 2
+  //
+  Device (P2P2) {
+    //
+    // Device 2, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00020000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 2 [02])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A171 == 0xF0010701) { // SW ejected before ?
+          Store(0x02010701, A171) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x6800022B, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x6800022B to DBNS1_10
+          Return(0xF)
+        }
+        elseif (A171 == 0x10010701) { // ejected completed ?
+          Store(0x02010701, A171) // clear action value
+          Return (0x0)
+        }
+        elseif ((A171 == 0x01010701) || (A171 == 0x0F010701)){ // inserted ?
+          if (A14I == 0x00) {
+            Store(0x02010701, A171) // clear action value
+          }
+          Return (0xF)
+        }
+        elseif ((A171 == 0x0E010701) || (A171 == 0x0F010701)) { // inprogress inserted ?
+          if (A14I == 0x00) {
+            Store(0x02010701, A171) // clear action value
+          }
+          Return (0xF)
+        }
+        else {
+          Return (0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A171 == 0x02010701) { // is sw ejection?
+          Store(0xF0010701, A171) // set SW ejection event
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x6800022B, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x6800022B to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000002)
+    }
+  }
+
+  //
+  // Root Port 3
+  //
+  Device (P2P3) {
+    //
+    // Device 3, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00030000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 3 [03])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A172 == 0xF0020701) { // SW ejected before ?
+          Store(0x02020701, A172) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x6800023B, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x6800023B to DBNS1_10
+          Return(0xF)
+        }
+        elseif (A172 == 0x10020701) { // ejected complete ?
+          Store(0x02020701, A172) // clear action value
+          Return (0x0)
+        }
+        elseif ((A172 == 0x01020701) || (A172 == 0x0F020701)) { // inserted ?
+          if (A13I == 0x00) {
+            Store(0x02020701, A172) // clear action value
+          }
+          Return (0xF)
+        }
+        elseif ((A172 == 0x0E020701) || (A172 == 0x0F020701)) { // inprogress inserted ?
+          if (A13I == 0x00) {
+            Store(0x02020701, A172) // clear action value
+          }
+          Return (0xF)
+        }
+        else {
+          Return (0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A172 == 0x02020701) { // is sw ejection?
+          Store(0xF0020701, A172) // set SW ejection event
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x6800023B, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x6800023B to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000003)
+    }
+  }
+
+  //
+  // Root Port 4
+  //
+  Device (P2P4) {
+    //
+    // Device 4, Function 0 (Bus 0).
+    //
+
+    Name (_ADR, 0x00040000)
+    Name(_HPP, Package(){0x08,0x40, 0x01, 0x00})
+
+    Device (S0F0) {
+      //
+      // On Bus 4 ([04])
+      // Slot 0 (Device 0), Function 0
+      //
+
+      Name (_ADR, 0x00000000)
+
+      Method (_STA, 0) {
+        if (A173 == 0xF0030701) { // SW ejected before ?
+          Store(0x02030701, A173) // clear action value
+          Store(0x680000A4, DIN0) // Off RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x6800024B, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x6800024B to DBNS1_10
+          Return(0xF)
+        }
+        elseif (A173 == 0x10030701) { // ejected complete ?
+          Store(0x02030701, A173) // clear action value
+          Return (0x0)
+        }
+        elseif ((A173 == 0x01030701) || (A173 == 0x0F030701)) { // inserted ?
+          if (A12I == 0x00) {
+            Store(0x02030701, A173) // clear action value
+          }
+          Return (0xF)
+        }
+        elseif ((A173 == 0x0E030701) || (A173 == 0x0F030701)) { // inprogress inserted ?
+          if (A12I == 0x00) {
+            Store(0x02030701, A173) // clear action value
+          }
+          Return (0xF)
+        }
+        else {
+          Return (0xF)
+        }
+      }
+
+      Method (_EJ0, 1) {
+        if (A173 == 0x02030701) { // is sw ejection?
+          Store(0xF0030701, A173) // set SW ejection event
+          Store(0x680000B4, DIN0) // Blink RED LED
+                                  // <Led:6-7.Led_action:4-5.Ampere_HP_CMD:0-3>
+                                  // Ampere_HP_CMD: LED_CMD = 4, HP_CHG_CMD = 3
+          Store(0x6800024B, OUTV) // <MsgType(0x6)-Hdlr(0x8).Resv.action.dev.segment>
+                                  // action: Insert = 1 & Remove = 2
+                                  // 0x6800024B to DBNS1_10
+        }
+      }
+
+      Name(_SUN, 0x00000004)
+    }
+  }
+
   Method (_PXM, 0, NotSerialized) {
     // Patch by code
     Return(0xFF)
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [edk2-platforms][PATCH 6/6] AmpereAltraPkg: Enable NVMe Hot Plug feature
  2023-05-11  8:10 [edk2-platforms][PATCH 0/6] Support NVMe Hot Plug feature for Ampere Altra and Ampere Altra Max Minh Nguyen
                   ` (4 preceding siblings ...)
  2023-05-11  8:10 ` [edk2-platforms][PATCH 5/6] JadePkg: Support ACPI tables for Hot Plug of Ampere Altra Max Minh Nguyen
@ 2023-05-11  8:10 ` Minh Nguyen
  2023-06-02 12:37 ` [edk2-platforms][PATCH 0/6] Support NVMe Hot Plug feature for Ampere Altra and Ampere Altra Max Ard Biesheuvel
  6 siblings, 0 replies; 8+ messages in thread
From: Minh Nguyen @ 2023-05-11  8:10 UTC (permalink / raw)
  To: devel
  Cc: patches, quic_llindhol, ardb+tianocore, nhi, tinhnguyen,
	Vu Nguyen, Minh Nguyen

From: Vu Nguyen <vunguyen@os.amperecomputing.com>

This enables NVMe Hot Plug feature after finishing
PCIe set up. This helps to detect NVMe disk when
it's removed or inserted into its slot.

Signed-off-by: Minh Nguyen <minhnguyen1@os.amperecomputing.com>
---
 Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf | 3 ++-
 Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.c   | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf
index 32d60bec1440..f9d5c927fca3 100644
--- a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf
+++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf
@@ -1,6 +1,6 @@
 ## @file
 #
-# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR>
+# Copyright (c) 2020 - 2023, Ampere Computing LLC. All rights reserved.<BR>
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -30,6 +30,7 @@ [LibraryClasses]
   BoardPcieLib
   DebugLib
   HobLib
+  PcieHotPlugLib
   PeimEntryPoint
   PeiServicesLib
 
diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.c
index 598a2e64d02f..bf4395d48d40 100644
--- a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.c
+++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.c
@@ -16,6 +16,7 @@
 #include <Library/DebugLib.h>
 #include <Library/HobLib.h>
 #include <Library/Ac01PcieLib.h>
+#include <Library/PcieHotPlugLib.h>
 #include <Library/PeiServicesLib.h>
 #include <Platform/Ac01.h>
 #include <Ppi/ReadOnlyVariable2.h>
@@ -207,6 +208,8 @@ PcieInitEntry (
 
   Ac01PcieCorePostSetupRC (mRootComplexList);
 
+  PcieHotPlugStart ();
+
   //
   // Build Root Complex info Hob
   //
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [edk2-platforms][PATCH 0/6] Support NVMe Hot Plug feature for Ampere Altra and Ampere Altra Max
  2023-05-11  8:10 [edk2-platforms][PATCH 0/6] Support NVMe Hot Plug feature for Ampere Altra and Ampere Altra Max Minh Nguyen
                   ` (5 preceding siblings ...)
  2023-05-11  8:10 ` [edk2-platforms][PATCH 6/6] AmpereAltraPkg: Enable NVMe Hot Plug feature Minh Nguyen
@ 2023-06-02 12:37 ` Ard Biesheuvel
  6 siblings, 0 replies; 8+ messages in thread
From: Ard Biesheuvel @ 2023-06-02 12:37 UTC (permalink / raw)
  To: Minh Nguyen
  Cc: devel, patches, quic_llindhol, ardb+tianocore, nhi, tinhnguyen

On Thu, 11 May 2023 at 10:10, Minh Nguyen
<minhnguyen1@os.amperecomputing.com> wrote:
>
> These patches support NVMe Hot Plug feature for Ampere Altra and Ampere Altra Max.
>
> Minh Nguyen (2):
>   AmpereAltraPkg: Add Hot Plug Slot Capable during PCIe port
>     initialization
>   AmpereAltraPkg: Change PCIe Amba Link Timeout value
>
> Vu Nguyen (4):
>   AmpereAltraPkg: Add PCIe Hot Plug library
>   JadePkg: Support ACPI tables for Hot Plug of Ampere Altra
>   JadePkg: Support ACPI tables for Hot Plug of Ampere Altra Max
>   AmpereAltraPkg: Enable NVMe Hot Plug feature
>

Pushed as a869bae89a6d..38170a4175a6

Thanks,

>  Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec                        |    8 +-
>  Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec                    |   13 +
>  Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc                    |    1 +
>  Platform/Ampere/JadePkg/Jade.dsc                                        |   66 ++
>  Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf       |    3 +-
>  Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.inf |   37 +
>  Silicon/Ampere/AmpereAltraPkg/Include/Library/PcieHotPlugLib.h          |  162 +++
>  Silicon/Ampere/AmpereSiliconPkg/Include/Library/PcieHotPlugPortMapLib.h |   81 ++
>  Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.c         |    3 +
>  Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c            |   13 +-
>  Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.c   |  397 ++++++++
>  Platform/Ampere/JadePkg/Ac02AcpiTables/CommonDevices.asi                |   24 +
>  Platform/Ampere/JadePkg/Ac02AcpiTables/Dsdt.asl                         |  511 ++++++++++
>  Platform/Ampere/JadePkg/Ac02AcpiTables/MHPP.asi                         |   92 ++
>  Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S0.asi                       |  545 ++++++++++
>  Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S1.asi                       | 1072 +++++++++++++++++++
>  Platform/Ampere/JadePkg/AcpiTables/Dsdt.asl                             |  499 ++++++++-
>  Platform/Ampere/JadePkg/AcpiTables/MHPP.asi                             |  127 +++
>  Platform/Ampere/JadePkg/AcpiTables/PCI-S0.asi                           |  548 +++++++++-
>  Platform/Ampere/JadePkg/AcpiTables/PCI-S1.asi                           | 1074 +++++++++++++++++++-
>  20 files changed, 5269 insertions(+), 7 deletions(-)
>  create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.inf
>  create mode 100644 Silicon/Ampere/AmpereAltraPkg/Include/Library/PcieHotPlugLib.h
>  create mode 100644 Silicon/Ampere/AmpereSiliconPkg/Include/Library/PcieHotPlugPortMapLib.h
>  create mode 100644 Silicon/Ampere/AmpereAltraPkg/Library/PcieHotPlugLib/PcieHotPlugLib.c
>  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/MHPP.asi
>  create mode 100644 Platform/Ampere/JadePkg/AcpiTables/MHPP.asi
>
> --
> 2.39.0
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-06-02 12:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-11  8:10 [edk2-platforms][PATCH 0/6] Support NVMe Hot Plug feature for Ampere Altra and Ampere Altra Max Minh Nguyen
2023-05-11  8:10 ` [edk2-platforms][PATCH 1/6] AmpereAltraPkg: Add PCIe Hot Plug library Minh Nguyen
2023-05-11  8:10 ` [edk2-platforms][PATCH 2/6] AmpereAltraPkg: Add Hot Plug Slot Capable during PCIe port initialization Minh Nguyen
2023-05-11  8:10 ` [edk2-platforms][PATCH 3/6] AmpereAltraPkg: Change PCIe Amba Link Timeout value Minh Nguyen
2023-05-11  8:10 ` [edk2-platforms][PATCH 4/6] JadePkg: Support ACPI tables for Hot Plug of Ampere Altra Minh Nguyen
2023-05-11  8:10 ` [edk2-platforms][PATCH 5/6] JadePkg: Support ACPI tables for Hot Plug of Ampere Altra Max Minh Nguyen
2023-05-11  8:10 ` [edk2-platforms][PATCH 6/6] AmpereAltraPkg: Enable NVMe Hot Plug feature Minh Nguyen
2023-06-02 12:37 ` [edk2-platforms][PATCH 0/6] Support NVMe Hot Plug feature for Ampere Altra and Ampere Altra Max Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox