Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
cc8414e
src/arch/ppc64/include/arch/io.h: implement IO functions
miczyg1 Sep 15, 2020
e5fb1ed
mb/raptor-cs/talos-2: add basic mainboard structure
miczyg1 Sep 15, 2020
027459e
src/arch/ppc64/arch_timer.c: implement timer functions
miczyg1 Sep 17, 2020
11ee756
ppc64/bootblock_crt0.S: minimal implementation for bootblock C enviro…
krystian-hebel Sep 23, 2020
2abf54c
src/arch/ppc64/include/arch/io.h: remove obsolete statements
miczyg1 Sep 23, 2020
ee55037
arch/ppc64/include/arch/io.h: use proper instructions for IO operations
krystian-hebel Sep 23, 2020
ebf13af
Makefile.inc: compile ECC tools and inject ECC to final image
miczyg1 Sep 24, 2020
c20580b
src/mainboard/raptor-cs/talos-2/Kconfig: temporarily shrink the ROM s…
miczyg1 Sep 24, 2020
b0c6265
3rdparty/sb-signing-utils: add SecureBoot utility for OpenPOWER
miczyg1 Sep 24, 2020
e11d2eb
Makefile.inc: add signing procedure
miczyg1 Sep 24, 2020
c393292
Makefile.inc: automatically pad the coreboot to 1M before applying ECC
miczyg1 Sep 24, 2020
924b6f7
Makefile.inc: fix typo
miczyg1 Sep 24, 2020
9d201f5
arch/ppc64/include/arch/io.h: ignore HRMOR for MMIO operations
krystian-hebel Sep 24, 2020
d71636a
.gitmodules: use upstream for intel-sec-tools
krystian-hebel Sep 24, 2020
446310d
drivers/uart/Kconfig: enable also for PPC64
krystian-hebel Sep 25, 2020
c1afb3c
mainboard/talos-2/bootblock.c: do not repeat what lib/bootblock does
krystian-hebel Sep 25, 2020
fee2131
Merge pull request #16 from 3mdeb/booting_test
miczyg1 Sep 25, 2020
83fe67a
Makefile.inc; make the final file to be coreboot.rom with exact size …
miczyg1 Sep 25, 2020
ba9ae23
Merge pull request #15 from 3mdeb/inject_ecc
miczyg1 Sep 25, 2020
4dd45b7
src/mainboard/raptor-cs/talos-2/bootblock.c: initialize SoL instead o…
miczyg1 Sep 25, 2020
a2a8613
src/mainboard/raptor-cs/talos-2/bootblock.c: drop obsolete step in So…
miczyg1 Sep 25, 2020
5b1e02c
Merge pull request #17 from 3mdeb/sol_init
miczyg1 Sep 28, 2020
8adacd6
src/arch/ppc64/include/arch/io.h: fix the LPC base address
miczyg1 Sep 30, 2020
40bc1e1
src/mainboard/raptor-cs/talos-2/bootblock.c: implement post code func…
miczyg1 Sep 30, 2020
53cae6b
.gitmodules: use full paths
miczyg1 Sep 30, 2020
dd399ca
ppc64/byteorder.h: define use of big endian
krystian-hebel Sep 30, 2020
bd4e7be
src/lib/fmap.c: use le*toh() functions where needed
krystian-hebel Sep 30, 2020
4bf0665
src/lib/cbfs.c: use le*toh() functions where needed
krystian-hebel Sep 30, 2020
b71f96c
mainboard/talos-2/memlayout.ld: do not overwrite CBFS image
krystian-hebel Oct 8, 2020
fd681c9
ppc64/bootblock_crt0.S: workaround different entry point in QEMU
krystian-hebel Oct 8, 2020
8adc8ce
ppc64/bootblock_crt0.S: do not clear BSS
krystian-hebel Oct 8, 2020
5186a3e
commonlib/lz4_wrapper.c: do not use bitfields
krystian-hebel Oct 8, 2020
1d7f24c
src/mainboard/raptor-cs/talos-2/Kconfig: increase ROM size and separa…
miczyg1 Oct 12, 2020
2f8b62b
src/mainboard/raptor-cs/talos-2/memlayout.ld: set bootblock size to 16K
miczyg1 Oct 12, 2020
321ba00
Makefile.inc: sign and inject ECC to the bootblock separately from CBFS
miczyg1 Oct 12, 2020
6661f6a
configs/config.raptor-cs-talos-2: add config for op-build
miczyg1 Oct 12, 2020
9772aed
src/mainboard/raptor-cs/talos-2/memlayout.ld: set bootblock size to 2…
miczyg1 Oct 12, 2020
c22fae2
configs/config.raptor-cs-talos-2: do not use any toolchain
miczyg1 Oct 12, 2020
a21f03d
Makefile.inc: fix syntax
miczyg1 Oct 12, 2020
f7aea12
Makefile.inc,Kconfig: remove bootblock outside CBFS
miczyg1 Oct 26, 2020
e005ddc
src/mainboard/raptor-cs/talos-2/memlayout.ld: increase the bootblock …
miczyg1 Dec 1, 2020
cd3211c
src/mainboard/raptor-cs/talos-2/memlayout.ld: start bootblock at 0 as…
miczyg1 Dec 1, 2020
c76037e
Merge pull request #20 from 3mdeb/op_build_support
miczyg1 Dec 2, 2020
692bd9f
Merge branch 'up_master' into rebased_talos_2_support
krystian-hebel Dec 8, 2020
0e6af4b
talos-2/memlayout.ld: add section for CBFS mcache
krystian-hebel Dec 8, 2020
a63d04b
Revert "src/lib/cbfs.c: use le*toh() functions where needed"
krystian-hebel Dec 8, 2020
6f5a735
Merge pull request #22 from 3mdeb/rebased_talos_2_support
miczyg1 Dec 14, 2020
b2268fe
src/soc/raptor-cs/*: Add file structure to soc
Dec 14, 2020
b91c259
src/soc/ibm/*: Add structe according to the example, rename soc vendo…
Dec 15, 2020
4368691
src/lib/prog_loaders.c: remove debug
IgorBagnucki Dec 15, 2020
bbcf85d
src/soc/ibm/power9/*: Apply review suggestions
Dec 16, 2020
86e2602
src/soc/ibm/power9/Kconfig: Update help
IgorBagnucki Dec 16, 2020
7e24b11
src/soc/ibm/power9/Kconfig: fix typo
IgorBagnucki Dec 16, 2020
8578665
Merge pull request #23 from 3mdeb/soc_structure
miczyg1 Dec 16, 2020
a4489bc
src/lib/prog_loaders.c: first prototype of scom indirect
Jan 19, 2021
294953d
src/lib/prog_loaders.c: check hmer
Jan 20, 2021
9320507
src/lib/prog_loaders.c:m Add debuging
Jan 21, 2021
8538e8c
src/mainboard/raptor-cs/talos-2/mainboard.c: implement istep reporting
Jan 21, 2021
73a1266
src/arch/ppc64/include/arch/io.h: Move report_istep()
Jan 25, 2021
0d43c16
README.md: add info about Insurgo GitHub
miczyg1 Feb 3, 2021
f25013b
cpu/power9: move SCOM access functions to a separate file
krystian-hebel Feb 5, 2021
9bd542a
cpu/power9: add directory to Makefile's subdirs
krystian-hebel Feb 5, 2021
9f2de5d
Makefile.inc: add ECC for CBFS on POWER9
krystian-hebel Feb 5, 2021
36e4c1f
tmp: move further stages higher in memory
krystian-hebel Feb 5, 2021
3aa0f03
arch/ppc64/bootblock_crt0.S: enable vector operations
krystian-hebel Feb 8, 2021
9d0f49f
Merge pull request #24 from 3mdeb/scom_indirect
IgorBagnucki Feb 9, 2021
a22e83f
Merge pull request #26 from 3mdeb/istep_reporting
IgorBagnucki Feb 9, 2021
1cbc6a1
src/mainboard/raptor-cs/talos-2/romstage.c: scom_init initial
Feb 11, 2021
45d5f65
util/cbfstool/flashmap/fmap.c: fix fmaptool endianness bugs on BE
Oct 20, 2020
4531ab0
util/cbfstool/flashmap/fmap.c: Fix endianness in test functions
Dec 4, 2020
2b08332
util/cbfstool/flashmap/fmap.c: add missing htole16()
krystian-hebel Feb 11, 2021
5dfd763
Merge pull request #21 from 3mdeb/fmaptool_endianness
krystian-hebel Feb 11, 2021
88b73d4
implement p9_fbc_no_hp_scom()
Feb 12, 2021
3fd5f53
continue scom_init implementation
Feb 15, 2021
9336964
move scom registers definitions
Feb 16, 2021
ff2f717
start implementation of istep 8.10
Feb 17, 2021
7b0365c
cpu/power9: fix directory structure and timer build fault
krystian-hebel Feb 18, 2021
7595dc1
add istep 8.10
Feb 18, 2021
f4b8733
fix indentation
Feb 18, 2021
2b1baa0
move isteps 8.9, 8.10 to soc subdir
Feb 19, 2021
ab69641
src/soc/ibm/power9/istep_8_10.c: Change testet indirect scom reg
Feb 19, 2021
62568e6
rc/include/cpu/power/scom.h: create functions for scom rmw
Feb 22, 2021
a965f57
cpu/power9: fix directory structure and timer build fault
krystian-hebel Feb 18, 2021
2ba58bb
Merge pull request #31 from 3mdeb/tmp2
IgorBagnucki Feb 23, 2021
c28043c
src/include/cpu/power/istep_8_9.c: remove attributes found in hosboot…
Feb 23, 2021
b94ea9b
scom_registers.h, step_8_10.c: fix formatting
Feb 23, 2021
dfb7d06
src/include/cpu/power/istep_8_9.c: remove attributes with values set …
Feb 24, 2021
19ba287
include/cpu/power/scom.h: add RMW variants without a chiplet ID
krystian-hebel Feb 23, 2021
e0336e5
Merge pull request #29 from 3mdeb/cpu_power_fix
miczyg1 Feb 25, 2021
1c40160
cpu/power9/scom.c: reset SCOM after an error
krystian-hebel Feb 25, 2021
abd3717
cpu/power9/scom: fixes after review
krystian-hebel Feb 26, 2021
fc0a7b4
cpu/power9: fix tabulations
miczyg1 Feb 26, 2021
cabaf02
Merge pull request #36 from 3mdeb/scom_reset
miczyg1 Feb 26, 2021
33ea2ba
src/soc/ibm/power9: review fixes
Mar 1, 2021
a4e6c9b
Merge branch 'talos_2_support' into scom_init
IgorBagnucki Mar 1, 2021
620ec8b
src/soc/ibm/power9/istep_8_10.c: Change mask values to PPC_BITMASK() …
Mar 1, 2021
f5b3c74
src/cpu/power/scom_init.c: Delete empty file
IgorBagnucki Mar 1, 2021
9c8521c
src/soc/ibm/power9/istep_8_9.c: Describe register fields
Mar 2, 2021
4207270
Merge branch 'scom_init' of github.com:3mdeb/coreboot into scom_init
Mar 2, 2021
726b067
src/soc/ibm/power9/istep_8_10.c: Clean up istep 8.10
Mar 4, 2021
aa24675
src/soc/ibm/power9/istep_8_10.c Clean up sitep 8.10 p9_xbus_g1_scom()
Mar 5, 2021
9c04be1
src/soc/ibm/power9/Makefile.inc: Rename CPU_IBM_POWER9 to SOC_IBM_POWER9
Mar 5, 2021
33d090b
Implement istep 8.9, 8.10 on top of staging branch
Sep 3, 2021
f1ba4c0
Fix gitmodules
Sep 3, 2021
fd91b65
Fix makefile
Sep 3, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,60 +1,64 @@
[submodule "3rdparty/blobs"]
path = 3rdparty/blobs
url = ../blobs.git
url = https://review.coreboot.org/blobs.git
update = none
ignore = dirty
[submodule "util/nvidia-cbootimage"]
path = util/nvidia/cbootimage
url = ../nvidia-cbootimage.git
url = https://review.coreboot.org/nvidia-cbootimage.git
[submodule "vboot"]
path = 3rdparty/vboot
url = ../vboot.git
url = https://review.coreboot.org/vboot.git
branch = main
[submodule "arm-trusted-firmware"]
path = 3rdparty/arm-trusted-firmware
url = ../arm-trusted-firmware.git
url = https://review.coreboot.org/arm-trusted-firmware.git
[submodule "3rdparty/chromeec"]
path = 3rdparty/chromeec
url = ../chrome-ec.git
url = https://review.coreboot.org/chrome-ec.git
[submodule "libhwbase"]
path = 3rdparty/libhwbase
url = ../libhwbase.git
url = https://review.coreboot.org/libhwbase.git
[submodule "libgfxinit"]
path = 3rdparty/libgfxinit
url = ../libgfxinit.git
url = https://review.coreboot.org/libgfxinit.git
[submodule "3rdparty/fsp"]
path = 3rdparty/fsp
url = ../fsp.git
url = https://review.coreboot.org/fsp.git
update = none
ignore = dirty
[submodule "opensbi"]
path = 3rdparty/opensbi
url = ../opensbi.git
url = https://review.coreboot.org/opensbi.git
[submodule "intel-microcode"]
path = 3rdparty/intel-microcode
url = ../intel-microcode.git
url = https://review.coreboot.org/intel-microcode.git
update = none
ignore = dirty
[submodule "3rdparty/ffs"]
path = 3rdparty/ffs
url = ../ffs.git
url = https://review.coreboot.org/ffs.git
[submodule "3rdparty/amd_blobs"]
path = 3rdparty/amd_blobs
url = ../amd_blobs
url = https://review.coreboot.org/amd_blobs
update = none
ignore = dirty
[submodule "3rdparty/cmocka"]
path = 3rdparty/cmocka
url = ../cmocka.git
url = https://review.coreboot.org/cmocka.git
update = none
[submodule "3rdparty/qc_blobs"]
path = 3rdparty/qc_blobs
url = ../qc_blobs.git
url = https://review.coreboot.org/qc_blobs.git
update = none
ignore = dirty
[submodule "3rdparty/intel-sec-tools"]
path = 3rdparty/intel-sec-tools
url = ../9esec-security-tooling.git
url = https://github.com/coreboot/9esec-security-tooling.git
[submodule "3rdparty/stm"]
path = 3rdparty/stm
url = ../STM
url = https://review.coreboot.org/STM
branch = stmpe
[submodule "3rdparty/sb-signing-utils"]
path = 3rdparty/sb-signing-utils
url = https://github.com/open-power/sb-signing-utils.git
1 change: 1 addition & 0 deletions 3rdparty/sb-signing-utils
Submodule sb-signing-utils added at 591c8f
36 changes: 32 additions & 4 deletions Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -500,9 +500,9 @@ ifeq ($(CONFIG_DEBUG_ADA_CODE),y)
ADAFLAGS_common += -gnata
endif

additional-dirs := $(objutil)/cbfstool $(objutil)/ifdtool \
additional-dirs += $(objutil)/cbfstool $(objutil)/ifdtool \
$(objutil)/options $(objutil)/amdfwtool \
$(objutil)/cbootimage
$(objutil)/cbootimage $(objutil)/ffs

export $(COREBOOT_EXPORTS)

Expand Down Expand Up @@ -538,6 +538,8 @@ RMODTOOL:=$(objutil)/cbfstool/rmodtool
IFWITOOL:=$(objutil)/cbfstool/ifwitool
IFITTOOL:=$(objutil)/cbfstool/ifittool
AMDCOMPRESS:=$(objutil)/cbfstool/amdcompress
ECCTOOL:=$(objutil)/ffs/ecc/ecc
SBSINGTOOLS:=$(objutil)/sb-signing-utils

$(obj)/cbfstool: $(CBFSTOOL)
cp $< $@
Expand Down Expand Up @@ -576,6 +578,18 @@ $(IFDTOOL):

AMDFWTOOL:=$(objutil)/amdfwtool/amdfwtool

$(ECCTOOL):
@printf " Compile ECCTOOL\n"
cp -r $(top)/3rdparty/ffs $(objutil)
cd $(objutil)/ffs && autoreconf -i && ./configure
+$(MAKE) -C $(objutil)/ffs

$(SBSINGTOOLS):
@printf " Compile SB SIGNING UTILS\n"
cp -r $(top)/3rdparty/sb-signing-utils $(objutil)
cd $(objutil)/sb-signing-utils && autoreconf -i -Wno-unsupported && ./configure
+$(MAKE) -C $(objutil)/sb-signing-utils

APCB_EDIT_TOOL:=$(top)/util/apcb/apcb_edit.py

CBOOTIMAGE:=$(objutil)/cbootimage/cbootimage
Expand Down Expand Up @@ -687,7 +701,7 @@ install-git-commit-clangfmt:
include util/crossgcc/Makefile.inc

.PHONY: tools
tools: $(objutil)/kconfig/conf $(objutil)/kconfig/toada $(CBFSTOOL) $(objutil)/cbfstool/cbfs-compression-tool $(FMAPTOOL) $(RMODTOOL) $(IFWITOOL) $(objutil)/nvramtool/nvramtool $(objutil)/sconfig/sconfig $(IFDTOOL) $(CBOOTIMAGE) $(AMDFWTOOL) $(AMDCOMPRESS) $(FUTILITY) $(BINCFG) $(IFITTOOL) $(objutil)/supermicro/smcbiosinfo
tools: $(objutil)/kconfig/conf $(objutil)/kconfig/toada $(CBFSTOOL) $(objutil)/cbfstool/cbfs-compression-tool $(FMAPTOOL) $(RMODTOOL) $(IFWITOOL) $(objutil)/nvramtool/nvramtool $(objutil)/sconfig/sconfig $(IFDTOOL) $(CBOOTIMAGE) $(AMDFWTOOL) $(AMDCOMPRESS) $(FUTILITY) $(BINCFG) $(IFITTOOL) $(objutil)/supermicro/smcbiosinfo $(ECCTOOL) $(SBSINGTOOL)

###########################################################################
# Common recipes for all stages
Expand Down Expand Up @@ -1124,7 +1138,7 @@ else
RAMSTAGE=
endif

$(obj)/coreboot.rom: $(obj)/coreboot.pre $(RAMSTAGE) $(CBFSTOOL) $$(INTERMEDIATE)
$(obj)/coreboot.rom: $(obj)/coreboot.pre $(RAMSTAGE) $(CBFSTOOL) $(ECCTOOL) $(SBSINGTOOLS) $$(INTERMEDIATE)
@printf " CBFS $(subst $(obj)/,,$(@))\n"
# The full ROM may be larger than the CBFS part, so create an empty
# file (filled with \377 = 0xff) and copy the CBFS image over it.
Expand All @@ -1144,6 +1158,20 @@ endif # CONFIG_CPU_INTEL_FIRMWARE_INTERFACE_TABLE
$(CBFSTOOL) $@ layout
@printf " CBFSPRINT $(subst $(obj)/,,$(@))\n\n"
$(CBFSTOOL) $@ print -r $(subst $(spc),$(comma),$(all-regions))
ifeq ($(CONFIG_ARCH_PPC64),y)
cp -r $(top)/3rdparty/sb-signing-utils/test/keys /tmp
@printf " SBSIGN $(subst $(obj)/,,$(@))\n"
cd $(SBSINGTOOLS) && ./sign-with-local-keys.sh $(top)/$(objcbfs)/bootblock.bin $(top)/$(obj)/bootblock.signed 2> /dev/null
cd $(SBSINGTOOLS) && ./sign-with-local-keys.sh $(top)/$@ $(top)/$@.signed 2> /dev/null
@printf " ECC $(subst $(obj)/,,$(@))\n"
$(ECCTOOL) --inject $(top)/$@.signed --output $(top)/$@.signed.ecc --p8
$(ECCTOOL) --inject $(top)/$@ --output $(top)/$@.ecc --p8
@printf " ECC bootblock\n"
dd if=$(obj)/bootblock.signed of=$(obj)/bootblock.signed.pad ibs=25486 conv=sync 2> /dev/null
$(ECCTOOL) --inject $(obj)/bootblock.signed.pad --output $(obj)/bootblock.signed.ecc --p8
rm $(obj)/bootblock.signed $(obj)/bootblock.signed.pad
endif


cbfs-files-y += $(CONFIG_CBFS_PREFIX)/romstage
$(CONFIG_CBFS_PREFIX)/romstage-file := $(objcbfs)/romstage.elf
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Contributing

All relevant chnages to OpenPOWER Talos II should go here:
https://github.com/InsurgoTech/coreboot

coreboot README
===============

Expand Down
1 change: 1 addition & 0 deletions configs/config.raptor-cs-talos-2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_VENDOR_RAPTOR_CS=y
5 changes: 4 additions & 1 deletion src/arch/ppc64/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ ppc64_asm_flags =
################################################################################
ifeq ($(CONFIG_ARCH_BOOTBLOCK_PPC64),y)

bootblock-y = bootblock.S stages.c
bootblock-y = bootblock_crt0.S
bootblock-y += arch_timer.c
bootblock-y += boot.c
bootblock-y += rom_media.c
bootblock-y += \
Expand All @@ -34,6 +35,7 @@ endif
################################################################################
ifeq ($(CONFIG_ARCH_ROMSTAGE_PPC64),y)

romstage-y += arch_timer.c
romstage-y += boot.c
romstage-y += stages.c
romstage-y += rom_media.c
Expand Down Expand Up @@ -62,6 +64,7 @@ endif
################################################################################
ifeq ($(CONFIG_ARCH_RAMSTAGE_PPC64),y)

ramstage-y += arch_timer.c
ramstage-y += rom_media.c
ramstage-y += stages.c
ramstage-y += boot.c
Expand Down
44 changes: 44 additions & 0 deletions src/arch/ppc64/arch_timer.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/* SPDX-License-Identifier: GPL-2.0-only */

