From: Graeme Gregory graeme.gregory@linaro.org
For armv8 ACPI on model before there is bootloader support pass an ACPI blob via the chosen node of the FDT. This is the same method used on armv7 prototype.
Signed-off-by: Graeme Gregory graeme.gregory@linaro.org --- Makefile | 36 +++++++++++++++++++++++++++--------- model.lds.S | 9 +++++++++ 2 files changed, 36 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile index 38595a3..11182a0 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,8 @@ GIC_CPU_BASE := 0x2c002000 CNTFRQ := 0x01800000 # 24Mhz
#INITRD_FLAGS := -DUSE_INITRD -CPPFLAGS += $(INITRD_FLAGS) +ACPI_FLAGS := -DUSE_ACPI +CPPFLAGS += $(INITRD_FLAGS) $(ACPI_FLAGS)
BOOTLOADER := boot.S MBOX_OFFSET := 0xfff8 @@ -30,6 +31,12 @@ FILESYSTEM_START:= $(shell echo $$(($(PHYS_OFFSET) + $(FS_OFFSET)))) FILESYSTEM_SIZE := $(shell stat -Lc %s $(FILESYSTEM) 2>/dev/null || echo 0) FILESYSTEM_END := $(shell echo $$(($(FILESYSTEM_START) + $(FILESYSTEM_SIZE))))
+ACPI := tables.acpi +ACPI_OFFSET := 0xF000000 +ACPI_START := $(shell echo $$(($(PHYS_OFFSET) + ($ACPI_OFFSET)))) +ACPI_SIZE := $(shell stat -Lc %s $(ACPI) 2>/dev/null || echo 0) +ACPI_END := $(shell echo $$(($(ACPI_START) + $(ACPI_SIZE)))) + FDT_SRC := rtsm_ve-aemv8a.dts FDT_INCL_REGEX := (/include/[[:space:]]*")([^"]+)(".*) FDT_DEPS := $(FDT_SRC) $(addprefix $(dir $(FDT_SRC)), $(shell sed -ne 'sq$(strip $(FDT_INCL_REGEX)q\2q p' < $(FDT_SRC)))) @@ -37,19 +44,30 @@ FDT_OFFSET := 0x08000000
BOOTARGS_COMMON := "console=ttyAMA0 earlyprintk=pl011,0x1c090000 $(BOOTARGS_EXTRA)"
+CHOSEN_NODE := chosen { ifneq (,$(findstring USE_INITRD,$(CPPFLAGS))) BOOTARGS := "$(BOOTARGS_COMMON)" -CHOSEN_NODE := chosen { \ - bootargs = "$(BOOTARGS)"; \ +CHOSEN_NODE += bootargs = "$(BOOTARGS)"; \ linux,initrd-start = <$(FILESYSTEM_START)>; \ - linux,initrd-end = <$(FILESYSTEM_END)>; \ - }; + linux,initrd-end = <$(FILESYSTEM_END)>; + +ifneq (,$(findstring USE_ACPI,$(CPPFLAGS))) +CHOSEN_NODE += linux,acpi-start = <$(ACPI_START)>; \ + linux,acpi-len = <$(ACPI_SIZE)>; +endif + else BOOTARGS := "root=/dev/nfs nfsroot=<serverip>:<rootfs>,tcp rw ip=dhcp $(BOOTARGS_COMMON)" CHOSEN_NODE := chosen { \ - bootargs = "$(BOOTARGS)"; \ - }; + bootargs = "$(BOOTARGS)"; + +ifneq (,$(findstring USE_ACPI,$(CPPFLAGS))) +CHOSEN_NODE += linux,acpi-start = <$(ACPI_START)>; \ + linux,acpi-len = <$(ACPI_SIZE)>; +endif + endif +CHOSEN_NODE += };
CROSS_COMPILE ?= aarch64-none-linux-gnu- CC := $(CROSS_COMPILE)gcc @@ -68,14 +86,14 @@ boot.o: $(BOOTLOADER) Makefile $(CC) $(CPPFLAGS) -DCNTFRQ=$(CNTFRQ) -DUART_BASE=$(UART_BASE) -DSYSREGS_BASE=$(SYSREGS_BASE) -DGIC_DIST_BASE=$(GIC_DIST_BASE) -DGIC_CPU_BASE=$(GIC_CPU_BASE) -c -o $@ $(BOOTLOADER)
model.lds: $(LD_SCRIPT) Makefile - $(CC) $(CPPFLAGS) -DPHYS_OFFSET=$(PHYS_OFFSET) -DMBOX_OFFSET=$(MBOX_OFFSET) -DKERNEL_OFFSET=$(KERNEL_OFFSET) -DFDT_OFFSET=$(FDT_OFFSET) -DFS_OFFSET=$(FS_OFFSET) -DKERNEL=$(KERNEL) -DFILESYSTEM=$(FILESYSTEM) -E -P -C -o $@ $< + $(CC) $(CPPFLAGS) -DPHYS_OFFSET=$(PHYS_OFFSET) -DMBOX_OFFSET=$(MBOX_OFFSET) -DKERNEL_OFFSET=$(KERNEL_OFFSET) -DFDT_OFFSET=$(FDT_OFFSET) -DFS_OFFSET=$(FS_OFFSET) -DKERNEL=$(KERNEL) -DFILESYSTEM=$(FILESYSTEM) -DACPI=$(ACPI) -DACPI_OFFSET=$(ACPI_OFFSET) -E -P -C -o $@ $<
ifeq ($(DTC),) $(error No dtc found! You can git clone from git://git.jdl.com/software/dtc.git) endif
fdt.dtb: $(FDT_DEPS) Makefile - ( echo "/include/ "$(FDT_SRC)"" ; echo "/ { $(CHOSEN_NODE) };" ) | $(DTC) -O dtb -o $@ - + ( echo "/include/ "$(FDT_SRC)"" ; echo "/ { $(CHOSEN_NODE) };" ) | tee chosen.dts | $(DTC) -O dtb -o $@ -
# The filesystem archive might not exist if INITRD is not being used .PHONY: all clean $(FILESYSTEM) diff --git a/model.lds.S b/model.lds.S index ec27433..f8d4683 100644 --- a/model.lds.S +++ b/model.lds.S @@ -15,6 +15,10 @@ INPUT(./boot.o) INPUT(KERNEL) INPUT(./fdt.dtb)
+#ifdef USE_ACPI +INPUT(ACPI) +#endif + #ifdef USE_INITRD INPUT(FILESYSTEM) #endif @@ -33,6 +37,11 @@ SECTIONS . = PHYS_OFFSET + FDT_OFFSET; dtb = .; .dtb : { ./fdt.dtb } + . = PHYS_OFFSET + ACPI_OFFSET; + acpi = .; +#ifdef USE_ACPI + .acpi : { ACPI } +#endif . = PHYS_OFFSET + FS_OFFSET; filesystem = .; #ifdef USE_INITRD