Add OpenCompute Yosemite BMC ARM board
PATCH 1/1 Add OpenCompute Yosemite BMC ARM board
The Yosemite BMC board is very similar to the Palmetto BMC. They both configure an AST2400 SoC and have rather simple device sets.
The Yosemite uses dual SPI flashes but the AST2400's memory controller, via hardware strapping, makes either a NAND, NOR, or SPI available at boot at 0x0 and 0x2000:0000. For the board emulation included here the SPIs are replaced with CFI flash to allow simple pflash configuration via the caller.
Additionally, to support an SPL boot where DRAM has not been calibrated, the board relocates global data and the stack into the small 32kb of SRAM.
--- hw/arm/Makefile.objs | 2 +- hw/arm/fbyosemite-bmc.c | 115 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 hw/arm/fbyosemite-bmc.c
hw/arm/Makefile.objs +1 -1
@@ -16,4 +16,4 @@ obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o obj-$(CONFIG_XLNX_ZYNQMP) += xlnx-zynqmp.o xlnx-ep108.o obj-$(CONFIG_FSL_IMX25) += fsl-imx25.o imx25_pdk.o obj-$(CONFIG_FSL_IMX31) += fsl-imx31.o kzm.o -obj-$(CONFIG_ASPEED_SOC) += ast2500.o ast2500-edk.o ast2400.o palmetto-bmc.o +obj-$(CONFIG_ASPEED_SOC) += ast2500.o ast2500-edk.o ast2400.o palmetto-bmc.o fbyosemite-bmc.o
hw/arm/fbyosemite-bmc.c new file +115 -0
115 lines not on this page · raw message
Signature · 1 line
2.7.4
Hey Teddy,
Quoted 2 lines · Teddy Reed
The Yosemite BMC board is very similar to the Palmetto BMC. They both configure an AST2400 SoC and have rather simple device sets.
Nice!
Are you planning on sending this upstream?
Quoted 7 lines
The Yosemite uses dual SPI flashes but the AST2400's memory controller, via hardware strapping, makes either a NAND, NOR, or SPI available at boot at
0x0and 0x2000:0000. For the board emulation included here the SPIs are replaced with CFI flash to allow simple pflash configuration via the caller.Additionally, to support an SPL boot where DRAM has not been calibrated, the board relocates global data and the stack into the small 32kb of SRAM.
You need to add a developers certificate of origin (the signed off by line) to your commit message.
Quoted 3 lines
--- hw/arm/Makefile.objs | 2 +- hw/arm/fbyosemite-bmc.c | 115 ++++++++++++++++++++++++++++++++++++++++++++++++
Are you attached to calling it "fbyosemite"? We didn't stick ibm in front of the palmettos. No biggie though.
Quoted 34 lines
2 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 hw/arm/fbyosemite-bmc.chw/arm/Makefile.objs +1
-1@@ -16,4 +16,4 @@ obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o obj-$(CONFIG_XLNX_ZYNQMP) += xlnx-zynqmp.o xlnx-ep108.o obj-$(CONFIG_FSL_IMX25) += fsl-imx25.o imx25_pdk.o obj-$(CONFIG_FSL_IMX31) += fsl-imx31.o kzm.o -obj-$(CONFIG_ASPEED_SOC) += ast2500.o ast2500-edk.o ast2400.o palmetto-bmc.o +obj-$(CONFIG_ASPEED_SOC) += ast2500.o ast2500-edk.o ast2400.o palmetto-bmc.o fbyosemite-bmc.ohw/arm/fbyosemite-bmc.c new file +15
-0@@ -0,0 +1,115 @@ +/* +* OpenCompute Facebook Yosemite BMC +* +* Teddy Reed <[email protected]> +* +* Copyright 2016-Present, Facebook, Inc. +* +* This code is licensed under the GPL version 2 or later. See +* the COPYING file in the top-level directory. +*/ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h"
hw/arm/fbyosemite-bmc.c line 25
Quoted 10 lines
hw/arm/fbyosemite-bmc.c new file +10
-0+#include "exec/address-spaces.h" +#include "hw/arm/arm.h" +#include "hw/arm/ast2400.h" +#include "hw/boards.h" +#include "hw/block/flash.h" + +#define AST2400_FLASH0_BASE 0x20000000 +#define AST2400_FLASH0_SIZE 0x02000000/* Max is 64k, but set 32kB */ +#define AST2400_FLASH1_BASE 0x24000000 +#define AST2400_FLASH1_SIZE 0x02000000
These are really board-specific defines, not ast2400 ones I think. Perhaps don't use the AST2400 prefix?
Quoted 6 lines
hw/arm/fbyosemite-bmc.c new file +6
-0+#define FBYOSEMITE_TEXT_BASE 0x0 + +static struct arm_boot_info fbyosemite_bmc_binfo = { + .loader_start =FBYOSEMITE_TEXT_BASE , + .board_id =0 , + .nb_cpus =1 ,
hw/arm/fbyosemite-bmc.c line 41
Quoted 10 lines
hw/arm/fbyosemite-bmc.c new file +10
-0+}; + +typedef struct FBYosemiteBMCState { +AST2400State soc; +MemoryRegion ram; +MemoryRegion flash0_alias; +}FBYosemiteBMCState ; + +static pflash_t *pflash_register (hwaddr base,hwaddr size,const char * name, +DriveInfo *info) {
You've got a few *'s with the space on the wrong side.
hw/arm/fbyosemite-bmc.c line 53
Quoted 12 lines
hw/arm/fbyosemite-bmc.c new file +12
-0+int sector_len =128 *1024 ; +int be =0 ; +pflash_t *pf; + + pf =pflash_cfi01_register (base,NULL , name, size, + info ?blk_by_legacy_dinfo (info) :NULL , + sector_len, size / sector_len, +2 ,0 ,0 ,0 ,0 , be); +if (pf ==NULL ) { +fprintf (stderr,"qemu: Error registering flash memory.\n" ); +exit (1 ); + }
I suspect we want to do something other than exit(1) here.
Quoted 69 lines
hw/arm/fbyosemite-bmc.c new file +62
-1+return pf; +} + +static void fbyosemite_bmc_init (MachineState *machine) +{ +FBYosemiteBMCState *bmc; +DriveInfo *dinfo; +pflash_t *pflash0; +MemoryRegion *pflash0mem; + + bmc =g_new0 (FBYosemiteBMCState,1 ); +object_initialize (&bmc->soc, (sizeof (bmc->soc)),TYPE_AST2400 ); +object_property_add_child (OBJECT (machine),"soc" ,OBJECT (&bmc->soc), + &error_abort); + +memory_region_allocate_system_memory (&bmc->ram,NULL ,"ram" , ram_size); +memory_region_add_subregion (get_system_memory (),AST2400_SDRAM_BASE , + &bmc->ram); +object_property_add_const_link (OBJECT (&bmc->soc),"ram" ,OBJECT (&bmc->ram), + &error_abort); +object_property_set_bool (OBJECT (&bmc->soc), true,"realized" , + &error_abort); + +/* Connect flash0 */ + dinfo =drive_get_next (IF_PFLASH ); + pflash0 =pflash_register (AST2400_FLASH0_BASE ,AST2400_FLASH0_SIZE , +"fbyosemite.flash0" , dinfo); + +/* Map flash0 to FBYOSEMITE_TEXT_BASE */ + pflash0mem =sysbus_mmio_get_region (SYS_BUS_DEVICE (pflash0),0 ); +memory_region_set_readonly (pflash0mem, true); +memory_region_init_alias (&bmc->flash0_alias,NULL , +"flash0.alias" , pflash0mem,FBYOSEMITE_TEXT_BASE , +AST2400_FLASH0_SIZE ); +memory_region_add_subregion (get_system_memory (),FBYOSEMITE_TEXT_BASE , + &bmc->flash0_alias); +memory_region_set_readonly (&bmc->flash0_alias, true); + +/* Connect flash1 */ + dinfo =drive_get_next (IF_PFLASH ); +pflash_register (AST2400_FLASH1_BASE ,AST2400_FLASH1_SIZE , +"fbyosemite.flash1" , dinfo); + + fbyosemite_bmc_binfo.kernel_filename = machine->kernel_filename; + fbyosemite_bmc_binfo.initrd_filename = machine->initrd_filename; + fbyosemite_bmc_binfo.kernel_cmdline = machine->kernel_cmdline; + fbyosemite_bmc_binfo.ram_size = ram_size; +arm_load_kernel (ARM_CPU (first_cpu), &fbyosemite_bmc_binfo); +} + +static void fbyosemite_bmc_machine_init (MachineClass *mc) +{ + mc->desc ="OpenCompute Facebook Yosemite BMC" ; + mc->init = fbyosemite_bmc_init; + mc->max_cpus =1 ; + mc->no_sdcard =1 ; + mc->no_floppy =1 ; + mc->no_cdrom =1 ; + mc->no_parallel =1 ; +} + +DEFINE_MACHINE ("fbyosemite-bmc" , fbyosemite_bmc_machine_init); --2.7.4
_______________________________________________
openbmc mailing list
[email protected]
https://lists.ozlabs.org/listinfo/openbmc
Quoted 9 lines · Joel Stanley
Hey Teddy,
Quoted 2 lines · Teddy Reed
The Yosemite BMC board is very similar to the Palmetto BMC. They both configure an AST2400 SoC and have rather simple device sets.
Nice!
Are you planning on sending this upstream?
Yeah! I'm not sure if the IBM team plans to push the QEMU changes in the OpenBMC fork upstream en masse, if not I can also send a similar patch once we work through a few revisions here.
Quoted 11 lines
Quoted 8 lines
The Yosemite uses dual SPI flashes but the AST2400's memory controller, via hardware strapping, makes either a NAND, NOR, or SPI available at boot at
0x0and 0x2000:0000. For the board emulation included here the SPIs are replaced with CFI flash to allow simple pflash configuration via the caller.Additionally, to support an SPL boot where DRAM has not been calibrated, the board relocates global data and the stack into the small 32kb of SRAM.
You need to add a developers certificate of origin (the signed off by line) to your commit message.
Womp, thanks.
Quoted 7 lines
Quoted 4 lines
--- hw/arm/Makefile.objs | 2 +- hw/arm/fbyosemite-bmc.c | 115 ++++++++++++++++++++++++++++++++++++++++++++++++Are you attached to calling it "fbyosemite"? We didn't stick ibm in front of the palmettos. No biggie though.
It's sort of an arraigned attachment.
The oh-so creative Silicon Valley has aptly named both an OS and embedded board Yosemite (as well as several other codenamed-thingies).
There's a current conflict with Yosemite in U-Boot too! So we need to use "fb" here. We have 3 other boards right now, Wedge, Wedge100, and Lightning. Lightning also has a conflict in U-Boot so I'm porting all of our configs, past and future, to include an "fb" prefix. :/
Quoted 40 lines
Quoted 40 lines
2 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 hw/arm/fbyosemite-bmc.chw/arm/Makefile.objs +1
-1@@ -16,4 +16,4 @@ obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o obj-$(CONFIG_XLNX_ZYNQMP) += xlnx-zynqmp.o xlnx-ep108.o obj-$(CONFIG_FSL_IMX25) += fsl-imx25.o imx25_pdk.o obj-$(CONFIG_FSL_IMX31) += fsl-imx31.o kzm.o -obj-$(CONFIG_ASPEED_SOC) += ast2500.o ast2500-edk.o ast2400.o palmetto-bmc.o +obj-$(CONFIG_ASPEED_SOC) += ast2500.o ast2500-edk.o ast2400.o palmetto-bmc.o fbyosemite-bmc.ohw/arm/fbyosemite-bmc.c new file +20
-0@@ -0,0 +1,115 @@ +/* +* OpenCompute Facebook Yosemite BMC +* +* Teddy Reed <[email protected]> +* +* Copyright 2016-Present, Facebook, Inc. +* +* This code is licensed under the GPL version 2 or later. See +* the COPYING file in the top-level directory. +*/ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" +#include "exec/address-spaces.h" +#include "hw/arm/arm.h" +#include "hw/arm/ast2400.h" +#include "hw/boards.h" +#include "hw/block/flash.h"
Quoted 8 lines
hw/arm/fbyosemite-bmc.c line 25
Quoted 5 lines
hw/arm/fbyosemite-bmc.c new file +5
-0+ +#define AST2400_FLASH0_BASE 0x20000000 +#define AST2400_FLASH0_SIZE 0x02000000/* Max is 64k, but set 32kB */ +#define AST2400_FLASH1_BASE 0x24000000 +#define AST2400_FLASH1_SIZE 0x02000000These are really board-specific defines, not ast2400 ones I think. Perhaps don't use the AST2400 prefix?
They are defined in the AST2400 specification. Whether they are SPI/CFI/NAND is based on the strapping. If SPI, and the board allows dual SPI (1250+) then the second flash base is also valid.
Though, because of the strapping requirement and potential variance, your recommendation seems best. I'll rename them. :)
Quoted 33 lines
Quoted 7 lines
hw/arm/fbyosemite-bmc.c new file +6
-0+#define FBYOSEMITE_TEXT_BASE 0x0 + +static struct arm_boot_info fbyosemite_bmc_binfo = { + .loader_start =FBYOSEMITE_TEXT_BASE , + .board_id =0 , + .nb_cpus =1 ,hw/arm/fbyosemite-bmc.c line 41
Quoted 10 lines
hw/arm/fbyosemite-bmc.c new file +10
-0+}; + +typedef struct FBYosemiteBMCState { +AST2400State soc; +MemoryRegion ram; +MemoryRegion flash0_alias; +}FBYosemiteBMCState ; + +static pflash_t *pflash_register (hwaddr base,hwaddr size,const char * name, +DriveInfo *info) {You've got a few *'s with the space on the wrong side.
hw/arm/fbyosemite-bmc.c line 53
Quoted 12 lines
hw/arm/fbyosemite-bmc.c new file +12
-0+int sector_len =128 *1024 ; +int be =0 ; +pflash_t *pf; + + pf =pflash_cfi01_register (base,NULL , name, size, + info ?blk_by_legacy_dinfo (info) :NULL , + sector_len, size / sector_len, +2 ,0 ,0 ,0 ,0 , be); +if (pf ==NULL ) { +fprintf (stderr,"qemu: Error registering flash memory.\n" ); +exit (1 ); + }
Quoted 1 line
I suspect we want to do something other than exit(1) here.
An error_report or fprintf followed by exit 1 seems pretty standard within the ARM machine models. I'm happy to change if anyone has a preferred recommendation?
Quoted 57 lines
Quoted 57 lines
hw/arm/fbyosemite-bmc.c new file +56
-0+return pf; +} + +static void fbyosemite_bmc_init (MachineState *machine) +{ +FBYosemiteBMCState *bmc; +DriveInfo *dinfo; +pflash_t *pflash0; +MemoryRegion *pflash0mem; + + bmc =g_new0 (FBYosemiteBMCState,1 ); +object_initialize (&bmc->soc, (sizeof (bmc->soc)),TYPE_AST2400 ); +object_property_add_child (OBJECT (machine),"soc" ,OBJECT (&bmc->soc), + &error_abort); + +memory_region_allocate_system_memory (&bmc->ram,NULL ,"ram" , ram_size); +memory_region_add_subregion (get_system_memory (),AST2400_SDRAM_BASE , + &bmc->ram); +object_property_add_const_link (OBJECT (&bmc->soc),"ram" ,OBJECT (&bmc->ram), + &error_abort); +object_property_set_bool (OBJECT (&bmc->soc), true,"realized" , + &error_abort); + +/* Connect flash0 */ + dinfo =drive_get_next (IF_PFLASH ); + pflash0 =pflash_register (AST2400_FLASH0_BASE ,AST2400_FLASH0_SIZE , +"fbyosemite.flash0" , dinfo); + +/* Map flash0 to FBYOSEMITE_TEXT_BASE */ + pflash0mem =sysbus_mmio_get_region (SYS_BUS_DEVICE (pflash0),0 ); +memory_region_set_readonly (pflash0mem, true); +memory_region_init_alias (&bmc->flash0_alias,NULL , +"flash0.alias" , pflash0mem,FBYOSEMITE_TEXT_BASE , +AST2400_FLASH0_SIZE ); +memory_region_add_subregion (get_system_memory (),FBYOSEMITE_TEXT_BASE , + &bmc->flash0_alias); +memory_region_set_readonly (&bmc->flash0_alias, true); + +/* Connect flash1 */ + dinfo =drive_get_next (IF_PFLASH ); +pflash_register (AST2400_FLASH1_BASE ,AST2400_FLASH1_SIZE , +"fbyosemite.flash1" , dinfo); + + fbyosemite_bmc_binfo.kernel_filename = machine->kernel_filename; + fbyosemite_bmc_binfo.initrd_filename = machine->initrd_filename; + fbyosemite_bmc_binfo.kernel_cmdline = machine->kernel_cmdline; + fbyosemite_bmc_binfo.ram_size = ram_size; +arm_load_kernel (ARM_CPU (first_cpu), &fbyosemite_bmc_binfo); +} + +static void fbyosemite_bmc_machine_init (MachineClass *mc) +{ + mc->desc ="OpenCompute Facebook Yosemite BMC" ; + mc->init = fbyosemite_bmc_init; + mc->max_cpus =1 ; + mc->no_sdcard =1 ;
Quoted 8 lines
Quoted 8 lines
hw/arm/fbyosemite-bmc.c new file +6
-1+ mc->no_floppy =1 ; + mc->no_cdrom =1 ; + mc->no_parallel =1 ; +} + +DEFINE_MACHINE ("fbyosemite-bmc" , fbyosemite_bmc_machine_init); --2.7.4
Thanks Joel! I'll have a v2 out shortly.
Signature · 1 line
Teddy Reed V
Hi Teddy,
Quoted 7 lines · Teddy Reed
Quoted 6 lines · Joel Stanley
Hey Teddy,
Quoted 2 lines · Teddy Reed
The Yosemite BMC board is very similar to the Palmetto BMC. They both configure an AST2400 SoC and have rather simple device sets.
Quoted 7 lines
Quoted 3 lines
Nice!
Are you planning on sending this upstream?
Yeah! I'm not sure if the IBM team plans to push the QEMU changes in the OpenBMC fork upstream en masse, if not I can also send a similar patch once we work through a few revisions here.
My preference is that patch authors send their own work upstream, at least for the moment. I'll aim to be a maintainer in upstream for the Aspeed bits, but I'm not across what hoops I'll need to jump through for that, and until then it's probably best that everyone submits their own patches.
Cheers,
Andrew
Quoted 18 lines · Andrew Jeffery
Hi Teddy,
Quoted 7 lines · Teddy Reed
Quoted 6 lines · Joel Stanley
Hey Teddy,
Quoted 2 lines · Teddy Reed
The Yosemite BMC board is very similar to the Palmetto BMC. They both configure an AST2400 SoC and have rather simple device sets.
Quoted 7 lines
Quoted 3 lines
Nice!
Are you planning on sending this upstream?
Yeah! I'm not sure if the IBM team plans to push the QEMU changes in the OpenBMC fork upstream en masse, if not I can also send a similar patch once we work through a few revisions here.
Quoted 5 lines
My preference is that patch authors send their own work upstream, at least for the moment. I'll aim to be a maintainer in upstream for the Aspeed bits, but I'm not across what hoops I'll need to jump through for that, and until then it's probably best that everyone submits their own patches.
Excellent, sounds like a plan!
Signature · 1 line
Teddy Reed V