PROM and Flash Memory Management 

Quick Start

see some sample scripts and instructions for making and loading proms

Overview

This document summarizes the requirements for the SW support of the flash memory management. Currently sw supports only the 'Small' Flash Memory part which is socketed and is limited to 512KB. The small flash only supports boot prom and storage space for miscellaneous data (i.e. crashdump data, env variables). There is a need to the lmux and luc fpga images as well as the diag rprom  larger space for boot prom to grow.

Note that while we call it the 'Large' Flash, its actually the standard or the default Flash as production boards will map this chip to physical address 0x1fc00000 where the boot/reset vectors, BOOT Prom, must be resident. The 'Small' or the socketed flash (what we have been using currently) is the backup or the Recovery PROM mapped to an offset several MB's removed from 0x1fc00000. As noted below in the Hardare section the physical addresses for these two flash memorys may be swapped.

Terminology

Boot-Prom - sw resident in in the boot exception vector (0xBFC00000) address space of the  which will load and run the run time software.

RProm - The 'Recovery' Prom is like the Boot-Prom but resident on Large flash but its main function is to Program the Large/Std flash with Boot-Prom  image and  other parts of the Large/Std Flash.

Diag-Prom - The 'diagnostic' Prom will be used for the manufacturing process, where based on a 'diag-jumper' or a non-volatile flag (in flash or seep) the Boot-Prom will load the Diag-Prom and run it.

Partition/Prom-Partition - This is the methode by which the flash memory is divided up. Each partition is a multiple of 64K Bytes (a typical flash sector block), starting at offset 0 with uncompressed data section of  0 or more bytes followed by compressed data section of 0 or more bytes. The last 128 bytes of the partition is the Control Block which contain the contents of the partition, crc32 for data and the control block, and version/description info for the partition:

addr
field
description
0x0
info_str
version or info string of  79 bytes max
0x50
reserved[0]
24 bytes of reserved data
0x67
reserved[23]

0x68
flags
comressed_data, data_crc32
0x6a
part_type
partition type a.k.a. prom_type
0x6c
compressed_start
partition relative offset of  compressed data section
0x70
compressed_size
size of the compressed data
0x74 uncompressed_size
size when compressed data is uncompressed
0x78
data_crc32
crc32 over the uncompressed and compressed data
0x7c
header_crc32
crc32 over the control block excluding this field


luc_hex - Ascii hex encoded LUC FPGA Image. The hex file may be as big as 4.5 MB, but currently compresses it to ~500KB.

lmux_hex - Ascii hex encoded LMUX FPGA Image: The hex file may be as big as 1.1 MB, but currently compresses it to ~ 99KB.

Hardware

Prom_Types of Partition_Types

Each Partition must be one of the following groups of partition types:
Note that the compression results were based on linux utility compress just to find out the compressability of the *.hex files. The compression factors using the makerom utility will differ but have not been measured yet. Also the compressability of the *.hex files will become less favorable as more 'real' code is added to the fpga image.

Implementation Plan

Memory Partitioning for the Large (Standard-PROM) Flash

Partition
NFP-TXRX
NFP-FP
FC
SSC
SSC-MGMT*
boot
768KB
768KB
768KB
768KB
448KB
diag
768KB
768KB
768KB
768KB
N/A
lmux_hex
0.5MB
N/A
N/A
N/A
N/A
luc_hex
1.5MB
N/A
N/A
N/A
N/A
sys (env, crashdump)
64KB
64KB
64KB
64KB
64KB
Unused
448KB
2.5MB
448KB
448KB
0






Total
4MB
4MB
2MB
2MB
512KB

Flash Partitioning for the Small (Recovery-PROM) Flash

Partition
NFP-TXRX
NFP-FP
FC
SSC
SSC-MGMT*
RPROM
512KB
512KB
512KB
512KB
N/A






Total
512KB
512KB
512KB
512KB
N/A

*SSC-MGMT only has 1 PROM, is a different chip, but was included in the table for completeness.

Partition Manager

Each partition can have compressed and uncompressed data. The partition control block located at the end of the partition will provide information regarding locations and sizes of these parts. The SYS partition will also contain the a list of offsets to all the control blocks of partitions in the flash memory.

