public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v4] MdePkg/Include: Add IPMI KCS definitions
@ 2023-03-24  3:15 Chang, Abner
  2023-03-24  3:43 ` [edk2-devel] " Tinh Nguyen
  2023-03-24 19:37 ` Michael D Kinney
  0 siblings, 2 replies; 7+ messages in thread
From: Chang, Abner @ 2023-03-24  3:15 UTC (permalink / raw)
  To: devel
  Cc: Michael D Kinney, Liming Gao, Zhiguang Liu, Nickle Wang,
	Igor Kulchytskyy, Isaac Oram, Abdul Lateef Attar

From: Abner Chang <abner.chang@amd.com>

BZ #4354
This change adds definitions for IPMI KCS.

Spec ref:
https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/ipmi-second-gen-interface-spec-v2-rev1-1.html

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
Acked-by: Isaac Oram <isaac.w.oram@intel.com>
---
 MdePkg/MdePkg.dec                         |  6 ++
 MdePkg/Include/IndustryStandard/IpmiKcs.h | 76 +++++++++++++++++++++++
 2 files changed, 82 insertions(+)
 create mode 100644 MdePkg/Include/IndustryStandard/IpmiKcs.h

diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 2d643bede1d..5cf04bc0cb6 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -9,6 +9,7 @@
 # (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development LP<BR>
 # Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
 # Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.<BR>
+# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -2342,6 +2343,11 @@
   # @Prompt Memory Address of GuidedExtractHandler Table.
   gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x1000000|UINT64|0x30001015
 
