![]() |
|
|||
File indexing completed on 2025-05-11 08:23:53
0001 #ifndef PPC_MOTLOAD_VPD_H 0002 #define PPC_MOTLOAD_VPD_H 0003 0004 /* MotLoad VPD format */ 0005 0006 /* Till Straumann, 2005; see copyright notice at the end of this file */ 0007 0008 #ifdef __cplusplus 0009 extern "C" { 0010 #endif 0011 0012 /* 0013 VPD = "MOTOROLA" , { field } 0014 0015 field = type_byte, length_byte, { data } 0016 */ 0017 0018 /* Known fields so far */ 0019 typedef enum { 0020 ProductIdent = 0x01, /* String */ 0021 AssemblyNumber = 0x02, /* String */ 0022 SerialNumber = 0x03, /* String */ 0023 CpuClockHz = 0x05, /* binary (5bytes), 0x01 byte appended to unsigned int */ 0024 BusClockHz = 0x06, /* binary (5bytes), 0x01 byte appended to unsigned int */ 0025 EthernetAddr = 0x08, /* binary (7bytes), 0x00 byte appended, 2nd has 0x01 appended */ 0026 CpuType = 0x09, /* String */ 0027 EEpromCrc = 0x0a, /* binary (4bytes) */ 0028 FlashConfig = 0x0b, /* binary */ 0029 L2CacheConfig = 0x0e, /* binary */ 0030 VPDRevision = 0x0f, /* binary (4bytes) */ 0031 L3CacheConfig = 0x19, /* binary */ 0032 End = 0xff 0033 } VpdKey; 0034 0035 typedef struct { 0036 VpdKey key; /* key for the data item to be read into 'buf' */ 0037 char instance; /* instance # (starting with 0) - some keys are present more than one time */ 0038 void *buf; /* pointer to area where the data item is to be stored */ 0039 int buflen; /* available space in the buffer */ 0040 char found; /* set by BSP_vpdRetrieveFields() to the original length as found in the PROM */ 0041 } VpdBufRec, *VpdBuf; 0042 0043 0044 #define VPD_END { key:End, } 0045 0046 0047 /* Scan the VPD EEPROM for a number of fields 0048 * 0049 * Pass an array of VpdBufRec items. The routine 0050 * fills the 'buf'fers for all keys that are found 0051 * and sets the 'found' field to the original length 0052 * of the data (i.e., as found in the PROM) so that 0053 * the routine could be called again with a larger 0054 * buffer. 0055 * 0056 * NOTE: - the array must be terminated by a VPD_END record! 0057 * - no CRC check is performed. 0058 * - INTERRUPT MANAGEMENT MUST BE FUNCTIONAL 0059 * 0060 * RETURNS: 0 on success, -1 if any read errors were 0061 * encountered or if the "MOTOROLA" header 0062 * was not found. 0063 */ 0064 int 0065 BSP_vpdRetrieveFields(VpdBuf data); 0066 0067 /* Example: 0068 * Read 2nd ethernet address: 0069 * 0070 * char enet_addr_2[6]; 0071 * 0072 * VpdBufRec enetVpd [] = { 0073 * { key: EthernetAddr, instance: 1, buf: enet_addr_2, buflen: 2}, 0074 * VPD_END 0075 * }; 0076 * 0077 * if ( BSP_vpdRetrieveFields(enetVpd) ) { 0078 * error("ethernet address couldn't be read\n"); 0079 * } else if ( enetVpd[0].found < 6 ) { 0080 * error("2nd ethernet address not found in VPD\n"); 0081 * } else { 0082 * use_it(enet_addr_2); 0083 * } 0084 */ 0085 0086 0087 /* Simple wrapper if only one field is needed 0088 * 0089 * RETURNS: original length if key is found, -1 on error or if key is not found 0090 */ 0091 int 0092 BSP_vpdRetrieveKey(VpdKey k, void *buf, int buflen, int instance); 0093 0094 #ifdef __cplusplus 0095 } 0096 #endif 0097 0098 /* 0099 * Authorship 0100 * ---------- 0101 * This software ('beatnik' RTEMS BSP for MVME6100 and MVME5500) was 0102 * created by Till Straumann <strauman@slac.stanford.edu>, 2005-2007, 0103 * Stanford Linear Accelerator Center, Stanford University. 0104 * 0105 * Acknowledgement of sponsorship 0106 * ------------------------------ 0107 * The 'beatnik' BSP was produced by 0108 * the Stanford Linear Accelerator Center, Stanford University, 0109 * under Contract DE-AC03-76SFO0515 with the Department of Energy. 0110 * 0111 * Government disclaimer of liability 0112 * ---------------------------------- 0113 * Neither the United States nor the United States Department of Energy, 0114 * nor any of their employees, makes any warranty, express or implied, or 0115 * assumes any legal liability or responsibility for the accuracy, 0116 * completeness, or usefulness of any data, apparatus, product, or process 0117 * disclosed, or represents that its use would not infringe privately owned 0118 * rights. 0119 * 0120 * Stanford disclaimer of liability 0121 * -------------------------------- 0122 * Stanford University makes no representations or warranties, express or 0123 * implied, nor assumes any liability for the use of this software. 0124 * 0125 * Stanford disclaimer of copyright 0126 * -------------------------------- 0127 * Stanford University, owner of the copyright, hereby disclaims its 0128 * copyright and all other rights in this software. Hence, anyone may 0129 * freely use it for any purpose without restriction. 0130 * 0131 * Maintenance of notices 0132 * ---------------------- 0133 * In the interest of clarity regarding the origin and status of this 0134 * SLAC software, this and all the preceding Stanford University notices 0135 * are to remain affixed to any copy or derivative of this software made 0136 * or distributed by the recipient and are to be affixed to any copy of 0137 * software made or distributed by the recipient that contains a copy or 0138 * derivative of this software. 0139 * 0140 * ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03 0141 */ 0142 0143 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |