x86 System on a Chip (SoC) Development
  SoC development is best done in parallel with development for a specific
  board.  The combined steps are listed
  here.
  The development steps for the SoC are listed below:
  - FSP 1.1 required files
- SoC Required Files
- Start Booting
- Early Debug
- Bootblock
- TempRamInit
- Romstage
    
      - Enable Serial Output"
- Get the Previous Sleep State
- Add the MemoryInit Support
 
  Create the directory as src/soc/<Vendor>/<Chip Family>.
  The following files are required to build a new SoC:
  - Include files
    
      - include/soc/pei_data.h
- include/soc/pm.h
 
- Kconfig - Defines the Kconfig value for the SoC and selects the tool
    chains for the various stages:
    
      - select ARCH_BOOTBLOCK_<Tool Chain>
- select ARCH_RAMSTAGE_<Tool Chain>
- select ARCH_ROMSTAGE_<Tool Chain>
- select ARCH_VERSTAGE_<Tool Chain>
 
- Makefile.inc - Specify the include paths
- memmap.c - Top of usable RAM
  Some SoC parts require additional firmware components in the flash.
  This section describes how to add those pieces.
Intel Firmware Descriptor
  The Intel Firmware Descriptor (IFD) is located at the base of the flash part.
  The following command overwrites the base of the flash image with the Intel
  Firmware Descriptor:
dd if=descriptor.bin of=build/coreboot.rom conv=notrunc >/dev/null 2>&1
  Some SoC parts contain and require that the Management Engine (ME) be running
  before it is possible to bring the x86 processor out of reset.  A binary file
  containing the management engine code must be added to the firmware using the
  ifdtool.  The following commands add this binary blob:
util/ifdtool/ifdtool -i ME:me.bin  build/coreboot.rom
mv build/coreboot.rom.new build/coreboot.rom
  Early debugging between the reset vector and the time the serial port is enabled
  is most easily done by writing values to port 0x80.
Success
  When the reset vector is successfully invoked, port 0x80 will output the following value:
  Implement the bootblock using the following steps:
  - Create the directory as src/soc/<Vendor>/<Chip Family>/bootblock
- Add the timestamp.inc file which initializes the floating point registers and saves
    the initial timestamp.
  
- Add the bootblock.c file which:
    
      - Enables memory-mapped PCI config access
- Updates the microcode by calling intel_update_microcode_from_cbfs
- Enable ROM caching
 
- Edit the src/soc/<Vendor>/<Chip Family>/Kconfig file
    
      - Add the BOOTBLOCK_CPU_INIT value to point to the bootblock.c file
- Add the CHIPSET_BOOTBLOCK_INCLUDE value to point to the timestamp.inc file
 
- Edit the src/soc/<Vendor>/<Chip Family>/Makefile.inc file
    
      - Add the bootblock subdirectory
 
- Edit the src/soc/<Vendor>/<Chip Family>/memmap.c file
    
      - Add the fsp/memmap.h include file
- Add the mmap_region_granularity routine
 
- Add the necessary .h files to define the necessary values and structures
- When successful port 0x80 will output the following values:
    
      - 0x01: POST_RESET_VECTOR_CORRECT
        - Bootblock successfully executed the
        reset vector
        and entered the 16-bit code at
        _start
      
- 0x10: POST_ENTER_PROTECTED_MODE
        - Bootblock executing in
        32-bit mode
      
- 0x10 - Verstage/romstage reached 32-bit mode
 
  Build Note: The following files are included into the default bootblock image:
  Enable the call to TempRamInit in two stages:
  - Finding the FSP binary in the read-only CBFS region
- Call TempRamInit
Find FSP Binary
Use the following steps to locate the FSP binary:
  - Edit the src/soc/<Vendor>/<Chip Family>/Kconfig file
    
      - Add "select USE_GENERIC_FSP_CAR_INC" to enable the use of
        src/drivers/intel/fsp1_1/cache_as_ram.inc
      
- Add "select SOC_INTEL_COMMON" to enable the use of the files from src/soc/intel/common
        specifically building
        util.c
      
 
- Debug the result until port 0x80 outputs
    
      - 0x90: POST_FSP_TEMP_RAM_INIT
        - Just before calling
        TempRamInit
      
- Alternating 0xba and 0x01 - The FSP image was not found
 
- Add the FSP binary file to the flash image
- Set the following Kconfig values:
    
      - CONFIG_FSP_LOC to the FSP base address specified in the previous step
- CONFIG_FSP_IMAGE_ID_STRING
 
- Debug the result until port 0x80 outputs
    
      - 0x90: POST_FSP_TEMP_RAM_INIT
        - Just before calling
        TempRamInit
      
- Alternating 0xbb and 0x02 - TempRamInit executed, no CPU microcode update found
 
Calling TempRamInit
Use the following steps to debug the call to TempRamInit:
  - Add the CPU microcode update file
    
      - Add the microcode file with the following command
util/cbfstool/cbfstool build/coreboot.rom add -t microcode -n cpu_microcode_blob.bin -b <base address> -f cpu_microcode_blob.bin
 
- Set the Kconfig values
        
          - CONFIG_CPU_MICROCODE_CBFS_LOC set to the value from the previous step
- CONFIG_CPU_MICROCODE_CBFS_LEN
 
 
- Debug the result until port 0x80 outputs
    
      - 0x90: POST_FSP_TEMP_RAM_INIT
        - Just before calling
        TempRamInit
      
- 0x2A - Just before calling
        cache_as_ram_main
        which is the start of the verstage code which may be part of romstage
      
 
  The following steps add the serial output support for romstage:
  - Create the romstage subdirectory
- Add romstage/romstage.c
    
      - Program the necessary base addresses
- Disable the TCO
 
- Add romstage/Makefile.inc
    
      - Add romstage.c to romstage
 
- Add gpio configuration support if necessary
- Add the necessary .h files to support the build
- Update Makefile.inc
    
      - Add the romstage subdirectory
- Add the gpio configuration support file to romstage
 
- Set the necessary Kconfig values to enable serial output:
    
      - CONFIG_DRIVERS_UART_<driver>=y
- CONFIG_CONSOLE_SERIAL=y
- CONFIG_UART_FOR_CONSOLE=<port>
- CONFIG_CONSOLE_SERIAL_115200=y
 
  The following steps implement the code to get the previous sleep state:
  - Implement the fill_power_state routine which determines the previous sleep state
- Debug the result until port 0x80 outputs
    
      - 0x32:
        - Just after entering
        romstage_common
      
- 0x33 - Just after calling
        soc_pre_ram_init
      
- 0x34:
        - Just after entering
        raminit
      
 
  The following steps implement the code to support the FSP MemoryInit call:
  - Add the chip.h header file to define the UPD values which get passed
    to MemoryInit.  Skip the values containing SPD addresses and DRAM
    configuration data which is determined by the board.
    
      Build Note: The src/mainboard/<Vendor>/<Board>/devicetree.cb
      file specifies the default values for these parameters.  The build
      process creates the static.c module which contains the config data
      structure containing these values.
     
- Edit romstage/romstage.c
    
      - Implement the romstage/romstage.c/soc_memory_init_params routine to
        copy the values from the config structure into the UPD structure
      
- Implement the soc_display_memory_init_params routine to display
        the updated UPD parameters by calling fsp_display_upd_value
      
 
Modified: 31 January 2016