Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / SLOF / include / calculatecrc.h
1 /******************************************************************************
2  * Copyright (c) 2004, 2008 IBM Corporation
3  * All rights reserved.
4  * This program and the accompanying materials
5  * are made available under the terms of the BSD License
6  * which accompanies this distribution, and is available at
7  * http://www.opensource.org/licenses/bsd-license.php
8  *
9  * Contributors:
10  *     IBM Corporation - initial implementation
11  *****************************************************************************/
12 #ifndef CALCULATECRC_H
13 #define CALCULATECRC_H
14
15         #define FLASHFS_DATADDR 0x18                // uint64_t position of pointer to data
16         #define FLASHFS_FILE_SIZE_ADDR 0x08         // uint64_t pos of total flashimage size value relative to data
17         #define FLASHFS_HEADER_SIZE_ADDR 0x08       // uint64_t position of total flash header size value
18
19         #ifdef __ASSEMBLER__
20                 // "CRC_GENERATOR" must contain equal inforamtion as "CRC_METHODE"
21                 #define CRC_GENERATOR 0x0000000004C11DB7
22                 #define CRC_REGISTERMASK 0x00000000FFFFFFFF
23                 #define CRC_REGISTERLENGTH 32
24         #endif          /* __ASSEMBLER__ */
25
26         #ifndef __ASSEMBLER__
27                 #define FLASHFS_ROMADDR 0x00            // uint64_t position of pointer to next file
28                 #define FLASHFS_HEADER_DATA_SIZE 0x68   // 104 bytes of total header data size
29                 #define CRC_METHODE Ethernet_32         // define the CRc genarator (CRC 16 bit to 64 is supported)
30
31         //--- header format ---------------------------------
32                 struct stH {
33                                 char magic[8];            // (generic!) headerfile
34                                 uint64_t flashlen;        // dyn
35                                 char version[16];         // $DRIVER_INFO alignment!
36                                 char platform_name[32];   // (hardware)   headerfile
37                                 char date[6];             // dyn (format -> JB)
38                                 char padding1[2];         // padding byte
39                                 char mdate[6];            // modify date
40                                 char padding2[2];         // padding byte
41                                 char platform_revision[4];// (hardware)   headerfile
42                                 uint32_t padding;
43                                 uint64_t ui64CRC;         // insert calculated CRC here
44                                 uint64_t ui64FileEnd;     // = 0xFFFF FFFF FFFF FFFF
45                 };
46         #endif          /* __ASSEMBLER__ */
47
48 #endif          /* CALCULATECRC_H */
49
50 /*--- supported CRC Generators -------------------------
51 +       Name                                            length          usage                                           Generator
52 +       Tap_16                                          16 bit          Tape                                            0x00008005      
53 +       Floppy_16                                       16 bit          Floppy                                          0x00001021
54 +       Ethernet_32                                     32 bit          Ethernet                                        0x04C11DB7
55 +       SPTrEMBL_64                                     64 bit          white noise like date           0x0000001B
56 +       SPTrEMBL_improved_64            64 bit          DNA code like date                      0xAD93D23594C9362D
57 +       DLT1_64                                         64 bit          Tape                                            0x42F0E1EBA9EA3693
58 +       
59 +       CRC_REGISTERLENGTH      = bit length
60 +       CRC_REGISTERMASK        = -1 for a n-bit numer where n = bit length
61 +               example TAP_16:         CRC_REGSISTERLENGTH = 16
62 +                                                       CRC_REGISTERMASK = 0xFFFFFFFF = (-1 if 16 bit number is used)
63 +
64 +       TrEMBL see also http://www.cs.ud.ac.uk/staff/D.Jones/crcbote.pdf
65 +       DLT1 se also    http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-182.pdf
66 +--------------------------------------------------------*/