diff options
author | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-03-15 19:52:11 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-03-16 17:17:24 +1100 |
commit | 1998d7fe4a640c790e20aaedb9cdb2a581598349 (patch) | |
tree | fd30faeb1087da7b9b1060aff99983905b16ec3e /core/platform.c | |
parent | 701617b1f6b12305aac88b71374f27b68f5a684e (diff) | |
download | skiboot-1998d7fe4a640c790e20aaedb9cdb2a581598349.zip skiboot-1998d7fe4a640c790e20aaedb9cdb2a581598349.tar.gz skiboot-1998d7fe4a640c790e20aaedb9cdb2a581598349.tar.bz2 |
generic platform: If /bmc in device tree, attempt to init one
For the most part, this gets us somewhere on some OpenPOWER systems
before there's a platform file for that machine.
Useful in bringup only, and marked as such with scary looking log
messages.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/platform.c')
-rw-r--r-- | core/platform.c | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/core/platform.c b/core/platform.c index 1d4ae6d..2a206c8 100644 --- a/core/platform.c +++ b/core/platform.c @@ -25,6 +25,7 @@ #include <errorlog.h> #include <bt.h> #include <nvram.h> +#include <platforms/astbmc/astbmc.h> bool manufacturing_mode = false; struct platform platform; @@ -105,7 +106,17 @@ opal_call(OPAL_CEC_REBOOT2, opal_cec_reboot2, 2); static bool generic_platform_probe(void) { - uart_init(); + if (dt_find_by_path(dt_root, "bmc")) { + /* We appear to have a BMC... so let's cross our fingers + * and see if we can do anything! + */ + prlog(PR_ERR, "GENERIC BMC PLATFORM: **GUESSING** that there's " + "*maybe* a BMC we can talk to.\n"); + prlog(PR_ERR, "THIS IS ****UNSUPPORTED****, BRINGUP USE ONLY.\n"); + astbmc_early_init(); + } else { + uart_init(); + } return true; } @@ -115,8 +126,15 @@ static void generic_platform_init(void) if (uart_enabled()) set_opal_console(&uart_opal_con); - /* Enable a BT interface if we find one too */ - bt_init(); + if (dt_find_by_path(dt_root, "bmc")) { + prlog(PR_ERR, "BMC-GUESSWORK: Here be dragons with a taste for human flesh\n"); + astbmc_init(); + } else { + /* Otherwise we go down the ultra-minimal path */ + + /* Enable a BT interface if we find one too */ + bt_init(); + } /* Fake a real time clock */ fake_rtc_init(); @@ -127,6 +145,23 @@ static int64_t generic_cec_power_down(uint64_t request __unused) return OPAL_UNSUPPORTED; } +static int generic_resource_loaded(enum resource_id id, uint32_t subid) +{ + if (dt_find_by_path(dt_root, "bmc")) + return flash_resource_loaded(id, subid); + + return OPAL_EMPTY; +} + +static int generic_start_preload_resource(enum resource_id id, uint32_t subid, + void *buf, size_t *len) +{ + if (dt_find_by_path(dt_root, "bmc")) + return flash_start_preload_resource(id, subid, buf, len); + + return OPAL_EMPTY; +} + static struct bmc_platform generic_bmc = { .name = "generic", }; @@ -140,6 +175,8 @@ static struct platform generic_platform = { .nvram_start_read = fake_nvram_start_read, .nvram_write = fake_nvram_write, .cec_power_down = generic_cec_power_down, + .start_preload_resource = generic_start_preload_resource, + .resource_loaded = generic_resource_loaded, }; const struct bmc_platform *bmc_platform = &generic_bmc; |