openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

utils_eeprom.h (45721B)


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      6  *
      7  * DPP eeprom utils
      8  */
      9 
     10 /*
     11  * If LOCK_EEPROM is set 'TRUE' then physical writing to parallel
     12  * eeprom is protected with the internal 'software data
     13  * protection'.
     14  * Since our eeprom blocks are protected by CRC signature,
     15  * this feature is disabled here.
     16  * If LOCK_EEPROM is set 'TRUE' then it should be checked on
     17  * what happens if the unlock sequence is disturbed (say by
     18  * watchdog interrupt) by another user of the eeprom.
     19  */
     20 #define LOCK_EEPROM FALSE
     21 /*
     22  * Number of blocks in EEPROM area which are assigned
     23  * to boot time. Update when adding new boot-time blocks.
     24  */
     25 #define NUM_B_EE_BLOCKS     2
     26 /*
     27  * Number of blocks in EEPROM area which are assigned
     28  * to boot time and to run time.
     29  * Update when adding new blocks.
     30  */
     31 #define NUM_EE_BLOCKS        7
     32 #define SIZEOF_EE_BLOCK_01  30
     33 #define SIZEOF_EE_BLOCK_02 126
     34 #define SIZEOF_EE_BLOCK_03 126
     35 #define SIZEOF_EE_BLOCK_04 142
     36 #define SIZEOF_EE_BLOCK_05 4094
     37 #define SIZEOF_EE_BLOCK_06 254
     38 #define SIZEOF_EE_BLOCK_07 164
     39 
     40 
     41 /*
     42  * Maximal number of characters in memory device to
     43  * contain downloaded application program.
     44  * This is a string which must be null terminated.
     45  */
     46 #define MEM_DEVICE_NAME_LEN         10
     47 /*
     48  * Default value for name of device to contain the
     49  * file of the application program.
     50  */
     51 #define B_DEFAULT_MEM_DEVICE_NAME "DUNE_01:"
     52 /*
     53  * Maximal number of characters in name of download
     54  * file (on downloading host) which contains the
     55  * application program.
     56  * This is a string which must be null terminated.
     57  */
     58 #define DLD_FILE_NAME_LEN         16
     59 #define B_DEFAULT_DLD_FILE_NAME   "RefDesign_02.zip"
     60 /*
     61  * Maximal number of characters in name of target
     62  * board which runs the application program.
     63  * This is a string which must be null terminated.
     64  */
     65 #define TARGET_NAME_LEN           10
     66 #define B_DEFAULT_TARGET_NAME     "Dune_FEC"
     67 /*
     68  * Default value for maximal number of bytes in
     69  * local ram file to contain the downloaded
     70  * application.
     71  * This is also the size reserved on Flash memory
     72  * for the application program file.
     73  * Note that the LS 17 bits must be zero
     74  * and, in any case, are ignored. Address must,
     75  * then, be a multiple of 128K.
     76  */
     77 #define B_DEFAULT_MEM_DRV_LEN_4MEG       0x100000
     78 /*1.5 Meg, support both kind of Flash (4 and 8)*/
     79 /*2.5 Meg, support both only one kind of Flash of 8 Mega*/
     80 #define B_DEFAULT_MEM_DRV_LEN_8MEG_VER_B 0x280000
     81 /*4 Meg, not suitable for Flash less then 8 Mega*/
     82 #define B_DEFAULT_MEM_DRV_LEN_8MEG_VER_C 0x400000
     83 
     84 /*
     85  * Default value for maximal number of bytes in
     86  * local flash memory to contain all application
     87  * programs.
     88  * The maximal number of application programs
     89  * that can be stored in flash memory is
     90  * floor(app_flash_size/mem_drv_len).
     91  * Note that the LS 17 bits must be zero
     92  * and, in any case, are ignored. Address must,
     93  * then, be a multiple of 128K.
     94  */
     95 #define B_DEFAULT_APP_FLASH_SIZE_4MEG         (2 * B_DEFAULT_MEM_DRV_LEN_4MEG)
     96 #define B_DEFAULT_APP_FLASH_SIZE_8MEG         (2 * B_DEFAULT_MEM_DRV_LEN_8MEG_VER_B)
     97 #define B_DEFAULT_APP_FLASH_SIZE_8MEG_VER_C   (B_DEFAULT_MEM_DRV_LEN_8MEG_VER_C)
     98 
     99 /*
    100  * Default value for base address of
    101  * local flash memory that is assigned
    102  * to contain application programs.
    103  * Note that the LS 17 bits must be zero
    104  * and, in any case, are ignored. Address must,
    105  * then, be a multiple of 128K.
    106  */
    107 #define B_DEFAULT_APP_FLASH_BASE_4MEG     0xFFC00000
    108 #define B_DEFAULT_APP_FLASH_BASE_8MEG     0xFF800000
    109 /*
    110  * Default value for where the application
    111  * program will be taken from.
    112  * A value of zero is reserved for downloading
    113  * host. Otherwise, this is the number of
    114  * Flash memory block. If the indicated block
    115  * is out of specified Flash bounds, the
    116  * first applicable value is taken, depending
    117  * on APP_LOAD_METHOD.
    118  */
    119 #define B_DEFAULT_APP_SOURCE         0x01
    120 #define METHOD_NEWEST_VERSION        0x00
    121 #define METHOD_FILE_THEN_NEWEST      0x01
    122 #define METHOD_FLASH_THEN_NEWEST     0x02
    123 /*
    124  * Default value for method of application loading
    125  * in case indicated source does not contain
    126  * a legitimate file or in case special method
    127  * is indicated.
    128  * For METHOD_NEWEST_VERSION -
    129  *   All Flash blocks are searched and then Host
    130  *   file and the one with newwest version
    131  *   mark is taken.
    132  * For METHOD_FILE_THEN_NEWEST -
    133  *   First, indicated source is checked. If
    134  *   it contains a valid version then this version
    135  *   and source are used. If no valid file is
    136  *   found on Flash then Host file is checked and
    137  *   is taken if it can be found.
    138  * For METHOD_FLASH_THEN_NEWEST -
    139  *   First, all Flash fioles are checked. If
    140  *   any contains a valid version then this version
    141  *   and this file are used. If no valid file is
    142  *   found on indicated source then all Flash
    143  *   blocks are searched and then Host file and
    144  *   the one with newwest version mark is taken.
    145  */
    146 #define B_DEFAULT_APP_LOAD_METHOD      METHOD_FLASH_THEN_NEWEST
    147 /*
    148  * Default value for indication on whether Flash
    149  * should be automatically loaded from host file
    150  * if host file is more up to date than oldest
    151  * file on Flash.
    152  * The file to replace is always the oldest one
    153  * (or the first not loaded at all).
    154  * No Flash file is loaded if the version of the
    155  * host file is already on one of the Flash files.
    156  * On final version, set default to FALSE
    157  */
    158 #define B_DEFAULT_AUTO_FLASH_LOAD      FALSE
    159 /*
    160  * Default value for indication on whether to
    161  * load application after startup process or
    162  * go straight to kernel. Going straight to
    163  * kernel allows Tornado to communicate with
    164  * the board using WDB.
    165  * Values:
    166  *   SHELL_ONCE -
    167  *     Go to OS shell after startup but next
    168  *     startup, return to previously loaded value.
    169  *   SHELL_THEN_APPLICATION
    170  *     Go to OS shell after startup but after
    171  *     timeout, if user gives no indication, go to
    172  *     application.
    173  *   STRAIGHT_TO_APPLICATION
    174  *     Go straight to application after startup.
    175  * On final version, set default to STRAIGHT_TO_APPLICATION
    176  */
    177 #define SHELL_ONCE                      BIT(1)
    178 #define SHELL_THEN_APPLICATION          BIT(0)
    179 #define STRAIGHT_TO_APPLICATION         0
    180 #define B_DEFAULT_KERNEL_STARTUP        STRAIGHT_TO_APPLICATION
    181 /*
    182  * Default value for indication on whether to
    183  * activate the various caches.
    184  * For debugging, set both defaults to FALSE.
    185  * On final version, set both defaults to TRUE
    186  */
    187 #define B_DEFAULT_ACTIVATE_INST_CACHE  FALSE
    188 #define B_DEFAULT_ACTIVATE_DATA_CACHE  FALSE
    189 /*
    190  * Default value for console baud rate.
    191  * Values up to 115200 are allowed.
    192  */
    193 #define B_DEFAULT_CONSOLE_BAUD_RATE    38400
    194 #define IP_FROM_NV      0
    195 #define IP_FROM_SLOT_ID 1
    196 #define IP_FROM_CRATE 2
    197 /*
    198  * Default value mode of getting IP address at
    199  * startup.
    200  * See explanation for the various modes below.
    201  * For IP_FROM_NV -
    202  *   Read IP address from NVRAM.
    203  * For IP_FROM_SLOT_ID -
    204  *   Read LS byte of IP address from slot ID
    205  *   and take the rest as
    206  *   set_by_user.set_by_user.set_by_user.xx
    207  *   (xx is slot ID as read from EPLD).
    208  *   In stand alone mode, always read IP from NVRAM.
    209  * For IP_FROM_CRATE -
    210  *   Read LS byte of IP address from slot ID
    211  *   and take the rest as
    212  *   CRATE_TYPE.CRATE_ID_MSB.CRATE_ID_LSB.xx
    213  *   (xx is slot ID as read from EPLD).
    214  *   In stand alone mode, always read IP from NVRAM.
    215  */
    216 #define B_DEFAULT_IP_SOURCE_MODE       IP_FROM_NV
    217 #define TEST_IRQ6                      BIT(0)
    218 #define TEST_NMI                       BIT(1)
    219 /*
    220  * Default value mode for various tests at
    221  * startup.
    222  * For TEST_IRQ6 -
    223  *   Carry out IRQ6 injection and monitoring at startup.
    224  * For TEST_NMI -
    225  *   Carry out IRQ0 injection and monitoring at startup.
    226  * By default, do not
    227  */
    228 #define B_DEFAULT_TEST_AT_STARTUP      0
    229 /*
    230  * Default value for startup_counter variable in block
    231  * one of NVRAM.
    232  */
    233 #define B_DEFAULT_STARTUP_COUNTER      0x00
    234 /*
    235  * deafualt values for Base and Option Registesr 4 and 5
    236  */
    237 #define B_DEFAULT_BASE_REGISTER_04             0x40007001
    238 #define B_DEFAULT_BASE_REGISTER_05             0x50007401
    239 #define B_DEFAULT_OPTION_REGISTER_04           0xFF8007FA
    240 #define B_DEFAULT_OPTION_REGISTER_05           0xFF8007FA
    241 /*
    242  * Default value for timeout on a live TCP connection
    243  * (in units of 0.5 seconds).
    244  * This is the time between two consecutive retries.
    245  */
    246 #define B_DEFAULT_TCP_TIMEOUT 4
    247 /*
    248  * Default value for retries on a live TCP connection.
    249  * After sending specified retries, connection is declared
    250  * 'Down'.
    251  */
    252 #define B_DEFAULT_TCP_RETRIES 3
    253 /*
    254  * Default value for clk_mirror_data is '0'.
    255  * when zero, the clocks are not affected by the NvRam settings.
    256  */
    257 #define B_DEFAULT_CLK_MIRROR_DATA 0
    258 /*
    259  * }
    260  */
    261 /*
    262  * Default values for general nv ram fields
    263  * (block_03)
    264  * {
    265  */
    266 /*
    267  * Default value for indication on whether to
    268  * use page mode or not.
    269  */
    270 #define DEFAULT_PAGE_MODE       TRUE
    271 /*
    272  * Default value for number of lines per page.
    273  * Meaningful only if 'page_mode' is set.
    274  */
    275 #define DEFAULT_PAGE_LINES      25
    276 /*
    277  * Default value for indication on whether to
    278  * use full line edit (wair for CR before processing) or
    279  * respond to every character entered.
    280  */
    281 #define DEFAULT_LINE_MODE             FALSE
    282 /*
    283  * Default value on whether to activate watchdog when
    284  * application becomes active.
    285  * On final version, set default to TRUE
    286  */
    287 #define DEFAULT_ACTIVATE_WATCHDOG     FALSE
    288 /*
    289  * Default value for time period for watchdog.
    290  * Units: 100 milli seconds.
    291  * Maximal value: 31
    292  * expiration. Meaningful only if 'ACTIVATE_WATCHDOG'
    293  * is set.
    294  */
    295 #define DEFAULT_WATCHDOG_PERIOD       25
    296 /*
    297  * Timeout on standard Telnet activity in seconds.
    298  * After this time of inactivity, telnet will
    299  * be disconnected.
    300  */
    301 #define DEFEULT_TELNET_ACTIVITY_TIMEOUT_STD  20
    302 /*
    303  * Timeout on Telnet activity, in seconds, in case
    304  * user interface system is in a 'continuous display'
    305  * state. Usually, this is a value larger than
    306  * the standard timeout.
    307  * After this time of inactivity, telnet will
    308  * be disconnected.
    309  */
    310 #define DEFAULT_TELNET_ACTIVITY_TIMEOUT_CONT 100
    311 /*
    312  * Event error level at and above which events are
    313  * displayed on the screen.
    314  */
    315 #define DEFAULT_EVENT_DISPLAY_LEVEL          SVR_WRN
    316 /*
    317  * Event error level at and above which events are
    318  * stored in NVRAM log.
    319  */
    320 #define DEFAULT_EVENT_NVRAM_LEVEL            SVR_ERR
    321 /*
    322  * Event error level at and above which events are
    323  * sent to a syslog server.
    324  */
    325 #define DEFAULT_EVENT_SYSLOG_LEVEL           SVR_LAST
    326 /*
    327  * Debug tool. Specified debug level for Marvell's DPSS.
    328  * Depending on its value, various display option will
    329  * be activated at runtime.
    330  * A value of '0' indicates 'no display option active'.
    331  */
    332 #define DEFAULT_DPSS_DISPLAY_LEVEL           0
    333 /*
    334  * Debug tool. Specified debug level for Marvell's DPSS.
    335  * Depending on its value, various debug option will
    336  * be activated at runtime.
    337  * A value of '0' indicates 'no debug option active'.
    338  */
    339 #define DEFAULT_DPSS_DEBUG_LEVEL             0
    340 /*
    341  * Demo tool. Tells tha application whether to start
    342  * in demo mode - and what type of demo. Currently,
    343  * only "negev_demo" is supported, but this nv val,
    344  * will allow future releases to support more demo
    345  * modes. '0' indicates - no demo.
    346  */
    347 #define DEFAULT_START_APPLICATION_IN_DEMO_MODE  0
    348 /*
    349  * Flag. If set 'true' (on) then at startup a default
    350  * cli file is run
    351  */
    352 #define DEFAULT_RUN_UI_STARTUP_SCRIPT       FALSE
    353 /*
    354  * Flag. If set 'true' (on) then Marvell's DPSS
    355  * data structures are initialized from a file on flash.
    356  */
    357 #define DEFAULT_DPSS_LOAD_FROM_FILE         FALSE
    358 /*
    359  * Flag indicating whether mibs should be read
    360  * from downloading host (using TFTP) at startup.
    361  */
    362 #define DEFAULT_DOWNLOAD_MIBS                FALSE
    363 /*
    364  * Flag indicating whether to load the Net-SNMP package at run time
    365  */
    366 #define DEFAULT_LOAD_NETSNMP                 FALSE
    367 /*
    368  * Size on Nvram of the NetSNMP command line
    369  */
    370 #define SNMP_CMD_LINE_SIZE                   128
    371 #define DEFAULT_SNMP_CMD_LINE                ""
    372 /*
    373  * Default value on whether to background collect temperature.
    374  * Enable disable background collection temperature.
    375  * If disabled:
    376  *  1. No I2C transaction toward the temperature.
    377  *  2. No valid temperature is given when asked.
    378  *  3. Original intension is to reduced the I2C
    379  *     transactions for hardware debugging.
    380  */
    381 #define DEFAULT_BCKG_TEMPERATURES_EN      TRUE
    382 /*
    383  * Default value on whether to hook our software exception handler.
    384  * The exception includes:
    385  *  1. Software emulation (0x1000).
    386  *  2. Alignment (0x600).
    387  *  3. DSI (0x300).
    388  *  4. ISI (0x400).
    389  */
    390 #define DEFAULT_HOOK_SOFTWARE_EXCEPTION   TRUE
    391 /*
    392  * }
    393  */
    394 /*
    395  * Default values for nv ram fields related to
    396  * DUNE chip set.
    397  * {
    398  */
    399 /*
    400  * Default value for indication on whether to
    401  * load 'configuration' register of FE chip
    402  * from NV ram or leave it (to load from MD).
    403  */
    404 #define DEFAULT_CONF_FROM_MD         TRUE
    405 /*
    406  * Default value for 'configuration' register
    407  * of FE chip:
    408  * Chip id = 1
    409  * Mode FE2 = 1
    410  * Repeater = 0
    411  * Planes = one plane
    412  */
    413 #define DEFAULT_FE_CONFIGURATION      0x1001
    414 /*
    415  * }
    416  */
    417 /*
    418  * Definitions related to NMI/reset/watchdog exception
    419  * block (block_04).
    420  * {
    421  */
    422 /*
    423  * Default values for NV ram fields related to
    424  * NMI/reset/watchdog exception block.
    425  * {
    426  */
    427 /*
    428  * Default value for 'new_n_valid' element:
    429  * If set to '0' then this block contains
    430  * no information (either there has not been
    431  * any exception or data of last exception
    432  * has been displayed on the screen and transferred
    433  * to the 'log' fifo.
    434  */
    435 #define DEFAULT_NEW_N_VALID        0
    436 #define DEFAULT_ERROR_IDENTIFIER   0
    437 
    438 /*
    439  * HOST_EEPROM_FRONT_CARD_TYPE_TYPE enum.
    440  * The front line cards to work with the GFA.
    441  * The enum is valid only for front line cards
    442  * outside from dune.
    443  */
    444 typedef enum
    445 {
    446   HOST_EEPROM_FRONT_CARD_TYPE_NONE=0,
    447   HOST_EEPROM_FRONT_CARD_TYPE_X10,
    448   HOST_EEPROM_FRONT_CARD_TYPE_IXP2800,
    449 
    450   HOST_EEPROM_FRONT_CARD_TYPE_NOF
    451 } HOST_EEPROM_FRONT_CARD_TYPE ;
    452 /*
    453  * The default front card type is NONE.
    454  * Should only be changed when the GFA works
    455  * with non-Dune front line cards.
    456  */
    457 
    458 
    459 /*
    460  * Definitions related to NVRAM event log
    461  * block (block_05).
    462  * {
    463  */
    464 /*
    465  * Number of elements in event log. Make sure
    466  * size of event log array is not larger than size
    467  * assigned to nvram log file in all.
    468  */
    469 #define NUM_EVENT_LOG_ITEMS       30
    470 /*
    471  * }
    472  */
    473 typedef struct
    474 {
    475   unsigned long startup_counter ;
    476 } __ATTRIBUTE_PACKED__ BLOCK_01  ;
    477 typedef struct
    478 {
    479   unsigned long  ip_addr ;
    480   unsigned long  ip_mask ;
    481   unsigned long  default_gateway_addr ;
    482   unsigned long  downloading_host_addr ;
    483   unsigned long  mem_drv_len ;
    484   unsigned long  app_flash_size ;
    485   char           *app_flash_base ;
    486   unsigned long  console_baud_rate ;
    487   unsigned char  app_source ;
    488   unsigned char  app_load_method ;
    489   unsigned char  auto_flash_load ;
    490   unsigned char  kernel_startup ;
    491   char           mem_device_name[MEM_DEVICE_NAME_LEN + 1] ;
    492   char           dld_file_name[DLD_FILE_NAME_LEN + 1] ;
    493   char           target_name[TARGET_NAME_LEN + 1] ;
    494   unsigned char  activate_inst_cache ;
    495   unsigned char  activate_data_cache ;
    496   unsigned char  ip_source_mode ;
    497   unsigned char  test_at_startup ;
    498   /* 
    499    * The following block of params are for the base / option regsiters needed for
    500    * the test chip board
    501    */
    502   unsigned long  base_register_04 ;
    503   unsigned long  base_register_05 ;
    504   unsigned long  option_register_04 ;
    505   unsigned long  option_register_05 ;
    506   unsigned char  tcp_timeout ;
    507   unsigned char  tcp_retries ;
    508   unsigned long  debug_register_01;
    509 } __ATTRIBUTE_PACKED__ BLOCK_02  ;
    510 typedef struct
    511 {
    512   unsigned char  page_mode ;
    513   unsigned char  page_lines ;
    514   unsigned char  conf_from_md[NUM_FE_ON_BOARD] ;
    515   unsigned short fe_configuration[NUM_FE_ON_BOARD] ;
    516   unsigned char  line_mode ;
    517   unsigned char  activate_watchdog ;
    518   unsigned char  watchdog_period ;
    519     /*
    520      * Timeout on standard Telnet activity in seconds.
    521      * After this time of inactivity, telnet will
    522      * be disconnected.
    523      */
    524   unsigned char  telnet_activity_timeout_std ;
    525     /*
    526      * Timeout on Telnet activity, in seconds, in case
    527      * user interface system is in a 'continuous display'
    528      * state. Usually, this is a value larger than
    529      * the standard timeout.
    530      * After this time of inactivity, telnet will
    531      * be disconnected.
    532      */
    533   unsigned char  telnet_activity_timeout_cont ;
    534     /*
    535      * Minimal severity, above which events are displayed
    536      * (related to gen_err).
    537      */
    538   unsigned char  event_display_level ;
    539   unsigned char  event_nvram_level ;
    540     /*
    541      * Flag. If set to non-zero:
    542      * + SOC_SAND_FAP10M system: Marvell's DPSS is initialized and started at startup.
    543      * + SOC_SAND_FAP20V system: sweep application is initialized and started at startup.
    544      * Refer to enumerator 'D_APPLICATION_ACTIVATE' for different kinds of application flavors.
    545      */
    546   unsigned char  usr_app_flavor ;
    547     /*
    548      * Debug tool. Specified debug level for Marvell's DPSS.
    549      * Depending on its value, various display option will
    550      * be activated at runtime.
    551      */
    552   unsigned char  dpss_display_level ;
    553     /*
    554      * Debug tool. Specified debug level for Marvell's DPSS.
    555      * Depending on its value, various debug option will
    556      * be activated at runtime.
    557      */
    558   unsigned char  dpss_debug_level ;
    559     /*
    560      * Hook our exception handler regarding the 
    561      *  1. Software Emulation Exception
    562      *  2. Alignment (0x600).
    563      *  3. DSI (0x300).
    564      *  4. ISI (0x400).
    565      */
    566   unsigned char  hook_software_exception ;
    567     /*
    568      * Enable disable background collection temperature.
    569      * If disabled:
    570      *  1. No I2C transaction toward the temperature.
    571      *  2. No valid temperature is given when asked.
    572      *  3. Original intension is to reduced the I2C 
    573      *     transactions for hardware debugging.
    574      */
    575   unsigned char  bckg_temperatures_en ;
    576   /*
    577    * Enables running of default cli script at startup.
    578    */
    579   unsigned char  run_ui_startup_script;
    580   /*
    581    * Enables loading of dpss config file (dune_rpc.cfg)
    582    * from the flash instead of from tftp.
    583    */
    584   unsigned char  load_dpss_from_file_on_flash;
    585   /*
    586    * Enables starting the application in demo mode
    587    * Currently only "negev_demo" is supported.
    588    */
    589   unsigned char  start_application_in_demo_mode;
    590   /*
    591    * Determine if the SOC_SAND_FAP10M is accessing the device
    592    * via the ECI/PCI interface.
    593    */
    594   unsigned char  fap10m_run_mode;
    595 
    596   /*
    597    * Minimal severity, above which events are sent to
    598    * syslog server (related to gen_err).
    599    */
    600   unsigned char  event_syslog_level ;
    601 
    602 
    603 } __ATTRIBUTE_PACKED__ BLOCK_03  ;
    604 typedef struct
    605 {
    606     /*
    607      * Internal error identifier of this exception.
    608      * If this value is '0' then no meaningful
    609      * exception description is contained in this
    610      * block.
    611      */
    612   unsigned long  error_identifier ;
    613     /*
    614      * Number of system startup at which this exception
    615      * occurred. Value taken from NV ram, block 01.
    616      */
    617   unsigned long  startup_count ;
    618     /*
    619      * Time from last startup (when reset exception
    620      * has occurred), in units of 10 milli seconds.
    621      */
    622   unsigned long  time_from_startup ;
    623     /*
    624      * Time of day (when reset exception
    625      * has occurred), in units T.B.D.
    626      */
    627   unsigned long  tod[2] ;
    628     /*
    629      * Name identifier of task (where reset exception
    630      * has occurred).
    631      */
    632   char           task_name[10] ;
    633     /*
    634      * Value of program counter where reset exception
    635      * has occurred.
    636      */
    637   unsigned long  program_counter ;
    638     /*
    639      * Number identifier of task (where reset exception
    640      * has occurred).
    641      */
    642   int            task_id ;
    643     /*
    644      * Free text description of exception. Null terminated
    645      * string.
    646      */
    647   char           nmi_text[80] ;
    648     /*
    649      * Flag. If non-zero then this exception should also
    650      * trigger an alarm.
    651      */
    652   unsigned char  trigger_alarm ;
    653     /*
    654      * Counter. If, somehow, a few reset exceptions
    655      * occur before actual hardware reset hits the
    656      * system then only information concerning the last one
    657      * is stored in this block. However, this counter
    658      * is incremented, in that case.
    659      */
    660   unsigned char  exception_counter ;
    661     /*
    662      * Flag. If non-zero then all fields in this block,
    663      * assigned to reset/watchdog exception, are valid
    664      * and should be displayed on the screen and moved
    665      * to the NV ram 'log'.
    666      * It is up to the writer of the exception handler
    667      * to fill all other elements with meaningful information
    668      * before asserting this field.
    669      */
    670   unsigned char  new_n_valid ;
    671     /*
    672      * Identifier of boot version used when exception
    673      * was detected.
    674      */
    675   unsigned short boot_ver ;
    676     /*
    677      * Identifier of application version used when
    678      * exception was detected.
    679      */
    680   unsigned short prog_ver ;
    681     /*
    682      * Time elapsed from restarting the watchdog
    683      * timer (until reset exception has occurred),
    684      * in units of milli seconds.
    685      */
    686   unsigned long  time_from_wd_restart ;
    687     /*
    688      * Time elapsed from start to end of watchdog/NMI
    689      * interrupt handler,
    690      * in units of milli seconds.
    691      */
    692   unsigned long  handler_processing_time ;
    693 } __ATTRIBUTE_PACKED__ BLOCK_04  ;
    694 typedef struct
    695 {
    696     /*
    697      * Full identifier of the event
    698      */
    699   int event_id ;
    700     /*
    701      * Time from last startup when event was detected
    702      * (displayed/stored), in units of 10 milli seconds.
    703      */
    704   unsigned long  time_from_startup ;
    705     /*
    706      * Error reported by OS when event was first
    707      * reported.
    708      */
    709   int  vx_works_error ;
    710     /*
    711      * Identifier of boot version used when event
    712      * was detected.
    713      */
    714   unsigned short  boot_ver ;
    715     /*
    716      * Identifier of application version used when
    717      * event was detected.
    718      */
    719   unsigned short  prog_ver ;
    720     /*
    721      * Number of system startup at which this exception
    722      * occurred. Value taken from NV ram, block 01.
    723      */
    724   unsigned short startup_count ;
    725     /*
    726      * This byte contains an indication on whether
    727      * this event is an alarm and, if so, whether it is
    728      * a 'set alarm' or a 'reset alarm' event as
    729      * follows:
    730      *   SET_ALARM         BIT(0)
    731      *   RESET_ALARM       BIT(1)
    732      *   ALARM_EVENT       (SET_ALARM | RESET_ALARM)
    733      *   ALARM_TYPE_MASK   0x0000FF00
    734      * If ALARM_EVENT is zero then this is not an alarm event.
    735      * If it is an alarm event then ALARM_TYPE_MASK contains
    736      * an identifier of the alarm (in addition to event_id)
    737      */
    738   unsigned short   alarm_flags ;
    739     /*
    740      * Severity of event.
    741      * Values
    742      *   SVR_MSG 0
    743      *   SVR_WRN 1
    744      *   SVR_ERR 2
    745      *   SVR_FTL 3
    746      */
    747   char severity ;
    748     /*
    749      * Number of times event was found to have repeated
    750      * when it was .
    751      */
    752   unsigned char num_accumulated ;
    753     /*
    754      * Text to display when scanning of events (for aging) finds
    755      * an event which has non-zero num_accumulated element and
    756      * which is still pending.
    757      */
    758   char event_text[80] ;
    759     /*
    760      * Name of task at which event was detected.
    761      */
    762   char task_name[10] ;
    763     /*
    764      * Name of procedure at which event was detected.
    765      */
    766   char proc_name[16] ;
    767 } __ATTRIBUTE_PACKED__ EVENT_LOG_ITEM  ;
    768 typedef struct
    769 {
    770     /*
    771      * Index in array 'event_log_item' of next item
    772      * to load.
    773      */
    774   unsigned char next_in_index ;
    775     /*
    776      * Number of meaningful events logged in array
    777      * 'event_log_item'. Events are stored cyclicly.
    778      * For example, if 'NUM_EVENT_LOG_ITEMS' is 20,
    779      * 'next_in_index' is 5 and 'num_events_logged'
    780      * is 7 then the index of the first meaningful
    781      * entry is 18. 
    782      */
    783   unsigned char num_events_logged ;
    784     /*
    785      * Array of events pushed into this log file.
    786      */
    787   EVENT_LOG_ITEM event_log_item[NUM_EVENT_LOG_ITEMS] ;
    788 } __ATTRIBUTE_PACKED__ BLOCK_05  ;
    789 typedef struct
    790 {
    791   unsigned char  load_netsnmp ;
    792   unsigned char  download_mibs ;
    793   char           snmp_cmd_line[SNMP_CMD_LINE_SIZE] ;
    794   /*
    795    */
    796 } __ATTRIBUTE_PACKED__ BLOCK_06  ;
    797 typedef struct
    798 {
    799     /*
    800      * Internal error identifier of this exception.
    801      * If this value is '0' then no meaningful
    802      * exception description is contained in this
    803      * block.
    804      */
    805   unsigned long  error_identifier ;
    806     /*
    807      * Number of system startup at which this exception
    808      * occurred. Value taken from NV ram, block 01.
    809      */
    810   unsigned long  startup_count ;
    811     /*
    812      * Time from last startup (when reset exception
    813      * has occurred), in units of 10 milli seconds.
    814      */
    815   unsigned long  time_from_startup ;
    816     /*
    817      * Time of day (when reset exception
    818      * has occurred), in units T.B.D.
    819      */
    820   unsigned long  tod[2] ;
    821     /*
    822      * Name identifier of task (where reset exception
    823      * has occurred).
    824      */
    825   char           task_name[10] ;
    826     /*
    827      * Value of program counter where reset exception
    828      * has occurred.
    829      */
    830   unsigned long  program_counter ;
    831     /*
    832      * Number identifier of task (where reset exception
    833      * has occurred).
    834      */
    835   int            task_id ;
    836     /*
    837      * Free text description of exception. Null terminated
    838      * string.
    839      */
    840   char           text[80] ;
    841     /*
    842      * Flag. If non-zero then this exception should also
    843      * trigger an alarm.
    844      */
    845   unsigned char  trigger_alarm ;
    846     /*
    847      * Counter. If, somehow, a few reset exceptions
    848      * occur before actual hardware reset hits the
    849      * system then only information concerning the last one
    850      * is stored in this block. However, this counter
    851      * is incremented, in that case.
    852      */
    853   unsigned char  exception_counter ;
    854     /*
    855      * Flag. If non-zero then all fields in this block,
    856      * assigned to exception, are valid
    857      * and should be displayed on the screen and moved
    858      * to the NV ram 'log'.
    859      * It is up to the writer of the exception handler
    860      * to fill all other elements with meaningful information
    861      * before asserting this field.
    862      */
    863   unsigned char  new_n_valid ;
    864     /*
    865      * Identifier of boot version used when exception
    866      * was detected.
    867      */
    868   unsigned short boot_ver ;
    869     /*
    870      * Identifier of application version used when
    871      * exception was detected.
    872      */
    873   unsigned short prog_ver ;
    874     /*
    875      * Time elapsed from start to end of exception
    876      * interrupt handler,
    877      * in units of milli seconds.
    878      */
    879   unsigned long  handler_processing_time ;
    880     /*
    881      * Value of 'Machine State Register' (MSR) at the 
    882      * time of the excpetion.
    883      */
    884   unsigned long  msr_register ;
    885     /*
    886      * Registers R0-R5
    887      */
    888   unsigned long  registers_0_to_4[5] ;
    889     /*
    890      * Registers R29-R31
    891      */
    892   unsigned long  registers_30_to_31[2] ;
    893 } __ATTRIBUTE_PACKED__ BLOCK_07  ;
    894 
    895 typedef union
    896 {
    897   BLOCK_01  block_01 ;
    898   unsigned char fill[SIZEOF_EE_BLOCK_01] ;
    899 } __ATTRIBUTE_PACKED__ UN_EE_BLOCK_01 ;
    900 typedef union
    901 {
    902   BLOCK_02  block_02 ;
    903   unsigned char fill[SIZEOF_EE_BLOCK_02] ;
    904 } __ATTRIBUTE_PACKED__ UN_EE_BLOCK_02 ;
    905 typedef union
    906 {
    907   BLOCK_03  block_03 ;
    908   unsigned char fill[SIZEOF_EE_BLOCK_03] ;
    909 } __ATTRIBUTE_PACKED__ UN_EE_BLOCK_03 ;
    910 typedef union
    911 {
    912   BLOCK_04  block_04 ;
    913   unsigned char fill[SIZEOF_EE_BLOCK_04] ;
    914 } __ATTRIBUTE_PACKED__ UN_EE_BLOCK_04 ;
    915 typedef union
    916 {
    917   BLOCK_05  block_05 ;
    918   unsigned char fill[SIZEOF_EE_BLOCK_05] ;
    919 } __ATTRIBUTE_PACKED__ UN_EE_BLOCK_05 ;
    920 typedef union
    921 {
    922   BLOCK_06  block_06 ;
    923   unsigned char fill[SIZEOF_EE_BLOCK_06] ;
    924 } __ATTRIBUTE_PACKED__ UN_EE_BLOCK_06 ;
    925 typedef union
    926 {
    927   BLOCK_07  block_07 ;
    928   unsigned char fill[SIZEOF_EE_BLOCK_07] ;
    929 } __ATTRIBUTE_PACKED__ UN_EE_BLOCK_07 ;
    930 typedef struct
    931 {
    932   UN_EE_BLOCK_01 un_ee_block_01 ;
    933   unsigned short crc16 ;
    934 } __ATTRIBUTE_PACKED__ EE_BLOCK_01  ;
    935 typedef struct
    936 {
    937   UN_EE_BLOCK_02 un_ee_block_02 ;
    938   unsigned short crc16 ;
    939 } __ATTRIBUTE_PACKED__ EE_BLOCK_02  ;
    940 typedef struct
    941 {
    942   UN_EE_BLOCK_03 un_ee_block_03 ;
    943   unsigned short crc16 ;
    944 } __ATTRIBUTE_PACKED__ EE_BLOCK_03  ;
    945 typedef struct
    946 {
    947   UN_EE_BLOCK_04 un_ee_block_04 ;
    948   unsigned short crc16 ;
    949 } __ATTRIBUTE_PACKED__ EE_BLOCK_04  ;
    950 typedef struct
    951 {
    952   UN_EE_BLOCK_05 un_ee_block_05 ;
    953   unsigned short crc16 ;
    954 } __ATTRIBUTE_PACKED__ EE_BLOCK_05  ;
    955 typedef struct
    956 {
    957   UN_EE_BLOCK_06 un_ee_block_06 ;
    958   unsigned short crc16 ;
    959 } __ATTRIBUTE_PACKED__ EE_BLOCK_06  ;
    960 typedef struct
    961 {
    962   UN_EE_BLOCK_07 un_ee_block_07 ;
    963   unsigned short crc16 ;
    964 } __ATTRIBUTE_PACKED__ EE_BLOCK_07  ;
    965 typedef struct
    966 {
    967   EE_BLOCK_01 ee_block_01 ;
    968   EE_BLOCK_02 ee_block_02 ;
    969   EE_BLOCK_03 ee_block_03 ;
    970   EE_BLOCK_04 ee_block_04 ;
    971   EE_BLOCK_05 ee_block_05 ;
    972   EE_BLOCK_06 ee_block_06 ;
    973   EE_BLOCK_07 ee_block_07 ;
    974 } __ATTRIBUTE_PACKED__ EE_AREA  ;
    975 
    976 /*
    977  * Definitions related to Serial EEPROM chip (AT24C04, I2C)
    978  * Chip has 512 non-volatile bytes.
    979  * {
    980  */
    981 #define SER_EE_POWER_OF_SIZE                       9
    982 #define SER_EPROM_I2C_ADDRESS_WRITE                0xA0
    983 /*
    984  */
    985 #define HOST_SER_EE_POWER_OF_SIZE                  9
    986 #define HOST_SER_EPROM_I2C_ADDRESS_WRITE           0xA4
    987 /*
    988  * I2C pasrameters for NVRAM on front end card.
    989  */
    990 #define FRONT_SER_EE_POWER_OF_SIZE                 9
    991 #define FRONT_SER_EPROM_I2C_ADDRESS_READ           0xA9
    992 /*
    993  * I2C pasrameters for NVRAM on host_db card.
    994  */
    995 #define HOST_DB_SER_EE_POWER_OF_SIZE               9
    996 /*
    997  * Size of serial eeprom must be a multiple
    998  * of block size, SER_EPROM_BLOCK_SIZE.
    999  */
   1000 #define SIZEOF_SERIAL_EE                  B_BIT(SER_EE_POWER_OF_SIZE)
   1001 /*
   1002  * Load high bits of offset in serial eeprom (src)
   1003  * into address (dest). Note that src is at least two
   1004  * bytes long while dest is one byte long.
   1005  */
   1006 #define SER_EPROM_BLOCK_SIZE              16
   1007 /*
   1008  * Number of blocks in serial EEPROM area which
   1009  * are assigned to boot time and to run time.
   1010  * Update when changing/adding new blocks.
   1011  * Make sure blocks (with CRC) are multiples
   1012  * of SER_EPROM_BLOCK_SIZE
   1013  */
   1014 #define NUM_SERIAL_EE_BLOCKS         2
   1015 #define SIZEOF_SERIAL_EE_BLOCK_01    ((SER_EPROM_BLOCK_SIZE * 1) - 2)
   1016 #define SIZEOF_SERIAL_EE_BLOCK_02    ((SER_EPROM_BLOCK_SIZE * 5) - 2)
   1017 #define SIZEOF_SERIAL_EE_FILLER      \
   1018           SIZEOF_SERIAL_EE - (SIZEOF_SERIAL_EE_BLOCK_01+2 + SIZEOF_SERIAL_EE_BLOCK_02+2)
   1019 /*
   1020  * Number of blocks in HOST serial EEPROM area which
   1021  * are assigned to boot time and to run time.
   1022  * Update when changing/adding new blocks.
   1023  * Make sure blocks (with CRC) are multiples
   1024  * of SER_EPROM_BLOCK_SIZE
   1025  */
   1026 #define SIZEOF_HOST_SERIAL_EE             B_BIT(HOST_SER_EE_POWER_OF_SIZE)
   1027 #define HOST_NUM_SERIAL_EE_BLOCKS         2
   1028 #define HOST_SIZEOF_SERIAL_EE_BLOCK_01    ((SER_EPROM_BLOCK_SIZE * 1) - 2)
   1029 #define HOST_SIZEOF_SERIAL_EE_BLOCK_02    ((SER_EPROM_BLOCK_SIZE * 20) - 2)
   1030 #define SIZEOF_HOST_SERIAL_EE_FILLER      \
   1031           SIZEOF_HOST_SERIAL_EE -  \
   1032           (HOST_SIZEOF_SERIAL_EE_BLOCK_01+ 2 + \
   1033           HOST_SIZEOF_SERIAL_EE_BLOCK_02 + 2)
   1034 /*
   1035  * Number of blocks in FRONT serial EEPROM area which
   1036  * are assigned to boot time and to run time.
   1037  * Update when changing/adding new blocks.
   1038  * Make sure blocks (with CRC) are multiples
   1039  * of SER_EPROM_BLOCK_SIZE
   1040  */
   1041 #define SIZEOF_FRONT_SERIAL_EE             B_BIT(FRONT_SER_EE_POWER_OF_SIZE)
   1042 #define FRONT_NUM_SERIAL_EE_BLOCKS         2
   1043 #define FRONT_SIZEOF_SERIAL_EE_BLOCK_01    ((SER_EPROM_BLOCK_SIZE * 1) - 2)
   1044 #define FRONT_SIZEOF_SERIAL_EE_BLOCK_02    ((SER_EPROM_BLOCK_SIZE * 20) - 2)
   1045 #define SIZEOF_FRONT_SERIAL_EE_FILLER      \
   1046           SIZEOF_FRONT_SERIAL_EE -  \
   1047           (FRONT_SIZEOF_SERIAL_EE_BLOCK_01+ 2 + \
   1048           FRONT_SIZEOF_SERIAL_EE_BLOCK_02 + 2)
   1049 
   1050 /*
   1051  * Number of blocks in HOST_DB serial EEPROM area which
   1052  * are assigned to boot time and to run time.
   1053  * Update when changing/adding new blocks.
   1054  * Make sure blocks (with CRC) are multiples
   1055  * of SER_EPROM_BLOCK_SIZE
   1056  */
   1057 #define SIZEOF_HOST_DB_SERIAL_EE           B_BIT(HOST_DB_SER_EE_POWER_OF_SIZE)
   1058 #define HOST_DB_NUM_SERIAL_EE_BLOCKS         2
   1059 #define HOST_DB_SIZEOF_SERIAL_EE_BLOCK_01    ((SER_EPROM_BLOCK_SIZE * 1) - 2)
   1060 #define HOST_DB_SIZEOF_SERIAL_EE_BLOCK_02    ((SER_EPROM_BLOCK_SIZE * 20) - 2)
   1061 #define SIZEOF_HOST_DB_SERIAL_EE_FILLER      \
   1062           SIZEOF_HOST_DB_SERIAL_EE -  \
   1063           (HOST_DB_SIZEOF_SERIAL_EE_BLOCK_01+ 2 + \
   1064           HOST_DB_SIZEOF_SERIAL_EE_BLOCK_02 + 2)
   1065 /*
   1066  * for the standard nvram handling system, block identifiers
   1067  * of serial eeprom start at 'SERIAL_EE_FIRST_BLOCK_ID' while
   1068  * offest starts at 'SERIAL_EE_FIRST_OFFSET' (Make sure there is no
   1069  * overlap with other NVRAM systems!).
   1070  * Currently the only other system is the parallel eeprom.
   1071  */
   1072 #define SERIAL_EE_FIRST_BLOCK_ID          100
   1073 #define SERIAL_EE_FIRST_OFFSET            NV_RAM_SIZE
   1074 #define HOST_SERIAL_EE_FIRST_BLOCK_ID     200
   1075 #define FRONT_SERIAL_EE_FIRST_BLOCK_ID    300
   1076 #define HOST_DB_SERIAL_EE_FIRST_BLOCK_ID   400
   1077 
   1078 /*
   1079  * Maximal number of characters on name of board type
   1080  * (including ending null).
   1081  */
   1082 #define B_MAX_BOARD_NAME_LEN         12
   1083 /*
   1084  * Default value for name of this board type.
   1085  * Suffix 'new' specifies new PCI board.
   1086  */
   1087 #define B_DEFAULT_BOARD_NAME         "BRD0001A"
   1088 #define B_DEFAULT_BOARD_NAME_NEW     "BRD0011A"
   1089 /*
   1090  * Maximal number of characters on description of board type
   1091  * (including ending null).
   1092  */
   1093 #define B_MAX_BOARD_DESCRIPTION_LEN  40
   1094 /*
   1095  * Default value for name of this board type.
   1096  * Suffix 'new' specifies new PCI board.
   1097  */
   1098 #define B_DEFAULT_BOARD_DESCRIPTION      "CPU mezzanine"
   1099 #define B_DEFAULT_BOARD_DESCRIPTION_NEW  "CPU-PMC"
   1100 /*
   1101  * Default value for identifier of hardware of this board.
   1102  * Suffix 'new' specifies new PCI board.
   1103  */
   1104 #define B_DEFAULT_BOARD_SERIAL_NUMBER 0x0001
   1105 #define B_DEFAULT_BOARD_SERIAL_NUMBER_NEW 0x0001
   1106 /*
   1107  * Default value for hardware version of this board.
   1108  * Suffix 'new' specifies new PCI board.
   1109  */
   1110 #define B_DEFAULT_BOARD_VERSION       101
   1111 #define B_DEFAULT_BOARD_VERSION_NEW   102
   1112 /*
   1113  * HOST serial eeprom - default values
   1114  * {
   1115  */
   1116 /*
   1117  * Maximal number of characters on host catalaog number.
   1118  * (including ending null).
   1119  */
   1120 #define B_HOST_MAX_CATALOG_NUMBER_LEN     9
   1121 /*
   1122  * Default value for host catalaog number.
   1123  */
   1124 #define B_DEFAULT_HOST_CATALOG_NUMBER ""
   1125 /*
   1126  * Maximal number of characters on description of host board type
   1127  * (including ending null).
   1128  */
   1129 #define B_HOST_MAX_BOARD_DESCRIPTION_LEN  50
   1130 /*
   1131  * Default value for host board description.
   1132  */
   1133 #define B_DEFAULT_HOST_BOARD_DESCRIPTION ""
   1134 /*
   1135  * Maximal number of characters on host board version
   1136  */
   1137 #define B_HOST_MAX_DEFAULT_BOARD_VERSION_LEN  7
   1138 /*
   1139  * Default value for host board description.
   1140  */
   1141 #define B_DEFAULT_HOST_BOARD_VERSION ""
   1142 /*
   1143  * Maximal number of characters on empty param
   1144  */
   1145 #define B_HOST_MAX_PARAM_LEN  20
   1146 /*
   1147  * Default value for host board description.
   1148  */
   1149 #define B_DEFAULT_ENPTY_PARAM ""
   1150 /*
   1151  * Default value for host board description.
   1152  */
   1153 #define B_DEFAULT_HOST_BOARD_SN 0x0000
   1154 /*
   1155  * Default value for host board type.
   1156  */
   1157 #define B_DEFAULT_HOST_BOARD_TYPE 0x0000
   1158 /*
   1159  * }
   1160  */
   1161 /*
   1162  * FRONT serial eeprom - default values
   1163  * {
   1164  */
   1165 /*
   1166  * FRONT_CARD_TYPE:
   1167  * Front line cards produced by Dune.
   1168  * See definitions below:
   1169  *   FRONT_END_FTG         2200
   1170  *   FRONT_END_TGS         2300
   1171  */
   1172 /*
   1173  * Maximal number of characters on front catalaog number.
   1174  * (including ending null).
   1175  */
   1176 #define B_FRONT_MAX_CATALOG_NUMBER_LEN     9
   1177 /*
   1178  * Default value for front catalaog number.
   1179  */
   1180 #define B_DEFAULT_FRONT_CATALOG_NUMBER ""
   1181 /*
   1182  * Maximal number of characters on description of front board type
   1183  * (including ending null).
   1184  */
   1185 #define B_FRONT_MAX_BOARD_DESCRIPTION_LEN      50
   1186 /*
   1187  * Default value for front board description.
   1188  */
   1189 #define B_DEFAULT_FRONT_BOARD_DESCRIPTION      ""
   1190 /*
   1191  * Maximal number of characters on front board version
   1192  */
   1193 #define B_FRONT_MAX_DEFAULT_BOARD_VERSION_LEN  7
   1194 /*
   1195  * Default value for front board description.
   1196  */
   1197 #define B_DEFAULT_FRONT_BOARD_VERSION          ""
   1198 /*
   1199  * Maximal number of characters on empty param
   1200  */
   1201 #define B_FRONT_MAX_PARAM_LEN      20
   1202 /*
   1203  * Default value for front board description.
   1204  */
   1205 #define B_DEFAULT_ENPTY_PARAM      ""
   1206 /*
   1207  * Default value for front board description.
   1208  */
   1209 #define B_DEFAULT_FRONT_BOARD_SN   0x0000
   1210 /*
   1211  * Default value for front board type.
   1212  */
   1213 #define B_DEFAULT_FRONT_BOARD_TYPE SOC_UNKNOWN_CARD
   1214 /*
   1215  * }
   1216  */
   1217 /*
   1218  * HOST_DB serial eeprom - default values
   1219  * {
   1220  */
   1221 /*
   1222  * HOST_DB_CARD_TYPE:
   1223  * Host_db line cards produced by Dune.
   1224  * See definitions below:
   1225  */
   1226 /*
   1227  * Maximal number of characters on host_db catalaog number.
   1228  * (including ending null).
   1229  */
   1230 #define B_HOST_DB_MAX_CATALOG_NUMBER_LEN     9
   1231 /*
   1232  * Default value for host_db catalaog number.
   1233  */
   1234 #define B_DEFAULT_HOST_DB_CATALOG_NUMBER ""
   1235 /*
   1236  * Maximal number of characters on description of host_db board type
   1237  * (including ending null).
   1238  */
   1239 #define B_HOST_DB_MAX_BOARD_DESCRIPTION_LEN      50
   1240 /*
   1241  * Default value for host_db board description.
   1242  */
   1243 #define B_DEFAULT_HOST_DB_BOARD_DESCRIPTION      ""
   1244 /*
   1245  * Maximal number of characters on host_db board version
   1246  */
   1247 #define B_HOST_DB_MAX_DEFAULT_BOARD_VERSION_LEN  7
   1248 /*
   1249  * Default value for host_db board description.
   1250  */
   1251 #define B_DEFAULT_HOST_DB_BOARD_VERSION          ""
   1252 /*
   1253  * Maximal number of characters on empty param
   1254  */
   1255 #define B_HOST_DB_MAX_PARAM_LEN      20
   1256 /*
   1257  * Default value for host_db board description.
   1258  */
   1259 #define B_DEFAULT_ENPTY_PARAM      ""
   1260 /*
   1261  * Default value for host_db board description.
   1262  */
   1263 #define B_DEFAULT_HOST_DB_BOARD_SN   0x0000
   1264 /*
   1265  * Default value for host_db board type.
   1266  */
   1267 #define B_DEFAULT_HOST_DB_BOARD_TYPE SOC_UNKNOWN_CARD
   1268 /*
   1269  * }
   1270  */
   1271 
   1272 typedef struct
   1273 {
   1274   char eth_addr[MAC_ADRS_LEN] ;
   1275 } __ATTRIBUTE_PACKED__ SERIAL_EE_BLOCK_01  ;
   1276 typedef struct
   1277 {
   1278   unsigned short  board_serial_number ;
   1279   unsigned short  board_version ;
   1280   char            board_description[B_MAX_BOARD_DESCRIPTION_LEN] ;
   1281   char            board_name[B_MAX_BOARD_NAME_LEN] ;
   1282 } __ATTRIBUTE_PACKED__ SERIAL_EE_BLOCK_02  ;
   1283 typedef union
   1284 {
   1285   SERIAL_EE_BLOCK_01  serial_ee_block_01 ;
   1286   unsigned char fill[SIZEOF_SERIAL_EE_BLOCK_01] ;
   1287 } __ATTRIBUTE_PACKED__ UN_SERIAL_EE_BLOCK_01 ;
   1288 typedef union
   1289 {
   1290   SERIAL_EE_BLOCK_02  serial_ee_block_02 ;
   1291   unsigned char fill[SIZEOF_SERIAL_EE_BLOCK_02] ;
   1292 } __ATTRIBUTE_PACKED__ UN_SERIAL_EE_BLOCK_02 ;
   1293 typedef struct
   1294 {
   1295   UN_SERIAL_EE_BLOCK_01 un_serial_ee_block_01 ;
   1296   unsigned short crc16 ;
   1297 } __ATTRIBUTE_PACKED__ SER_EE_BLOCK_01  ;
   1298 typedef struct
   1299 {
   1300   UN_SERIAL_EE_BLOCK_02 un_serial_ee_block_02 ;
   1301   unsigned short crc16 ;
   1302 } __ATTRIBUTE_PACKED__ SER_EE_BLOCK_02  ;
   1303 typedef struct
   1304 {
   1305   unsigned char fill[SIZEOF_SERIAL_EE_FILLER];
   1306 } __ATTRIBUTE_PACKED__ SER_EE_BLOCK_03 ;
   1307 /*
   1308  * Definitions related to HOST serial eeprom
   1309  * {
   1310  */
   1311 typedef struct
   1312 {
   1313   unsigned short host_board_type ;
   1314 } __ATTRIBUTE_PACKED__ HOST_SERIAL_EE_BLOCK_01  ;
   1315 typedef struct
   1316 {
   1317   char  host_board_catalog_number[B_HOST_MAX_CATALOG_NUMBER_LEN];
   1318   char  host_board_description[B_HOST_MAX_BOARD_DESCRIPTION_LEN];
   1319   char  host_board_version[B_HOST_MAX_DEFAULT_BOARD_VERSION_LEN];
   1320   unsigned short host_board_serial_number;
   1321   /*
   1322    * On BRD0012A this is the C2C Clock rate in MHZ
   1323    */
   1324   unsigned short fap_pp_interface_clk;
   1325   /*
   1326    * On BRD0012A this is an indicator, to load or not DFCDLs values.
   1327    * 1 - use board EEPROM. Do not load in software.
   1328    * 0 - Software do all.
   1329    */
   1330   unsigned short  fap_use_eeprom_vals;
   1331   unsigned short  eeprom_front_card_type;
   1332   char  host_board_param_1[B_HOST_MAX_PARAM_LEN];
   1333   char  host_board_param_2[B_HOST_MAX_PARAM_LEN];
   1334   char  host_board_param_3[B_HOST_MAX_PARAM_LEN];
   1335   char  host_board_param_4[B_HOST_MAX_PARAM_LEN];
   1336   char  host_board_param_5[B_HOST_MAX_PARAM_LEN];
   1337   char  host_board_param_6[B_HOST_MAX_PARAM_LEN];
   1338   char  host_board_param_7[B_HOST_MAX_PARAM_LEN];
   1339   char  host_board_param_8[B_HOST_MAX_PARAM_LEN];
   1340   char  host_board_param_9[B_HOST_MAX_PARAM_LEN];
   1341   char  host_board_param_10[B_HOST_MAX_PARAM_LEN];
   1342 } __ATTRIBUTE_PACKED__ HOST_SERIAL_EE_BLOCK_02  ;
   1343 typedef union
   1344 {
   1345   HOST_SERIAL_EE_BLOCK_01  host_serial_ee_block_01 ;
   1346   unsigned char fill[HOST_SIZEOF_SERIAL_EE_BLOCK_01] ;
   1347 } __ATTRIBUTE_PACKED__ UN_HOST_SERIAL_EE_BLOCK_01 ;
   1348 typedef union
   1349 {
   1350   HOST_SERIAL_EE_BLOCK_02  host_serial_ee_block_02 ;
   1351   unsigned char fill[HOST_SIZEOF_SERIAL_EE_BLOCK_02] ;
   1352 } __ATTRIBUTE_PACKED__ UN_HOST_SERIAL_EE_BLOCK_02 ;
   1353 typedef struct
   1354 {
   1355   UN_HOST_SERIAL_EE_BLOCK_01 un_host_serial_ee_block_01 ;
   1356   unsigned short crc16 ;
   1357 } __ATTRIBUTE_PACKED__ HOST_SER_EE_BLOCK_01  ;
   1358 typedef struct
   1359 {
   1360   UN_HOST_SERIAL_EE_BLOCK_02 un_host_serial_ee_block_02 ;
   1361   unsigned short crc16 ;
   1362 } __ATTRIBUTE_PACKED__ HOST_SER_EE_BLOCK_02  ;
   1363 typedef struct
   1364 {
   1365   unsigned char fill[SIZEOF_HOST_SERIAL_EE_FILLER];
   1366 } __ATTRIBUTE_PACKED__ HOST_SER_EE_BLOCK_03;
   1367 /*
   1368  * }
   1369  */
   1370 /*
   1371  * Definitions related to FRONT serial eeprom
   1372  * {
   1373  */
   1374 typedef struct
   1375 {
   1376   unsigned short front_board_type ;
   1377 } __ATTRIBUTE_PACKED__ FRONT_SERIAL_EE_BLOCK_01  ;
   1378 typedef struct
   1379 {
   1380   char  front_board_catalog_number[B_FRONT_MAX_CATALOG_NUMBER_LEN] ;
   1381   char  front_board_description[B_FRONT_MAX_BOARD_DESCRIPTION_LEN] ;
   1382   char  front_board_version[B_FRONT_MAX_DEFAULT_BOARD_VERSION_LEN] ;
   1383   unsigned short front_board_serial_number ;
   1384   char  front_board_param_1[B_FRONT_MAX_PARAM_LEN] ;
   1385   char  front_board_param_2[B_FRONT_MAX_PARAM_LEN] ;
   1386   char  front_board_param_3[B_FRONT_MAX_PARAM_LEN] ;
   1387   char  front_board_param_4[B_FRONT_MAX_PARAM_LEN] ;
   1388   char  front_board_param_5[B_FRONT_MAX_PARAM_LEN] ;
   1389   char  front_board_param_6[B_FRONT_MAX_PARAM_LEN] ;
   1390   char  front_board_param_7[B_FRONT_MAX_PARAM_LEN] ;
   1391   char  front_board_param_8[B_FRONT_MAX_PARAM_LEN] ;
   1392   char  front_board_param_9[B_FRONT_MAX_PARAM_LEN] ;
   1393   char  front_board_param_10[B_FRONT_MAX_PARAM_LEN] ;
   1394 } __ATTRIBUTE_PACKED__ FRONT_SERIAL_EE_BLOCK_02  ;
   1395 typedef union
   1396 {
   1397   FRONT_SERIAL_EE_BLOCK_01  front_serial_ee_block_01 ;
   1398   unsigned char fill[FRONT_SIZEOF_SERIAL_EE_BLOCK_01] ;
   1399 } __ATTRIBUTE_PACKED__ UN_FRONT_SERIAL_EE_BLOCK_01 ;
   1400 typedef union
   1401 {
   1402   FRONT_SERIAL_EE_BLOCK_02  front_serial_ee_block_02 ;
   1403   unsigned char fill[FRONT_SIZEOF_SERIAL_EE_BLOCK_02] ;
   1404 } __ATTRIBUTE_PACKED__ UN_FRONT_SERIAL_EE_BLOCK_02 ;
   1405 typedef struct
   1406 {
   1407   UN_FRONT_SERIAL_EE_BLOCK_01 un_front_serial_ee_block_01 ;
   1408   unsigned short crc16 ;
   1409 } __ATTRIBUTE_PACKED__ FRONT_SER_EE_BLOCK_01  ;
   1410 typedef struct
   1411 {
   1412   UN_FRONT_SERIAL_EE_BLOCK_02 un_front_serial_ee_block_02 ;
   1413   unsigned short crc16 ;
   1414 } __ATTRIBUTE_PACKED__ FRONT_SER_EE_BLOCK_02  ;
   1415 typedef struct
   1416 {
   1417   unsigned char fill[SIZEOF_FRONT_SERIAL_EE_FILLER];
   1418 } __ATTRIBUTE_PACKED__ FRONT_SER_EE_BLOCK_03;
   1419 /*
   1420  * }
   1421  */
   1422 /*
   1423  * Definitions related to HOST_DB serial eeprom
   1424  * {
   1425  */
   1426 typedef struct
   1427 {
   1428   unsigned short host_db_board_type ;
   1429 } __ATTRIBUTE_PACKED__ HOST_DB_SERIAL_EE_BLOCK_01  ;
   1430 typedef struct
   1431 {
   1432   char  host_db_board_catalog_number[B_HOST_DB_MAX_CATALOG_NUMBER_LEN] ;
   1433   char  host_db_board_description[B_HOST_DB_MAX_BOARD_DESCRIPTION_LEN] ;
   1434   char  host_db_board_version[B_HOST_DB_MAX_DEFAULT_BOARD_VERSION_LEN] ;
   1435   unsigned short host_db_board_serial_number ;
   1436   char  host_db_board_param_1[B_HOST_DB_MAX_PARAM_LEN] ;
   1437   char  host_db_board_param_2[B_HOST_DB_MAX_PARAM_LEN] ;
   1438   char  host_db_board_param_3[B_HOST_DB_MAX_PARAM_LEN] ;
   1439   char  host_db_board_param_4[B_HOST_DB_MAX_PARAM_LEN] ;
   1440   char  host_db_board_param_5[B_HOST_DB_MAX_PARAM_LEN] ;
   1441   char  host_db_board_param_6[B_HOST_DB_MAX_PARAM_LEN] ;
   1442   char  host_db_board_param_7[B_HOST_DB_MAX_PARAM_LEN] ;
   1443   char  host_db_board_param_8[B_HOST_DB_MAX_PARAM_LEN] ;
   1444   char  host_db_board_param_9[B_HOST_DB_MAX_PARAM_LEN] ;
   1445   char  host_db_board_param_10[B_HOST_DB_MAX_PARAM_LEN] ;
   1446 } __ATTRIBUTE_PACKED__ HOST_DB_SERIAL_EE_BLOCK_02  ;
   1447 typedef union
   1448 {
   1449   HOST_DB_SERIAL_EE_BLOCK_01  host_db_serial_ee_block_01 ;
   1450   unsigned char fill[HOST_DB_SIZEOF_SERIAL_EE_BLOCK_01] ;
   1451 } __ATTRIBUTE_PACKED__ UN_HOST_DB_SERIAL_EE_BLOCK_01 ;
   1452 typedef union
   1453 {
   1454   HOST_DB_SERIAL_EE_BLOCK_02  host_db_serial_ee_block_02 ;
   1455   unsigned char fill[HOST_DB_SIZEOF_SERIAL_EE_BLOCK_02] ;
   1456 } __ATTRIBUTE_PACKED__ UN_HOST_DB_SERIAL_EE_BLOCK_02 ;
   1457 typedef struct
   1458 {
   1459   UN_HOST_DB_SERIAL_EE_BLOCK_01 un_host_db_serial_ee_block_01 ;
   1460   unsigned short crc16 ;
   1461 } __ATTRIBUTE_PACKED__ HOST_DB_SER_EE_BLOCK_01  ;
   1462 typedef struct
   1463 {
   1464   UN_HOST_DB_SERIAL_EE_BLOCK_02 un_host_db_serial_ee_block_02 ;
   1465   unsigned short crc16 ;
   1466 } __ATTRIBUTE_PACKED__ HOST_DB_SER_EE_BLOCK_02  ;
   1467 typedef struct
   1468 {
   1469   unsigned char fill[SIZEOF_HOST_DB_SERIAL_EE_FILLER];
   1470 } __ATTRIBUTE_PACKED__ HOST_DB_SER_EE_BLOCK_03;
   1471 /*
   1472  * }
   1473  */
   1474 
   1475 typedef struct
   1476 {
   1477   SER_EE_BLOCK_01         ser_ee_block_01 ;
   1478   SER_EE_BLOCK_02         ser_ee_block_02 ;
   1479   SER_EE_BLOCK_03         ser_ee_block_03_filler ; 
   1480   HOST_SER_EE_BLOCK_01    host_ser_ee_block_01 ;
   1481   HOST_SER_EE_BLOCK_02    host_ser_ee_block_02 ;
   1482   HOST_SER_EE_BLOCK_03    host_ser_ee_block_03 ;
   1483   FRONT_SER_EE_BLOCK_01   front_ser_ee_block_01 ;
   1484   FRONT_SER_EE_BLOCK_02   front_ser_ee_block_02 ;
   1485   FRONT_SER_EE_BLOCK_03   front_ser_ee_block_03 ;
   1486   HOST_DB_SER_EE_BLOCK_01  host_db_ser_ee_block_01 ;
   1487   HOST_DB_SER_EE_BLOCK_02  host_db_ser_ee_block_02 ;
   1488   HOST_DB_SER_EE_BLOCK_03  host_db_ser_ee_block_03 ;
   1489 } __ATTRIBUTE_PACKED__ SERIAL_EE_AREA  ;
   1490 
   1491 unsigned char eepromReadByte
   1492     (
   1493     int offset
   1494     );
   1495 STATUS
   1496   eepromWriteBytes(
   1497     int           offset,     /* Offset, in Eeprom, to write int0 */
   1498     unsigned char *data_ptr,  /* Pointer to source data           */
   1499     unsigned int  size        /* Number of bytes to read from data*/
   1500                               /* and write into offset            */
   1501     );
   1502 
   1503 unsigned
   1504   int
   1505     ser_ee_high_image_read(
   1506       unsigned int   offset,
   1507       unsigned int   num,
   1508       unsigned char  *dest,
   1509       unsigned int   *err_flg,
   1510       char           *err_msg
   1511       );
   1512 unsigned
   1513   int
   1514     ser_ee_high_image_write(
   1515       unsigned int   offset,
   1516       unsigned int   num,
   1517       unsigned char  *dest,
   1518       unsigned int   *err_flg,
   1519       char           *err_msg
   1520       );
   1521