#include <timer.h>

/* Refer to hostboot/src/kernel/timemgr.C */

/* Time base frequency is 512 MHz so 512 ticks per usec */
#define TB_TICKS_PER_USEC 512

static inline uint64_t get_time_base(void)
{
uint64_t tb = 0;
asm volatile("mfspr %0, 268" : "=r" (tb));
return tb;
}

static struct monotonic_counter {
int initialized;
struct mono_time time;
uint64_t last_value;
} mono_counter;

void timer_monotonic_get(struct mono_time *mt)
{
uint64_t current_tick;
uint64_t usecs_elapsed;

if (!mono_counter.initialized) {
mono_counter.last_value = get_time_base();
mono_counter.initialized = 1;
}

current_tick = get_time_base();
usecs_elapsed = (current_tick - mono_counter.last_value) / TB_TICKS_PER_USEC;

/* Update current time and tick values only if a full tick occurred. */
if (usecs_elapsed) {
mono_time_add_usecs(&mono_counter.time, usecs_elapsed);
mono_counter.last_value = current_tick;
}

/* Save result. */
*mt = mono_counter.time;
}
34 changes: 0 additions & 34 deletions src/arch/ppc64/bootblock.S

This file was deleted.

76 changes: 76 additions & 0 deletions src/arch/ppc64/bootblock_crt0.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Early initialization code for POWER8.
*/