+  ## This value is the IPMI KCS Interface I/O base address used to transmit IPMI commands.
+  #  The value of 0xca2 is the default I/O base address defined in IPMI specification.
+  # @Prompt IPMI KCS Interface I/O Base Address
+  gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsIoBaseAddress|0xca2|UINT16|0x00000031
+
 [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
   ## This value is used to set the base address of PCI express hierarchy.
   # @Prompt PCI Express Base Address.
diff --git a/MdePkg/Include/IndustryStandard/IpmiKcs.h b/MdePkg/Include/IndustryStandard/IpmiKcs.h
new file mode 100644
index 00000000000..1e1be787617
--- /dev/null
+++ b/MdePkg/Include/IndustryStandard/IpmiKcs.h
@@ -0,0 +1,76 @@
+/** @file
+  IPMI KCS Register Definitions
+
+  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Revision Reference:
+  IPMI Specification
+  Version 2.0, Rev. 1.1
+  https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/ipmi-second-gen-interface-spec-v2-rev1-1.html
+**/
+
+#ifndef IPMI_KCS_H_
+#define IPMI_KCS_H_
+
+#define IPMI_KCS_STATUS_REGISTER_OFFSET    1
+#define IPMI_KCS_COMMAND_REGISTER_OFFSET   1
+#define IPMI_KCS_DATA_OUT_REGISTER_OFFSET  0
+#define IPMI_KCS_DATA_IN_REGISTER_OFFSET   0
+
+///
+/// IPMI KCS Interface Status Bits
+///
+#define IPMI_KCS_OBF           BIT0
+#define IPMI_KCS_IBF           BIT1
+#define IPMI_KCS_SMS_ATN       BIT2
+#define IPMI_KCS_COMMAND_DATA  BIT3
+#define IPMI_KCS_OEM1          BIT4
+#define IPMI_KCS_OEM2          BIT5
+#define IPMI_KCS_S0            BIT6
+#define IPMI_KCS_S1            BIT7
+
+///
+/// IPMI KCS Interface Control Codes
+///
+#define IPMI_KCS_CONTROL_CODE_GET_STATUS_ABORT  0x60
+#define IPMI_KCS_CONTROL_CODE_WRITE_START       0x61
+#define IPMI_KCS_CONTROL_CODE_WRITE_END         0x62
+#define IPMI_KCS_CONTROL_CODE_READ              0x68
+
+///
+/// Status Codes
+///
+#define IPMI_KCS_STATUS_NO_ERROR      0x00
+#define IPMI_KCS_STATUS_ABORT         0x01
+#define IPMI_KCS_STATUS_ILLEGAL       0x02
+#define IPMI_KCS_STATUS_LENGTH_ERROR  0x06
+#define IPMI_KCS_STATUS_UNSPECIFIED   0xFF
+
+///
+/// KCS Interface State Bit
+///
+typedef enum {
+  IPMI_KCS_IDLE_STATE = 0,
+  IPMI_KCS_READ_STATE,
+  IPMI_KCS_WRITE_STATE,
+  IPMI_KCS_ERROR_STATE
+} IPMI_KCS_STATE;
+
+///
+/// IPMI KCS Interface Request Format
+///
+typedef struct {
+  UINT8    NetFunc;
+  UINT8    Command;
+  UINT8    Data[];
+} IPMI_KCS_RESQUEST_HEADER;
+
+///
+/// IPMI KCS Interface Response Format
+///
+typedef struct {
+  UINT8    NetFunc;
+  UINT8    Command;
+} IPMI_KCS_RESPONSE_HEADER;
+#endif
-- 
2.37.1.windows.1


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

* Re: [edk2-devel] [PATCH v4] MdePkg/Include: Add IPMI KCS definitions
  2023-03-24  3:15 [PATCH v4] MdePkg/Include: Add IPMI KCS definitions Chang, Abner
@ 2023-03-24  3:43 ` Tinh Nguyen
  2023-03-24  9:05   ` Chang, Abner
  2023-03-24  9:16   ` Chang, Abner
  2023-03-24 19:37 ` Michael D Kinney
  1 sibling, 2 replies; 7+ messages in thread
From: Tinh Nguyen @ 2023-03-24  3:43 UTC (permalink / raw)
  To: devel, abner.chang
  Cc: Michael D Kinney, Liming Gao, Zhiguang Liu, Nickle Wang,
	Igor Kulchytskyy, Isaac Oram, Abdul Lateef Attar


On 24/03/2023 10:15, Chang, Abner via groups.io wrote:
> From: Abner Chang <abner.chang@amd.com>
>
> BZ #4354
> This change adds definitions for IPMI KCS.
>
> Spec ref:
> https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/ipmi-second-gen-interface-spec-v2-rev1-1.html
>
> Signed-off-by: Abner Chang <abner.chang@amd.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> Cc: Isaac Oram <isaac.w.oram@intel.com>
> Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
> Acked-by: Isaac Oram <isaac.w.oram@intel.com>
> ---
>   MdePkg/MdePkg.dec                         |  6 ++
>   MdePkg/Include/IndustryStandard/IpmiKcs.h | 76 +++++++++++++++++++++++
>   2 files changed, 82 insertions(+)
>   create mode 100644 MdePkg/Include/IndustryStandard/IpmiKcs.h
>
> diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
> index 2d643bede1d..5cf04bc0cb6 100644
> --- a/MdePkg/MdePkg.dec
> +++ b/MdePkg/MdePkg.dec
> @@ -9,6 +9,7 @@
>   # (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development LP<BR>
>   # Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
>   # Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.<BR>
> +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
>   #
>   # SPDX-License-Identifier: BSD-2-Clause-Patent
>   #
> @@ -2342,6 +2343,11 @@
>     # @Prompt Memory Address of GuidedExtractHandler Table.
>     gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x1000000|UINT64|0x30001015
>   
> +  ## This value is the IPMI KCS Interface I/O base address used to transmit IPMI commands.
> +  #  The value of 0xca2 is the default I/O base address defined in IPMI specification.
> +  # @Prompt IPMI KCS Interface I/O Base Address
> +  gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsIoBaseAddress|0xca2|UINT16|0x00000031
> +
>   [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
>     ## This value is used to set the base address of PCI express hierarchy.
>     # @Prompt PCI Express Base Address.
> diff --git a/MdePkg/Include/IndustryStandard/IpmiKcs.h b/MdePkg/Include/IndustryStandard/IpmiKcs.h
> new file mode 100644
> index 00000000000..1e1be787617
> --- /dev/null
> +++ b/MdePkg/Include/IndustryStandard/IpmiKcs.h
> @@ -0,0 +1,76 @@
> +/** @file
> +  IPMI KCS Register Definitions
> +
> +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +  @par Revision Reference:
> +  IPMI Specification
> +  Version 2.0, Rev. 1.1
> +  https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/ipmi-second-gen-interface-spec-v2-rev1-1.html
> +**/
> +
> +#ifndef IPMI_KCS_H_
> +#define IPMI_KCS_H_
> +
> +#define IPMI_KCS_STATUS_REGISTER_OFFSET    1
> +#define IPMI_KCS_COMMAND_REGISTER_OFFSET   1
> +#define IPMI_KCS_DATA_OUT_REGISTER_OFFSET  0
> +#define IPMI_KCS_DATA_IN_REGISTER_OFFSET   0
> +
> +///
> +/// IPMI KCS Interface Status Bits
> +///
> +#define IPMI_KCS_OBF           BIT0
> +#define IPMI_KCS_IBF           BIT1
> +#define IPMI_KCS_SMS_ATN       BIT2
> +#define IPMI_KCS_COMMAND_DATA  BIT3
> +#define IPMI_KCS_OEM1          BIT4
> +#define IPMI_KCS_OEM2          BIT5
> +#define IPMI_KCS_S0            BIT6
> +#define IPMI_KCS_S1            BIT7
> +
> +///
> +/// IPMI KCS Interface Control Codes
> +///
> +#define IPMI_KCS_CONTROL_CODE_GET_STATUS_ABORT  0x60
> +#define IPMI_KCS_CONTROL_CODE_WRITE_START       0x61
> +#define IPMI_KCS_CONTROL_CODE_WRITE_END         0x62
> +#define IPMI_KCS_CONTROL_CODE_READ              0x68
> +
> +///
> +/// Status Codes
> +///
> +#define IPMI_KCS_STATUS_NO_ERROR      0x00
> +#define IPMI_KCS_STATUS_ABORT         0x01
> +#define IPMI_KCS_STATUS_ILLEGAL       0x02
> +#define IPMI_KCS_STATUS_LENGTH_ERROR  0x06
> +#define IPMI_KCS_STATUS_UNSPECIFIED   0xFF
> +
> +///
> +/// KCS Interface State Bit
> +///
> +typedef enum {
> +  IPMI_KCS_IDLE_STATE = 0,
> +  IPMI_KCS_READ_STATE,
> +  IPMI_KCS_WRITE_STATE,
> +  IPMI_KCS_ERROR_STATE
> +} IPMI_KCS_STATE;
> +
> +///
> +/// IPMI KCS Interface Request Format
> +///
> +typedef struct {
> +  UINT8    NetFunc;
> +  UINT8    Command;
> +  UINT8    Data[];
> +} IPMI_KCS_RESQUEST_HEADER;
I mean, there's a typo here, IPMI_KCS_REQUEST_HEADER
> +
> +///
> +/// IPMI KCS Interface Response Format
> +///
> +typedef struct {
> +  UINT8    NetFunc;
> +  UINT8    Command;
> +} IPMI_KCS_RESPONSE_HEADER;
> +#endif

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

* Re: [edk2-devel] [PATCH v4] MdePkg/Include: Add IPMI KCS definitions
  2023-03-24  3:43 ` [edk2-devel] " Tinh Nguyen
@ 2023-03-24  9:05   ` Chang, Abner
  2023-03-24  9:16   ` Chang, Abner
  1 sibling, 0 replies; 7+ messages in thread
From: Chang, Abner @ 2023-03-24  9:05 UTC (permalink / raw)
  To: Tinh Nguyen, devel@edk2.groups.io
  Cc: Michael D Kinney, Liming Gao, Zhiguang Liu, Nickle Wang,
	Igor Kulchytskyy, Isaac Oram, Attar, AbdulLateef (Abdul Lateef)

[AMD Official Use Only - General]



> -----Original Message-----
> From: Tinh Nguyen <tinhnguyen@amperemail.onmicrosoft.com>
> Sent: Friday, March 24, 2023 11:43 AM
> To: devel@edk2.groups.io; Chang, Abner <Abner.Chang@amd.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>; Liming Gao
> <gaoliming@byosoft.com.cn>; Zhiguang Liu <zhiguang.liu@intel.com>; Nickle
> Wang <nicklew@nvidia.com>; Igor Kulchytskyy <igork@ami.com>; Isaac
> Oram <isaac.w.oram@intel.com>; Attar, AbdulLateef (Abdul Lateef)
> <AbdulLateef.Attar@amd.com>
> Subject: Re: [edk2-devel] [PATCH v4] MdePkg/Include: Add IPMI KCS
> definitions
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> On 24/03/2023 10:15, Chang, Abner via groups.io wrote:
> > From: Abner Chang <abner.chang@amd.com>
> >
> > BZ #4354
> > This change adds definitions for IPMI KCS.
> >
> > Spec ref:
> >
> https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/i
> pm
> > i-second-gen-interface-spec-v2-rev1-1.html
> >
> > Signed-off-by: Abner Chang <abner.chang@amd.com>
> > Cc: Michael D Kinney <michael.d.kinney@intel.com>
> > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> > Cc: Nickle Wang <nicklew@nvidia.com>
> > Cc: Igor Kulchytskyy <igork@ami.com>
> > Cc: Isaac Oram <isaac.w.oram@intel.com>
> > Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
> > Acked-by: Isaac Oram <isaac.w.oram@intel.com>
> > ---
> >   MdePkg/MdePkg.dec                         |  6 ++
> >   MdePkg/Include/IndustryStandard/IpmiKcs.h | 76
> +++++++++++++++++++++++
> >   2 files changed, 82 insertions(+)
> >   create mode 100644 MdePkg/Include/IndustryStandard/IpmiKcs.h
> >
> > diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index
> > 2d643bede1d..5cf04bc0cb6 100644
> > --- a/MdePkg/MdePkg.dec
> > +++ b/MdePkg/MdePkg.dec
> > @@ -9,6 +9,7 @@
> >   # (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development
> LP<BR>
> >   # Copyright (c) 2022, Loongson Technology Corporation Limited. All rights
> reserved.<BR>
> >   # Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.<BR>
> > +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> > +reserved.<BR>
> >   #
> >   # SPDX-License-Identifier: BSD-2-Clause-Patent
> >   #
> > @@ -2342,6 +2343,11 @@
> >     # @Prompt Memory Address of GuidedExtractHandler Table.
> >
> >
> gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x1000
> 000
> > |UINT64|0x30001015
> >
> > +  ## This value is the IPMI KCS Interface I/O base address used to transmit
> IPMI commands.
> > +  #  The value of 0xca2 is the default I/O base address defined in IPMI
> specification.
> > +  # @Prompt IPMI KCS Interface I/O Base Address
> > +
> > +
> gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsIoBaseAddress|0xca2|UINT16|0x00
> 00
> > + 0031
> > +
> >   [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
> >     ## This value is used to set the base address of PCI express hierarchy.
> >     # @Prompt PCI Express Base Address.
> > diff --git a/MdePkg/Include/IndustryStandard/IpmiKcs.h
> > b/MdePkg/Include/IndustryStandard/IpmiKcs.h
> > new file mode 100644
> > index 00000000000..1e1be787617
> > --- /dev/null
> > +++ b/MdePkg/Include/IndustryStandard/IpmiKcs.h
> > @@ -0,0 +1,76 @@
> > +/** @file
> > +  IPMI KCS Register Definitions
> > +
> > +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> > + reserved.<BR>
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +  @par Revision Reference:
> > +  IPMI Specification
> > +  Version 2.0, Rev. 1.1
> > +
> >
> +https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/
> ip
> > +mi-second-gen-interface-spec-v2-rev1-1.html
> > +**/
> > +
> > +#ifndef IPMI_KCS_H_
> > +#define IPMI_KCS_H_
> > +
> > +#define IPMI_KCS_STATUS_REGISTER_OFFSET    1
> > +#define IPMI_KCS_COMMAND_REGISTER_OFFSET   1
> > +#define IPMI_KCS_DATA_OUT_REGISTER_OFFSET  0
> > +#define IPMI_KCS_DATA_IN_REGISTER_OFFSET   0
> > +
> > +///
> > +/// IPMI KCS Interface Status Bits
> > +///
> > +#define IPMI_KCS_OBF           BIT0
> > +#define IPMI_KCS_IBF           BIT1
> > +#define IPMI_KCS_SMS_ATN       BIT2
> > +#define IPMI_KCS_COMMAND_DATA  BIT3
> > +#define IPMI_KCS_OEM1          BIT4
> > +#define IPMI_KCS_OEM2          BIT5
> > +#define IPMI_KCS_S0            BIT6
> > +#define IPMI_KCS_S1            BIT7
> > +
> > +///
> > +/// IPMI KCS Interface Control Codes
> > +///
> > +#define IPMI_KCS_CONTROL_CODE_GET_STATUS_ABORT  0x60
> > +#define IPMI_KCS_CONTROL_CODE_WRITE_START       0x61
> > +#define IPMI_KCS_CONTROL_CODE_WRITE_END         0x62
> > +#define IPMI_KCS_CONTROL_CODE_READ              0x68
> > +
> > +///
> > +/// Status Codes
> > +///
> > +#define IPMI_KCS_STATUS_NO_ERROR      0x00
> > +#define IPMI_KCS_STATUS_ABORT         0x01
> > +#define IPMI_KCS_STATUS_ILLEGAL       0x02
> > +#define IPMI_KCS_STATUS_LENGTH_ERROR  0x06
> > +#define IPMI_KCS_STATUS_UNSPECIFIED   0xFF
> > +
> > +///
> > +/// KCS Interface State Bit
> > +///
> > +typedef enum {
> > +  IPMI_KCS_IDLE_STATE = 0,
> > +  IPMI_KCS_READ_STATE,
> > +  IPMI_KCS_WRITE_STATE,
> > +  IPMI_KCS_ERROR_STATE
> > +} IPMI_KCS_STATE;
> > +
> > +///
> > +/// IPMI KCS Interface Request Format /// typedef struct {
> > +  UINT8    NetFunc;
> > +  UINT8    Command;
> > +  UINT8    Data[];
> > +} IPMI_KCS_RESQUEST_HEADER;
> I mean, there's a typo here, IPMI_KCS_REQUEST_HEADER
Will fix it. Thanks.

Abner


> > +
> > +///
> > +/// IPMI KCS Interface Response Format /// typedef struct {
> > +  UINT8    NetFunc;
> > +  UINT8    Command;
> > +} IPMI_KCS_RESPONSE_HEADER;
> > +#endif

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

* Re: [edk2-devel] [PATCH v4] MdePkg/Include: Add IPMI KCS definitions
  2023-03-24  3:43 ` [edk2-devel] " Tinh Nguyen
  2023-03-24  9:05   ` Chang, Abner
@ 2023-03-24  9:16   ` Chang, Abner
  1 sibling, 0 replies; 7+ messages in thread
From: Chang, Abner @ 2023-03-24  9:16 UTC (permalink / raw)
  To: Tinh Nguyen, devel@edk2.groups.io
  Cc: Michael D Kinney, Liming Gao, Zhiguang Liu, Nickle Wang,
	Igor Kulchytskyy, Isaac Oram, Attar, AbdulLateef (Abdul Lateef)

[AMD Official Use Only - General]

Hi Tinh,
V5 was sent to correct typo.
Thanks
Abner

> -----Original Message-----
> From: Tinh Nguyen <tinhnguyen@amperemail.onmicrosoft.com>
> Sent: Friday, March 24, 2023 11:43 AM
> To: devel@edk2.groups.io; Chang, Abner <Abner.Chang@amd.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>; Liming Gao
> <gaoliming@byosoft.com.cn>; Zhiguang Liu <zhiguang.liu@intel.com>; Nickle
> Wang <nicklew@nvidia.com>; Igor Kulchytskyy <igork@ami.com>; Isaac
> Oram <isaac.w.oram@intel.com>; Attar, AbdulLateef (Abdul Lateef)
> <AbdulLateef.Attar@amd.com>
> Subject: Re: [edk2-devel] [PATCH v4] MdePkg/Include: Add IPMI KCS
> definitions
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> On 24/03/2023 10:15, Chang, Abner via groups.io wrote:
> > From: Abner Chang <abner.chang@amd.com>
> >
> > BZ #4354
> > This change adds definitions for IPMI KCS.
> >
> > Spec ref:
> >
> https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/i
> pm
> > i-second-gen-interface-spec-v2-rev1-1.html
> >
> > Signed-off-by: Abner Chang <abner.chang@amd.com>
> > Cc: Michael D Kinney <michael.d.kinney@intel.com>
> > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> > Cc: Nickle Wang <nicklew@nvidia.com>
> > Cc: Igor Kulchytskyy <igork@ami.com>
> > Cc: Isaac Oram <isaac.w.oram@intel.com>
> > Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
> > Acked-by: Isaac Oram <isaac.w.oram@intel.com>
> > ---
> >   MdePkg/MdePkg.dec                         |  6 ++
> >   MdePkg/Include/IndustryStandard/IpmiKcs.h | 76
> +++++++++++++++++++++++
> >   2 files changed, 82 insertions(+)
> >   create mode 100644 MdePkg/Include/IndustryStandard/IpmiKcs.h
> >
> > diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index
> > 2d643bede1d..5cf04bc0cb6 100644
> > --- a/MdePkg/MdePkg.dec
> > +++ b/MdePkg/MdePkg.dec
> > @@ -9,6 +9,7 @@
> >   # (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development
> LP<BR>
> >   # Copyright (c) 2022, Loongson Technology Corporation Limited. All rights
> reserved.<BR>
> >   # Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.<BR>
> > +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> > +reserved.<BR>
> >   #
> >   # SPDX-License-Identifier: BSD-2-Clause-Patent
> >   #
> > @@ -2342,6 +2343,11 @@
> >     # @Prompt Memory Address of GuidedExtractHandler Table.
> >
> >
> gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x1000
> 000
> > |UINT64|0x30001015
> >
> > +  ## This value is the IPMI KCS Interface I/O base address used to transmit
> IPMI commands.
> > +  #  The value of 0xca2 is the default I/O base address defined in IPMI
> specification.
> > +  # @Prompt IPMI KCS Interface I/O Base Address
> > +
> > +
> gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsIoBaseAddress|0xca2|UINT16|0x00
> 00
> > + 0031
> > +
> >   [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
> >     ## This value is used to set the base address of PCI express hierarchy.
> >     # @Prompt PCI Express Base Address.
> > diff --git a/MdePkg/Include/IndustryStandard/IpmiKcs.h
> > b/MdePkg/Include/IndustryStandard/IpmiKcs.h
> > new file mode 100644
> > index 00000000000..1e1be787617
> > --- /dev/null
> > +++ b/MdePkg/Include/IndustryStandard/IpmiKcs.h
> > @@ -0,0 +1,76 @@
> > +/** @file
> > +  IPMI KCS Register Definitions
> > +
> > +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> > + reserved.<BR>
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +  @par Revision Reference:
> > +  IPMI Specification
> > +  Version 2.0, Rev. 1.1
> > +
> >
> +https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/
> ip
> > +mi-second-gen-interface-spec-v2-rev1-1.html
> > +**/
> > +
> > +#ifndef IPMI_KCS_H_
> > +#define IPMI_KCS_H_
> > +
> > +#define IPMI_KCS_STATUS_REGISTER_OFFSET    1
> > +#define IPMI_KCS_COMMAND_REGISTER_OFFSET   1
> > +#define IPMI_KCS_DATA_OUT_REGISTER_OFFSET  0
> > +#define IPMI_KCS_DATA_IN_REGISTER_OFFSET   0
> > +
> > +///
> > +/// IPMI KCS Interface Status Bits
> > +///
> > +#define IPMI_KCS_OBF           BIT0
> > +#define IPMI_KCS_IBF           BIT1
> > +#define IPMI_KCS_SMS_ATN       BIT2
> > +#define IPMI_KCS_COMMAND_DATA  BIT3
> > +#define IPMI_KCS_OEM1          BIT4
> > +#define IPMI_KCS_OEM2          BIT5
> > +#define IPMI_KCS_S0            BIT6
> > +#define IPMI_KCS_S1            BIT7
> > +
> > +///
> > +/// IPMI KCS Interface Control Codes
> > +///
> > +#define IPMI_KCS_CONTROL_CODE_GET_STATUS_ABORT  0x60
> > +#define IPMI_KCS_CONTROL_CODE_WRITE_START       0x61
> > +#define IPMI_KCS_CONTROL_CODE_WRITE_END         0x62
> > +#define IPMI_KCS_CONTROL_CODE_READ              0x68
> > +
> > +///
> > +/// Status Codes
> > +///
> > +#define IPMI_KCS_STATUS_NO_ERROR      0x00
> > +#define IPMI_KCS_STATUS_ABORT         0x01
> > +#define IPMI_KCS_STATUS_ILLEGAL       0x02
> > +#define IPMI_KCS_STATUS_LENGTH_ERROR  0x06
> > +#define IPMI_KCS_STATUS_UNSPECIFIED   0xFF
> > +
> > +///
> > +/// KCS Interface State Bit
> > +///
> > +typedef enum {
> > +  IPMI_KCS_IDLE_STATE = 0,
> > +  IPMI_KCS_READ_STATE,
> > +  IPMI_KCS_WRITE_STATE,
> > +  IPMI_KCS_ERROR_STATE
> > +} IPMI_KCS_STATE;
> > +
> > +///
> > +/// IPMI KCS Interface Request Format /// typedef struct {
> > +  UINT8    NetFunc;
> > +  UINT8    Command;
> > +  UINT8    Data[];
> > +} IPMI_KCS_RESQUEST_HEADER;
> I mean, there's a typo here, IPMI_KCS_REQUEST_HEADER
> > +
> > +///
> > +/// IPMI KCS Interface Response Format /// typedef struct {
> > +  UINT8    NetFunc;
> > +  UINT8    Command;
> > +} IPMI_KCS_RESPONSE_HEADER;
> > +#endif

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

* Re: [PATCH v4] MdePkg/Include: Add IPMI KCS definitions
  2023-03-24  3:15 [PATCH v4] MdePkg/Include: Add IPMI KCS definitions Chang, Abner
  2023-03-24  3:43 ` [edk2-devel] " Tinh Nguyen
@ 2023-03-24 19:37 ` Michael D Kinney
  2023-03-25 13:46   ` Chang, Abner
  1 sibling, 1 reply; 7+ messages in thread
From: Michael D Kinney @ 2023-03-24 19:37 UTC (permalink / raw)
  To: abner.chang@amd.com, devel@edk2.groups.io
  Cc: Gao, Liming, Liu, Zhiguang, Nickle Wang, Igor Kulchytskyy,
	Oram, Isaac W, Abdul Lateef Attar, Kinney, Michael D

Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>

> -----Original Message-----
> From: abner.chang@amd.com <abner.chang@amd.com>
> Sent: Thursday, March 23, 2023 8:16 PM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>;
> Nickle Wang <nicklew@nvidia.com>; Igor Kulchytskyy <igork@ami.com>; Oram, Isaac W <isaac.w.oram@intel.com>; Abdul Lateef Attar
> <AbdulLateef.Attar@amd.com>
> Subject: [PATCH v4] MdePkg/Include: Add IPMI KCS definitions
> 
> From: Abner Chang <abner.chang@amd.com>
> 
> BZ #4354
> This change adds definitions for IPMI KCS.
> 
> Spec ref:
> https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/ipmi-second-gen-interface-spec-v2-rev1-1.html
> 
> Signed-off-by: Abner Chang <abner.chang@amd.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> Cc: Isaac Oram <isaac.w.oram@intel.com>
> Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
> Acked-by: Isaac Oram <isaac.w.oram@intel.com>
> ---
>  MdePkg/MdePkg.dec                         |  6 ++
>  MdePkg/Include/IndustryStandard/IpmiKcs.h | 76 +++++++++++++++++++++++
>  2 files changed, 82 insertions(+)
>  create mode 100644 MdePkg/Include/IndustryStandard/IpmiKcs.h
> 
> diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
> index 2d643bede1d..5cf04bc0cb6 100644
> --- a/MdePkg/MdePkg.dec
> +++ b/MdePkg/MdePkg.dec
> @@ -9,6 +9,7 @@
>  # (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development LP<BR>
>  # Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
>  # Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.<BR>
> +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
>  #
>  # SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -2342,6 +2343,11 @@
>    # @Prompt Memory Address of GuidedExtractHandler Table.
>    gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x1000000|UINT64|0x30001015
> 
> +  ## This value is the IPMI KCS Interface I/O base address used to transmit IPMI commands.
> +  #  The value of 0xca2 is the default I/O base address defined in IPMI specification.
> +  # @Prompt IPMI KCS Interface I/O Base Address
> +  gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsIoBaseAddress|0xca2|UINT16|0x00000031
> +
>  [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
>    ## This value is used to set the base address of PCI express hierarchy.
>    # @Prompt PCI Express Base Address.
> diff --git a/MdePkg/Include/IndustryStandard/IpmiKcs.h b/MdePkg/Include/IndustryStandard/IpmiKcs.h
> new file mode 100644
> index 00000000000..1e1be787617
> --- /dev/null
> +++ b/MdePkg/Include/IndustryStandard/IpmiKcs.h
> @@ -0,0 +1,76 @@
> +/** @file
> +  IPMI KCS Register Definitions
> +
> +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +  @par Revision Reference:
> +  IPMI Specification
> +  Version 2.0, Rev. 1.1
> +  https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/ipmi-second-gen-interface-spec-v2-rev1-1.html
> +**/
> +
> +#ifndef IPMI_KCS_H_
> +#define IPMI_KCS_H_
> +
> +#define IPMI_KCS_STATUS_REGISTER_OFFSET    1
> +#define IPMI_KCS_COMMAND_REGISTER_OFFSET   1
> +#define IPMI_KCS_DATA_OUT_REGISTER_OFFSET  0
> +#define IPMI_KCS_DATA_IN_REGISTER_OFFSET   0
> +
> +///
> +/// IPMI KCS Interface Status Bits
> +///
> +#define IPMI_KCS_OBF           BIT0
> +#define IPMI_KCS_IBF           BIT1
> +#define IPMI_KCS_SMS_ATN       BIT2
> +#define IPMI_KCS_COMMAND_DATA  BIT3
> +#define IPMI_KCS_OEM1          BIT4
> +#define IPMI_KCS_OEM2          BIT5
> +#define IPMI_KCS_S0            BIT6
> +#define IPMI_KCS_S1            BIT7
> +
> +///
> +/// IPMI KCS Interface Control Codes
> +///
> +#define IPMI_KCS_CONTROL_CODE_GET_STATUS_ABORT  0x60
> +#define IPMI_KCS_CONTROL_CODE_WRITE_START       0x61
> +#define IPMI_KCS_CONTROL_CODE_WRITE_END         0x62
> +#define IPMI_KCS_CONTROL_CODE_READ              0x68
> +
> +///
> +/// Status Codes
> +///
> +#define IPMI_KCS_STATUS_NO_ERROR      0x00
> +#define IPMI_KCS_STATUS_ABORT         0x01
> +#define IPMI_KCS_STATUS_ILLEGAL       0x02
> +#define IPMI_KCS_STATUS_LENGTH_ERROR  0x06
> +#define IPMI_KCS_STATUS_UNSPECIFIED   0xFF
> +
> +///
> +/// KCS Interface State Bit
> +///
> +typedef enum {
> +  IPMI_KCS_IDLE_STATE = 0,
> +  IPMI_KCS_READ_STATE,
> +  IPMI_KCS_WRITE_STATE,
> +  IPMI_KCS_ERROR_STATE
> +} IPMI_KCS_STATE;
> +
> +///
> +/// IPMI KCS Interface Request Format
> +///
> +typedef struct {
> +  UINT8    NetFunc;
> +  UINT8    Command;
> +  UINT8    Data[];
> +} IPMI_KCS_RESQUEST_HEADER;
> +
> +///
> +/// IPMI KCS Interface Response Format
> +///
> +typedef struct {
> +  UINT8    NetFunc;
> +  UINT8    Command;
> +} IPMI_KCS_RESPONSE_HEADER;
> +#endif
> --
> 2.37.1.windows.1


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

* Re: [PATCH v4] MdePkg/Include: Add IPMI KCS definitions
  2023-03-24 19:37 ` Michael D Kinney
@ 2023-03-25 13:46   ` Chang, Abner
  2023-03-25 14:19     ` Tinh Nguyen
  0 siblings, 1 reply; 7+ messages in thread
From: Chang, Abner @ 2023-03-25 13:46 UTC (permalink / raw)
  To: Kinney, Michael D, devel@edk2.groups.io
  Cc: Gao, Liming, Liu, Zhiguang, Nickle Wang, Igor Kulchytskyy,
	Oram, Isaac W, Attar, AbdulLateef (Abdul Lateef), Tinh Nguyen

[-- Attachment #1: Type: text/plain, Size: 6486 bytes --]

[AMD Official Use Only - General]

Hi Mike, please note  there is V5 of IPMI KCS that fixes a typo found by Tinh.
Thanks

@Tinh, would you like to provide your R-B or Acked-by tag for V5?

Thanks
Abner

> -----Original Message-----
> From: Kinney, Michael D <michael.d.kinney@intel.com>
> Sent: Saturday, March 25, 2023 3:37 AM
> To: Chang, Abner <Abner.Chang@amd.com>; devel@edk2.groups.io
> Cc: Gao, Liming <gaoliming@byosoft.com.cn>; Liu, Zhiguang
> <zhiguang.liu@intel.com>; Nickle Wang <nicklew@nvidia.com>; Igor
> Kulchytskyy <igork@ami.com>; Oram, Isaac W <isaac.w.oram@intel.com>;
> Attar, AbdulLateef (Abdul Lateef) <AbdulLateef.Attar@amd.com>; Kinney,
> Michael D <michael.d.kinney@intel.com>
> Subject: RE: [PATCH v4] MdePkg/Include: Add IPMI KCS definitions
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
> 
> > -----Original Message-----
> > From: abner.chang@amd.com <abner.chang@amd.com>
> > Sent: Thursday, March 23, 2023 8:16 PM
> > To: devel@edk2.groups.io
> > Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming
> > <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>;
> > Nickle Wang <nicklew@nvidia.com>; Igor Kulchytskyy <igork@ami.com>;
> > Oram, Isaac W <isaac.w.oram@intel.com>; Abdul Lateef Attar
> > <AbdulLateef.Attar@amd.com>
> > Subject: [PATCH v4] MdePkg/Include: Add IPMI KCS definitions
> >
> > From: Abner Chang <abner.chang@amd.com>
> >
> > BZ #4354
> > This change adds definitions for IPMI KCS.
> >
> > Spec ref:
> >
> https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/i
> pm
> > i-second-gen-interface-spec-v2-rev1-1.html
> >
> > Signed-off-by: Abner Chang <abner.chang@amd.com>
> > Cc: Michael D Kinney <michael.d.kinney@intel.com>
> > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> > Cc: Nickle Wang <nicklew@nvidia.com>
> > Cc: Igor Kulchytskyy <igork@ami.com>
> > Cc: Isaac Oram <isaac.w.oram@intel.com>
> > Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
> > Acked-by: Isaac Oram <isaac.w.oram@intel.com>
> > ---
> >  MdePkg/MdePkg.dec                         |  6 ++
> >  MdePkg/Include/IndustryStandard/IpmiKcs.h | 76
> > +++++++++++++++++++++++
> >  2 files changed, 82 insertions(+)
> >  create mode 100644 MdePkg/Include/IndustryStandard/IpmiKcs.h
> >
> > diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index
> > 2d643bede1d..5cf04bc0cb6 100644
> > --- a/MdePkg/MdePkg.dec
> > +++ b/MdePkg/MdePkg.dec
> > @@ -9,6 +9,7 @@
> >  # (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development
> > LP<BR>  # Copyright (c) 2022, Loongson Technology Corporation Limited.
> > All rights reserved.<BR>  # Copyright (c) 2021 - 2022, Arm Limited.
> > All rights reserved.<BR>
> > +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> > +reserved.<BR>
> >  #
> >  # SPDX-License-Identifier: BSD-2-Clause-Patent  # @@ -2342,6 +2343,11
> > @@
> >    # @Prompt Memory Address of GuidedExtractHandler Table.
> >
> >
> gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x1000
> 000
> > |UINT64|0x30001015
> >
> > +  ## This value is the IPMI KCS Interface I/O base address used to transmit
> IPMI commands.
> > +  #  The value of 0xca2 is the default I/O base address defined in IPMI
> specification.
> > +  # @Prompt IPMI KCS Interface I/O Base Address
> > +
> > +
> gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsIoBaseAddress|0xca2|UINT16|0x00
> 00
> > + 0031
> > +
> >  [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
> >    ## This value is used to set the base address of PCI express hierarchy.
> >    # @Prompt PCI Express Base Address.
> > diff --git a/MdePkg/Include/IndustryStandard/IpmiKcs.h
> > b/MdePkg/Include/IndustryStandard/IpmiKcs.h
> > new file mode 100644
> > index 00000000000..1e1be787617
> > --- /dev/null
> > +++ b/MdePkg/Include/IndustryStandard/IpmiKcs.h
> > @@ -0,0 +1,76 @@
> > +/** @file
> > +  IPMI KCS Register Definitions
> > +
> > +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> > + reserved.<BR>
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +  @par Revision Reference:
> > +  IPMI Specification
> > +  Version 2.0, Rev. 1.1
> > +
> >
> +https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/
> ip
> > +mi-second-gen-interface-spec-v2-rev1-1.html
> > +**/
> > +
> > +#ifndef IPMI_KCS_H_
> > +#define IPMI_KCS_H_
> > +
> > +#define IPMI_KCS_STATUS_REGISTER_OFFSET    1
> > +#define IPMI_KCS_COMMAND_REGISTER_OFFSET   1
> > +#define IPMI_KCS_DATA_OUT_REGISTER_OFFSET  0
> > +#define IPMI_KCS_DATA_IN_REGISTER_OFFSET   0
> > +
> > +///
> > +/// IPMI KCS Interface Status Bits
> > +///
> > +#define IPMI_KCS_OBF           BIT0
> > +#define IPMI_KCS_IBF           BIT1
> > +#define IPMI_KCS_SMS_ATN       BIT2
> > +#define IPMI_KCS_COMMAND_DATA  BIT3
> > +#define IPMI_KCS_OEM1          BIT4
> > +#define IPMI_KCS_OEM2          BIT5
> > +#define IPMI_KCS_S0            BIT6
> > +#define IPMI_KCS_S1            BIT7
> > +
> > +///
> > +/// IPMI KCS Interface Control Codes
> > +///
> > +#define IPMI_KCS_CONTROL_CODE_GET_STATUS_ABORT  0x60
> > +#define IPMI_KCS_CONTROL_CODE_WRITE_START       0x61
> > +#define IPMI_KCS_CONTROL_CODE_WRITE_END         0x62
> > +#define IPMI_KCS_CONTROL_CODE_READ              0x68
> > +
> > +///
> > +/// Status Codes
> > +///
> > +#define IPMI_KCS_STATUS_NO_ERROR      0x00
> > +#define IPMI_KCS_STATUS_ABORT         0x01
> > +#define IPMI_KCS_STATUS_ILLEGAL       0x02
> > +#define IPMI_KCS_STATUS_LENGTH_ERROR  0x06
> > +#define IPMI_KCS_STATUS_UNSPECIFIED   0xFF
> > +
> > +///
> > +/// KCS Interface State Bit
> > +///
> > +typedef enum {
> > +  IPMI_KCS_IDLE_STATE = 0,
> > +  IPMI_KCS_READ_STATE,
> > +  IPMI_KCS_WRITE_STATE,
> > +  IPMI_KCS_ERROR_STATE
> > +} IPMI_KCS_STATE;
> > +
> > +///
> > +/// IPMI KCS Interface Request Format /// typedef struct {
> > +  UINT8    NetFunc;
> > +  UINT8    Command;
> > +  UINT8    Data[];
> > +} IPMI_KCS_RESQUEST_HEADER;
> > +
> > +///
> > +/// IPMI KCS Interface Response Format /// typedef struct {
> > +  UINT8    NetFunc;
> > +  UINT8    Command;
> > +} IPMI_KCS_RESPONSE_HEADER;
> > +#endif
> > --
> > 2.37.1.windows.1

[-- Attachment #2: Type: message/rfc822, Size: 14864 bytes --]

From: "Chang, Abner via groups.io" <abner.chang=amd.com@groups.io>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Michael D Kinney <michael.d.kinney@intel.com>, Liming Gao <gaoliming@byosoft.com.cn>, Zhiguang Liu <zhiguang.liu@intel.com>, Nickle Wang <nicklew@nvidia.com>, Igor Kulchytskyy <igork@ami.com>, Isaac Oram <isaac.w.oram@intel.com>, "Attar, AbdulLateef (Abdul Lateef)" <AbdulLateef.Attar@amd.com>
Subject: [edk2-devel] [PATCH v5] MdePkg/Include: Add IPMI KCS definitions
Date: Fri, 24 Mar 2023 09:14:18 +0000
Message-ID: <174F50201D0D38A5.19937@groups.io>

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.


From: Abner Chang <abner.chang@amd.com>

BZ #4354
This change adds definitions for IPMI KCS.

Spec ref:
https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/ipmi-second-gen-interface-spec-v2-rev1-1.html

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
Acked-by: Isaac Oram <isaac.w.oram@intel.com>
---
 MdePkg/MdePkg.dec                         |  6 ++
 MdePkg/Include/IndustryStandard/IpmiKcs.h | 76 +++++++++++++++++++++++
 2 files changed, 82 insertions(+)
 create mode 100644 MdePkg/Include/IndustryStandard/IpmiKcs.h

diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 2d643bede1d..5cf04bc0cb6 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -9,6 +9,7 @@
 # (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development LP<BR>
 # Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
 # Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.<BR>
+# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -2342,6 +2343,11 @@
   # @Prompt Memory Address of GuidedExtractHandler Table.
   gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x1000000|UINT64|0x30001015

+  ## This value is the IPMI KCS Interface I/O base address used to transmit IPMI commands.
+  #  The value of 0xca2 is the default I/O base address defined in IPMI specification.
+  # @Prompt IPMI KCS Interface I/O Base Address
+  gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsIoBaseAddress|0xca2|UINT16|0x00000031
+
 [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
   ## This value is used to set the base address of PCI express hierarchy.
   # @Prompt PCI Express Base Address.
diff --git a/MdePkg/Include/IndustryStandard/IpmiKcs.h b/MdePkg/Include/IndustryStandard/IpmiKcs.h
new file mode 100644
index 00000000000..7b3ba45bf9d
--- /dev/null
+++ b/MdePkg/Include/IndustryStandard/IpmiKcs.h
@@ -0,0 +1,76 @@
+/** @file
+  IPMI KCS Register Definitions
+
+  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Revision Reference:
+  IPMI Specification
+  Version 2.0, Rev. 1.1
+  https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/ipmi-second-gen-interface-spec-v2-rev1-1.html
+**/
+
+#ifndef IPMI_KCS_H_
+#define IPMI_KCS_H_
+
+#define IPMI_KCS_STATUS_REGISTER_OFFSET    1
+#define IPMI_KCS_COMMAND_REGISTER_OFFSET   1
+#define IPMI_KCS_DATA_OUT_REGISTER_OFFSET  0
+#define IPMI_KCS_DATA_IN_REGISTER_OFFSET   0
+
+///
+/// IPMI KCS Interface Status Bits
+///
+#define IPMI_KCS_OBF           BIT0
+#define IPMI_KCS_IBF           BIT1
+#define IPMI_KCS_SMS_ATN       BIT2
+#define IPMI_KCS_COMMAND_DATA  BIT3
+#define IPMI_KCS_OEM1          BIT4
+#define IPMI_KCS_OEM2          BIT5
+#define IPMI_KCS_S0            BIT6
+#define IPMI_KCS_S1            BIT7
+
+///
+/// IPMI KCS Interface Control Codes
+///
+#define IPMI_KCS_CONTROL_CODE_GET_STATUS_ABORT  0x60
+#define IPMI_KCS_CONTROL_CODE_WRITE_START       0x61
+#define IPMI_KCS_CONTROL_CODE_WRITE_END         0x62
+#define IPMI_KCS_CONTROL_CODE_READ              0x68
+
+///
+/// Status Codes
+///
+#define IPMI_KCS_STATUS_NO_ERROR      0x00
+#define IPMI_KCS_STATUS_ABORT         0x01
+#define IPMI_KCS_STATUS_ILLEGAL       0x02
+#define IPMI_KCS_STATUS_LENGTH_ERROR  0x06
+#define IPMI_KCS_STATUS_UNSPECIFIED   0xFF
+
+///
+/// KCS Interface State Bit
+///
+typedef enum {
+  IPMI_KCS_IDLE_STATE = 0,
+  IPMI_KCS_READ_STATE,
+  IPMI_KCS_WRITE_STATE,
+  IPMI_KCS_ERROR_STATE
+} IPMI_KCS_STATE;
+
+///
+/// IPMI KCS Interface Request Format
+///
+typedef struct {
+  UINT8    NetFunc;
+  UINT8    Command;
+  UINT8    Data[];
+} IPMI_KCS_REQUEST_HEADER;
+
+///
+/// IPMI KCS Interface Response Format
+///
+typedef struct {
+  UINT8    NetFunc;
+  UINT8    Command;
+} IPMI_KCS_RESPONSE_HEADER;
+#endif
--
2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101766): https://edk2.groups.io/g/devel/message/101766
Mute This Topic: https://groups.io/mt/97819873/7039027
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [abner.chang@amd.com]
-=-=-=-=-=-=-=-=-=-=-=-



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

* Re: [PATCH v4] MdePkg/Include: Add IPMI KCS definitions
  2023-03-25 13:46   ` Chang, Abner
@ 2023-03-25 14:19     ` Tinh Nguyen
  0 siblings, 0 replies; 7+ messages in thread
From: Tinh Nguyen @ 2023-03-25 14:19 UTC (permalink / raw)
  To: Chang, Abner, Kinney, Michael D, devel@edk2.groups.io
  Cc: Gao, Liming, Liu, Zhiguang, Nickle Wang, Igor Kulchytskyy,
	Oram, Isaac W, Attar, AbdulLateef (Abdul Lateef)

Thank you for your hard work

Reviewed-by: Tinh Nguyen <tinhnguyen@os.amperecomputing.com>

On 3/25/2023 8:46 PM, Chang, Abner wrote:
> [EXTERNAL EMAIL NOTICE: This email originated from an external sender. Please be mindful of safe email handling and proprietary information protection practices.]
>
>
> [AMD Official Use Only - General]
>
> Hi Mike, please note  there is V5 of IPMI KCS that fixes a typo found by Tinh.
> Thanks
>
> @Tinh, would you like to provide your R-B or Acked-by tag for V5?
>
> Thanks
> Abner
>
>> -----Original Message-----
>> From: Kinney, Michael D <michael.d.kinney@intel.com>
>> Sent: Saturday, March 25, 2023 3:37 AM
>> To: Chang, Abner <Abner.Chang@amd.com>; devel@edk2.groups.io
>> Cc: Gao, Liming <gaoliming@byosoft.com.cn>; Liu, Zhiguang
>> <zhiguang.liu@intel.com>; Nickle Wang <nicklew@nvidia.com>; Igor
>> Kulchytskyy <igork@ami.com>; Oram, Isaac W <isaac.w.oram@intel.com>;
>> Attar, AbdulLateef (Abdul Lateef) <AbdulLateef.Attar@amd.com>; Kinney,
>> Michael D <michael.d.kinney@intel.com>
>> Subject: RE: [PATCH v4] MdePkg/Include: Add IPMI KCS definitions
>>
>> Caution: This message originated from an External Source. Use proper
>> caution when opening attachments, clicking links, or responding.
>>
>>
>> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
>>
>>> -----Original Message-----
>>> From: abner.chang@amd.com <abner.chang@amd.com>
>>> Sent: Thursday, March 23, 2023 8:16 PM
>>> To: devel@edk2.groups.io
>>> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming
>>> <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>;
>>> Nickle Wang <nicklew@nvidia.com>; Igor Kulchytskyy <igork@ami.com>;
>>> Oram, Isaac W <isaac.w.oram@intel.com>; Abdul Lateef Attar
>>> <AbdulLateef.Attar@amd.com>
>>> Subject: [PATCH v4] MdePkg/Include: Add IPMI KCS definitions
>>>
>>> From: Abner Chang <abner.chang@amd.com>
>>>
>>> BZ #4354
>>> This change adds definitions for IPMI KCS.
>>>
>>> Spec ref:
>>>
>> https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/i
>> pm
>>> i-second-gen-interface-spec-v2-rev1-1.html
>>>
>>> Signed-off-by: Abner Chang <abner.chang@amd.com>
>>> Cc: Michael D Kinney <michael.d.kinney@intel.com>
>>> Cc: Liming Gao <gaoliming@byosoft.com.cn>
>>> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
>>> Cc: Nickle Wang <nicklew@nvidia.com>
>>> Cc: Igor Kulchytskyy <igork@ami.com>
>>> Cc: Isaac Oram <isaac.w.oram@intel.com>
>>> Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
>>> Acked-by: Isaac Oram <isaac.w.oram@intel.com>
>>> ---
>>>   MdePkg/MdePkg.dec                         |  6 ++
>>>   MdePkg/Include/IndustryStandard/IpmiKcs.h | 76
>>> +++++++++++++++++++++++
>>>   2 files changed, 82 insertions(+)
>>>   create mode 100644 MdePkg/Include/IndustryStandard/IpmiKcs.h
>>>
>>> diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index
>>> 2d643bede1d..5cf04bc0cb6 100644
>>> --- a/MdePkg/MdePkg.dec
>>> +++ b/MdePkg/MdePkg.dec
>>> @@ -9,6 +9,7 @@
>>>   # (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development
>>> LP<BR>  # Copyright (c) 2022, Loongson Technology Corporation Limited.
>>> All rights reserved.<BR>  # Copyright (c) 2021 - 2022, Arm Limited.
>>> All rights reserved.<BR>
>>> +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
>>> +reserved.<BR>
>>>   #
>>>   # SPDX-License-Identifier: BSD-2-Clause-Patent  # @@ -2342,6 +2343,11
>>> @@
>>>     # @Prompt Memory Address of GuidedExtractHandler Table.
>>>
>>>
>> gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x1000
>> 000
>>> |UINT64|0x30001015
>>>
>>> +  ## This value is the IPMI KCS Interface I/O base address used to transmit
>> IPMI commands.
>>> +  #  The value of 0xca2 is the default I/O base address defined in IPMI
>> specification.
>>> +  # @Prompt IPMI KCS Interface I/O Base Address
>>> +
>>> +
>> gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsIoBaseAddress|0xca2|UINT16|0x00
>> 00
>>> + 0031
>>> +
>>>   [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
>>>     ## This value is used to set the base address of PCI express hierarchy.
>>>     # @Prompt PCI Express Base Address.
>>> diff --git a/MdePkg/Include/IndustryStandard/IpmiKcs.h
>>> b/MdePkg/Include/IndustryStandard/IpmiKcs.h
>>> new file mode 100644
>>> index 00000000000..1e1be787617
>>> --- /dev/null
>>> +++ b/MdePkg/Include/IndustryStandard/IpmiKcs.h
>>> @@ -0,0 +1,76 @@
>>> +/** @file
>>> +  IPMI KCS Register Definitions
>>> +
>>> +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
>>> + reserved.<BR>
>>> +  SPDX-License-Identifier: BSD-2-Clause-Patent
>>> +
>>> +  @par Revision Reference:
>>> +  IPMI Specification
>>> +  Version 2.0, Rev. 1.1
>>> +
>>>
>> +https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/
>> ip
>>> +mi-second-gen-interface-spec-v2-rev1-1.html
>>> +**/
>>> +
>>> +#ifndef IPMI_KCS_H_
>>> +#define IPMI_KCS_H_
>>> +
>>> +#define IPMI_KCS_STATUS_REGISTER_OFFSET    1
>>> +#define IPMI_KCS_COMMAND_REGISTER_OFFSET   1
>>> +#define IPMI_KCS_DATA_OUT_REGISTER_OFFSET  0
>>> +#define IPMI_KCS_DATA_IN_REGISTER_OFFSET   0
>>> +
>>> +///
>>> +/// IPMI KCS Interface Status Bits
>>> +///
>>> +#define IPMI_KCS_OBF           BIT0
>>> +#define IPMI_KCS_IBF           BIT1
>>> +#define IPMI_KCS_SMS_ATN       BIT2
>>> +#define IPMI_KCS_COMMAND_DATA  BIT3
>>> +#define IPMI_KCS_OEM1          BIT4
>>> +#define IPMI_KCS_OEM2          BIT5
>>> +#define IPMI_KCS_S0            BIT6
>>> +#define IPMI_KCS_S1            BIT7
>>> +
>>> +///
>>> +/// IPMI KCS Interface Control Codes
>>> +///
>>> +#define IPMI_KCS_CONTROL_CODE_GET_STATUS_ABORT  0x60
>>> +#define IPMI_KCS_CONTROL_CODE_WRITE_START       0x61
>>> +#define IPMI_KCS_CONTROL_CODE_WRITE_END         0x62
>>> +#define IPMI_KCS_CONTROL_CODE_READ              0x68
>>> +
>>> +///
>>> +/// Status Codes
>>> +///
>>> +#define IPMI_KCS_STATUS_NO_ERROR      0x00
>>> +#define IPMI_KCS_STATUS_ABORT         0x01
>>> +#define IPMI_KCS_STATUS_ILLEGAL       0x02
>>> +#define IPMI_KCS_STATUS_LENGTH_ERROR  0x06
>>> +#define IPMI_KCS_STATUS_UNSPECIFIED   0xFF
>>> +
>>> +///
>>> +/// KCS Interface State Bit
>>> +///
>>> +typedef enum {
>>> +  IPMI_KCS_IDLE_STATE = 0,
>>> +  IPMI_KCS_READ_STATE,
>>> +  IPMI_KCS_WRITE_STATE,
>>> +  IPMI_KCS_ERROR_STATE
>>> +} IPMI_KCS_STATE;
>>> +
>>> +///
>>> +/// IPMI KCS Interface Request Format /// typedef struct {
>>> +  UINT8    NetFunc;
>>> +  UINT8    Command;
>>> +  UINT8    Data[];
>>> +} IPMI_KCS_RESQUEST_HEADER;
>>> +
>>> +///
>>> +/// IPMI KCS Interface Response Format /// typedef struct {
>>> +  UINT8    NetFunc;
>>> +  UINT8    Command;
>>> +} IPMI_KCS_RESPONSE_HEADER;
>>> +#endif
>>> --
>>> 2.37.1.windows.1

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

end of thread, other threads:[~2023-03-25 14:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-24  3:15 [PATCH v4] MdePkg/Include: Add IPMI KCS definitions Chang, Abner
2023-03-24  3:43 ` [edk2-devel] " Tinh Nguyen
2023-03-24  9:05   ` Chang, Abner
2023-03-24  9:16   ` Chang, Abner
2023-03-24 19:37 ` Michael D Kinney
2023-03-25 13:46   ` Chang, Abner
2023-03-25 14:19     ` Tinh Nguyen

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