2 * PCMCIA 16-bit resource management functions
4 * The initial developer of the original code is David A. Hinds
5 * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
6 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
8 * Copyright (C) 1999 David A. Hinds
9 * Copyright (C) 2004-2005 Dominik Brodowski
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
17 #include <linux/module.h>
18 #include <linux/kernel.h>
19 #include <linux/interrupt.h>
20 #include <linux/delay.h>
21 #include <linux/pci.h>
22 #include <linux/device.h>
23 #include <linux/netdevice.h>
24 #include <linux/slab.h>
28 #include <pcmcia/ss.h>
29 #include <pcmcia/cs.h>
30 #include <pcmcia/cistpl.h>
31 #include <pcmcia/cisreg.h>
32 #include <pcmcia/ds.h>
34 #include "cs_internal.h"
37 /* Access speed for IO windows */
39 module_param(io_speed, int, 0444);
42 int pcmcia_validate_mem(struct pcmcia_socket *s)
44 if (s->resource_ops->validate_mem)
45 return s->resource_ops->validate_mem(s);
46 /* if there is no callback, we can assume that everything is OK */
50 struct resource *pcmcia_find_mem_region(u_long base, u_long num, u_long align,
51 int low, struct pcmcia_socket *s)
53 if (s->resource_ops->find_mem)
54 return s->resource_ops->find_mem(base, num, align, low, s);
61 * Special stuff for managing IO windows, because they are scarce
63 static int alloc_io_space(struct pcmcia_socket *s, struct resource *res,
67 unsigned int base = res->start;
68 unsigned int num = res->end;
71 res->flags |= IORESOURCE_IO;
73 dev_dbg(&s->dev, "alloc_io_space request for %pR, %d lines\n",
76 align = base ? (lines ? 1<<lines : 0) : 1;
77 if (align && (align < num)) {
79 dev_dbg(&s->dev, "odd IO request\n");
82 while (align && (align < num))
85 if (base & ~(align-1)) {
86 dev_dbg(&s->dev, "odd IO request\n");
90 ret = s->resource_ops->find_io(s, res->flags, &base, num, align);
92 dev_dbg(&s->dev, "alloc_io_space request returned %d", ret);
97 res->end = res->start + num - 1;
98 dev_dbg(&s->dev, "alloc_io_space request returned %pR, %d\n", res, ret);
100 } /* alloc_io_space */
103 static void release_io_space(struct pcmcia_socket *s, struct resource *res)
105 resource_size_t num = resource_size(res);
108 dev_dbg(&s->dev, "release_io_space for %pR\n", res);
110 for (i = 0; i < MAX_IO_WIN; i++) {
113 if ((s->io[i].res->start <= res->start) &&
114 (s->io[i].res->end >= res->end)) {
115 s->io[i].InUse -= num;
116 res->start = res->end = 0;
117 res->flags = IORESOURCE_IO;
118 /* Free the window if no one else is using it */
119 if (s->io[i].InUse == 0) {
120 release_resource(s->io[i].res);
126 } /* release_io_space */
130 * pcmcia_access_config() - read or write card configuration registers
132 * pcmcia_access_config() reads and writes configuration registers in
133 * attribute memory. Memory window 0 is reserved for this and the tuple
134 * reading services. Drivers must use pcmcia_read_config_byte() or
135 * pcmcia_write_config_byte().
137 static int pcmcia_access_config(struct pcmcia_device *p_dev,
138 off_t where, u8 *val,
139 int (*accessf) (struct pcmcia_socket *s,
140 int attr, unsigned int addr,
141 unsigned int len, void *ptr))
143 struct pcmcia_socket *s;
150 mutex_lock(&s->ops_mutex);
151 c = p_dev->function_config;
153 if (!(c->state & CONFIG_LOCKED)) {
154 dev_dbg(&s->dev, "Configuration isnt't locked\n");
155 mutex_unlock(&s->ops_mutex);
159 addr = (c->ConfigBase + where) >> 1;
161 ret = accessf(s, 1, addr, 1, val);
163 mutex_unlock(&s->ops_mutex);
166 } /* pcmcia_access_config */
170 * pcmcia_read_config_byte() - read a byte from a card configuration register
172 * pcmcia_read_config_byte() reads a byte from a configuration register in
175 int pcmcia_read_config_byte(struct pcmcia_device *p_dev, off_t where, u8 *val)
177 return pcmcia_access_config(p_dev, where, val, pcmcia_read_cis_mem);
179 EXPORT_SYMBOL(pcmcia_read_config_byte);
183 * pcmcia_write_config_byte() - write a byte to a card configuration register
185 * pcmcia_write_config_byte() writes a byte to a configuration register in
188 int pcmcia_write_config_byte(struct pcmcia_device *p_dev, off_t where, u8 val)
190 return pcmcia_access_config(p_dev, where, &val, pcmcia_write_cis_mem);
192 EXPORT_SYMBOL(pcmcia_write_config_byte);
195 int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh,
198 struct pcmcia_socket *s = p_dev->socket;
204 if (req->Page != 0) {
205 dev_dbg(&s->dev, "failure: requested page is zero\n");
208 mutex_lock(&s->ops_mutex);
209 s->win[wh].card_start = req->CardOffset;
210 ret = s->ops->set_mem_map(s, &s->win[wh]);
212 dev_warn(&s->dev, "failed to set_mem_map\n");
213 mutex_unlock(&s->ops_mutex);
215 } /* pcmcia_map_mem_page */
216 EXPORT_SYMBOL(pcmcia_map_mem_page);
219 /** pcmcia_modify_configuration
221 * Modify a locked socket configuration
223 int pcmcia_modify_configuration(struct pcmcia_device *p_dev,
226 struct pcmcia_socket *s;
232 mutex_lock(&s->ops_mutex);
233 c = p_dev->function_config;
235 if (!(s->state & SOCKET_PRESENT)) {
236 dev_dbg(&s->dev, "No card present\n");
240 if (!(c->state & CONFIG_LOCKED)) {
241 dev_dbg(&s->dev, "Configuration isnt't locked\n");
246 if (mod->Attributes & (CONF_IRQ_CHANGE_VALID | CONF_VCC_CHANGE_VALID)) {
248 "changing Vcc or IRQ is not allowed at this time\n");
253 /* We only allow changing Vpp1 and Vpp2 to the same value */
254 if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) &&
255 (mod->Attributes & CONF_VPP2_CHANGE_VALID)) {
256 if (mod->Vpp1 != mod->Vpp2) {
257 dev_dbg(&s->dev, "Vpp1 and Vpp2 must be the same\n");
261 s->socket.Vpp = mod->Vpp1;
262 if (s->ops->set_socket(s, &s->socket)) {
263 dev_printk(KERN_WARNING, &s->dev,
264 "Unable to set VPP\n");
268 } else if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) ||
269 (mod->Attributes & CONF_VPP2_CHANGE_VALID)) {
270 dev_dbg(&s->dev, "changing Vcc is not allowed at this time\n");
275 if (mod->Attributes & CONF_IO_CHANGE_WIDTH) {
276 pccard_io_map io_off = { 0, 0, 0, 0, 1 };
280 io_on.speed = io_speed;
281 for (i = 0; i < MAX_IO_WIN; i++) {
287 io_on.flags = MAP_ACTIVE | IO_DATA_PATH_WIDTH_8;
288 io_on.start = s->io[i].res->start;
289 io_on.stop = s->io[i].res->end;
291 s->ops->set_io_map(s, &io_off);
293 s->ops->set_io_map(s, &io_on);
298 mutex_unlock(&s->ops_mutex);
301 } /* modify_configuration */
302 EXPORT_SYMBOL(pcmcia_modify_configuration);
305 int pcmcia_release_configuration(struct pcmcia_device *p_dev)
307 pccard_io_map io = { 0, 0, 0, 0, 1 };
308 struct pcmcia_socket *s = p_dev->socket;
312 mutex_lock(&s->ops_mutex);
313 c = p_dev->function_config;
314 if (p_dev->_locked) {
316 if (--(s->lock_count) == 0) {
317 s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */
319 s->socket.io_irq = 0;
320 s->ops->set_socket(s, &s->socket);
323 if (c->state & CONFIG_LOCKED) {
324 c->state &= ~CONFIG_LOCKED;
325 if (c->state & CONFIG_IO_REQ)
326 for (i = 0; i < MAX_IO_WIN; i++) {
330 if (s->io[i].Config != 0)
333 s->ops->set_io_map(s, &io);
336 mutex_unlock(&s->ops_mutex);
339 } /* pcmcia_release_configuration */
342 /** pcmcia_release_io
344 * Release_io() releases the I/O ranges allocated by a client. This
345 * may be invoked some time after a card ejection has already dumped
346 * the actual socket configuration, so if the client is "stale", we
347 * don't bother checking the port ranges against the current socket
350 static int pcmcia_release_io(struct pcmcia_device *p_dev)
352 struct pcmcia_socket *s = p_dev->socket;
356 mutex_lock(&s->ops_mutex);
360 c = p_dev->function_config;
362 release_io_space(s, &c->io[0]);
365 release_io_space(s, &c->io[1]);
368 c->state &= ~CONFIG_IO_REQ;
371 mutex_unlock(&s->ops_mutex);
374 } /* pcmcia_release_io */
377 int pcmcia_release_window(struct pcmcia_device *p_dev, window_handle_t wh)
379 struct pcmcia_socket *s = p_dev->socket;
386 mutex_lock(&s->ops_mutex);
389 if (!(p_dev->_win & CLIENT_WIN_REQ(wh))) {
390 dev_dbg(&s->dev, "not releasing unknown window\n");
391 mutex_unlock(&s->ops_mutex);
395 /* Shut down memory window */
396 win->flags &= ~MAP_ACTIVE;
397 s->ops->set_mem_map(s, win);
398 s->state &= ~SOCKET_WIN_REQ(wh);
400 /* Release system memory */
402 release_resource(win->res);
406 p_dev->_win &= ~CLIENT_WIN_REQ(wh);
407 mutex_unlock(&s->ops_mutex);
410 } /* pcmcia_release_window */
411 EXPORT_SYMBOL(pcmcia_release_window);
414 int pcmcia_request_configuration(struct pcmcia_device *p_dev,
419 struct pcmcia_socket *s = p_dev->socket;
423 if (!(s->state & SOCKET_PRESENT))
426 if (req->IntType & INT_CARDBUS) {
427 dev_dbg(&s->dev, "IntType may not be INT_CARDBUS\n");
431 mutex_lock(&s->ops_mutex);
432 c = p_dev->function_config;
433 if (c->state & CONFIG_LOCKED) {
434 mutex_unlock(&s->ops_mutex);
435 dev_dbg(&s->dev, "Configuration is locked\n");
439 /* Do power control. We don't allow changes in Vcc. */
440 s->socket.Vpp = req->Vpp;
441 if (s->ops->set_socket(s, &s->socket)) {
442 mutex_unlock(&s->ops_mutex);
443 dev_printk(KERN_WARNING, &s->dev,
444 "Unable to set socket state\n");
448 /* Pick memory or I/O card, DMA mode, interrupt */
449 c->IntType = req->IntType;
450 c->Attributes = req->Attributes;
451 if (req->IntType & INT_MEMORY_AND_IO)
452 s->socket.flags |= SS_IOCARD;
453 if (req->IntType & INT_ZOOMED_VIDEO)
454 s->socket.flags |= SS_ZVCARD | SS_IOCARD;
455 if (req->Attributes & CONF_ENABLE_DMA)
456 s->socket.flags |= SS_DMA_MODE;
457 if (req->Attributes & CONF_ENABLE_SPKR)
458 s->socket.flags |= SS_SPKR_ENA;
459 if (req->Attributes & CONF_ENABLE_IRQ)
460 s->socket.io_irq = s->pcmcia_irq;
462 s->socket.io_irq = 0;
463 s->ops->set_socket(s, &s->socket);
466 /* Set up CIS configuration registers */
467 base = c->ConfigBase = req->ConfigBase;
468 c->CardValues = req->Present;
469 if (req->Present & PRESENT_COPY) {
471 pcmcia_write_cis_mem(s, 1, (base + CISREG_SCR)>>1, 1, &c->Copy);
473 if (req->Present & PRESENT_OPTION) {
474 if (s->functions == 1) {
475 c->Option = req->ConfigIndex & COR_CONFIG_MASK;
477 c->Option = req->ConfigIndex & COR_MFC_CONFIG_MASK;
478 c->Option |= COR_FUNC_ENA|COR_IREQ_ENA;
479 if (req->Present & PRESENT_IOBASE_0)
480 c->Option |= COR_ADDR_DECODE;
482 if ((req->Attributes & CONF_ENABLE_IRQ) &&
483 !(req->Attributes & CONF_ENABLE_PULSE_IRQ))
484 c->Option |= COR_LEVEL_REQ;
485 pcmcia_write_cis_mem(s, 1, (base + CISREG_COR)>>1, 1, &c->Option);
488 if (req->Present & PRESENT_STATUS) {
489 c->Status = req->Status;
490 pcmcia_write_cis_mem(s, 1, (base + CISREG_CCSR)>>1, 1, &c->Status);
492 if (req->Present & PRESENT_PIN_REPLACE) {
494 pcmcia_write_cis_mem(s, 1, (base + CISREG_PRR)>>1, 1, &c->Pin);
496 if (req->Present & PRESENT_EXT_STATUS) {
497 c->ExtStatus = req->ExtStatus;
498 pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1, &c->ExtStatus);
500 if (req->Present & PRESENT_IOBASE_0) {
501 u8 b = c->io[0].start & 0xff;
502 pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b);
503 b = (c->io[0].start >> 8) & 0xff;
504 pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_1)>>1, 1, &b);
506 if (req->Present & PRESENT_IOSIZE) {
507 u8 b = resource_size(&c->io[0]) + resource_size(&c->io[1]) - 1;
508 pcmcia_write_cis_mem(s, 1, (base + CISREG_IOSIZE)>>1, 1, &b);
511 /* Configure I/O windows */
512 if (c->state & CONFIG_IO_REQ) {
513 iomap.speed = io_speed;
514 for (i = 0; i < MAX_IO_WIN; i++)
517 iomap.flags = MAP_ACTIVE;
518 switch (s->io[i].res->flags & IO_DATA_PATH_WIDTH) {
519 case IO_DATA_PATH_WIDTH_16:
520 iomap.flags |= MAP_16BIT; break;
521 case IO_DATA_PATH_WIDTH_AUTO:
522 iomap.flags |= MAP_AUTOSZ; break;
526 iomap.start = s->io[i].res->start;
527 iomap.stop = s->io[i].res->end;
528 s->ops->set_io_map(s, &iomap);
533 c->state |= CONFIG_LOCKED;
535 mutex_unlock(&s->ops_mutex);
537 } /* pcmcia_request_configuration */
538 EXPORT_SYMBOL(pcmcia_request_configuration);
542 * pcmcia_request_io() - attempt to reserve port ranges for PCMCIA devices
544 * pcmcia_request_io() attepts to reserve the IO port ranges specified in
545 * &struct pcmcia_device @p_dev->resource[0] and @p_dev->resource[1]. The
546 * "start" value is the requested start of the IO port resource; "end"
547 * reflects the number of ports requested. The number of IO lines requested
548 * is specified in &struct pcmcia_device @p_dev->io_lines.
550 int pcmcia_request_io(struct pcmcia_device *p_dev)
552 struct pcmcia_socket *s = p_dev->socket;
553 config_t *c = p_dev->function_config;
556 mutex_lock(&s->ops_mutex);
557 dev_dbg(&s->dev, "pcmcia_request_io: %pR , %pR", &c->io[0], &c->io[1]);
559 if (!(s->state & SOCKET_PRESENT)) {
560 dev_dbg(&s->dev, "pcmcia_request_io: No card present\n");
564 if (c->state & CONFIG_LOCKED) {
565 dev_dbg(&s->dev, "Configuration is locked\n");
568 if (c->state & CONFIG_IO_REQ) {
569 dev_dbg(&s->dev, "IO already configured\n");
573 ret = alloc_io_space(s, &c->io[0], p_dev->io_lines);
578 ret = alloc_io_space(s, &c->io[1], p_dev->io_lines);
580 release_io_space(s, &c->io[0]);
586 c->state |= CONFIG_IO_REQ;
589 dev_dbg(&s->dev, "pcmcia_request_io succeeded: %pR , %pR",
590 &c->io[0], &c->io[1]);
592 mutex_unlock(&s->ops_mutex);
595 } /* pcmcia_request_io */
596 EXPORT_SYMBOL(pcmcia_request_io);
600 * pcmcia_request_irq() - attempt to request a IRQ for a PCMCIA device
602 * pcmcia_request_irq() is a wrapper around request_irq which will allow
603 * the PCMCIA core to clean up the registration in pcmcia_disable_device().
604 * Drivers are free to use request_irq() directly, but then they need to
605 * call free_irq themselfves, too. Also, only IRQF_SHARED capable IRQ
606 * handlers are allowed.
608 int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev,
609 irq_handler_t handler)
616 ret = request_irq(p_dev->irq, handler, IRQF_SHARED,
617 p_dev->devname, p_dev->priv);
623 EXPORT_SYMBOL(pcmcia_request_irq);
627 * pcmcia_request_exclusive_irq() - attempt to request an exclusive IRQ first
629 * pcmcia_request_exclusive_irq() is a wrapper around request_irq which
630 * attempts first to request an exclusive IRQ. If it fails, it also accepts
631 * a shared IRQ, but prints out a warning. PCMCIA drivers should allow for
632 * IRQ sharing and either use request_irq directly (then they need to call
633 * free_irq themselves, too), or the pcmcia_request_irq() function.
636 __pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev,
637 irq_handler_t handler)
644 ret = request_irq(p_dev->irq, handler, 0, p_dev->devname, p_dev->priv);
646 ret = pcmcia_request_irq(p_dev, handler);
647 dev_printk(KERN_WARNING, &p_dev->dev, "pcmcia: "
648 "request for exclusive IRQ could not be fulfilled.\n");
649 dev_printk(KERN_WARNING, &p_dev->dev, "pcmcia: the driver "
650 "needs updating to supported shared IRQ lines.\n");
653 dev_printk(KERN_INFO, &p_dev->dev, "request_irq() failed\n");
658 } /* pcmcia_request_exclusive_irq */
659 EXPORT_SYMBOL(__pcmcia_request_exclusive_irq);
662 #ifdef CONFIG_PCMCIA_PROBE
664 /* mask of IRQs already reserved by other cards, we should avoid using them */
665 static u8 pcmcia_used_irq[NR_IRQS];
667 static irqreturn_t test_action(int cpl, void *dev_id)
673 * pcmcia_setup_isa_irq() - determine whether an ISA IRQ can be used
674 * @p_dev - the associated PCMCIA device
676 * locking note: must be called with ops_mutex locked.
678 static int pcmcia_setup_isa_irq(struct pcmcia_device *p_dev, int type)
680 struct pcmcia_socket *s = p_dev->socket;
681 unsigned int try, irq;
682 u32 mask = s->irq_mask;
685 for (try = 0; try < 64; try++) {
688 /* marked as available by driver, not blocked by userspace? */
689 if (!((mask >> irq) & 1))
692 /* avoid an IRQ which is already used by another PCMCIA card */
693 if ((try < 32) && pcmcia_used_irq[irq])
696 /* register the correct driver, if possible, to check whether
697 * registering a dummy handle works, i.e. if the IRQ isn't
698 * marked as used by the kernel resource management core */
699 ret = request_irq(irq, test_action, type, p_dev->devname,
702 free_irq(irq, p_dev);
703 p_dev->irq = s->pcmcia_irq = irq;
704 pcmcia_used_irq[irq]++;
712 void pcmcia_cleanup_irq(struct pcmcia_socket *s)
714 pcmcia_used_irq[s->pcmcia_irq]--;
718 #else /* CONFIG_PCMCIA_PROBE */
720 static int pcmcia_setup_isa_irq(struct pcmcia_device *p_dev, int type)
725 void pcmcia_cleanup_irq(struct pcmcia_socket *s)
731 #endif /* CONFIG_PCMCIA_PROBE */
735 * pcmcia_setup_irq() - determine IRQ to be used for device
736 * @p_dev - the associated PCMCIA device
738 * locking note: must be called with ops_mutex locked.
740 int pcmcia_setup_irq(struct pcmcia_device *p_dev)
742 struct pcmcia_socket *s = p_dev->socket;
747 /* already assigned? */
749 p_dev->irq = s->pcmcia_irq;
753 /* prefer an exclusive ISA irq */
754 if (!pcmcia_setup_isa_irq(p_dev, 0))
757 /* but accept a shared ISA irq */
758 if (!pcmcia_setup_isa_irq(p_dev, IRQF_SHARED))
761 /* but use the PCI irq otherwise */
763 p_dev->irq = s->pcmcia_irq = s->pci_irq;
771 /** pcmcia_request_window
773 * Request_window() establishes a mapping between card memory space
774 * and system memory space.
776 int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_handle_t *wh)
778 struct pcmcia_socket *s = p_dev->socket;
783 if (!(s->state & SOCKET_PRESENT)) {
784 dev_dbg(&s->dev, "No card present\n");
787 if (req->Attributes & (WIN_PAGED | WIN_SHARED)) {
788 dev_dbg(&s->dev, "bad attribute setting for iomem region\n");
792 /* Window size defaults to smallest available */
794 req->Size = s->map_size;
795 align = (((s->features & SS_CAP_MEM_ALIGN) ||
796 (req->Attributes & WIN_STRICT_ALIGN)) ?
797 req->Size : s->map_size);
798 if (req->Size & (s->map_size-1)) {
799 dev_dbg(&s->dev, "invalid map size\n");
802 if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) ||
803 (req->Base & (align-1))) {
804 dev_dbg(&s->dev, "invalid base address\n");
810 /* Allocate system memory window */
811 for (w = 0; w < MAX_WIN; w++)
812 if (!(s->state & SOCKET_WIN_REQ(w)))
815 dev_dbg(&s->dev, "all windows are used already\n");
819 mutex_lock(&s->ops_mutex);
822 if (!(s->features & SS_CAP_STATIC_MAP)) {
823 win->res = pcmcia_find_mem_region(req->Base, req->Size, align,
824 (req->Attributes & WIN_MAP_BELOW_1MB), s);
826 dev_dbg(&s->dev, "allocating mem region failed\n");
827 mutex_unlock(&s->ops_mutex);
831 p_dev->_win |= CLIENT_WIN_REQ(w);
833 /* Configure the socket controller */
836 win->speed = req->AccessSpeed;
837 if (req->Attributes & WIN_MEMORY_TYPE)
838 win->flags |= MAP_ATTRIB;
839 if (req->Attributes & WIN_ENABLE)
840 win->flags |= MAP_ACTIVE;
841 if (req->Attributes & WIN_DATA_WIDTH_16)
842 win->flags |= MAP_16BIT;
843 if (req->Attributes & WIN_USE_WAIT)
844 win->flags |= MAP_USE_WAIT;
847 if (s->ops->set_mem_map(s, win) != 0) {
848 dev_dbg(&s->dev, "failed to set memory mapping\n");
849 mutex_unlock(&s->ops_mutex);
852 s->state |= SOCKET_WIN_REQ(w);
854 /* Return window handle */
855 if (s->features & SS_CAP_STATIC_MAP)
856 req->Base = win->static_start;
858 req->Base = win->res->start;
860 mutex_unlock(&s->ops_mutex);
864 } /* pcmcia_request_window */
865 EXPORT_SYMBOL(pcmcia_request_window);
867 void pcmcia_disable_device(struct pcmcia_device *p_dev)
869 pcmcia_release_configuration(p_dev);
870 pcmcia_release_io(p_dev);
872 free_irq(p_dev->irq, p_dev->priv);
876 pcmcia_release_window(p_dev, p_dev->win);
878 EXPORT_SYMBOL(pcmcia_disable_device);