diff options
Diffstat (limited to 'drivers/net/sk98lin/h/skvpd.h')
-rw-r--r-- | drivers/net/sk98lin/h/skvpd.h | 248 |
1 files changed, 0 insertions, 248 deletions
diff --git a/drivers/net/sk98lin/h/skvpd.h b/drivers/net/sk98lin/h/skvpd.h deleted file mode 100644 index fdd9e48e8040..000000000000 --- a/drivers/net/sk98lin/h/skvpd.h +++ /dev/null | |||
@@ -1,248 +0,0 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: skvpd.h | ||
4 | * Project: GEnesis, PCI Gigabit Ethernet Adapter | ||
5 | * Version: $Revision: 1.15 $ | ||
6 | * Date: $Date: 2003/01/13 10:39:38 $ | ||
7 | * Purpose: Defines and Macros for VPD handling | ||
8 | * | ||
9 | ******************************************************************************/ | ||
10 | |||
11 | /****************************************************************************** | ||
12 | * | ||
13 | * (C)Copyright 1998-2003 SysKonnect GmbH. | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify | ||
16 | * it under the terms of the GNU General Public License as published by | ||
17 | * the Free Software Foundation; either version 2 of the License, or | ||
18 | * (at your option) any later version. | ||
19 | * | ||
20 | * The information in this file is provided "AS IS" without warranty. | ||
21 | * | ||
22 | ******************************************************************************/ | ||
23 | |||
24 | /* | ||
25 | * skvpd.h contains Diagnostic specific defines for VPD handling | ||
26 | */ | ||
27 | |||
28 | #ifndef __INC_SKVPD_H_ | ||
29 | #define __INC_SKVPD_H_ | ||
30 | |||
31 | /* | ||
32 | * Define Resource Type Identifiers and VPD keywords | ||
33 | */ | ||
34 | #define RES_ID 0x82 /* Resource Type ID String (Product Name) */ | ||
35 | #define RES_VPD_R 0x90 /* start of VPD read only area */ | ||
36 | #define RES_VPD_W 0x91 /* start of VPD read/write area */ | ||
37 | #define RES_END 0x78 /* Resource Type End Tag */ | ||
38 | |||
39 | #ifndef VPD_NAME | ||
40 | #define VPD_NAME "Name" /* Product Name, VPD name of RES_ID */ | ||
41 | #endif /* VPD_NAME */ | ||
42 | #define VPD_PN "PN" /* Adapter Part Number */ | ||
43 | #define VPD_EC "EC" /* Adapter Engineering Level */ | ||
44 | #define VPD_MN "MN" /* Manufacture ID */ | ||
45 | #define VPD_SN "SN" /* Serial Number */ | ||
46 | #define VPD_CP "CP" /* Extended Capability */ | ||
47 | #define VPD_RV "RV" /* Checksum and Reserved */ | ||
48 | #define VPD_YA "YA" /* Asset Tag Identifier */ | ||
49 | #define VPD_VL "VL" /* First Error Log Message (SK specific) */ | ||
50 | #define VPD_VF "VF" /* Second Error Log Message (SK specific) */ | ||
51 | #define VPD_RW "RW" /* Remaining Read / Write Area */ | ||
52 | |||
53 | /* 'type' values for vpd_setup_para() */ | ||
54 | #define VPD_RO_KEY 1 /* RO keys are "PN", "EC", "MN", "SN", "RV" */ | ||
55 | #define VPD_RW_KEY 2 /* RW keys are "Yx", "Vx", and "RW" */ | ||
56 | |||
57 | /* 'op' values for vpd_setup_para() */ | ||
58 | #define ADD_KEY 1 /* add the key at the pos "RV" or "RW" */ | ||
59 | #define OWR_KEY 2 /* overwrite key if already exists */ | ||
60 | |||
61 | /* | ||
62 | * Define READ and WRITE Constants. | ||
63 | */ | ||
64 | |||
65 | #define VPD_DEV_ID_GENESIS 0x4300 | ||
66 | |||
67 | #define VPD_SIZE_YUKON 256 | ||
68 | #define VPD_SIZE_GENESIS 512 | ||
69 | #define VPD_SIZE 512 | ||
70 | #define VPD_READ 0x0000 | ||
71 | #define VPD_WRITE 0x8000 | ||
72 | |||
73 | #define VPD_STOP(pAC,IoC) VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG,VPD_WRITE) | ||
74 | |||
75 | #define VPD_GET_RES_LEN(p) ((unsigned int) \ | ||
76 | (* (SK_U8 *)&(p)[1]) |\ | ||
77 | ((* (SK_U8 *)&(p)[2]) << 8)) | ||
78 | #define VPD_GET_VPD_LEN(p) ((unsigned int)(* (SK_U8 *)&(p)[2])) | ||
79 | #define VPD_GET_VAL(p) ((char *)&(p)[3]) | ||
80 | |||
81 | #define VPD_MAX_LEN 50 | ||
82 | |||
83 | /* VPD status */ | ||
84 | /* bit 7..1 reserved */ | ||
85 | #define VPD_VALID (1<<0) /* VPD data buffer, vpd_free_ro, */ | ||
86 | /* and vpd_free_rw valid */ | ||
87 | |||
88 | /* | ||
89 | * VPD structs | ||
90 | */ | ||
91 | typedef struct s_vpd_status { | ||
92 | unsigned short Align01; /* Alignment */ | ||
93 | unsigned short vpd_status; /* VPD status, description see above */ | ||
94 | int vpd_free_ro; /* unused bytes in read only area */ | ||
95 | int vpd_free_rw; /* bytes available in read/write area */ | ||
96 | } SK_VPD_STATUS; | ||
97 | |||
98 | typedef struct s_vpd { | ||
99 | SK_VPD_STATUS v; /* VPD status structure */ | ||
100 | char vpd_buf[VPD_SIZE]; /* VPD buffer */ | ||
101 | int rom_size; /* VPD ROM Size from PCI_OUR_REG_2 */ | ||
102 | int vpd_size; /* saved VPD-size */ | ||
103 | } SK_VPD; | ||
104 | |||
105 | typedef struct s_vpd_para { | ||
106 | unsigned int p_len; /* parameter length */ | ||
107 | char *p_val; /* points to the value */ | ||
108 | } SK_VPD_PARA; | ||
109 | |||
110 | /* | ||
111 | * structure of Large Resource Type Identifiers | ||
112 | */ | ||
113 | |||
114 | /* was removed because of alignment problems */ | ||
115 | |||
116 | /* | ||
117 | * structure of VPD keywords | ||
118 | */ | ||
119 | typedef struct s_vpd_key { | ||
120 | char p_key[2]; /* 2 bytes ID string */ | ||
121 | unsigned char p_len; /* 1 byte length */ | ||
122 | char p_val; /* start of the value string */ | ||
123 | } SK_VPD_KEY; | ||
124 | |||
125 | |||
126 | /* | ||
127 | * System specific VPD macros | ||
128 | */ | ||
129 | #ifndef SKDIAG | ||
130 | #ifndef VPD_DO_IO | ||
131 | #define VPD_OUT8(pAC,IoC,Addr,Val) (void)SkPciWriteCfgByte(pAC,Addr,Val) | ||
132 | #define VPD_OUT16(pAC,IoC,Addr,Val) (void)SkPciWriteCfgWord(pAC,Addr,Val) | ||
133 | #define VPD_IN8(pAC,IoC,Addr,pVal) (void)SkPciReadCfgByte(pAC,Addr,pVal) | ||
134 | #define VPD_IN16(pAC,IoC,Addr,pVal) (void)SkPciReadCfgWord(pAC,Addr,pVal) | ||
135 | #define VPD_IN32(pAC,IoC,Addr,pVal) (void)SkPciReadCfgDWord(pAC,Addr,pVal) | ||
136 | #else /* VPD_DO_IO */ | ||
137 | #define VPD_OUT8(pAC,IoC,Addr,Val) SK_OUT8(IoC,PCI_C(Addr),Val) | ||
138 | #define VPD_OUT16(pAC,IoC,Addr,Val) SK_OUT16(IoC,PCI_C(Addr),Val) | ||
139 | #define VPD_IN8(pAC,IoC,Addr,pVal) SK_IN8(IoC,PCI_C(Addr),pVal) | ||
140 | #define VPD_IN16(pAC,IoC,Addr,pVal) SK_IN16(IoC,PCI_C(Addr),pVal) | ||
141 | #define VPD_IN32(pAC,IoC,Addr,pVal) SK_IN32(IoC,PCI_C(Addr),pVal) | ||
142 | #endif /* VPD_DO_IO */ | ||
143 | #else /* SKDIAG */ | ||
144 | #define VPD_OUT8(pAC,Ioc,Addr,Val) { \ | ||
145 | if ((pAC)->DgT.DgUseCfgCycle) \ | ||
146 | SkPciWriteCfgByte(pAC,Addr,Val); \ | ||
147 | else \ | ||
148 | SK_OUT8(pAC,PCI_C(Addr),Val); \ | ||
149 | } | ||
150 | #define VPD_OUT16(pAC,Ioc,Addr,Val) { \ | ||
151 | if ((pAC)->DgT.DgUseCfgCycle) \ | ||
152 | SkPciWriteCfgWord(pAC,Addr,Val); \ | ||
153 | else \ | ||
154 | SK_OUT16(pAC,PCI_C(Addr),Val); \ | ||
155 | } | ||
156 | #define VPD_IN8(pAC,Ioc,Addr,pVal) { \ | ||
157 | if ((pAC)->DgT.DgUseCfgCycle) \ | ||
158 | SkPciReadCfgByte(pAC,Addr,pVal); \ | ||
159 | else \ | ||
160 | SK_IN8(pAC,PCI_C(Addr),pVal); \ | ||
161 | } | ||
162 | #define VPD_IN16(pAC,Ioc,Addr,pVal) { \ | ||
163 | if ((pAC)->DgT.DgUseCfgCycle) \ | ||
164 | SkPciReadCfgWord(pAC,Addr,pVal); \ | ||
165 | else \ | ||
166 | SK_IN16(pAC,PCI_C(Addr),pVal); \ | ||
167 | } | ||
168 | #define VPD_IN32(pAC,Ioc,Addr,pVal) { \ | ||
169 | if ((pAC)->DgT.DgUseCfgCycle) \ | ||
170 | SkPciReadCfgDWord(pAC,Addr,pVal); \ | ||
171 | else \ | ||
172 | SK_IN32(pAC,PCI_C(Addr),pVal); \ | ||
173 | } | ||
174 | #endif /* nSKDIAG */ | ||
175 | |||
176 | /* function prototypes ********************************************************/ | ||
177 | |||
178 | #ifndef SK_KR_PROTO | ||
179 | #ifdef SKDIAG | ||
180 | extern SK_U32 VpdReadDWord( | ||
181 | SK_AC *pAC, | ||
182 | SK_IOC IoC, | ||
183 | int addr); | ||
184 | #endif /* SKDIAG */ | ||
185 | |||
186 | extern SK_VPD_STATUS *VpdStat( | ||
187 | SK_AC *pAC, | ||
188 | SK_IOC IoC); | ||
189 | |||
190 | extern int VpdKeys( | ||
191 | SK_AC *pAC, | ||
192 | SK_IOC IoC, | ||
193 | char *buf, | ||
194 | int *len, | ||
195 | int *elements); | ||
196 | |||
197 | extern int VpdRead( | ||
198 | SK_AC *pAC, | ||
199 | SK_IOC IoC, | ||
200 | const char *key, | ||
201 | char *buf, | ||
202 | int *len); | ||
203 | |||
204 | extern SK_BOOL VpdMayWrite( | ||
205 | char *key); | ||
206 | |||
207 | extern int VpdWrite( | ||
208 | SK_AC *pAC, | ||
209 | SK_IOC IoC, | ||
210 | const char *key, | ||
211 | const char *buf); | ||
212 | |||
213 | extern int VpdDelete( | ||
214 | SK_AC *pAC, | ||
215 | SK_IOC IoC, | ||
216 | char *key); | ||
217 | |||
218 | extern int VpdUpdate( | ||
219 | SK_AC *pAC, | ||
220 | SK_IOC IoC); | ||
221 | |||
222 | #ifdef SKDIAG | ||
223 | extern int VpdReadBlock( | ||
224 | SK_AC *pAC, | ||
225 | SK_IOC IoC, | ||
226 | char *buf, | ||
227 | int addr, | ||
228 | int len); | ||
229 | |||
230 | extern int VpdWriteBlock( | ||
231 | SK_AC *pAC, | ||
232 | SK_IOC IoC, | ||
233 | char *buf, | ||
234 | int addr, | ||
235 | int len); | ||
236 | #endif /* SKDIAG */ | ||
237 | #else /* SK_KR_PROTO */ | ||
238 | extern SK_U32 VpdReadDWord(); | ||
239 | extern SK_VPD_STATUS *VpdStat(); | ||
240 | extern int VpdKeys(); | ||
241 | extern int VpdRead(); | ||
242 | extern SK_BOOL VpdMayWrite(); | ||
243 | extern int VpdWrite(); | ||
244 | extern int VpdDelete(); | ||
245 | extern int VpdUpdate(); | ||
246 | #endif /* SK_KR_PROTO */ | ||
247 | |||
248 | #endif /* __INC_SKVPD_H_ */ | ||