#define FIXUP_ENDIAN \
tdi 0,0,0x48; /* Reverse endian of b . + 8 */ \
b $+44; /* Skip trampoline if endian is good */ \
.long 0xa600607d; /* mfmsr r11 */ \
.long 0x01006b69; /* xori r11,r11,1 */ \
.long 0x00004039; /* li r10,0 */ \
.long 0x6401417d; /* mtmsrd r10,1 */ \
.long 0x05009f42; /* bcl 20,31,$+4 */ \
.long 0xa602487d; /* mflr r10 */ \
.long 0x14004a39; /* addi r10,r10,20 */ \
.long 0xa6035a7d; /* mtsrr0 r10 */ \
.long 0xa6037b7d; /* mtsrr1 r11 */ \
.long 0x2400004c /* rfid */

/* SBE sets HRMOR to 130MB, ie 2MB into 10MB cache. Our bootblock is loaded
* 12 KB above that address - it is used as a place for interrupt vectors in
* Hostboot, but it isn't actually a part of the HBBL partition to save space
* in PNOR image. */

.section ".text._start", "ax", %progbits
.globl _start
_start:
/* QEMU with hb-mode=on starts at address 0x10, while hardware at 0x0. */
nop
nop
nop
nop
FIXUP_ENDIAN

/* Set program priority to medium */
or %r2, %r2, %r2