Following functions will be in the API

Flash drivers 

Must support 3 different different flash chips. The discovery of the chip type and sizes will be at boot time, as well as the table of contents for the partitions in the flash. The driver will support flash prom on 2 locations (with the exception of SSC-MGMT) and the recovery procedures if running from the Recovery-PROM.

Following Api are added to the existing ones defined in from-api.h

for Embedded Systems (TXRX, FP, FC, SSC_MGMT) Run time and PROM


for BSD (SSC)

To be implemented

Linux  Utilities

nfx-tree/Tools/makerom

Currently the makerom utility takes bootroom.big (output of conv utility which takes boot elf image) and creates bootrom.bin composed of the uncompressed part (exception vectors and sw needed to uncompress the compressed portion) and compressed part, and creates a control block containing the content info at the end of the 448 KB.

The makerom utility will be able to create a rom binary for the entire PROM with all the necessary partitions. In addtition it will be able to create a rom binary for just a single partition. This will enable us to decouple the FPGA Image updates and the boot-prom updates.

makerom
       <bootrom.big> <bootrom.bin> <bootrom.nm> <r7k|sibyte|ssc_mgmt>
    -d <bootrom.big> <bootrom.bin>
    -f full-part-opt <out.bin> <bootrom.big> <bootrom.version> <bootrom.nm> [<diag.big> <diag.version> <diag.nm> [<lmux.hex> <lmux.info> <luc.hex> <luc.info>]]
    -s single-part-opt
<file.bin> <file.big> <file.version> [<file.nm>|<comp_offset>]

    -v <file.bin>

    full-part-opt :  r7k | sibyte | ssc_mgmt | rprom_r7k | rprom_sibyte
    single-part-opt:
r7k | sibyte | ssc_mgmt | rprom_r7k | rprom_sibyte | diag_r7k | diag_sibyte | luc_hex | lmux_hex


see sample script file for generating all the prom binaries in nfx-tree/code/prom-decompress/mkproms.sh

another instruction for creating and loading Luc/Lmux binaries

BSD Utilities

bin/prom-upgrade

The prom-upgrade utility will be able to upgrade an entire PROM will all the partitions correctly initialized, or just the individual partitions from the *.bin files created by the makerom utility.

prom-upgrade
<slot> <cpu> [<prom-part-binary-file>]

Embedded Systems Commands

prom



New prom commands have been added for use in the PROM. The current 'prom' cmd will have changed:

existing commands (no changes)
            prom id
            prom read  <offset> <length>
            prom upgrade <addr> [<length>]
            prom upgrade <ipaddr> <fname>


modified commands - added the flash selector field (0 - current, 1 - alternate)
            prom erase [0|1] <sector>
            prom fill  [0|1] <offset> <src_addr> <length>

new commands -
    stress command allows you to stress the flash chip (current 0 or alternate 1) by specifying offset and  len (in sector multiple hex val, i.e. n*10000). The command will erase each sector write a pattern of 0 or 1 or 0101.. 1010.. or address to the flash and verify the data.
            prom stress [0|1] <offset> <len> <repeat-count>
   
    view command will show the flash chip info and partition sub cmd will dump the contents of the partitions at sepcified address len, or (default is all the partitions in whole flash)
            prom view [partition [<address> <len>]]


xlnx

current cmd to load the fpga from memory will now have an option to load from flash partition

PROM boot sequence for FPGA's on Tx Rx board

When  the PROM boots and  there is are valid partitions for the  FPGA's, then images will be uncompressed and loaded enabling the autoload process to proceed.

The API function

int prom_part_proc_data(unsigned short prom_type,
                        int32(*ucb_fct)(void *uhdl, char * buf, int dlen),
                        void * user_handle);


is available for the FPGA driver (and currently there the prom cmd 'xlmx luc|lmux [flash]' uses above fct to load the FPGA from the compressed ascii encoded lmux_hex and luc_hex images in flash) to access the data. The above function will select the prom partition from the specified type (LMUX or LUC), decompressed the data, and call the user call back function with the arguments user_handle, ptr to the uncompressed data, and the length of the uncompressed data.