x86: Add basic support to queensbay platform and crownbay board
PATCH 17/25 x86: Add basic support to queensbay platform and crownbay board
Implement minimum required functions for the basic support to queensbay platform and crownbay board.
--- arch/x86/cpu/queensbay/Makefile | 9 +++++ arch/x86/cpu/queensbay/tnc.c | 48 +++++++++++++++++++++++ arch/x86/cpu/queensbay/tnc_car.S | 75 ++++++++++++++++++++++++++++++++++++ arch/x86/cpu/queensbay/tnc_dram.c | 81 +++++++++++++++++++++++++++++++++++++++ arch/x86/cpu/queensbay/tnc_pci.c | 62 ++++++++++++++++++++++++++++++ board/intel/crownbay/MAINTAINERS | 6 +++ board/intel/crownbay/Makefile | 7 ++++ board/intel/crownbay/crownbay.c | 20 ++++++++++ board/intel/crownbay/start.S | 9 +++++ 9 files changed, 317 insertions(+) create mode 100644 arch/x86/cpu/queensbay/Makefile create mode 100644 arch/x86/cpu/queensbay/tnc.c create mode 100644 arch/x86/cpu/queensbay/tnc_car.S create mode 100644 arch/x86/cpu/queensbay/tnc_dram.c create mode 100644 arch/x86/cpu/queensbay/tnc_pci.c create mode 100644 board/intel/crownbay/MAINTAINERS create mode 100644 board/intel/crownbay/Makefile create mode 100644 board/intel/crownbay/crownbay.c create mode 100644 board/intel/crownbay/start.S
arch/x86/cpu/queensbay/Makefile new file +9 -0
@@ -0,0 +1,9 @@ +# +# Copyright (C) 2014, Bin Meng <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += tnc_car.o tnc_dram.o tnc.o +obj-y += fsp_configs.o fsp_support.o +obj-$(CONFIG_PCI) += tnc_pci.o
arch/x86/cpu/queensbay/tnc.c new file +48 -0
48 lines not on this page · raw message
arch/x86/cpu/queensbay/tnc_car.S new file +75 -0
75 lines not on this page · raw message
arch/x86/cpu/queensbay/tnc_dram.c new file +81 -0
81 lines not on this page · raw message
arch/x86/cpu/queensbay/tnc_pci.c new file +62 -0
62 lines not on this page · raw message
board/intel/crownbay/MAINTAINERS new file +6 -0
@@ -0,0 +1,6 @@ +INTEL CROWNBAY BOARD +M: Bin Meng <[email protected]> +S: Maintained +F: board/intel/crownbay/ +F: include/configs/crownbay.h +F: configs/crownbay_defconfig
board/intel/crownbay/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# Copyright (C) 2014, Bin Meng <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += crownbay.o start.o
board/intel/crownbay/crownbay.c new file +20 -0
@@ -0,0 +1,20 @@ +/* +* Copyright (C) 2014, Bin Meng <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/pnp_def.h> +#include <smsc_lpc47m.h> + +#define SERIAL_DEV PNP_DEV(0x2e, 4) +#define UART0_BASE 0x3f8 + +DECLARE_GLOBAL_DATA_PTR ; + +int board_early_init_f (void ) +{ +lpc47m_enable_serial (SERIAL_DEV ,UART0_BASE ); +return 0 ; +}
board/intel/crownbay/start.S new file +9 -0
@@ -0,0 +1,9 @@ +/* + * Copyright (C) 2014, Bin Meng <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +.globl early_board_init +early_board_init: + jmp early_board_init_ret
Signature · 1 line
1.8.2.1
PATCH 17/25 x86: Add basic support to queensbay platform and crownbay board
Hi Bin,
Quoted 67 lines · Bin Meng
Implement minimum required functions for the basic support to queensbay platform and crownbay board.
Signed-off-by Bin Meng <[email protected]>--- arch/x86/cpu/queensbay/Makefile | 9 +++++ arch/x86/cpu/queensbay/tnc.c | 48 +++++++++++++++++++++++ arch/x86/cpu/queensbay/tnc_car.S | 75 ++++++++++++++++++++++++++++++++++++ arch/x86/cpu/queensbay/tnc_dram.c | 81 +++++++++++++++++++++++++++++++++++++++ arch/x86/cpu/queensbay/tnc_pci.c | 62 ++++++++++++++++++++++++++++++ board/intel/crownbay/MAINTAINERS | 6 +++ board/intel/crownbay/Makefile | 7 ++++ board/intel/crownbay/crownbay.c | 20 ++++++++++ board/intel/crownbay/start.S | 9 +++++ 9 files changed, 317 insertions(+) create mode 100644 arch/x86/cpu/queensbay/Makefile create mode 100644 arch/x86/cpu/queensbay/tnc.c create mode 100644 arch/x86/cpu/queensbay/tnc_car.S create mode 100644 arch/x86/cpu/queensbay/tnc_dram.c create mode 100644 arch/x86/cpu/queensbay/tnc_pci.c create mode 100644 board/intel/crownbay/MAINTAINERS create mode 100644 board/intel/crownbay/Makefile create mode 100644 board/intel/crownbay/crownbay.c create mode 100644 board/intel/crownbay/start.Sarch/x86/cpu/queensbay/Makefile new file +9
-0@@ -0,0 +1,9 @@ +# +# Copyright (C) 2014, Bin Meng <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += tnc_car.o tnc_dram.o tnc.o +obj-y += fsp_configs.o fsp_support.o +obj-$(CONFIG_PCI) += tnc_pci.oarch/x86/cpu/queensbay/tnc.c new file +21
-0@@ -0,0 +1,48 @@ +/* +* Copyright (C) 2014, Bin Meng <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/post.h> +#include <asm/arch/fsp/fsp_support.h> + +int arch_cpu_init (void ) +{ +post_code (POST_CPU_INIT ); +#ifdef CONFIG_SYS_X86_TSC_TIMER +timer_set_base (rdtsc ()); +#endif + +return x86_cpu_init_f (); +} +
arch/x86/cpu/queensbay/tnc.c line 31
Quoted 10 lines
arch/x86/cpu/queensbay/tnc.c new file +10
-0+int print_cpuinfo (void ) +{ +post_code (POST_CPU_INFO ); +return default_print_cpuinfo (); +} + +void reset_cpu (ulong addr) +{ +/* cold reset */ +outb (0x06 ,0xcf9 );
I think there is a constant somewhere for cf9?
arch/x86/cpu/queensbay/tnc.c line 38
Quoted 7 lines
arch/x86/cpu/queensbay/tnc.c new file +7
-0+} + +void board_final_cleanup (void ) +{ +EFI_STATUS status; + +/* call into FspNotify */
Remove blank line
arch/x86/cpu/queensbay/tnc.c line 41
Quoted 3 lines
arch/x86/cpu/queensbay/tnc.c new file +3
-0+ +debug ("Calling into FSP (notify phase EnumInitPhaseReadyToBoot): " ); + status =FspNotifyWrapper (NULL , EnumInitPhaseReadyToBoot);
Are we stuck with these mixed case identifiers?
Quoted 23 lines
arch/x86/cpu/queensbay/tnc.c new file +7
-0+if (status !=FSP_SUCCESS ) +debug ("fail, error code %x\n" , status); +else +debug ("OK\n" ); + +return ; +}arch/x86/cpu/queensbay/tnc_car.S new file +10
-0@@ -0,0 +1,75 @@ +/* + * Copyright (C) 2014, Bin Meng <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <config.h> +#include <asm/post.h> + +.globl car_init
arch/x86/cpu/queensbay/tnc_car.S line 20
Quoted 10 lines
arch/x86/cpu/queensbay/tnc_car.S new file +10
-0+car_init: + /* + * Note: ebp holds the BIST value (built-in self test) so far, but ebp + * will be destroyed through the FSP call, thus we have to test the + * BIST value here before we call into FSP. + */ + test %ebp, %ebp + jz car_init_start + post_code(POST_BIST_FAILURE) + jmp die
Is there no way to save it anywhere?
Quoted 44 lines
arch/x86/cpu/queensbay/tnc_car.S new file +44
-0+ +car_init_start: + post_code(POST_CAR_START) + lea find_fsp_header_stack, %esp + jmp FindFspHeader + +find_fsp_header_ret: + /* EAX points to FSP_INFO_HEADER */ + mov %eax, %ebp + + /* sanity test */ + cmp $CONFIG_FSP_LOCATION, %eax + jb die + + /* calculate TempRamInitEntry address */ + mov 0x30(%ebp), %eax + add 0x1c(%ebp), %eax + + /* call FSP TempRamInitEntry to setup temporary stack */ + lea temp_ram_init_stack, %esp + jmp *%eax + +temp_ram_init_ret: + addl $4, %esp + cmp $0, %eax + jz continue + post_code(POST_CAR_FAILURE) + +die: + hlt + jmp die + hlt + +continue: + post_code(POST_CAR_CPU_CACHE) + jmp car_init_ret + + .balign 4 +find_fsp_header_stack: + .long find_fsp_header_ret + + .balign 4 +temp_ram_init_stack: + .long temp_ram_init_ret
arch/x86/cpu/queensbay/tnc_car.S line 74
Quoted 10 lines
arch/x86/cpu/queensbay/tnc_car.S new file +10
-0+ .long temp_ram_init_params +temp_ram_init_params: + .long ucode_start /* microcode base */ + .long ucode_size /* microcode size */ + .long CONFIG_SYS_MONITOR_BASE /* code region base */ + .long CONFIG_SYS_MONITOR_LEN /* code region size */ + + .balign 4 +ucode_start: + .include "arch/x86/cpu/queensbay/M0220661105.inc"
Does the microcode have to be applied before we even have temporary RAM?
Quoted 63 lines
arch/x86/cpu/queensbay/tnc_car.S new file +1
-0+ucode_size = ( . - ucode_start)arch/x86/cpu/queensbay/tnc_dram.c new file +56
-0@@ -0,0 +1,81 @@ +/* +* Copyright (C) 2014, Bin Meng <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/arch/fsp/fsp_support.h> +#include <asm/e820.h> +#include <asm/post.h> + +DECLARE_GLOBAL_DATA_PTR ; + +int dram_init (void ) +{ +phys_size_t ram_size =0 ; +EFI_PEI_HOB_POINTERS hob; + + hob.Raw = gd->arch.hob_list; +while (!END_OF_HOB_LIST (hob)) { +if (hob.Header->HobType ==EFI_HOB_TYPE_RESOURCE_DESCRIPTOR ) { +if (hob.ResourceDescriptor->ResourceType ==EFI_RESOURCE_SYSTEM_MEMORY || + hob.ResourceDescriptor->ResourceType ==EFI_RESOURCE_MEMORY_RESERVED ) { + ram_size += hob.ResourceDescriptor->ResourceLength; + } + } + hob.Raw =GET_NEXT_HOB (hob); + } + + gd->ram_size = ram_size; +post_code (POST_DRAM ); + +return 0 ; +} + +void dram_init_banksize (void ) +{ + gd->bd->bi_dram[0 ].start =0 ; + gd->bd->bi_dram[0 ].size = gd->ram_size; +} + +/* +* This function looks for the highest region of memory lower than 4GB which +* has enough space for U-Boot where U-Boot is aligned on a page boundary. +* It overrides the default implementation found elsewhere which simply +* picks the end of ram, wherever that may be. The location of the stack, +* the relocation address, and how far U-Boot is moved by relocation are +* set in the global data structure. +*/ +ulong board_get_usable_ram_top (ulong total_size) +{ +return GetUsableLowMemTop (gd->arch.hob_list); +} + +unsigned install_e820_map (unsigned max_entries,struct e820entry *entries) +{
arch/x86/cpu/queensbay/tnc_dram.c line 66
Quoted 10 lines
arch/x86/cpu/queensbay/tnc_dram.c new file +10
-0+unsigned num_entries =0 ; + +EFI_PEI_HOB_POINTERS hob; + + hob.Raw = gd->arch.hob_list; + +while (!END_OF_HOB_LIST (hob)) { +if (hob.Header->HobType ==EFI_HOB_TYPE_RESOURCE_DESCRIPTOR ) { +if (hob.ResourceDescriptor->ResourceType ==EFI_RESOURCE_SYSTEM_MEMORY ) { + entries[num_entries].addr = hob.ResourceDescriptor->PhysicalStart;
Can we make these identifiers follow style?
Quoted 63 lines
arch/x86/cpu/queensbay/tnc_dram.c new file +15
-0+ entries[num_entries].size = hob.ResourceDescriptor->ResourceLength; + entries[num_entries].type =E820_RAM ; + }else if (hob.ResourceDescriptor->ResourceType ==EFI_RESOURCE_MEMORY_RESERVED ) { + entries[num_entries].addr = hob.ResourceDescriptor->PhysicalStart; + entries[num_entries].size = hob.ResourceDescriptor->ResourceLength; + entries[num_entries].type =E820_RESERVED ; + } + + } + hob.Raw =GET_NEXT_HOB (hob); + num_entries++; + } + +return num_entries; +}arch/x86/cpu/queensbay/tnc_pci.c new file +42
-0@@ -0,0 +1,62 @@ +/* +* Copyright (C) 2014, Bin Meng <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <pci.h> +#include <asm/pci.h> +#include <asm/arch/fsp/fsp_support.h> + +DECLARE_GLOBAL_DATA_PTR ; + +void board_pci_setup_hose (struct pci_controller *hose) +{ + hose->first_busno =0 ; + hose->last_busno =0 ; + +/* PCI memory space */ +pci_set_region (hose->regions +0 , +CONFIG_PCI_MEM_BUS , +CONFIG_PCI_MEM_PHYS , +CONFIG_PCI_MEM_SIZE , +PCI_REGION_MEM ); + +/* PCI IO space */ +pci_set_region (hose->regions +1 , +CONFIG_PCI_IO_BUS , +CONFIG_PCI_IO_PHYS , +CONFIG_PCI_IO_SIZE , +PCI_REGION_IO ); + +pci_set_region (hose->regions +2 , +CONFIG_PCI_PREF_BUS , +CONFIG_PCI_PREF_PHYS , +CONFIG_PCI_PREF_SIZE , +PCI_REGION_PREFETCH ); + + pci_set_region(hose->regions + 3, + 0, + 0, + gd->ram_size,
arch/x86/cpu/queensbay/tnc_pci.c line 52
Quoted 10 lines
arch/x86/cpu/queensbay/tnc_pci.c new file +10
-0+ PCI_REGION_MEM | PCI_REGION_SYS_MEMORY); + + hose->region_count =4 ; +} + +int board_pci_post_scan (struct pci_controller *hose) +{ +EFI_STATUS status; + +/* call into FspNotify */
Remove blank line
Quoted 43 lines
arch/x86/cpu/queensbay/tnc_pci.c new file +10
-0+ +debug ("Calling into FSP (notify phase EnumInitPhaseAfterPciEnumeration): " ); + status =FspNotifyWrapper (NULL , EnumInitPhaseAfterPciEnumeration); +if (status !=FSP_SUCCESS ) +debug ("fail, error code %x\n" , status); +else +debug ("OK\n" ); + +return 0 ; +}board/intel/crownbay/MAINTAINERS new file +6
-0@@ -0,0 +1,6 @@ +INTEL CROWNBAY BOARD +M: Bin Meng <[email protected]> +S: Maintained +F: board/intel/crownbay/ +F: include/configs/crownbay.h +F: configs/crownbay_defconfigboard/intel/crownbay/Makefile new file +7
-0@@ -0,0 +1,7 @@ +# +# Copyright (C) 2014, Bin Meng <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += crownbay.o start.oboard/intel/crownbay/crownbay.c new file +2
-0@@ -0,0 +1,20 @@ +/* +* Copyright (C) 2014, Bin Meng <[email protected]>
board/intel/crownbay/crownbay.c line 12
Quoted 10 lines
board/intel/crownbay/crownbay.c new file +10
-0+* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/pnp_def.h> +#include <smsc_lpc47m.h> + +#define SERIAL_DEV PNP_DEV(0x2e, 4) +#define UART0_BASE 0x3f8
I think there is a constant for this somewhere already?
board/intel/crownbay/crownbay.c line 18
Quoted 6 lines
board/intel/crownbay/crownbay.c new file +6
-0+ +DECLARE_GLOBAL_DATA_PTR ; + +int board_early_init_f (void ) +{ +lpc47m_enable_serial (SERIAL_DEV ,UART0_BASE );
blank line before return. Why do we need to do this so early?
Quoted 18 lines
board/intel/crownbay/crownbay.c new file +2
-0+return 0 ; +}board/intel/crownbay/start.S new file +9
-1@@ -0,0 +1,9 @@ +/* + * Copyright (C) 2014, Bin Meng <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +.globl early_board_init +early_board_init: + jmp early_board_init_ret --
Quoted 2 lines
1.8.2.1
Regards,
Simon
PATCH 17/25 x86: Add basic support to queensbay platform and crownbay board
Hi Simon,
Quoted 74 lines · Simon Glass
Hi Bin,
Quoted 71 lines · Bin Meng
Implement minimum required functions for the basic support to queensbay platform and crownbay board.
Signed-off-by Bin Meng <[email protected]>--- arch/x86/cpu/queensbay/Makefile | 9 +++++ arch/x86/cpu/queensbay/tnc.c | 48 +++++++++++++++++++++++ arch/x86/cpu/queensbay/tnc_car.S | 75 ++++++++++++++++++++++++++++++++++++ arch/x86/cpu/queensbay/tnc_dram.c | 81 +++++++++++++++++++++++++++++++++++++++ arch/x86/cpu/queensbay/tnc_pci.c | 62 ++++++++++++++++++++++++++++++ board/intel/crownbay/MAINTAINERS | 6 +++ board/intel/crownbay/Makefile | 7 ++++ board/intel/crownbay/crownbay.c | 20 ++++++++++ board/intel/crownbay/start.S | 9 +++++ 9 files changed, 317 insertions(+) create mode 100644 arch/x86/cpu/queensbay/Makefile create mode 100644 arch/x86/cpu/queensbay/tnc.c create mode 100644 arch/x86/cpu/queensbay/tnc_car.S create mode 100644 arch/x86/cpu/queensbay/tnc_dram.c create mode 100644 arch/x86/cpu/queensbay/tnc_pci.c create mode 100644 board/intel/crownbay/MAINTAINERS create mode 100644 board/intel/crownbay/Makefile create mode 100644 board/intel/crownbay/crownbay.c create mode 100644 board/intel/crownbay/start.Sarch/x86/cpu/queensbay/Makefile new file +9
-0@@ -0,0 +1,9 @@ +# +# Copyright (C) 2014, Bin Meng <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += tnc_car.o tnc_dram.o tnc.o +obj-y += fsp_configs.o fsp_support.o +obj-$(CONFIG_PCI) += tnc_pci.oarch/x86/cpu/queensbay/tnc.c new file +25
-0@@ -0,0 +1,48 @@ +/* +* Copyright (C) 2014, Bin Meng <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/post.h> +#include <asm/arch/fsp/fsp_support.h> + +int arch_cpu_init (void ) +{ +post_code (POST_CPU_INIT ); +#ifdef CONFIG_SYS_X86_TSC_TIMER +timer_set_base (rdtsc ()); +#endif + +return x86_cpu_init_f (); +} + +int print_cpuinfo (void ) +{ +post_code (POST_CPU_INFO ); +return default_print_cpuinfo ();
Quoted 8 lines
arch/x86/cpu/queensbay/tnc.c line 31
Quoted 6 lines
arch/x86/cpu/queensbay/tnc.c new file +6
-0+} + +void reset_cpu (ulong addr) +{ +/* cold reset */ +outb (0x06 ,0xcf9 );I think there is a constant somewhere for cf9?
Yes, I found one in arch/x86/include/asm/processor.h and will use that.
Quoted 9 lines
arch/x86/cpu/queensbay/tnc.c line 38
Quoted 7 lines
arch/x86/cpu/queensbay/tnc.c new file +7
-0+} + +void board_final_cleanup (void ) +{ +EFI_STATUS status; + +/* call into FspNotify */ Remove blank line
OK.
Quoted 5 lines
arch/x86/cpu/queensbay/tnc.c line 41
Quoted 3 lines
arch/x86/cpu/queensbay/tnc.c new file +3
-0+ +debug ("Calling into FSP (notify phase EnumInitPhaseReadyToBoot): " ); + status =FspNotifyWrapper (NULL , EnumInitPhaseReadyToBoot);Are we stuck with these mixed case identifiers?
I may have to fix FSP support library coding style issues in v2.
Quoted 27 lines
Quoted 27 lines
arch/x86/cpu/queensbay/tnc.c new file +7
-0+if (status !=FSP_SUCCESS ) +debug ("fail, error code %x\n" , status); +else +debug ("OK\n" ); + +return ; +}arch/x86/cpu/queensbay/tnc_car.S new file +14
-0@@ -0,0 +1,75 @@ +/* + * Copyright (C) 2014, Bin Meng <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <config.h> +#include <asm/post.h> + +.globl car_init +car_init: + /* + * Note: ebp holds the BIST value (built-in self test) so far, but ebp + * will be destroyed through the FSP call, thus we have to test the
Quoted 8 lines
arch/x86/cpu/queensbay/tnc_car.S line 20
Quoted 6 lines
arch/x86/cpu/queensbay/tnc_car.S new file +6
-0+ * BIST value here before we call into FSP. + */ + test %ebp, %ebp + jz car_init_start + post_code(POST_BIST_FAILURE) + jmp dieIs there no way to save it anywhere?
Unfortunately I did not find a way to save the ebp through the FSP call so far. The FSP documentation mentions that FSP tries to save bootloader's stack before call to FspInit to a temporary memory block after the call, however I found it is not working as documented. I may look into this in the future, but for now I think we have to let it be.
Quoted 48 lines
Quoted 48 lines
arch/x86/cpu/queensbay/tnc_car.S new file +48
-0+ +car_init_start: + post_code(POST_CAR_START) + lea find_fsp_header_stack, %esp + jmp FindFspHeader + +find_fsp_header_ret: + /* EAX points to FSP_INFO_HEADER */ + mov %eax, %ebp + + /* sanity test */ + cmp $CONFIG_FSP_LOCATION, %eax + jb die + + /* calculate TempRamInitEntry address */ + mov 0x30(%ebp), %eax + add 0x1c(%ebp), %eax + + /* call FSP TempRamInitEntry to setup temporary stack */ + lea temp_ram_init_stack, %esp + jmp *%eax + +temp_ram_init_ret: + addl $4, %esp + cmp $0, %eax + jz continue + post_code(POST_CAR_FAILURE) + +die: + hlt + jmp die + hlt + +continue: + post_code(POST_CAR_CPU_CACHE) + jmp car_init_ret + + .balign 4 +find_fsp_header_stack: + .long find_fsp_header_ret + + .balign 4 +temp_ram_init_stack: + .long temp_ram_init_ret + .long temp_ram_init_params +temp_ram_init_params: + .long ucode_start /* microcode base */ + .long ucode_size /* microcode size */
Quoted 8 lines
arch/x86/cpu/queensbay/tnc_car.S line 74
Quoted 6 lines
arch/x86/cpu/queensbay/tnc_car.S new file +6
-0+ .long CONFIG_SYS_MONITOR_BASE /* code region base */ + .long CONFIG_SYS_MONITOR_LEN /* code region size */ + + .balign 4 +ucode_start: + .include "arch/x86/cpu/queensbay/M0220661105.inc"Does the microcode have to be applied before we even have temporary RAM?
Unfortunately the microcode is required to be a parameter of the call to TempRamInit, which is defined by the FSP specification.
Quoted 68 lines
Quoted 68 lines
arch/x86/cpu/queensbay/tnc_car.S new file +1
-0+ucode_size = ( . - ucode_start)arch/x86/cpu/queensbay/tnc_dram.c new file +60
-0@@ -0,0 +1,81 @@ +/* +* Copyright (C) 2014, Bin Meng <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/arch/fsp/fsp_support.h> +#include <asm/e820.h> +#include <asm/post.h> + +DECLARE_GLOBAL_DATA_PTR ; + +int dram_init (void ) +{ +phys_size_t ram_size =0 ; +EFI_PEI_HOB_POINTERS hob; + + hob.Raw = gd->arch.hob_list; +while (!END_OF_HOB_LIST (hob)) { +if (hob.Header->HobType ==EFI_HOB_TYPE_RESOURCE_DESCRIPTOR ) { +if (hob.ResourceDescriptor->ResourceType ==EFI_RESOURCE_SYSTEM_MEMORY || + hob.ResourceDescriptor->ResourceType ==EFI_RESOURCE_MEMORY_RESERVED ) { + ram_size += hob.ResourceDescriptor->ResourceLength; + } + } + hob.Raw =GET_NEXT_HOB (hob); + } + + gd->ram_size = ram_size; +post_code (POST_DRAM ); + +return 0 ; +} + +void dram_init_banksize (void ) +{ + gd->bd->bi_dram[0 ].start =0 ; + gd->bd->bi_dram[0 ].size = gd->ram_size; +} + +/* +* This function looks for the highest region of memory lower than 4GB which +* has enough space for U-Boot where U-Boot is aligned on a page boundary. +* It overrides the default implementation found elsewhere which simply +* picks the end of ram, wherever that may be. The location of the stack, +* the relocation address, and how far U-Boot is moved by relocation are +* set in the global data structure. +*/ +ulong board_get_usable_ram_top (ulong total_size) +{ +return GetUsableLowMemTop (gd->arch.hob_list); +} + +unsigned install_e820_map (unsigned max_entries,struct e820entry *entries) +{ +unsigned num_entries =0 ; + +EFI_PEI_HOB_POINTERS hob; +
Quoted 8 lines
arch/x86/cpu/queensbay/tnc_dram.c line 66
Quoted 6 lines
arch/x86/cpu/queensbay/tnc_dram.c new file +6
-0+ hob.Raw = gd->arch.hob_list; + +while (!END_OF_HOB_LIST (hob)) { +if (hob.Header->HobType ==EFI_HOB_TYPE_RESOURCE_DESCRIPTOR ) { +if (hob.ResourceDescriptor->ResourceType ==EFI_RESOURCE_SYSTEM_MEMORY ) { + entries[num_entries].addr = hob.ResourceDescriptor->PhysicalStart;Can we make these identifiers follow style?
I may have to fix FSP support library coding style issues in v2.
Quoted 67 lines
Quoted 67 lines
arch/x86/cpu/queensbay/tnc_dram.c new file +15
-0+ entries[num_entries].size = hob.ResourceDescriptor->ResourceLength; + entries[num_entries].type =E820_RAM ; + }else if (hob.ResourceDescriptor->ResourceType ==EFI_RESOURCE_MEMORY_RESERVED ) { + entries[num_entries].addr = hob.ResourceDescriptor->PhysicalStart; + entries[num_entries].size = hob.ResourceDescriptor->ResourceLength; + entries[num_entries].type =E820_RESERVED ; + } + + } + hob.Raw =GET_NEXT_HOB (hob); + num_entries++; + } + +return num_entries; +}arch/x86/cpu/queensbay/tnc_pci.c new file +46
-0@@ -0,0 +1,62 @@ +/* +* Copyright (C) 2014, Bin Meng <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <pci.h> +#include <asm/pci.h> +#include <asm/arch/fsp/fsp_support.h> + +DECLARE_GLOBAL_DATA_PTR ; + +void board_pci_setup_hose (struct pci_controller *hose) +{ + hose->first_busno =0 ; + hose->last_busno =0 ; + +/* PCI memory space */ +pci_set_region (hose->regions +0 , +CONFIG_PCI_MEM_BUS , +CONFIG_PCI_MEM_PHYS , +CONFIG_PCI_MEM_SIZE , +PCI_REGION_MEM ); + +/* PCI IO space */ +pci_set_region (hose->regions +1 , +CONFIG_PCI_IO_BUS , +CONFIG_PCI_IO_PHYS , +CONFIG_PCI_IO_SIZE , +PCI_REGION_IO ); + +pci_set_region (hose->regions +2 , +CONFIG_PCI_PREF_BUS , +CONFIG_PCI_PREF_PHYS , +CONFIG_PCI_PREF_SIZE , +PCI_REGION_PREFETCH ); + +pci_set_region (hose->regions +3 , +0 , +0 , + gd->ram_size, +PCI_REGION_MEM |PCI_REGION_SYS_MEMORY ); + + hose->region_count =4 ; +}
Quoted 8 lines
arch/x86/cpu/queensbay/tnc_pci.c line 52
Quoted 6 lines
arch/x86/cpu/queensbay/tnc_pci.c new file +6
-0+ +int board_pci_post_scan (struct pci_controller *hose) +{ +EFI_STATUS status; + +/* call into FspNotify */ Remove blank line
OK.
Quoted 47 lines
Quoted 47 lines
arch/x86/cpu/queensbay/tnc_pci.c new file +10
-0+ +debug ("Calling into FSP (notify phase EnumInitPhaseAfterPciEnumeration): " ); + status =FspNotifyWrapper (NULL , EnumInitPhaseAfterPciEnumeration); +if (status !=FSP_SUCCESS ) +debug ("fail, error code %x\n" , status); +else +debug ("OK\n" ); + +return 0 ; +}board/intel/crownbay/MAINTAINERS new file +6
-0@@ -0,0 +1,6 @@ +INTEL CROWNBAY BOARD +M: Bin Meng <[email protected]> +S: Maintained +F: board/intel/crownbay/ +F: include/configs/crownbay.h +F: configs/crownbay_defconfigboard/intel/crownbay/Makefile new file +7
-0@@ -0,0 +1,7 @@ +# +# Copyright (C) 2014, Bin Meng <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += crownbay.o start.oboard/intel/crownbay/crownbay.c new file +6
-0@@ -0,0 +1,20 @@ +/* +* Copyright (C) 2014, Bin Meng <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +
Quoted 8 lines
board/intel/crownbay/crownbay.c line 12
Quoted 6 lines
board/intel/crownbay/crownbay.c new file +6
-0+#include <common.h> +#include <asm/pnp_def.h> +#include <smsc_lpc47m.h> + +#define SERIAL_DEV PNP_DEV(0x2e, 4) +#define UART0_BASE 0x3f8I think there is a constant for this somewhere already?
It was once defined in arch/x86/include/asm/ibmpc.h, however it was deleted by commit e98a03c "dm: x86: Convert coreboot serial to use driver model". Should I add that back?
Quoted 9 lines
board/intel/crownbay/crownbay.c line 18
Quoted 6 lines
board/intel/crownbay/crownbay.c new file +6
-0+ +DECLARE_GLOBAL_DATA_PTR ; + +int board_early_init_f (void ) +{ +lpc47m_enable_serial (SERIAL_DEV ,UART0_BASE );blank line before return. Why do we need to do this so early?
board_early_init_f() is the last routine which can be used to do such thing before call to serial_init().
[snip]
Regards,
Bin
PATCH 17/25 x86: Add basic support to queensbay platform and crownbay board
Hi Bin,
Quoted 144 lines · Bin Meng
Hi Simon,
Quoted 74 lines · Simon Glass
Hi Bin,
Quoted 71 lines · Bin Meng
Implement minimum required functions for the basic support to queensbay platform and crownbay board.
Signed-off-by Bin Meng <[email protected]>--- arch/x86/cpu/queensbay/Makefile | 9 +++++ arch/x86/cpu/queensbay/tnc.c | 48 +++++++++++++++++++++++ arch/x86/cpu/queensbay/tnc_car.S | 75 ++++++++++++++++++++++++++++++++++++ arch/x86/cpu/queensbay/tnc_dram.c | 81 +++++++++++++++++++++++++++++++++++++++ arch/x86/cpu/queensbay/tnc_pci.c | 62 ++++++++++++++++++++++++++++++ board/intel/crownbay/MAINTAINERS | 6 +++ board/intel/crownbay/Makefile | 7 ++++ board/intel/crownbay/crownbay.c | 20 ++++++++++ board/intel/crownbay/start.S | 9 +++++ 9 files changed, 317 insertions(+) create mode 100644 arch/x86/cpu/queensbay/Makefile create mode 100644 arch/x86/cpu/queensbay/tnc.c create mode 100644 arch/x86/cpu/queensbay/tnc_car.S create mode 100644 arch/x86/cpu/queensbay/tnc_dram.c create mode 100644 arch/x86/cpu/queensbay/tnc_pci.c create mode 100644 board/intel/crownbay/MAINTAINERS create mode 100644 board/intel/crownbay/Makefile create mode 100644 board/intel/crownbay/crownbay.c create mode 100644 board/intel/crownbay/start.Sarch/x86/cpu/queensbay/Makefile new file +9
-0@@ -0,0 +1,9 @@ +# +# Copyright (C) 2014, Bin Meng <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += tnc_car.o tnc_dram.o tnc.o +obj-y += fsp_configs.o fsp_support.o +obj-$(CONFIG_PCI) += tnc_pci.oarch/x86/cpu/queensbay/tnc.c new file +25
-0@@ -0,0 +1,48 @@ +/* +* Copyright (C) 2014, Bin Meng <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/post.h> +#include <asm/arch/fsp/fsp_support.h> + +int arch_cpu_init (void ) +{ +post_code (POST_CPU_INIT ); +#ifdef CONFIG_SYS_X86_TSC_TIMER +timer_set_base (rdtsc ()); +#endif + +return x86_cpu_init_f (); +} + +int print_cpuinfo (void ) +{ +post_code (POST_CPU_INFO ); +return default_print_cpuinfo ();Quoted 8 lines
arch/x86/cpu/queensbay/tnc.c line 31
Quoted 6 lines
arch/x86/cpu/queensbay/tnc.c new file +6
-0+} + +void reset_cpu (ulong addr) +{ +/* cold reset */ +outb (0x06 ,0xcf9 );I think there is a constant somewhere for cf9?
Yes, I found one in
arch/x86/include/asm/processor.hand will use that.Quoted 9 lines
arch/x86/cpu/queensbay/tnc.c line 38
Quoted 7 lines
arch/x86/cpu/queensbay/tnc.c new file +7
-0+} + +void board_final_cleanup (void ) +{ +EFI_STATUS status; + +/* call into FspNotify */ Remove blank line
OK.
Quoted 5 lines
arch/x86/cpu/queensbay/tnc.c line 41
Quoted 3 lines
arch/x86/cpu/queensbay/tnc.c new file +3
-0+ +debug ("Calling into FSP (notify phase EnumInitPhaseReadyToBoot): " ); + status =FspNotifyWrapper (NULL , EnumInitPhaseReadyToBoot);Are we stuck with these mixed case identifiers?
I may have to fix FSP support library coding style issues in v2.
Quoted 27 lines
Quoted 27 lines
arch/x86/cpu/queensbay/tnc.c new file +7
-0+if (status !=FSP_SUCCESS ) +debug ("fail, error code %x\n" , status); +else +debug ("OK\n" ); + +return ; +}arch/x86/cpu/queensbay/tnc_car.S new file +14
-0@@ -0,0 +1,75 @@ +/* + * Copyright (C) 2014, Bin Meng <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <config.h> +#include <asm/post.h> + +.globl car_init +car_init: + /* + * Note: ebp holds the BIST value (built-in self test) so far, but ebp + * will be destroyed through the FSP call, thus we have to test theQuoted 8 lines
arch/x86/cpu/queensbay/tnc_car.S line 20
Quoted 6 lines
arch/x86/cpu/queensbay/tnc_car.S new file +6
-0+ * BIST value here before we call into FSP. + */ + test %ebp, %ebp + jz car_init_start + post_code(POST_BIST_FAILURE) + jmp dieIs there no way to save it anywhere?
Quoted 6 lines
Unfortunately I did not find a way to save the ebp through the FSP call so far. The FSP documentation mentions that FSP tries to save bootloader's stack before call to FspInit to a temporary memory block after the call, however I found it is not working as documented. I may look into this in the future, but for now I think we have to let it be.
Not great, but score 1 for the binary blobs.
Quoted 274 lines
Quoted 49 lines
Quoted 49 lines
arch/x86/cpu/queensbay/tnc_car.S new file +48
-0+ +car_init_start: + post_code(POST_CAR_START) + lea find_fsp_header_stack, %esp + jmp FindFspHeader + +find_fsp_header_ret: + /* EAX points to FSP_INFO_HEADER */ + mov %eax, %ebp + + /* sanity test */ + cmp $CONFIG_FSP_LOCATION, %eax + jb die + + /* calculate TempRamInitEntry address */ + mov 0x30(%ebp), %eax + add 0x1c(%ebp), %eax + + /* call FSP TempRamInitEntry to setup temporary stack */ + lea temp_ram_init_stack, %esp + jmp *%eax + +temp_ram_init_ret: + addl $4, %esp + cmp $0, %eax + jz continue + post_code(POST_CAR_FAILURE) + +die: + hlt + jmp die + hlt + +continue: + post_code(POST_CAR_CPU_CACHE) + jmp car_init_ret + + .balign 4 +find_fsp_header_stack: + .long find_fsp_header_ret + + .balign 4 +temp_ram_init_stack: + .long temp_ram_init_ret + .long temp_ram_init_params +temp_ram_init_params: + .long ucode_start /* microcode base */ + .long ucode_size /* microcode size */Quoted 8 lines
arch/x86/cpu/queensbay/tnc_car.S line 74
Quoted 6 lines
arch/x86/cpu/queensbay/tnc_car.S new file +6
-0+ .long CONFIG_SYS_MONITOR_BASE /* code region base */ + .long CONFIG_SYS_MONITOR_LEN /* code region size */ + + .balign 4 +ucode_start: + .include "arch/x86/cpu/queensbay/M0220661105.inc"Does the microcode have to be applied before we even have temporary RAM?
Unfortunately the microcode is required to be a parameter of the call to TempRamInit, which is defined by the FSP specification.
Quoted 68 lines
Quoted 68 lines
arch/x86/cpu/queensbay/tnc_car.S new file +1
-0+ucode_size = ( . - ucode_start)arch/x86/cpu/queensbay/tnc_dram.c new file +60
-0@@ -0,0 +1,81 @@ +/* +* Copyright (C) 2014, Bin Meng <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/arch/fsp/fsp_support.h> +#include <asm/e820.h> +#include <asm/post.h> + +DECLARE_GLOBAL_DATA_PTR ; + +int dram_init (void ) +{ +phys_size_t ram_size =0 ; +EFI_PEI_HOB_POINTERS hob; + + hob.Raw = gd->arch.hob_list; +while (!END_OF_HOB_LIST (hob)) { +if (hob.Header->HobType ==EFI_HOB_TYPE_RESOURCE_DESCRIPTOR ) { +if (hob.ResourceDescriptor->ResourceType ==EFI_RESOURCE_SYSTEM_MEMORY || + hob.ResourceDescriptor->ResourceType ==EFI_RESOURCE_MEMORY_RESERVED ) { + ram_size += hob.ResourceDescriptor->ResourceLength; + } + } + hob.Raw =GET_NEXT_HOB (hob); + } + + gd->ram_size = ram_size; +post_code (POST_DRAM ); + +return 0 ; +} + +void dram_init_banksize (void ) +{ + gd->bd->bi_dram[0 ].start =0 ; + gd->bd->bi_dram[0 ].size = gd->ram_size; +} + +/* +* This function looks for the highest region of memory lower than 4GB which +* has enough space for U-Boot where U-Boot is aligned on a page boundary. +* It overrides the default implementation found elsewhere which simply +* picks the end of ram, wherever that may be. The location of the stack, +* the relocation address, and how far U-Boot is moved by relocation are +* set in the global data structure. +*/ +ulong board_get_usable_ram_top (ulong total_size) +{ +return GetUsableLowMemTop (gd->arch.hob_list); +} + +unsigned install_e820_map (unsigned max_entries,struct e820entry *entries) +{ +unsigned num_entries =0 ; + +EFI_PEI_HOB_POINTERS hob; +Quoted 8 lines
arch/x86/cpu/queensbay/tnc_dram.c line 66
Quoted 6 lines
arch/x86/cpu/queensbay/tnc_dram.c new file +6
-0+ hob.Raw = gd->arch.hob_list; + +while (!END_OF_HOB_LIST (hob)) { +if (hob.Header->HobType ==EFI_HOB_TYPE_RESOURCE_DESCRIPTOR ) { +if (hob.ResourceDescriptor->ResourceType ==EFI_RESOURCE_SYSTEM_MEMORY ) { + entries[num_entries].addr = hob.ResourceDescriptor->PhysicalStart;Can we make these identifiers follow style?
I may have to fix FSP support library coding style issues in v2.
Quoted 67 lines
Quoted 67 lines
arch/x86/cpu/queensbay/tnc_dram.c new file +15
-0+ entries[num_entries].size = hob.ResourceDescriptor->ResourceLength; + entries[num_entries].type =E820_RAM ; + }else if (hob.ResourceDescriptor->ResourceType ==EFI_RESOURCE_MEMORY_RESERVED ) { + entries[num_entries].addr = hob.ResourceDescriptor->PhysicalStart; + entries[num_entries].size = hob.ResourceDescriptor->ResourceLength; + entries[num_entries].type =E820_RESERVED ; + } + + } + hob.Raw =GET_NEXT_HOB (hob); + num_entries++; + } + +return num_entries; +}arch/x86/cpu/queensbay/tnc_pci.c new file +46
-0@@ -0,0 +1,62 @@ +/* +* Copyright (C) 2014, Bin Meng <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <pci.h> +#include <asm/pci.h> +#include <asm/arch/fsp/fsp_support.h> + +DECLARE_GLOBAL_DATA_PTR ; + +void board_pci_setup_hose (struct pci_controller *hose) +{ + hose->first_busno =0 ; + hose->last_busno =0 ; + +/* PCI memory space */ +pci_set_region (hose->regions +0 , +CONFIG_PCI_MEM_BUS , +CONFIG_PCI_MEM_PHYS , +CONFIG_PCI_MEM_SIZE , +PCI_REGION_MEM ); + +/* PCI IO space */ +pci_set_region (hose->regions +1 , +CONFIG_PCI_IO_BUS , +CONFIG_PCI_IO_PHYS , +CONFIG_PCI_IO_SIZE , +PCI_REGION_IO ); + +pci_set_region (hose->regions +2 , +CONFIG_PCI_PREF_BUS , +CONFIG_PCI_PREF_PHYS , +CONFIG_PCI_PREF_SIZE , +PCI_REGION_PREFETCH ); + +pci_set_region (hose->regions +3 , +0 , +0 , + gd->ram_size, +PCI_REGION_MEM |PCI_REGION_SYS_MEMORY ); + + hose->region_count =4 ; +}Quoted 8 lines
arch/x86/cpu/queensbay/tnc_pci.c line 52
Quoted 6 lines
arch/x86/cpu/queensbay/tnc_pci.c new file +6
-0+ +int board_pci_post_scan (struct pci_controller *hose) +{ +EFI_STATUS status; + +/* call into FspNotify */ Remove blank line
OK.
Quoted 47 lines
Quoted 47 lines
arch/x86/cpu/queensbay/tnc_pci.c new file +10
-0+ +debug ("Calling into FSP (notify phase EnumInitPhaseAfterPciEnumeration): " ); + status =FspNotifyWrapper (NULL , EnumInitPhaseAfterPciEnumeration); +if (status !=FSP_SUCCESS ) +debug ("fail, error code %x\n" , status); +else +debug ("OK\n" ); + +return 0 ; +}board/intel/crownbay/MAINTAINERS new file +6
-0@@ -0,0 +1,6 @@ +INTEL CROWNBAY BOARD +M: Bin Meng <[email protected]> +S: Maintained +F: board/intel/crownbay/ +F: include/configs/crownbay.h +F: configs/crownbay_defconfigboard/intel/crownbay/Makefile new file +7
-0@@ -0,0 +1,7 @@ +# +# Copyright (C) 2014, Bin Meng <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += crownbay.o start.oboard/intel/crownbay/crownbay.c new file +6
-0@@ -0,0 +1,20 @@ +/* +* Copyright (C) 2014, Bin Meng <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +Quoted 8 lines
board/intel/crownbay/crownbay.c line 12
Quoted 6 lines
board/intel/crownbay/crownbay.c new file +6
-0+#include <common.h> +#include <asm/pnp_def.h> +#include <smsc_lpc47m.h> + +#define SERIAL_DEV PNP_DEV(0x2e, 4) +#define UART0_BASE 0x3f8I think there is a constant for this somewhere already?
Quoted 3 lines
It was once defined in
arch/x86/include/asm/ibmpc.h, however it was deleted by commit e98a03c "dm: x86: Convert coreboot serial to use driver model". Should I add that back?
Not thrilled with the filename ibmpc.h. If you think of a better name please rename it. in any case yes please add it back...
Quoted 11 lines
Quoted 10 lines
board/intel/crownbay/crownbay.c line 18
Quoted 7 lines
board/intel/crownbay/crownbay.c new file +6
-0+ +DECLARE_GLOBAL_DATA_PTR ; + +int board_early_init_f (void ) +{ +lpc47m_enable_serial (SERIAL_DEV ,UART0_BASE );blank line before return. Why do we need to do this so early?
Quoted 2 lines
board_early_init_f()is the last routine which can be used to do such thing before call toserial_init().
OK.
Regards,
Simon