Message ID | 20220526215945.70791-1-eajames@linux.ibm.com |
---|---|
State | New |
Headers | show |
Series | [u-boot,v2019.04-aspeed-openbmc,v2] board: ast2600-ibm: Add AST2600 BMC based POWER10+ servers | expand |
On Thu, 26 May 2022 at 21:59, Eddie James <eajames@linux.ibm.com> wrote: > > Support IBM-specific options for POWER10+ servers built on AST2600 > BMC. > > Signed-off-by: Eddie James <eajames@linux.ibm.com> > --- > Changes since v1: > - Drop the defconfig in favor of yocto fragment > - remove __weak for board init > - select BOARD_LATE_INIT Thanks, I've merged this with a minor addition to the commit message about late init. I confirmed that setting these two in the config does what we want: echo CONFIG_BOARD_EARLY_INIT_F=n >> .config echo CONFIG_TARGET_AST2600_IBM=y >> .config > > arch/arm/mach-aspeed/ast2600/Kconfig | 9 ++++++ > board/aspeed/ast2600_ibm/Kconfig | 13 +++++++++ > board/aspeed/ast2600_ibm/Makefile | 1 + > board/aspeed/ast2600_ibm/ibm.c | 43 ++++++++++++++++++++++++++++ > 4 files changed, 66 insertions(+) > create mode 100644 board/aspeed/ast2600_ibm/Kconfig > create mode 100644 board/aspeed/ast2600_ibm/Makefile > create mode 100644 board/aspeed/ast2600_ibm/ibm.c > > diff --git a/arch/arm/mach-aspeed/ast2600/Kconfig b/arch/arm/mach-aspeed/ast2600/Kconfig > index fcdc425de5..46cc1ad1db 100644 > --- a/arch/arm/mach-aspeed/ast2600/Kconfig > +++ b/arch/arm/mach-aspeed/ast2600/Kconfig > @@ -31,6 +31,14 @@ config TARGET_SLT_AST2600 > help > SLT-AST2600 is Aspeed SLT board for AST2600 chip. > > +config TARGET_AST2600_IBM > + bool "AST2600-IBM" > + select BOARD_LATE_INIT > + select TPM > + select TPM2_TIS_I2C > + help > + AST2600-IBM is IBM boards for AST2600 BMC based P0WER10+ servers > + > config TARGET_AST2600_INTEL > bool "AST2600-INTEL" > depends on ASPEED_AST2600 > @@ -43,6 +51,7 @@ endchoice > source "board/aspeed/evb_ast2600/Kconfig" > source "board/aspeed/fpga_ast2600/Kconfig" > source "board/aspeed/slt_ast2600/Kconfig" > +source "board/aspeed/ast2600_ibm/Kconfig" > source "board/aspeed/ast2600_intel/Kconfig" > > endif > diff --git a/board/aspeed/ast2600_ibm/Kconfig b/board/aspeed/ast2600_ibm/Kconfig > new file mode 100644 > index 0000000000..38ee579ed7 > --- /dev/null > +++ b/board/aspeed/ast2600_ibm/Kconfig > @@ -0,0 +1,13 @@ > +if TARGET_AST2600_IBM > + > +config SYS_BOARD > + default "ast2600_ibm" > + > +config SYS_VENDOR > + default "aspeed" > + > +config SYS_CONFIG_NAME > + string "board configuration name" > + default "ast2600_ibm" > + > +endif > diff --git a/board/aspeed/ast2600_ibm/Makefile b/board/aspeed/ast2600_ibm/Makefile > new file mode 100644 > index 0000000000..ae1aded893 > --- /dev/null > +++ b/board/aspeed/ast2600_ibm/Makefile > @@ -0,0 +1 @@ > +obj-y += ibm.o > diff --git a/board/aspeed/ast2600_ibm/ibm.c b/board/aspeed/ast2600_ibm/ibm.c > new file mode 100644 > index 0000000000..37f469435f > --- /dev/null > +++ b/board/aspeed/ast2600_ibm/ibm.c > @@ -0,0 +1,43 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright 2022 IBM Corp. > + */ > + > +#include <common.h> > +#include <dm/uclass.h> > +#include <tpm-common.h> > +#include <tpm-v2.h> > + > +int board_late_init(void) > +{ > + int rc; > + struct udevice *dev; > + /* > + * The digest is just an arbitrary sequence for now to ensure that the > + * TPM gets "poisoned." > + */ > + const unsigned char digest[32] = { > + 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00, 0x01, > + 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, > + 0xa0, 0xb1, 0xc2, 0xd3, 0xe4, 0xf5, 0x06, 0x17, > + 0x28, 0x39, 0x4a, 0x5b, 0x6c, 0x7d, 0x8e, 0x9f > + }; > + > + rc = uclass_first_device_err(UCLASS_TPM, &dev); > + if (rc) > + return 0; > + > + rc = tpm_init(dev); > + if (rc) > + return 0; > + > + rc = tpm2_startup(dev, TPM2_SU_CLEAR); > + if (rc) > + return 0; > + > + rc = tpm2_pcr_extend(dev, 0, digest); > + if (!rc) > + printf("TPM: PCR0 extended.\n"); > + > + return 0; > +} > -- > 2.27.0 >
diff --git a/arch/arm/mach-aspeed/ast2600/Kconfig b/arch/arm/mach-aspeed/ast2600/Kconfig index fcdc425de5..46cc1ad1db 100644 --- a/arch/arm/mach-aspeed/ast2600/Kconfig +++ b/arch/arm/mach-aspeed/ast2600/Kconfig @@ -31,6 +31,14 @@ config TARGET_SLT_AST2600 help SLT-AST2600 is Aspeed SLT board for AST2600 chip. +config TARGET_AST2600_IBM + bool "AST2600-IBM" + select BOARD_LATE_INIT + select TPM + select TPM2_TIS_I2C + help + AST2600-IBM is IBM boards for AST2600 BMC based P0WER10+ servers + config TARGET_AST2600_INTEL bool "AST2600-INTEL" depends on ASPEED_AST2600 @@ -43,6 +51,7 @@ endchoice source "board/aspeed/evb_ast2600/Kconfig" source "board/aspeed/fpga_ast2600/Kconfig" source "board/aspeed/slt_ast2600/Kconfig" +source "board/aspeed/ast2600_ibm/Kconfig" source "board/aspeed/ast2600_intel/Kconfig" endif diff --git a/board/aspeed/ast2600_ibm/Kconfig b/board/aspeed/ast2600_ibm/Kconfig new file mode 100644 index 0000000000..38ee579ed7 --- /dev/null +++ b/board/aspeed/ast2600_ibm/Kconfig @@ -0,0 +1,13 @@ +if TARGET_AST2600_IBM + +config SYS_BOARD + default "ast2600_ibm" + +config SYS_VENDOR + default "aspeed" + +config SYS_CONFIG_NAME + string "board configuration name" + default "ast2600_ibm" + +endif diff --git a/board/aspeed/ast2600_ibm/Makefile b/board/aspeed/ast2600_ibm/Makefile new file mode 100644 index 0000000000..ae1aded893 --- /dev/null +++ b/board/aspeed/ast2600_ibm/Makefile @@ -0,0 +1 @@ +obj-y += ibm.o diff --git a/board/aspeed/ast2600_ibm/ibm.c b/board/aspeed/ast2600_ibm/ibm.c new file mode 100644 index 0000000000..37f469435f --- /dev/null +++ b/board/aspeed/ast2600_ibm/ibm.c @@ -0,0 +1,43 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2022 IBM Corp. + */ + +#include <common.h> +#include <dm/uclass.h> +#include <tpm-common.h> +#include <tpm-v2.h> + +int board_late_init(void) +{ + int rc; + struct udevice *dev; + /* + * The digest is just an arbitrary sequence for now to ensure that the + * TPM gets "poisoned." + */ + const unsigned char digest[32] = { + 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00, 0x01, + 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, + 0xa0, 0xb1, 0xc2, 0xd3, 0xe4, 0xf5, 0x06, 0x17, + 0x28, 0x39, 0x4a, 0x5b, 0x6c, 0x7d, 0x8e, 0x9f + }; + + rc = uclass_first_device_err(UCLASS_TPM, &dev); + if (rc) + return 0; + + rc = tpm_init(dev); + if (rc) + return 0; + + rc = tpm2_startup(dev, TPM2_SU_CLEAR); + if (rc) + return 0; + + rc = tpm2_pcr_extend(dev, 0, digest); + if (!rc) + printf("TPM: PCR0 extended.\n"); + + return 0; +}
Support IBM-specific options for POWER10+ servers built on AST2600 BMC. Signed-off-by: Eddie James <eajames@linux.ibm.com> --- Changes since v1: - Drop the defconfig in favor of yocto fragment - remove __weak for board init - select BOARD_LATE_INIT arch/arm/mach-aspeed/ast2600/Kconfig | 9 ++++++ board/aspeed/ast2600_ibm/Kconfig | 13 +++++++++ board/aspeed/ast2600_ibm/Makefile | 1 + board/aspeed/ast2600_ibm/ibm.c | 43 ++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+) create mode 100644 board/aspeed/ast2600_ibm/Kconfig create mode 100644 board/aspeed/ast2600_ibm/Makefile create mode 100644 board/aspeed/ast2600_ibm/ibm.c