[PATCH v5] MdePkg/Include: Add IPMI KCS definitions


Chang, Abner
 

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

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@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <gaoliming@...>
Cc: Zhiguang Liu <zhiguang.liu@...>
Cc: Nickle Wang <nicklew@...>
Cc: Igor Kulchytskyy <igork@...>
Cc: Isaac Oram <isaac.w.oram@...>
Cc: Abdul Lateef Attar <AbdulLateef.Attar@...>
Acked-by: Isaac Oram <isaac.w.oram@...>
---
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


Michael D Kinney
 

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

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chang, Abner via groups.io
Sent: Friday, March 24, 2023 2:14 AM
To: devel@edk2.groups.io
Cc: Kinney, Michael D <michael.d.kinney@...>; Gao, Liming <gaoliming@...>; Liu, Zhiguang <zhiguang.liu@...>;
Nickle Wang <nicklew@...>; Igor Kulchytskyy <igork@...>; Oram, Isaac W <isaac.w.oram@...>; Abdul Lateef Attar
<AbdulLateef.Attar@...>
Subject: [edk2-devel] [PATCH v5] MdePkg/Include: Add IPMI KCS definitions

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

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@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <gaoliming@...>
Cc: Zhiguang Liu <zhiguang.liu@...>
Cc: Nickle Wang <nicklew@...>
Cc: Igor Kulchytskyy <igork@...>
Cc: Isaac Oram <isaac.w.oram@...>
Cc: Abdul Lateef Attar <AbdulLateef.Attar@...>
Acked-by: Isaac Oram <isaac.w.oram@...>
---
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





Chang, Abner
 

[AMD Official Use Only - General]

 

Thanks Mike,

 

IPMI KCS: https://github.com/tianocore/edk2/pull/4184

MCTP: https://github.com/tianocore/edk2/pull/4183

We also fixed the ECC error in these two PRs, please also help to push it.

 

@Kinney, Michael D, @Leif Lindholm, @Andrew Fish

Hi stewards,

I would like to be the maintainer for *IPMI* and *MCTP* files under both MdePkg and MdeModulePkg. I will send the Maintainers.txt update for that if you have no concerns.

Will also invite Isaac @Oram, Isaac W from Intel and Nickle @Nickle Wang from Nvidia as reviewers.

Thanks

Abner

 

> -----Original Message-----

> From: Kinney, Michael D <michael.d.kinney@...>

> Sent: Saturday, March 25, 2023 11:33 PM

> To: devel@edk2.groups.io; Chang, Abner <Abner.Chang@...>

> Cc: Gao, Liming <gaoliming@...>; Liu, Zhiguang

> <zhiguang.liu@...>; Nickle Wang <nicklew@...>; Igor

> Kulchytskyy <igork@...>; Oram, Isaac W <isaac.w.oram@...>;

> Attar, AbdulLateef (Abdul Lateef) <AbdulLateef.Attar@...>; Kinney,

> Michael D <michael.d.kinney@...>

> Subject: RE: [edk2-devel] [PATCH v5] 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@...>

>

> > -----Original Message-----

> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chang,

> > Abner via groups.io

> > Sent: Friday, March 24, 2023 2:14 AM

> > To: devel@edk2.groups.io

> > Cc: Kinney, Michael D <michael.d.kinney@...>; Gao, Liming

> > <gaoliming@...>; Liu, Zhiguang <zhiguang.liu@...>;

> > Nickle Wang <nicklew@...>; Igor Kulchytskyy <igork@...>;

> > Oram, Isaac W <isaac.w.oram@...>; Abdul Lateef Attar

> > <AbdulLateef.Attar@...>

> > Subject: [edk2-devel] [PATCH v5] MdePkg/Include: Add IPMI KCS

> > definitions

> >

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

> >

> > 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@...>

> > Cc: Michael D Kinney <michael.d.kinney@...>

> > Cc: Liming Gao <gaoliming@...>

> > Cc: Zhiguang Liu <zhiguang.liu@...>

> > Cc: Nickle Wang <nicklew@...>

> > Cc: Igor Kulchytskyy <igork@...>

> > Cc: Isaac Oram <isaac.w.oram@...>

> > Cc: Abdul Lateef Attar <AbdulLateef.Attar@...>

> > Acked-by: Isaac Oram <isaac.w.oram@...>

