aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2018-10-14 22:49:53 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2018-10-18 09:56:17 -0400
commit11fdb309341ca1ba2e3d03fd1c9c0c6aedaea0b6 (patch)
tree81be79a518e1a6339547fc723ac1367a22dca2ed
parente63334e556d9286fc30bec1050360824bcd2d990 (diff)
powerpc/prom_init: Remove support for OPAL v2
We removed support for running under any OPAL version earlier than v3 in 2015 (they never saw the light of day anyway), but we kept some leftovers of this support in prom_init.c, so let's take it out. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--arch/powerpc/kernel/prom_init.c125
1 files changed, 10 insertions, 115 deletions
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index ebda53877842..84f763e0fe1d 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -43,7 +43,6 @@
43#include <asm/btext.h> 43#include <asm/btext.h>
44#include <asm/sections.h> 44#include <asm/sections.h>
45#include <asm/machdep.h> 45#include <asm/machdep.h>
46#include <asm/opal.h>
47#include <asm/asm-prototypes.h> 46#include <asm/asm-prototypes.h>
48 47
49#include <linux/linux_logo.h> 48#include <linux/linux_logo.h>
@@ -191,7 +190,6 @@ struct platform_support {
191#define PLATFORM_LPAR 0x0001 190#define PLATFORM_LPAR 0x0001
192#define PLATFORM_POWERMAC 0x0400 191#define PLATFORM_POWERMAC 0x0400
193#define PLATFORM_GENERIC 0x0500 192#define PLATFORM_GENERIC 0x0500
194#define PLATFORM_OPAL 0x0600
195 193
196static int __prombss of_platform; 194static int __prombss of_platform;
197 195
@@ -684,7 +682,7 @@ static void __init early_cmdline_parse(void)
684 prom_debug("Radix disabled from cmdline\n"); 682 prom_debug("Radix disabled from cmdline\n");
685} 683}
686 684
687#if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) 685#ifdef CONFIG_PPC_PSERIES
688/* 686/*
689 * The architecture vector has an array of PVR mask/value pairs, 687 * The architecture vector has an array of PVR mask/value pairs,
690 * followed by # option vectors - 1, followed by the option vectors. 688 * followed by # option vectors - 1, followed by the option vectors.
@@ -1231,7 +1229,7 @@ static void __init prom_send_capabilities(void)
1231 } 1229 }
1232#endif /* __BIG_ENDIAN__ */ 1230#endif /* __BIG_ENDIAN__ */
1233} 1231}
1234#endif /* #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) */ 1232#endif /* CONFIG_PPC_PSERIES */
1235 1233
1236/* 1234/*
1237 * Memory allocation strategy... our layout is normally: 1235 * Memory allocation strategy... our layout is normally:
@@ -1568,88 +1566,6 @@ static void __init prom_close_stdin(void)
1568 } 1566 }
1569} 1567}
1570 1568
1571#ifdef CONFIG_PPC_POWERNV
1572
1573#ifdef CONFIG_PPC_EARLY_DEBUG_OPAL
1574static u64 __prombss prom_opal_base;
1575static u64 __prombss prom_opal_entry;
1576#endif
1577
1578/*
1579 * Allocate room for and instantiate OPAL
1580 */
1581static void __init prom_instantiate_opal(void)
1582{
1583 phandle opal_node;
1584 ihandle opal_inst;
1585 u64 base, entry;
1586 u64 size = 0, align = 0x10000;
1587 __be64 val64;
1588 u32 rets[2];
1589
1590 prom_debug("prom_instantiate_opal: start...\n");
1591
1592 opal_node = call_prom("finddevice", 1, 1, ADDR("/ibm,opal"));
1593 prom_debug("opal_node: %x\n", opal_node);
1594 if (!PHANDLE_VALID(opal_node))
1595 return;
1596
1597 val64 = 0;
1598 prom_getprop(opal_node, "opal-runtime-size", &val64, sizeof(val64));
1599 size = be64_to_cpu(val64);
1600 if (size == 0)
1601 return;
1602 val64 = 0;
1603 prom_getprop(opal_node, "opal-runtime-alignment", &val64,sizeof(val64));
1604 align = be64_to_cpu(val64);
1605
1606 base = alloc_down(size, align, 0);
1607 if (base == 0) {
1608 prom_printf("OPAL allocation failed !\n");
1609 return;
1610 }
1611
1612 opal_inst = call_prom("open", 1, 1, ADDR("/ibm,opal"));
1613 if (!IHANDLE_VALID(opal_inst)) {
1614 prom_printf("opening opal package failed (%x)\n", opal_inst);
1615 return;
1616 }
1617
1618 prom_printf("instantiating opal at 0x%llx...", base);
1619
1620 if (call_prom_ret("call-method", 4, 3, rets,
1621 ADDR("load-opal-runtime"),
1622 opal_inst,
1623 base >> 32, base & 0xffffffff) != 0
1624 || (rets[0] == 0 && rets[1] == 0)) {
1625 prom_printf(" failed\n");
1626 return;
1627 }
1628 entry = (((u64)rets[0]) << 32) | rets[1];
1629
1630 prom_printf(" done\n");
1631
1632 reserve_mem(base, size);
1633
1634 prom_debug("opal base = 0x%llx\n", base);
1635 prom_debug("opal align = 0x%llx\n", align);
1636 prom_debug("opal entry = 0x%llx\n", entry);
1637 prom_debug("opal size = 0x%llx\n", size);
1638
1639 prom_setprop(opal_node, "/ibm,opal", "opal-base-address",
1640 &base, sizeof(base));
1641 prom_setprop(opal_node, "/ibm,opal", "opal-entry-address",
1642 &entry, sizeof(entry));
1643
1644#ifdef CONFIG_PPC_EARLY_DEBUG_OPAL
1645 prom_opal_base = base;
1646 prom_opal_entry = entry;
1647#endif
1648 prom_debug("prom_instantiate_opal: end...\n");
1649}
1650
1651#endif /* CONFIG_PPC_POWERNV */
1652
1653/* 1569/*
1654 * Allocate room for and instantiate RTAS 1570 * Allocate room for and instantiate RTAS
1655 */ 1571 */
@@ -2156,10 +2072,6 @@ static int __init prom_find_machine_type(void)
2156 } 2072 }
2157 } 2073 }
2158#ifdef CONFIG_PPC64 2074#ifdef CONFIG_PPC64
2159 /* Try to detect OPAL */
2160 if (PHANDLE_VALID(call_prom("finddevice", 1, 1, ADDR("/ibm,opal"))))
2161 return PLATFORM_OPAL;
2162
2163 /* Try to figure out if it's an IBM pSeries or any other 2075 /* Try to figure out if it's an IBM pSeries or any other
2164 * PAPR compliant platform. We assume it is if : 2076 * PAPR compliant platform. We assume it is if :
2165 * - /device_type is "chrp" (please, do NOT use that for future 2077 * - /device_type is "chrp" (please, do NOT use that for future
@@ -2488,7 +2400,7 @@ static void __init scan_dt_build_struct(phandle node, unsigned long *mem_start,
2488 } 2400 }
2489 2401
2490 /* Add a "linux,phandle" property if no "phandle" property already 2402 /* Add a "linux,phandle" property if no "phandle" property already
2491 * existed (can happen with OPAL) 2403 * existed.
2492 */ 2404 */
2493 if (!has_phandle) { 2405 if (!has_phandle) {
2494 soff = dt_find_string("linux,phandle"); 2406 soff = dt_find_string("linux,phandle");
@@ -3178,7 +3090,7 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
3178 */ 3090 */
3179 early_cmdline_parse(); 3091 early_cmdline_parse();
3180 3092
3181#if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) 3093#ifdef CONFIG_PPC_PSERIES
3182 /* 3094 /*
3183 * On pSeries, inform the firmware about our capabilities 3095 * On pSeries, inform the firmware about our capabilities
3184 */ 3096 */
@@ -3222,15 +3134,9 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
3222 * On non-powermacs, try to instantiate RTAS. PowerMacs don't 3134 * On non-powermacs, try to instantiate RTAS. PowerMacs don't
3223 * have a usable RTAS implementation. 3135 * have a usable RTAS implementation.
3224 */ 3136 */
3225 if (of_platform != PLATFORM_POWERMAC && 3137 if (of_platform != PLATFORM_POWERMAC)
3226 of_platform != PLATFORM_OPAL)
3227 prom_instantiate_rtas(); 3138 prom_instantiate_rtas();
3228 3139
3229#ifdef CONFIG_PPC_POWERNV
3230 if (of_platform == PLATFORM_OPAL)
3231 prom_instantiate_opal();
3232#endif /* CONFIG_PPC_POWERNV */
3233
3234#ifdef CONFIG_PPC64 3140#ifdef CONFIG_PPC64
3235 /* instantiate sml */ 3141 /* instantiate sml */
3236 prom_instantiate_sml(); 3142 prom_instantiate_sml();
@@ -3243,8 +3149,7 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
3243 * 3149 *
3244 * (This must be done after instanciating RTAS) 3150 * (This must be done after instanciating RTAS)
3245 */ 3151 */
3246 if (of_platform != PLATFORM_POWERMAC && 3152 if (of_platform != PLATFORM_POWERMAC)
3247 of_platform != PLATFORM_OPAL)
3248 prom_hold_cpus(); 3153 prom_hold_cpus();
3249 3154
3250 /* 3155 /*
@@ -3288,11 +3193,9 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
3288 /* 3193 /*
3289 * in case stdin is USB and still active on IBM machines... 3194 * in case stdin is USB and still active on IBM machines...
3290 * Unfortunately quiesce crashes on some powermacs if we have 3195 * Unfortunately quiesce crashes on some powermacs if we have
3291 * closed stdin already (in particular the powerbook 101). It 3196 * closed stdin already (in particular the powerbook 101).
3292 * appears that the OPAL version of OFW doesn't like it either.
3293 */ 3197 */
3294 if (of_platform != PLATFORM_POWERMAC && 3198 if (of_platform != PLATFORM_POWERMAC)
3295 of_platform != PLATFORM_OPAL)
3296 prom_close_stdin(); 3199 prom_close_stdin();
3297 3200
3298 /* 3201 /*
@@ -3310,10 +3213,8 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
3310 hdr = dt_header_start; 3213 hdr = dt_header_start;
3311 3214
3312 /* Don't print anything after quiesce under OPAL, it crashes OFW */ 3215 /* Don't print anything after quiesce under OPAL, it crashes OFW */
3313 if (of_platform != PLATFORM_OPAL) { 3216 prom_printf("Booting Linux via __start() @ 0x%lx ...\n", kbase);
3314 prom_printf("Booting Linux via __start() @ 0x%lx ...\n", kbase); 3217 prom_debug("->dt_header_start=0x%lx\n", hdr);
3315 prom_debug("->dt_header_start=0x%lx\n", hdr);
3316 }
3317 3218
3318#ifdef CONFIG_PPC32 3219#ifdef CONFIG_PPC32
3319 reloc_got2(-offset); 3220 reloc_got2(-offset);
@@ -3321,13 +3222,7 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
3321 unreloc_toc(); 3222 unreloc_toc();
3322#endif 3223#endif
3323 3224
3324#ifdef CONFIG_PPC_EARLY_DEBUG_OPAL
3325 /* OPAL early debug gets the OPAL base & entry in r8 and r9 */
3326 __start(hdr, kbase, 0, 0, 0,
3327 prom_opal_base, prom_opal_entry);
3328#else
3329 __start(hdr, kbase, 0, 0, 0, 0, 0); 3225 __start(hdr, kbase, 0, 0, 0, 0, 0);
3330#endif
3331 3226
3332 return 0; 3227 return 0;
3333} 3228}