pccard.c (64927) | pccard.c (65098) |
---|---|
1/* $NetBSD: pcmcia.c,v 1.13 1998/12/24 04:51:59 marc Exp $ */ | 1/* $NetBSD: pcmcia.c,v 1.13 1998/12/24 04:51:59 marc Exp $ */ |
2/* $FreeBSD: head/sys/dev/pccard/pccard.c 64927 2000-08-22 04:25:57Z imp $ */ | 2/* $FreeBSD: head/sys/dev/pccard/pccard.c 65098 2000-08-26 00:07:40Z 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 --- 123 unchanged lines hidden (view full) --- 134 continue; 135 136 pf->sc = sc; 137 pf->cfe = NULL; 138 pf->ih_fct = NULL; 139 pf->ih_arg = NULL; 140 pf->dev = NULL; 141 } | 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 --- 123 unchanged lines hidden (view full) --- 134 continue; 135 136 pf->sc = sc; 137 pf->cfe = NULL; 138 pf->ih_fct = NULL; 139 pf->ih_arg = NULL; 140 pf->dev = NULL; 141 } |
142 | 142#if 0 |
143 DEVPRINTF((dev, "chip_socket_disable\n")); 144 POWER_DISABLE_SOCKET(device_get_parent(dev), dev); | 143 DEVPRINTF((dev, "chip_socket_disable\n")); 144 POWER_DISABLE_SOCKET(device_get_parent(dev), dev); |
145#endif |
|
145 146 STAILQ_FOREACH(pf, &sc->card.pf_head, pf_list) { 147 if (STAILQ_EMPTY(&pf->cfe_head)) 148 continue; 149 /* XXX */ 150 /* 151 * In NetBSD, the drivers are responsible for activating 152 * each function of a card. I think that in FreeBSD we --- 109 unchanged lines hidden (view full) --- 262 */ 263 return (0); 264 } 265 266 /* 267 * it's possible for different functions' CCRs to be in the same 268 * underlying page. Check for that. 269 */ | 146 147 STAILQ_FOREACH(pf, &sc->card.pf_head, pf_list) { 148 if (STAILQ_EMPTY(&pf->cfe_head)) 149 continue; 150 /* XXX */ 151 /* 152 * In NetBSD, the drivers are responsible for activating 153 * each function of a card. I think that in FreeBSD we --- 109 unchanged lines hidden (view full) --- 263 */ 264 return (0); 265 } 266 267 /* 268 * it's possible for different functions' CCRs to be in the same 269 * underlying page. Check for that. 270 */ |
270 | |
271 STAILQ_FOREACH(tmp, &pf->sc->card.pf_head, pf_list) { 272 if ((tmp->pf_flags & PFF_ENABLED) && 273 (pf->ccr_base >= (tmp->ccr_base - tmp->pf_ccr_offset)) && 274 ((pf->ccr_base + PCCARD_CCR_SIZE) <= 275 (tmp->ccr_base - tmp->pf_ccr_offset + 276 tmp->pf_ccr_realsize))) { 277 pf->pf_ccrt = tmp->pf_ccrt; 278 pf->pf_ccrh = tmp->pf_ccrh; --- 9 unchanged lines hidden (view full) --- 288 pf->pf_ccr_window = tmp->pf_ccr_window; 289 break; 290 } 291 } 292 293 if (tmp == NULL) { 294 pf->ccr_rid = 0; 295 pf->ccr_res = bus_alloc_resource(dev, SYS_RES_MEMORY, | 271 STAILQ_FOREACH(tmp, &pf->sc->card.pf_head, pf_list) { 272 if ((tmp->pf_flags & PFF_ENABLED) && 273 (pf->ccr_base >= (tmp->ccr_base - tmp->pf_ccr_offset)) && 274 ((pf->ccr_base + PCCARD_CCR_SIZE) <= 275 (tmp->ccr_base - tmp->pf_ccr_offset + 276 tmp->pf_ccr_realsize))) { 277 pf->pf_ccrt = tmp->pf_ccrt; 278 pf->pf_ccrh = tmp->pf_ccrh; --- 9 unchanged lines hidden (view full) --- 288 pf->pf_ccr_window = tmp->pf_ccr_window; 289 break; 290 } 291 } 292 293 if (tmp == NULL) { 294 pf->ccr_rid = 0; 295 pf->ccr_res = bus_alloc_resource(dev, SYS_RES_MEMORY, |
296 &pf->ccr_rid, pf->ccr_base, pf->ccr_base + PCCARD_CCR_SIZE, 297 PCCARD_CCR_SIZE, RF_ACTIVE); 298 if (!pf->ccr_res) | 296 &pf->ccr_rid, 0xa0000, 0xdffff, 1 << 10, RF_ACTIVE); 297 if (!pf->ccr_res) { 298 DEVPRINTF((dev, "ccr_res == 0\n")); |
299 goto bad; | 299 goto bad; |
300 } |
|
300 CARD_SET_RES_FLAGS(device_get_parent(dev), dev, SYS_RES_MEMORY, 301 pf->ccr_rid, PCCARD_A_MEM_ATTR); | 301 CARD_SET_RES_FLAGS(device_get_parent(dev), dev, SYS_RES_MEMORY, 302 pf->ccr_rid, PCCARD_A_MEM_ATTR); |
303 CARD_SET_MEMORY_OFFSET(device_get_parent(dev), dev, 304 pf->ccr_rid, (pf->ccr_rid >> 10) << 10); |
|
302 pf->pf_ccrt = rman_get_bustag(pf->ccr_res); 303 pf->pf_ccrh = rman_get_bushandle(pf->ccr_res); 304 pf->pf_ccr_offset = rman_get_start(pf->ccr_res); 305 pf->pf_ccr_realsize = 1; 306 } 307 308 reg = (pf->cfe->number & PCCARD_CCR_OPTION_CFINDEX); 309 reg |= PCCARD_CCR_OPTION_LEVIREQ; --- 60 unchanged lines hidden (view full) --- 370 371 bad: 372 /* 373 * Decrement the reference count, and power down the socket, if 374 * necessary. 375 */ 376 if (--pf->sc->sc_enabled_count == 0) 377 POWER_DISABLE_SOCKET(device_get_parent(dev), dev); | 305 pf->pf_ccrt = rman_get_bustag(pf->ccr_res); 306 pf->pf_ccrh = rman_get_bushandle(pf->ccr_res); 307 pf->pf_ccr_offset = rman_get_start(pf->ccr_res); 308 pf->pf_ccr_realsize = 1; 309 } 310 311 reg = (pf->cfe->number & PCCARD_CCR_OPTION_CFINDEX); 312 reg |= PCCARD_CCR_OPTION_LEVIREQ; --- 60 unchanged lines hidden (view full) --- 373 374 bad: 375 /* 376 * Decrement the reference count, and power down the socket, if 377 * necessary. 378 */ 379 if (--pf->sc->sc_enabled_count == 0) 380 POWER_DISABLE_SOCKET(device_get_parent(dev), dev); |
378 DEVPRINTF((dev, "--enabled_count = %d\n", pf->sc->sc_enabled_count)); | 381 DEVPRINTF((dev, "bad --enabled_count = %d\n", pf->sc->sc_enabled_count)); |
379 380 return (1); 381} 382 383/* Disable PCCARD function. */ 384void 385pccard_function_disable(struct pccard_function *pf) 386{ --- 310 unchanged lines hidden --- | 382 383 return (1); 384} 385 386/* Disable PCCARD function. */ 387void 388pccard_function_disable(struct pccard_function *pf) 389{ --- 310 unchanged lines hidden --- |