> > ---

> >  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..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/

> 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_REQUEST_HEADER;

> > +

> > +///

> > +/// IPMI KCS Interface Response Format /// typedef struct {

> > +  UINT8    NetFunc;

> > +  UINT8    Command;

> > +} IPMI_KCS_RESPONSE_HEADER;

> > +#endif

> > --

> > 2.37.1.windows.1

> >

> >

> >

> >

> >

 


Michael D Kinney
 

From: Chang, Abner <Abner.Chang@...>
Sent: Sunday, March 26, 2023 6:56 AM
To: Kinney, Michael D <michael.d.kinney@...>; devel@edk2.groups.io; Nickle Wang <nicklew@...>; Oram, Isaac W <isaac.w.oram@...>; Leif Lindholm <quic_llindhol@...>; Andrew Fish <afish@...>
Cc: Gao, Liming <gaoliming@...>; Liu, Zhiguang <zhiguang.liu@...>; Igor Kulchytskyy <igork@...>; Attar, AbdulLateef (Abdul Lateef) <AbdulLateef.Attar@...>
Subject: RE: [edk2-devel] [PATCH v5] MdePkg/Include: Add IPMI KCS definitions

 

[AMD Official Use Only - General]

 

Thanks Mike,

 

IPMI KCS: https://github.com/tianocore/edk2/pull/4184

MCTP: https://github.com/tianocore/edk2/pull/4183

We also fixed the ECC error in these two PRs, please also help to push it.

 

@Kinney, Michael D, @Leif Lindholm, @Andrew Fish

Hi stewards,

I would like to be the maintainer for *IPMI* and *MCTP* files under both MdePkg and MdeModulePkg. I will send the Maintainers.txt update for that if you have no concerns.

Will also invite Isaac @Oram, Isaac W from Intel and Nickle @Nickle Wang from Nvidia as reviewers.

Thanks

Abner

 

> -----Original Message-----

> From: Kinney, Michael D <michael.d.kinney@...>

> Sent: Saturday, March 25, 2023 11:33 PM

> To: devel@edk2.groups.io; Chang, Abner <Abner.Chang@...>

> Cc: Gao, Liming <gaoliming@...>; Liu, Zhiguang

> <zhiguang.liu@...>; Nickle Wang <nicklew@...>; Igor

> Kulchytskyy <igork@...>; Oram, Isaac W <isaac.w.oram@...>;

> Attar, AbdulLateef (Abdul Lateef) <AbdulLateef.Attar@...>; Kinney,

> Michael D <michael.d.kinney@...>

> Subject: RE: [edk2-devel] [PATCH v5] 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@...>

>

> > -----Original Message-----

> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chang,

> > Abner via groups.io

> > Sent: Friday, March 24, 2023 2:14 AM

> > To: devel@edk2.groups.io

> > Cc: Kinney, Michael D <michael.d.kinney@...>; Gao, Liming

> > <gaoliming@...>; Liu, Zhiguang <zhiguang.liu@...>;

> > Nickle Wang <nicklew@...>; Igor Kulchytskyy <igork@...>;

> > Oram, Isaac W <isaac.w.oram@...>; Abdul Lateef Attar

> > <AbdulLateef.Attar@...>

> > Subject: [edk2-devel] [PATCH v5] MdePkg/Include: Add IPMI KCS

> > definitions

> >

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

> >

> > 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@...>

> > Cc: Michael D Kinney <michael.d.kinney@...>

> > Cc: Liming Gao <gaoliming@...>

> > Cc: Zhiguang Liu <zhiguang.liu@...>

> > Cc: Nickle Wang <nicklew@...>

> > Cc: Igor Kulchytskyy <igork@...>

> > Cc: Isaac Oram <isaac.w.oram@...>

> > Cc: Abdul Lateef Attar <AbdulLateef.Attar@...>

> > Acked-by: Isaac Oram <isaac.w.oram@...>

> > ---

> >  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..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/

> 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_REQUEST_HEADER;

> > +

> > +///

> > +/// IPMI KCS Interface Response Format /// typedef struct {

> > +  UINT8    NetFunc;

> > +  UINT8    Command;

> > +} IPMI_KCS_RESPONSE_HEADER;

> > +#endif

> > --

> > 2.37.1.windows.1

> >

> >

> >

> >

> >