aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-08-29 06:03:00 +1000
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-08-29 06:03:00 +1000
commit308423515ab9a7213fee7f6992eb9f675caef128 (patch)
tree5cd62624c128f3fa5a2ae316f38b1c969c2fcff3
parentc34c4ef8c660e3e439365c8f5c06143ff00bc6bc (diff)
downloadskiboot-308423515ab9a7213fee7f6992eb9f675caef128.zip
skiboot-308423515ab9a7213fee7f6992eb9f675caef128.tar.gz
skiboot-308423515ab9a7213fee7f6992eb9f675caef128.tar.bz2
occ: Make timeout platform dependent
Keep it 0 for open-power platforms where OCC is going to be preloaded, also avoids a annoying 1mn delay on early openpower and bml when there is no OCC firmware to wait for. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--hw/occ.c6
-rw-r--r--include/lpc.h2
-rw-r--r--include/platform.h9
-rw-r--r--platforms/ibm-fsp/firenze.c7
4 files changed, 22 insertions, 2 deletions
diff --git a/hw/occ.c b/hw/occ.c
index 62a62a8..17fca93 100644
--- a/hw/occ.c
+++ b/hw/occ.c
@@ -72,6 +72,10 @@ static bool wait_for_all_occ_init(void)
struct occ_pstate_table *occ_data;
int tries;
uint64_t start_time, end_time;
+ uint32_t timeout = 0;
+
+ if (platform.occ_timeout)
+ timeout = platform.occ_timeout();
start_time = mftb();
for_each_chip(chip) {
@@ -90,7 +94,7 @@ static bool wait_for_all_occ_init(void)
* homer_base+size before passing memory to host services.
* This ensures occ_data->valid == 0 before OCC load
*/
- tries = 600; /* 60 secs */
+ tries = timeout * 10;
while((occ_data->valid != 1) && tries--) {
time_wait_ms(100);
}
diff --git a/include/lpc.h b/include/lpc.h
index 47d1037..6463c3d 100644
--- a/include/lpc.h
+++ b/include/lpc.h
@@ -46,7 +46,7 @@ static inline int64_t lpc_fw_read32(uint32_t *val, uint32_t addr)
static inline int64_t lpc_fw_write32(uint32_t val, uint32_t addr)
{
- return lpc_write(OPAL_LPC_FW, addr, cpu_to_be64(val), 4);
+ return lpc_write(OPAL_LPC_FW, addr, val, 4);
}
diff --git a/include/platform.h b/include/platform.h
index 689a80b..4a9d758 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -107,6 +107,15 @@ struct platform {
int (*nvram_start_read)(void *dst, uint32_t src,
uint32_t len);
int (*nvram_write)(uint32_t dst, void *src, uint32_t len);
+
+ /*
+ * OCC timeout. This return how long we should wait for the OCC
+ * before timing out. This lets us use a high value on larger FSP
+ * machines and cut it off completely on BML boots and OpenPower
+ * machines without pre-existing OCC firmware. Returns a value in
+ * seconds.
+ */
+ uint32_t (*occ_timeout)(void);
};
extern struct platform __platforms_start;
diff --git a/platforms/ibm-fsp/firenze.c b/platforms/ibm-fsp/firenze.c
index ae72e21..c0a13c0 100644
--- a/platforms/ibm-fsp/firenze.c
+++ b/platforms/ibm-fsp/firenze.c
@@ -232,6 +232,12 @@ static void firenze_setup_phb(struct phb *phb, unsigned int index)
lxvpd_process_slot_entries(phb, dt_root, hub_id, index);
}
+static uint32_t ibm_fsp_occ_timeout(void)
+{
+ /* Use a fixed 60s value for now */
+ return 60;
+}
+
DECLARE_PLATFORM(firenze) = {
.name = "Firenze",
.probe = firenze_probe,
@@ -244,4 +250,5 @@ DECLARE_PLATFORM(firenze) = {
.nvram_info = fsp_nvram_info,
.nvram_start_read = fsp_nvram_start_read,
.nvram_write = fsp_nvram_write,
+ .occ_timeout = ibm_fsp_occ_timeout,
} ;