Deleted Added
full compact
cardbus_cis.c (106894) cardbus_cis.c (107301)
1/*
2 * Copyright (c) 2000,2001 Jonathan Chen.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
1/*
2 * Copyright (c) 2000,2001 Jonathan Chen.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD: head/sys/dev/cardbus/cardbus_cis.c 106894 2002-11-14 05:10:16Z imp $
28 * $FreeBSD: head/sys/dev/cardbus/cardbus_cis.c 107301 2002-11-27 06:56:29Z imp $
29 */
30
31/*
32 * CIS Handling for the Cardbus Bus
33 */
34
35#include <sys/param.h>
36#include <sys/systm.h>

--- 169 unchanged lines hidden (view full) ---

206 return (EINVAL);
207 }
208 return (0);
209}
210
211DECODE_PROTOTYPE(vers_1)
212{
213 int i;
29 */
30
31/*
32 * CIS Handling for the Cardbus Bus
33 */
34
35#include <sys/param.h>
36#include <sys/systm.h>

--- 169 unchanged lines hidden (view full) ---

206 return (EINVAL);
207 }
208 return (0);
209}
210
211DECODE_PROTOTYPE(vers_1)
212{
213 int i;
214
214 printf("Product version: %d.%d\n", tupledata[0], tupledata[1]);
215 printf("Product name: ");
216 for (i = 2; i < len; i++) {
217 if (tupledata[i] == '\0')
218 printf(" | ");
219 else if (tupledata[i] == 0xff)
220 break;
221 else
222 printf("%c", tupledata[i]);
223 }
224 printf("\n");
225 return (0);
226}
227
228DECODE_PROTOTYPE(funcid)
229{
215 printf("Product version: %d.%d\n", tupledata[0], tupledata[1]);
216 printf("Product name: ");
217 for (i = 2; i < len; i++) {
218 if (tupledata[i] == '\0')
219 printf(" | ");
220 else if (tupledata[i] == 0xff)
221 break;
222 else
223 printf("%c", tupledata[i]);
224 }
225 printf("\n");
226 return (0);
227}
228
229DECODE_PROTOTYPE(funcid)
230{
230 int i;
231 struct cardbus_devinfo *dinfo = device_get_ivars(child);
231 int numnames = sizeof(funcnames) / sizeof(funcnames[0]);
232 int numnames = sizeof(funcnames) / sizeof(funcnames[0]);
233 int i;
232
233 printf("Functions: ");
234 for (i = 0; i < len; i++) {
235 if (tupledata[i] < numnames)
236 printf("%s", funcnames[tupledata[i]]);
237 else
238 printf("Unknown(%d)", tupledata[i]);
239 if (i < len-1)
240 printf(", ");
241 }
234
235 printf("Functions: ");
236 for (i = 0; i < len; i++) {
237 if (tupledata[i] < numnames)
238 printf("%s", funcnames[tupledata[i]]);
239 else
240 printf("Unknown(%d)", tupledata[i]);
241 if (i < len-1)
242 printf(", ");
243 }
244
245 if (len > 0)
246 dinfo->funcid = tupledata[0]; /* use first in list */
242 printf("\n");
243 return (0);
244}
245
246DECODE_PROTOTYPE(manfid)
247{
247 printf("\n");
248 return (0);
249}
250
251DECODE_PROTOTYPE(manfid)
252{
253 struct cardbus_devinfo *dinfo = device_get_ivars(child);
248 int i;
254 int i;
255
249 printf("Manufacturer ID: ");
250 for (i = 0; i < len; i++)
251 printf("%02x", tupledata[i]);
252 printf("\n");
256 printf("Manufacturer ID: ");
257 for (i = 0; i < len; i++)
258 printf("%02x", tupledata[i]);
259 printf("\n");
260
261 if (len == 5) {
262 dinfo->mfrid = tupledata[1] | (tupledata[2]<<8);
263 dinfo->prodid = tupledata[3] | (tupledata[4]<<8);
264 }
253 return (0);
254}
255
256DECODE_PROTOTYPE(funce)
257{
265 return (0);
266}
267
268DECODE_PROTOTYPE(funce)
269{
258 int i;
270 struct cardbus_devinfo *dinfo = device_get_ivars(child);
271 int type, i;
272
259 printf("Function Extension: ");
260 for (i = 0; i < len; i++)
261 printf("%02x", tupledata[i]);
262 printf("\n");
273 printf("Function Extension: ");
274 for (i = 0; i < len; i++)
275 printf("%02x", tupledata[i]);
276 printf("\n");
277 if (len < 2) /* too short */
278 return (0);
279 type = tupledata[0]; /* XXX <32 always? */
280 switch (dinfo->funcid) {
281 case TPL_FUNC_SERIAL:
282 if (type == TPL_FUNCE_SER_UART) { /* NB: len known > 1 */
283 dinfo->funce.sio.type = tupledata[1] & 0x1f;
284 }
285 dinfo->fepresent |= 1<<type;
286 break;
287 case TPL_FUNC_LAN:
288 switch (type) {
289 case TPL_FUNCE_LAN_TECH:
290 dinfo->funce.lan.tech = tupledata[1]; /* XXX mask? */
291 break;
292#if 0
293 case TPL_FUNCE_LAN_SPEED:
294 for (i = 0; i < 3; i++) {
295 if (dinfo->funce.lan.speed[i] == 0) {
296 if (len > 4) {
297 dinfo->funce.lan.speed[i] =
298 ...;
299 }
300 break;
301 }
302 }
303 break;
304#endif
305 case TPL_FUNCE_LAN_MEDIA:
306 for (i = 0; i < 4 && dinfo->funce.lan.media[i]; i++) {
307 if (dinfo->funce.lan.media[i] == 0) {
308 /* NB: len known > 1 */
309 dinfo->funce.lan.media[i] =
310 tupledata[1]; /*XXX? mask */
311 break;
312 }
313 }
314 break;
315 case TPL_FUNCE_LAN_NID:
316 if (len > 6)
317 bcopy(&tupledata[1], dinfo->funce.lan.nid, 6);
318 break;
319 case TPL_FUNCE_LAN_CONN:
320 dinfo->funce.lan.contype = tupledata[1];/*XXX mask? */
321 break;
322 }
323 dinfo->fepresent |= 1<<type;
324 break;
325 }
263 return (0);
264}
265
266DECODE_PROTOTYPE(bar)
267{
268 struct cardbus_devinfo *dinfo = device_get_ivars(child);
269 int type;
270 int reg;

--- 779 unchanged lines hidden ---
326 return (0);
327}
328
329DECODE_PROTOTYPE(bar)
330{
331 struct cardbus_devinfo *dinfo = device_get_ivars(child);
332 int type;
333 int reg;

--- 779 unchanged lines hidden ---