diff options
-rw-r--r-- | core/platform.c | 18 | ||||
-rw-r--r-- | hw/ipmi/ipmi-sel.c | 21 | ||||
-rw-r--r-- | include/ipmi.h | 6 | ||||
-rw-r--r-- | include/platform.h | 23 | ||||
-rw-r--r-- | platforms/astbmc/astbmc.h | 4 | ||||
-rw-r--r-- | platforms/astbmc/common.c | 8 | ||||
-rw-r--r-- | platforms/astbmc/firestone.c | 3 | ||||
-rw-r--r-- | platforms/astbmc/garrison.c | 3 | ||||
-rw-r--r-- | platforms/astbmc/habanero.c | 3 | ||||
-rw-r--r-- | platforms/astbmc/palmetto.c | 3 |
10 files changed, 77 insertions, 15 deletions
diff --git a/core/platform.c b/core/platform.c index 9171fa3..99f1d1c 100644 --- a/core/platform.c +++ b/core/platform.c @@ -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. @@ -28,6 +28,7 @@ bool manufacturing_mode = false; struct platform platform; +const struct bmc_platform *bmc_platform = NULL; DEFINE_LOG_ENTRY(OPAL_RC_ABNORMAL_REBOOT, OPAL_PLATFORM_ERR_EVT, OPAL_CEC, OPAL_CEC_HARDWARE, OPAL_PREDICTIVE_ERR_FAULT_RECTIFY_REBOOT, @@ -122,12 +123,24 @@ static int64_t generic_cec_power_down(uint64_t request __unused) return OPAL_UNSUPPORTED; } +static struct bmc_platform generic_bmc = { + .name = "generic", +}; + static struct platform generic_platform = { .name = "generic", + .bmc = &generic_bmc, .init = generic_platform_init, .cec_power_down = generic_cec_power_down, }; +void set_bmc_platform(const struct bmc_platform *bmc) +{ + if (bmc) + prlog(PR_NOTICE, "PLAT: Detected BMC platform %s\n", bmc->name); + bmc_platform = bmc; +} + void probe_platform(void) { struct platform *platforms = &__platforms_start; @@ -154,8 +167,11 @@ void probe_platform(void) } prlog(PR_NOTICE, "PLAT: Detected %s platform\n", platform.name); + + set_bmc_platform(platform.bmc); } + int start_preload_resource(enum resource_id id, uint32_t subid, void *buf, size_t *len) { diff --git a/hw/ipmi/ipmi-sel.c b/hw/ipmi/ipmi-sel.c index 369cebc..b79959c 100644 --- a/hw/ipmi/ipmi-sel.c +++ b/hw/ipmi/ipmi-sel.c @@ -334,6 +334,11 @@ static void ipmi_elog_poll(struct ipmi_msg *msg) struct errorlog *elog_buf = (struct errorlog *) msg->user_data; size_t req_size; + if (bmc_platform->ipmi_oem_partial_add_esel == 0) { + prlog(PR_WARNING, "BUG: Dropping ESEL on the floor due to buggy/mising code in OPAL for this BMC"); + return; + } + ipmi_init_esel_record(); if (msg->cmd == IPMI_CMD(IPMI_RESERVE_SEL)) { first = true; @@ -386,7 +391,8 @@ static void ipmi_elog_poll(struct ipmi_msg *msg) req_size = IPMI_MAX_REQ_SIZE; } - ipmi_init_msg(msg, IPMI_DEFAULT_INTERFACE, IPMI_PARTIAL_ADD_ESEL, + ipmi_init_msg(msg, IPMI_DEFAULT_INTERFACE, + bmc_platform->ipmi_oem_partial_add_esel, ipmi_elog_poll, elog_buf, req_size, 2); msg->data[0] = reservation_id & 0xff; @@ -462,8 +468,19 @@ static void sel_pnor(uint8_t access) if (granted) occ_pnor_set_owner(PNOR_OWNER_EXTERNAL); + if (bmc_platform->ipmi_oem_pnor_access_status == 0) { + /** + * @fwts-label PNORAccessYeahButNoBut + * @fwts-advice OPAL doesn't know that the BMC supports + * PNOR access commands. This will be a bug in the OPAL + * support for this BMC. + */ + prlog(PR_ERR, "PNOR BUG: access requested but BMC doesn't support request\n"); + break; + } + /* Ack the request */ - msg = ipmi_mkmsg_simple(IPMI_PNOR_ACCESS_STATUS, &granted, 1); + msg = ipmi_mkmsg_simple(bmc_platform->ipmi_oem_pnor_access_status, &granted, 1); ipmi_queue_msg(msg); break; case RELEASE_PNOR: 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 */ diff --git a/platforms/astbmc/astbmc.h b/platforms/astbmc/astbmc.h index 322282e..3ef8dbf 100644 --- a/platforms/astbmc/astbmc.h +++ b/platforms/astbmc/astbmc.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. @@ -41,6 +41,8 @@ struct slot_table_entry { const struct slot_table_entry *children; }; +extern const struct bmc_platform astbmc_ami; + extern void astbmc_early_init(void); extern int64_t astbmc_ipmi_reboot(void); extern int64_t astbmc_ipmi_power_down(uint64_t request); diff --git a/platforms/astbmc/common.c b/platforms/astbmc/common.c index e1a8a4d..6e678a1 100644 --- a/platforms/astbmc/common.c +++ b/platforms/astbmc/common.c @@ -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. @@ -357,3 +357,9 @@ void astbmc_early_init(void) prd_init(); } + +const struct bmc_platform astbmc_ami = { + .name = "AMI", + .ipmi_oem_partial_add_esel = IPMI_CODE(0x32, 0xf0), + .ipmi_oem_pnor_access_status = IPMI_CODE(0x3a, 0x07), +}; diff --git a/platforms/astbmc/firestone.c b/platforms/astbmc/firestone.c index c4e6b2a..d2c4d14 100644 --- a/platforms/astbmc/firestone.c +++ b/platforms/astbmc/firestone.c @@ -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. @@ -146,6 +146,7 @@ static bool firestone_probe(void) DECLARE_PLATFORM(firestone) = { .name = "Firestone", + .bmc = &astbmc_ami, .probe = firestone_probe, .init = astbmc_init, .pci_get_slot_info = slot_table_get_slot_info, diff --git a/platforms/astbmc/garrison.c b/platforms/astbmc/garrison.c index f400a51..ed504ac 100644 --- a/platforms/astbmc/garrison.c +++ b/platforms/astbmc/garrison.c @@ -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. @@ -293,6 +293,7 @@ static bool garrison_probe(void) DECLARE_PLATFORM(garrison) = { .name = "Garrison", + .bmc = &astbmc_ami, .probe = garrison_probe, .init = astbmc_init, .pci_get_slot_info = slot_table_get_slot_info, diff --git a/platforms/astbmc/habanero.c b/platforms/astbmc/habanero.c index 738aa63..86e49bf 100644 --- a/platforms/astbmc/habanero.c +++ b/platforms/astbmc/habanero.c @@ -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. @@ -141,6 +141,7 @@ static bool habanero_probe(void) DECLARE_PLATFORM(habanero) = { .name = "Habanero", + .bmc = &astbmc_ami, .probe = habanero_probe, .init = astbmc_init, .pci_get_slot_info = slot_table_get_slot_info, diff --git a/platforms/astbmc/palmetto.c b/platforms/astbmc/palmetto.c index 033f103..0c7feff 100644 --- a/platforms/astbmc/palmetto.c +++ b/platforms/astbmc/palmetto.c @@ -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. @@ -46,6 +46,7 @@ static bool palmetto_probe(void) DECLARE_PLATFORM(palmetto) = { .name = "Palmetto", .probe = palmetto_probe, + .bmc = &astbmc_ami, .init = astbmc_init, .external_irq = astbmc_ext_irq_serirq_cpld, .cec_power_down = astbmc_ipmi_power_down, |