From a24905d607c8bf3dcd39c10b12a0f03b6b05fb00 Mon Sep 17 00:00:00 2001 From: Chris Wang Date: Thu, 16 Nov 2023 09:26:02 +0800 Subject: [PATCH] fby4: sd: Obtain BIOS information via PLDM SMBIOS # Description: - Enable KSC for setting bios information. # Motivation: - Support BMC can obtain BIOS version by standard PLDM command. # Test plan: - BMC can get bios version from bic. # Log: [First query] root@bmc:/tmp# pldmtool raw -m 40 -v -d 0x80 0x01 0x05 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 pldmtool: Tx: 80 01 05 00 00 00 00 00 00 00 00 pldmtool: Rx: 00 01 05 00 00 00 00 00 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [Power on the host] root@bmc:/tmp# busctl set-property xyz.openbmc_project.State.Host4 /xyz/openbmc_project/state/host4 xyz.openbmc_project.State.Host RequestedHostTransition s "xyz.openbmc_project.State.Host.Transition.On" [Wait for post code complete and query again] root@bmc:/tmp# pldmtool raw -m 40 -v -d 0x80 0x01 0x05 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 pldmtool: Tx: 80 01 05 00 00 00 00 00 00 00 00 pldmtool: Rx: 00 01 05 00 00 00 00 00 05 00 0c 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 59 34 54 52 5f 31 31 30 38 00 00 | [bios version: first text string] [Y4TR_1108] --- .../yv4-sd/boards/ast1030_evb.overlay | 5 ++++ meta-facebook/yv4-sd/src/platform/plat_init.c | 2 ++ meta-facebook/yv4-sd/src/platform/plat_kcs.c | 24 +++++++++++++++++++ meta-facebook/yv4-sd/src/platform/plat_kcs.h | 22 +++++++++++++++++ 4 files changed, 53 insertions(+) create mode 100644 meta-facebook/yv4-sd/src/platform/plat_kcs.c create mode 100644 meta-facebook/yv4-sd/src/platform/plat_kcs.h diff --git a/meta-facebook/yv4-sd/boards/ast1030_evb.overlay b/meta-facebook/yv4-sd/boards/ast1030_evb.overlay index 316d862131..8284e5bd9b 100644 --- a/meta-facebook/yv4-sd/boards/ast1030_evb.overlay +++ b/meta-facebook/yv4-sd/boards/ast1030_evb.overlay @@ -223,3 +223,8 @@ dma-mode; dma-ringbuf-size = <0x4000>; }; + +&kcs3 { + status = "okay"; + addr = <0xca2>; +}; \ No newline at end of file diff --git a/meta-facebook/yv4-sd/src/platform/plat_init.c b/meta-facebook/yv4-sd/src/platform/plat_init.c index bbd6c32ad2..c727b24cbf 100644 --- a/meta-facebook/yv4-sd/src/platform/plat_init.c +++ b/meta-facebook/yv4-sd/src/platform/plat_init.c @@ -32,6 +32,7 @@ #include "plat_pldm_monitor.h" #include "plat_class.h" #include "pcc.h" +#include "plat_kcs.h" void pal_pre_init() { @@ -78,6 +79,7 @@ void pal_post_init() { plat_mctp_init(); pcc_init(); + kcs_init(); pldm_load_state_effecter_table(PLAT_PLDM_MAX_STATE_EFFECTER_IDX); pldm_assign_gpio_effecter_id(PLAT_EFFECTER_ID_GPIO_HIGH_BYTE); } diff --git a/meta-facebook/yv4-sd/src/platform/plat_kcs.c b/meta-facebook/yv4-sd/src/platform/plat_kcs.c new file mode 100644 index 0000000000..4618d70bc1 --- /dev/null +++ b/meta-facebook/yv4-sd/src/platform/plat_kcs.c @@ -0,0 +1,24 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "plat_kcs.h" +#include "kcs.h" + +void kcs_init(void) +{ + char *kcs_config[] = { "KCS3" }; + kcs_device_init(kcs_config, ARRAY_SIZE(kcs_config)); +} diff --git a/meta-facebook/yv4-sd/src/platform/plat_kcs.h b/meta-facebook/yv4-sd/src/platform/plat_kcs.h new file mode 100644 index 0000000000..4b24cc108d --- /dev/null +++ b/meta-facebook/yv4-sd/src/platform/plat_kcs.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PLAT_KCS_H +#define PLAT_KCS_H + +void kcs_init(void); + +#endif