pccard_cis.c (86272) | pccard_cis.c (87352) |
---|---|
1/* $NetBSD: pcmcia_cis.c,v 1.10 1998/12/29 09:03:15 marc Exp $ */ | 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 86272 2001-11-11 20:15:47Z imp $ */ | 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 } | 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 ret = 1; goto done; /* XXX IMP XXX */ | |
172 tuple.ptr++; 173 break; 174 } 175 /* now all the normal tuples */ 176 177 tuple.length = pccard_cis_read_1(&tuple, tuple.ptr + 1); 178 switch (tuple.code) { 179 case PCCARD_CISTPL_LONGLINK_A: --- 129 unchanged lines hidden (view full) --- 309 tuple.length)); 310 311 for (i = 0; i < tuple.length; i++) { 312 DPRINTF((" %02x", 313 pccard_tuple_read_1(&tuple, i))); 314 if ((i % 16) == 13) 315 DPRINTF(("\n")); 316 } | 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 | 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#ifdef XXX /* I'm not up to this tonight, need to implement new API */ 326 /* to deal with moving windows and such. At least that's */ 327 /* what it appears at this instant */ 328 | |
329 /* 330 * the chain is done. Clean up and move onto the next one, 331 * if any. The loop is here in the case that there is an MFC 332 * card with no longlink (which defaults to existing, == 0). 333 * In general, this means that if one pointer fails, it will 334 * try the next one, instead of just bailing. 335 */ 336 337 while (1) { | 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) { |
338 pccard_chip_mem_unmap(pct, pch, window); 339 | |
340 if (longlink_present) { | 334 if (longlink_present) { |
341 /* 342 * if the longlink is to attribute memory, 343 * then it is unindexed. That is, if the 344 * link value is 0x100, then the actual 345 * memory address is 0x200. This means that 346 * we need to multiply by 2 before calling 347 * mem_map, and then divide the resulting ptr 348 * by 2 after. 349 */ 350 351 if (!longlink_common) 352 longlink_addr *= 2; 353 354 pccard_chip_mem_map(pct, pch, longlink_common ? 355 PCCARD_MEM_COMMON : PCCARD_MEM_ATTR, 356 longlink_addr, PCCARD_CIS_SIZE, 357 &pcmh, &tuple.ptr, &window); 358 359 if (!longlink_common) 360 tuple.ptr /= 2; | 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); |
361 DPRINTF(("cis mem map %x\n", 362 (unsigned int) tuple.memh)); 363 tuple.mult = longlink_common ? 1 : 2; 364 longlink_present = 0; 365 longlink_common = 1; 366 longlink_addr = 0; 367 } else if (mfc_count && (mfc_index < mfc_count)) { | 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)) { |
368 if (!mfc[mfc_index].common) 369 mfc[mfc_index].addr *= 2; 370 371 pccard_chip_mem_map(pct, pch, 372 mfc[mfc_index].common ? 373 PCCARD_MEM_COMMON : PCCARD_MEM_ATTR, 374 mfc[mfc_index].addr, PCCARD_CIS_SIZE, 375 &pcmh, &tuple.ptr, &window); 376 377 if (!mfc[mfc_index].common) 378 tuple.ptr /= 2; | 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); |
379 DPRINTF(("cis mem map %x\n", 380 (unsigned int) tuple.memh)); 381 /* set parse state, and point at the next one */ | 348 DPRINTF(("cis mem map %x\n", 349 (unsigned int) tuple.memh)); 350 /* set parse state, and point at the next one */ |
382 | |
383 tuple.mult = mfc[mfc_index].common ? 1 : 2; | 351 tuple.mult = mfc[mfc_index].common ? 1 : 2; |
384 | |
385 mfc_index++; 386 } else { 387 goto done; 388 } 389 390 /* make sure that the link is valid */ 391 tuple.code = pccard_cis_read_1(&tuple, tuple.ptr); 392 if (tuple.code != PCCARD_CISTPL_LINKTARGET) { --- 13 unchanged lines hidden (view full) --- 406 DPRINTF(("CISTPL_LINKTARGET magic " 407 "%02x%02x%02x incorrect\n", 408 pccard_tuple_read_1(&tuple, 0), 409 pccard_tuple_read_1(&tuple, 1), 410 pccard_tuple_read_1(&tuple, 2))); 411 continue; 412 } 413 tuple.ptr += 2 + tuple.length; | 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; |
414 | |
415 break; 416 } | 381 break; 382 } |
417#endif /* XXX */ | |
418 } 419 420done: 421 bus_release_resource(dev, SYS_RES_MEMORY, rid, res); 422 423 return (ret); 424} 425 --- 827 unchanged lines hidden --- | 383 } 384 385done: 386 bus_release_resource(dev, SYS_RES_MEMORY, rid, res); 387 388 return (ret); 389} 390 --- 827 unchanged lines hidden --- |