/* Stack */
lis %r1, _estack@ha
addi %r1, %r1, _estack@l

/* Clear .bss section */
/* Curently not needed, .bss is zeroed in the file. If it were to be used,
* make sure that .bss is 128B aligned (size of cache line), otherwise dcbz
* will clear (part of) .opd section! */
/*
lis %r5, _bss@ha
addi %r5, %r5, _bss@l
lis %r6, _ebss@ha
addi %r6, %r6, _ebss@l
addi %r6, %r6, -1
1:
dcbz 0, %r5
addi %r5, %r5, 128
cmpld cr7, %r5, %r6
blt cr7, 1b
*/

/* Enable floating point and vector operations */
/* Vector operations are sometimes generated for code like
* 'uint8_t x[32] = {0}', this results in an exception when vector registers
* (VEC) are not enabled. VSX (vector-scalar extension) is also enabled,
* there is no reason not to. Floating point must also be enabled for VSX.
*/
mfmsr %r3
ori %r3, %r3, 0x2000 /* FP = 1 */
oris %r3, %r3, 0x0280 /* VEC = 1, VSX = 1 */
mtmsr %r3

/* Load official procedure descriptor address for main() */
lis %r12, main@ha
addi %r12, %r12, main@l

/* Load TOC pointer and jump to main() */
ld %r2, 8(%r12)
b main
5 changes: 4 additions & 1 deletion src/arch/ppc64/include/arch/byteorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
#ifndef _BYTEORDER_H
#define _BYTEORDER_H

#define __LITTLE_ENDIAN 1234
#define __BIG_ENDIAN 4321

#define PPC_BIT(bit) (0x8000000000000000UL >> (bit))
#define PPC_BITMASK(bs,be) ((PPC_BIT(bs) - PPC_BIT(be)) | PPC_BIT(bs))

#endif /* _BYTEORDER_H */
Loading