1/* $NetBSD: pcmcia_cis.c,v 1.10 1998/12/29 09:03:15 marc Exp $ */ |
2/* $FreeBSD: head/sys/dev/pccard/pccard_cis.c 87352 2001-12-04 13:48:16Z imp $ */ |
3 4/* 5 * Copyright (c) 1997 Marc Horowitz. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright --- 152 unchanged lines hidden (view full) --- 163 } else if (tuple.code == PCCARD_CISTPL_END) { 164 DPRINTF(("CISTPL_END\n ff\n")); 165 /* Call the function for the END tuple, since 166 the CIS semantics depend on it */ 167 if ((*fct) (&tuple, arg)) { 168 ret = 1; 169 goto done; 170 } |
171 tuple.ptr++; 172 break; 173 } 174 /* now all the normal tuples */ 175 176 tuple.length = pccard_cis_read_1(&tuple, tuple.ptr + 1); 177 switch (tuple.code) { 178 case PCCARD_CISTPL_LONGLINK_A: --- 129 unchanged lines hidden (view full) --- 308 tuple.length)); 309 310 for (i = 0; i < tuple.length; i++) { 311 DPRINTF((" %02x", 312 pccard_tuple_read_1(&tuple, i))); 313 if ((i % 16) == 13) 314 DPRINTF(("\n")); 315 } |
316 |
317 if ((i % 16) != 14) 318 DPRINTF(("\n")); 319 } 320#endif 321 /* skip to the next tuple */ 322 tuple.ptr += 2 + tuple.length; 323 } 324 |
325 /* 326 * the chain is done. Clean up and move onto the next one, 327 * if any. The loop is here in the case that there is an MFC 328 * card with no longlink (which defaults to existing, == 0). 329 * In general, this means that if one pointer fails, it will 330 * try the next one, instead of just bailing. 331 */ 332 333 while (1) { |
334 if (longlink_present) { |
335 CARD_SET_RES_FLAGS(device_get_parent(dev), dev, 336 SYS_RES_MEMORY, rid, longlink_common ? 337 PCCARD_A_MEM_ATTR : PCCARD_A_MEM_ATTR); |
338 DPRINTF(("cis mem map %x\n", 339 (unsigned int) tuple.memh)); 340 tuple.mult = longlink_common ? 1 : 2; 341 longlink_present = 0; 342 longlink_common = 1; 343 longlink_addr = 0; 344 } else if (mfc_count && (mfc_index < mfc_count)) { |
345 CARD_SET_RES_FLAGS(device_get_parent(dev), dev, 346 SYS_RES_MEMORY, rid, mfc[mfc_index].common 347 ? PCCARD_A_MEM_ATTR : PCCARD_A_MEM_ATTR); |
348 DPRINTF(("cis mem map %x\n", 349 (unsigned int) tuple.memh)); 350 /* set parse state, and point at the next one */ |
351 tuple.mult = mfc[mfc_index].common ? 1 : 2; |
352 mfc_index++; 353 } else { 354 goto done; 355 } 356 357 /* make sure that the link is valid */ 358 tuple.code = pccard_cis_read_1(&tuple, tuple.ptr); 359 if (tuple.code != PCCARD_CISTPL_LINKTARGET) { --- 13 unchanged lines hidden (view full) --- 373 DPRINTF(("CISTPL_LINKTARGET magic " 374 "%02x%02x%02x incorrect\n", 375 pccard_tuple_read_1(&tuple, 0), 376 pccard_tuple_read_1(&tuple, 1), 377 pccard_tuple_read_1(&tuple, 2))); 378 continue; 379 } 380 tuple.ptr += 2 + tuple.length; |
381 break; 382 } |
383 } 384 385done: 386 bus_release_resource(dev, SYS_RES_MEMORY, rid, res); 387 388 return (ret); 389} 390 --- 827 unchanged lines hidden --- |