From 5611389876a748e19b7593d4eb426ced7a6ed31f Mon Sep 17 00:00:00 2001 From: Stewart Smith Date: Tue, 8 Nov 2016 15:25:46 +1100 Subject: Add BMC platform to enable correct OEM IPMI commands An out of tree platform (p8dtu) uses a different IPMI OEM command for IPMI_PARTIAL_ADD_ESEL. This exposed some assumptions about the BMC implementation in our core code. Now, with platform.bmc, each platform can dictate (or detect) the BMC that is present. We allow it to be set at runtime rather than purely statically in struct platform as it's possible to have differing BMC implementations on the one machine (e.g. AMI BMC or OpenBMC). Acked-by: Jeremy Kerr [stewart@linux.vnet.ibm.com: remove enum, update (C) years] Signed-off-by: Stewart Smith --- include/ipmi.h | 6 +----- include/platform.h | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/ipmi.h b/include/ipmi.h index a6791e4..35dee90 100644 --- a/include/ipmi.h +++ b/include/ipmi.h @@ -1,4 +1,4 @@ -/* Copyright 2013-2014 IBM Corp. +/* Copyright 2013-2016 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -120,10 +120,6 @@ #define IPMI_GET_BT_CAPS IPMI_CODE(IPMI_NETFN_APP, 0x36) #define IPMI_SET_SENSOR_READING IPMI_CODE(IPMI_NETFN_SE, 0x30) -/* AMI OEM comamnds. AMI uses NETFN 0x3a and 0x32 */ -#define IPMI_PARTIAL_ADD_ESEL IPMI_CODE(0x32, 0xf0) -#define IPMI_PNOR_ACCESS_STATUS IPMI_CODE(0x3a, 0x07) - /* * IPMI response codes. */ diff --git a/include/platform.h b/include/platform.h index ff75adf..9133204 100644 --- a/include/platform.h +++ b/include/platform.h @@ -1,4 +1,4 @@ -/* Copyright 2013-2014 IBM Corp. +/* Copyright 2013-2016 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,17 @@ enum resource_id { #define RESOURCE_SUBID_NONE 0 #define RESOURCE_SUBID_SUPPORTED 1 +struct bmc_platform { + const char *name; + + /* + * Map IPMI_OEM_X to vendor commands for this BMC + * 0 = unimplimented + */ + uint32_t ipmi_oem_partial_add_esel; + uint32_t ipmi_oem_pnor_access_status; +}; + /* * Each platform can provide a set of hooks * that can affect the generic code @@ -39,6 +50,13 @@ struct platform { const char *name; /* + * If BMC is constant, bmc platform specified here. + * Platforms can also call set_bmc_platform() if BMC platform is + * not a constant. + */ + const struct bmc_platform *bmc; + + /* * Probe platform, return true on a match, called before * any allocation has been performed outside of the heap * so the platform can perform additional memory reservations @@ -174,6 +192,7 @@ extern struct platform __platforms_start; extern struct platform __platforms_end; extern struct platform platform; +extern const struct bmc_platform *bmc_platform; extern bool manufacturing_mode; @@ -189,4 +208,6 @@ extern int resource_loaded(enum resource_id id, uint32_t idx); extern int wait_for_resource_loaded(enum resource_id id, uint32_t idx); +extern void set_bmc_platform(const struct bmc_platform *bmc); + #endif /* __PLATFORM_H */ -- cgit v1.1