pccard.c (181342) | pccard.c (181392) |
---|---|
1/* $NetBSD: pcmcia.c,v 1.23 2000/07/28 19:17:02 drochner Exp $ */ 2 3/*- 4 * Copyright (c) 1997 Marc Horowitz. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 16 unchanged lines hidden (view full) --- 25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32#include <sys/cdefs.h> | 1/* $NetBSD: pcmcia.c,v 1.23 2000/07/28 19:17:02 drochner Exp $ */ 2 3/*- 4 * Copyright (c) 1997 Marc Horowitz. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 16 unchanged lines hidden (view full) --- 25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/dev/pccard/pccard.c 181342 2008-08-06 07:34:35Z imp $"); | 33__FBSDID("$FreeBSD: head/sys/dev/pccard/pccard.c 181392 2008-08-07 20:52:54Z imp $"); |
34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/malloc.h> 38#include <sys/module.h> 39#include <sys/kernel.h> 40#include <sys/queue.h> 41#include <sys/sysctl.h> --- 607 unchanged lines hidden (view full) --- 649 int reg; 650 device_t dev = pf->sc->dev; 651 652 if (pf->cfe == NULL) { 653 DEVPRVERBOSE((dev, "No config entry could be allocated.\n")); 654 return (ENOMEM); 655 } 656 | 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/malloc.h> 38#include <sys/module.h> 39#include <sys/kernel.h> 40#include <sys/queue.h> 41#include <sys/sysctl.h> --- 607 unchanged lines hidden (view full) --- 649 int reg; 650 device_t dev = pf->sc->dev; 651 652 if (pf->cfe == NULL) { 653 DEVPRVERBOSE((dev, "No config entry could be allocated.\n")); 654 return (ENOMEM); 655 } 656 |
657 /* 658 * Increase the reference count on the socket, enabling power, if 659 * necessary. XXX: I don't see the enable power part here! 660 */ | 657 if (pf->pf_flags & PFF_ENABLED) 658 return (0); |
661 pf->sc->sc_enabled_count++; 662 | 659 pf->sc->sc_enabled_count++; 660 |
663 if (pf->pf_flags & PFF_ENABLED) { 664 /* 665 * Don't do anything if we're already enabled. 666 */ 667 return (0); 668 } 669 | |
670 /* 671 * it's possible for different functions' CCRs to be in the same 672 * underlying page. Check for that. 673 */ 674 STAILQ_FOREACH(tmp, &pf->sc->card.pf_head, pf_list) { 675 if ((tmp->pf_flags & PFF_ENABLED) && 676 (pf->ccr_base >= (tmp->ccr_base - tmp->pf_ccr_offset)) && 677 ((pf->ccr_base + PCCARD_CCR_SIZE) <= --- 92 unchanged lines hidden (view full) --- 770pccard_function_disable(struct pccard_function *pf) 771{ 772 struct pccard_function *tmp; 773 device_t dev = pf->sc->dev; 774 775 if (pf->cfe == NULL) 776 panic("pccard_function_disable: function not initialized"); 777 | 661 /* 662 * it's possible for different functions' CCRs to be in the same 663 * underlying page. Check for that. 664 */ 665 STAILQ_FOREACH(tmp, &pf->sc->card.pf_head, pf_list) { 666 if ((tmp->pf_flags & PFF_ENABLED) && 667 (pf->ccr_base >= (tmp->ccr_base - tmp->pf_ccr_offset)) && 668 ((pf->ccr_base + PCCARD_CCR_SIZE) <= --- 92 unchanged lines hidden (view full) --- 761pccard_function_disable(struct pccard_function *pf) 762{ 763 struct pccard_function *tmp; 764 device_t dev = pf->sc->dev; 765 766 if (pf->cfe == NULL) 767 panic("pccard_function_disable: function not initialized"); 768 |
778 if ((pf->pf_flags & PFF_ENABLED) == 0) { 779 /* 780 * Don't do anything if we're already disabled. 781 */ | 769 if ((pf->pf_flags & PFF_ENABLED) == 0) |
782 return; | 770 return; |
783 } 784 | |
785 if (pf->intr_handler != NULL) { 786 struct pccard_ivar *devi = PCCARD_IVAR(pf->dev); 787 struct resource_list_entry *rle = 788 resource_list_find(&devi->resources, SYS_RES_IRQ, 0); 789 if (rle == NULL) 790 panic("Can't disable an interrupt with no IRQ res\n"); 791 BUS_TEARDOWN_INTR(dev, pf->dev, rle->res, 792 pf->intr_handler_cookie); --- 703 unchanged lines hidden --- | 771 if (pf->intr_handler != NULL) { 772 struct pccard_ivar *devi = PCCARD_IVAR(pf->dev); 773 struct resource_list_entry *rle = 774 resource_list_find(&devi->resources, SYS_RES_IRQ, 0); 775 if (rle == NULL) 776 panic("Can't disable an interrupt with no IRQ res\n"); 777 BUS_TEARDOWN_INTR(dev, pf->dev, rle->res, 778 pf->intr_handler_cookie); --- 703 unchanged lines hidden --- |