Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

243 lines
11 KiB

  1. /*
  2. * $Log: V:/Flite/archives/TrueFFS5/Src/DOC2EXB.H_V $
  3. *
  4. * Rev 1.11 Apr 15 2002 07:35:22 oris
  5. * Make sure all relevant structures will allow easy little endian conversion.
  6. *
  7. * Rev 1.10 Feb 19 2002 20:58:38 oris
  8. * Moved include directive and routine prototypes to C file.
  9. *
  10. * Rev 1.9 Jan 21 2002 20:44:12 oris
  11. * Added DiskOnChip Millennium Plus 16MB firmware family definition.
  12. *
  13. * Rev 1.8 Jan 17 2002 22:58:42 oris
  14. * Added INFTL_NEAR_HEAP_SIZE, FIRMWARE_NO_MASK, STRONG_ARM_IPL definitions.
  15. * Removed different firmware STACK sizes.
  16. * Added parameter to getExbInfo() (firmware add to).
  17. * Added tffsFarHeapSize to exbStruct record.
  18. *
  19. * Rev 1.7 Jul 13 2001 01:01:06 oris
  20. * Added constant stack space for each of the different DiskOnChip.
  21. *
  22. * Rev 1.6 Jun 17 2001 08:17:24 oris
  23. * Changed placeExbByBuffer exbflags argument to word instead of byte to support /empty flag.
  24. * Added LEAVE_EMPTY and EXB_IN_ROM flags.
  25. *
  26. * Rev 1.5 Apr 09 2001 15:05:14 oris
  27. * End with an empty line.
  28. *
  29. * Rev 1.4 Apr 03 2001 14:39:54 oris
  30. * Add iplMod512 and splMod512 fields to the exbStruct record.
  31. *
  32. * Rev 1.3 Apr 02 2001 00:56:48 oris
  33. * Added EBDA_SUPPORT flag.
  34. * Bug fix of NO_PNP_HEADER flag.
  35. * Changed ifdef of h file from doc2hdrs_h to doc2exb_h.
  36. *
  37. * Rev 1.2 Apr 01 2001 07:50:00 oris
  38. * Updated copywrite notice.
  39. * Changed LEmin to dword
  40. * Added DOC2300_FAMILY_FIRMWARE firmware types.
  41. *
  42. * Rev 1.1 Feb 08 2001 10:32:06 oris
  43. * Seperated file signature into 2 fields signature and TrueFFS vesion to make it eligned
  44. *
  45. * Rev 1.0 Feb 02 2001 13:10:58 oris
  46. * Initial revision.
  47. *
  48. */
  49. /***********************************************************************************/
  50. /* M-Systems Confidential */
  51. /* Copyright (C) M-Systems Flash Disk Pioneers Ltd. 1995-2001 */
  52. /* All Rights Reserved */
  53. /***********************************************************************************/
  54. /* NOTICE OF M-SYSTEMS OEM */
  55. /* SOFTWARE LICENSE AGREEMENT */
  56. /* */
  57. /* THE USE OF THIS SOFTWARE IS GOVERNED BY A SEPARATE LICENSE */
  58. /* AGREEMENT BETWEEN THE OEM AND M-SYSTEMS. REFER TO THAT AGREEMENT */
  59. /* FOR THE SPECIFIC TERMS AND CONDITIONS OF USE, */
  60. /* OR CONTACT M-SYSTEMS FOR LICENSE ASSISTANCE: */
  61. /* E-MAIL = [email protected] */
  62. /***********************************************************************************/
  63. /*****************************************************************************
  64. * File Header *
  65. * ----------- *
  66. * Project : TrueFFS source code *
  67. * *
  68. * Name : doc2exb.h *
  69. * *
  70. * Description : M-Systems EXB firmware files and media definitions and *
  71. * data structures *
  72. * *
  73. *****************************************************************************/
  74. #ifndef DOC2EXB_H
  75. #define DOC2EXB_H
  76. #include "docbdk.h"
  77. #ifdef BDK_ACCESS
  78. extern BDKVol* bdkVol; /* pointer to current binary partition */
  79. #endif
  80. /**********************************/
  81. /* EXB file structure definitions */
  82. /**********************************/
  83. /* EXB Flag definitions */
  84. #define INSTALL_FIRST 1
  85. #define EXB_IN_ROM 2
  86. #define QUIET 4
  87. #define INT15_DISABLE 8
  88. #define FLOPPY 0x10
  89. #define SIS5598 0x20
  90. #define EBDA_SUPPORT 0x40
  91. #define NO_PNP_HEADER 0x80
  92. #define LEAVE_EMPTY 0x100
  93. #define FIRMWARE_NO_MASK 0xd00 /* Up to 8 firmwares */
  94. #define FIRMWARE_NO_SHIFT 9
  95. /* Firmware types */
  96. #define DOC2000_FAMILY_FIRMWARE 1
  97. #define DOCPLUS_FAMILY_FIRMWARE 2
  98. #define DOC2300_FAMILY_FIRMWARE 3
  99. #define DOCPLUS_INT1_FAMILY_FIRMWARE 4
  100. /* Firmware stack constant */
  101. #ifdef VERIFY_WRITE
  102. #define INFTL_NEAR_HEAP_SIZE sizeof(FLBuffer)+(SECTOR_SIZE<<1)+READ_BACK_BUFFER_SIZE
  103. #else
  104. #define INFTL_NEAR_HEAP_SIZE sizeof(FLBuffer)+(SECTOR_SIZE<<1)
  105. #endif /* VERIFY_WRITE */
  106. #define DEFAULT_DOC_STACK 2*1024
  107. /*General definitions */
  108. #define MAX_CODE_MODULES 6
  109. #define ANAND_MARK_ADDRESS 0x406
  110. #define ANAND_MARK_SIZE 2
  111. #define EXB_SIGN_OFFSET 8
  112. #define INVALID_MODULE_NO 0xff
  113. #define SIGN_SPL "����" /* EXB binary signature */
  114. #define SIGN_MSYS "OSAK" /* EXB file signature */
  115. #define SIGN_MSYS_SIZE 4
  116. /* File specific record specifing data for all firmwares in the file */
  117. typedef struct {
  118. byte mSysSign[SIGN_MSYS_SIZE]; /* identification signature */
  119. byte osakVer[SIGN_MSYS_SIZE]; /* identification signature */
  120. LEmin fileSize; /* Total file size */
  121. LEmin noOfFirmwares; /* Number of firmware supported by this file */
  122. } ExbGlobalHeader;
  123. /*-------------------------------------*/
  124. /* File specific record specifing data for a specific firmwares in the file */
  125. typedef struct {
  126. LEmin type; /* Firmware type (must fit the H/W) */
  127. LEmin startOffset; /* Firmware start offset in the file */
  128. LEmin endOffset; /* Firmware end offset in the file */
  129. LEmin splStartOffset; /* SPL start offset in the file */
  130. LEmin splEndOffset; /* SPL end offset in the file */
  131. } FirmwareHeader;
  132. /*-------------------------------------*/
  133. /* data structure representing BIOS extention header */
  134. typedef struct{
  135. unsigned char signature[2]; /* BIOS extention signature (0xAA55) */
  136. unsigned char lenMod512; /* length in unsigned chars modulo 512 */
  137. } BIOSHeader;
  138. /*-------------------------------------*/
  139. /* data structure representing IPL header */
  140. typedef struct{
  141. BIOSHeader biosHdr;
  142. byte jmpOpcode[3]; /* jmp start_of_code */
  143. byte dummy; /* dummy byte */
  144. byte msysStr[17]; /* ORG 7h ManStr DB '(C)M-Systems1998',0 */
  145. word pciHeader; /* ORG 18h ; PCI header */
  146. word pnpHeader; /* ORG 1Ah ; P&P header */
  147. byte dummy0[4]; /* Actual address must be shifted by 4 '0'*/
  148. LEushort windowBase; /* ORG 20h ; explicit DOC window base */
  149. Unaligned spl_offset; /* DFORMAT !!! */
  150. Unaligned spl_size; /* spl actual size */
  151. byte spl_chksum; /* 55 */
  152. } IplHeader;
  153. /*-------------------------------------*/
  154. /* data structure representing SPL header */
  155. typedef struct{
  156. unsigned char jmpOpcode[2];
  157. BIOSHeader biosHdr;
  158. /* Note: At run-time biosHdr.lenMod512 contains size of entire DOC 2000
  159. boot area modulo 512 as set by DFORMAT */
  160. Unaligned runtimeID; /* filled in by DFORMAT */
  161. Unaligned tffsHeapSize; /* filled in by DFORMAT */
  162. unsigned char chksumFix; /* changed by DFORMAT */
  163. unsigned char version;
  164. unsigned char subversion;
  165. char copyright[29]; /* "SPL_DiskOnChip (c) M-Systems", 0 */
  166. Unaligned windowBase; /* filled in by DFORMAT */
  167. Unaligned4 exbOffset; /* filled in by DFORMAT */
  168. } SplHeader;
  169. /*------------------------------------- */
  170. /* data structure representing TFFS header */
  171. typedef struct{
  172. BIOSHeader biosHdr;
  173. unsigned char jmpOpcode[3];
  174. char tffsId[4]; /* "TFFS" */
  175. unsigned char exbFlags; /* filled in by writeExbDriverImage() */
  176. Unaligned heapLen; /* not used for now */
  177. Unaligned windowBase; /* passed by SPL and saved here */
  178. unsigned char chksumFix; /* changed by writeExbDriverImage() */
  179. Unaligned runtimeID; /* passed by SPL and saved here */
  180. unsigned char firstDiskNumber; /* filled in............ */
  181. unsigned char lastDiskNumber; /* ..........at run-time */
  182. Unaligned versionNo; /* filled in at run-time */
  183. } TffsHeader;
  184. /* ------------------------------------- */
  185. /* data structure representing Socket Services header */
  186. typedef struct{
  187. BIOSHeader biosHdr;
  188. unsigned char jmpOpcode[3];
  189. char tffsId[4]; /* "TFFS" */
  190. unsigned char exbFlags; /* filled in by writeExbDriverImage() */
  191. unsigned char heapLen; /* not used for now */
  192. Unaligned windowBase; /* filled in at run-time */
  193. unsigned char chksumFix; /* changed by writeExbDriverImage() */
  194. } SSHeader;
  195. /* ------------------------------------- */
  196. /* Work space for writting the exb file */
  197. typedef struct{
  198. word exbFlags; /* For the complete list see doc2hdrs.h */
  199. word iplMod512; /* Size of the IPL module divided by 512 */
  200. word splMod512; /* Size of the SPL module divided by 512 */
  201. dword splMediaAddr; /* Start of the SPL module media address */
  202. dword ssMediaAddr; /* Start of the SS module media address */
  203. dword exbRealSize; /* Actual binary area + bad blocks */
  204. word moduleLength; /* Length of the modules in divided by 512 */
  205. dword tffsHeapSize; /* TFFS needed heap size */
  206. word tffsFarHeapSize; /* TFFS needed far heap size */
  207. word bufferOffset; /* Curret Offset inside the internal buffer */
  208. dword exbFileEnd; /* Offset of the last Byte of the files */
  209. dword exbFileOffset; /* Current Offset inside the EXB file */
  210. dword splStart; /* First SPL byte offset */
  211. dword splEnd; /* Last SPL byte offset */
  212. dword firmwareEnd; /* End offset of the specific firmware */
  213. dword firmwareStart; /* Start offset of the specific firmware */
  214. FLBuffer *buffer; /* Internal 512 byte buffer */
  215. } exbStruct;
  216. #endif /* DOC2EXB_H */