diff options
author | Nicholas Piggin <npiggin@gmail.com> | 2019-12-08 22:23:08 +1000 |
---|---|---|
committer | Oliver O'Halloran <oohall@gmail.com> | 2019-12-16 14:50:56 +1100 |
commit | 35776a29f24ec4e3b8cd19cfc87dd05f9c646cdc (patch) | |
tree | 39b7b0b8964478d077b9e0ecf8bacfc039eae99e /core | |
parent | d71bb89816f77551998bfdc60162c91857639c16 (diff) | |
download | skiboot-35776a29f24ec4e3b8cd19cfc87dd05f9c646cdc.zip skiboot-35776a29f24ec4e3b8cd19cfc87dd05f9c646cdc.tar.gz skiboot-35776a29f24ec4e3b8cd19cfc87dd05f9c646cdc.tar.bz2 |
add little endian support
This adds support for building LE skiboot with LITTLE_ENDIAN=1.
This is not complete, notably PHB3, NPU* and *CAPI*, but it is
sufficient to build and boot on mambo and OpenPOWER POWER9 systems.
LE/ELFv2 is a nicer calling convention, and results in smaller image and
less stack usage. It also follows the rest of the Linux/OpenPOWER stack
moving to LE.
The OPALv3 call interface still requires an ugly transition through BE
for compatibility, but that is all handled on the OPAL side.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/cpu.c | 24 | ||||
-rw-r--r-- | core/init.c | 1 |
2 files changed, 22 insertions, 3 deletions
@@ -42,7 +42,7 @@ static unsigned long hid0_attn; static bool sreset_enabled; static bool ipi_enabled; static bool pm_enabled; -static bool current_hile_mode; +static bool current_hile_mode = HAVE_LITTLE_ENDIAN; static bool current_radix_mode = true; static bool tm_suspend_enabled; @@ -1415,6 +1415,24 @@ static int64_t cpu_change_all_hid0(struct hid0_change_req *req) return OPAL_SUCCESS; } +void cpu_set_hile_mode(bool hile) +{ + struct hid0_change_req req; + + if (hile == current_hile_mode) + return; + + if (hile) { + req.clr_bits = 0; + req.set_bits = hid0_hile; + } else { + req.clr_bits = hid0_hile; + req.set_bits = 0; + } + cpu_change_all_hid0(&req); + current_hile_mode = hile; +} + static void cpu_cleanup_one(void *param __unused) { mtspr(SPR_AMR, 0); @@ -1453,8 +1471,8 @@ static int64_t cpu_cleanup_all(void) void cpu_fast_reboot_complete(void) { - /* Fast reboot will have cleared HID0:HILE */ - current_hile_mode = false; + /* Fast reboot will have set HID0:HILE to skiboot endian */ + current_hile_mode = HAVE_LITTLE_ENDIAN; /* and set HID0:RADIX */ current_radix_mode = true; diff --git a/core/init.c b/core/init.c index b7bf2e5..16f4a4f 100644 --- a/core/init.c +++ b/core/init.c @@ -632,6 +632,7 @@ void __noreturn load_and_boot_kernel(bool is_reboot) cpu_disable_ME_RI_all(); patch_traps(false); + cpu_set_hile_mode(false); /* Clear HILE on all CPUs */ checksum_romem(); |