Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6:
pcmcia: avoid buffer overflow in pcmcia_setup_isa_irq
pcmcia: do not request windows if you don't need to
pcmcia: insert PCMCIA device resources into resource tree
pcmcia: export resource information to sysfs
pcmcia: use struct resource for PCMCIA devices, part 2
pcmcia: remove memreq_t
pcmcia: move local definitions out of include/pcmcia/cs.h
pcmcia: do not use io_req_t when calling pcmcia_request_io()
pcmcia: do not use io_req_t after call to pcmcia_request_io()
pcmcia: use struct resource for PCMCIA devices
pcmcia: clean up cs.h
pcmcia: use pcmica_{read,write}_config_byte
pcmcia: remove cs_types.h
pcmcia: remove unused flag, simplify headers
pcmcia: remove obsolete CS_EVENT_ definitions
pcmcia: split up central event handler
pcmcia: simplify event callback
pcmcia: remove obsolete ioctl

Conflicts in:
- drivers/staging/comedi/drivers/*
- drivers/staging/wlags49_h2/wl_cs.c
due to dev_info_t and whitespace changes

+1204 -3202
-23
Documentation/feature-removal-schedule.txt
··· 116 116 117 117 --------------------------- 118 118 119 - What: PCMCIA control ioctl (needed for pcmcia-cs [cardmgr, cardctl]) 120 - When: 2.6.35/2.6.36 121 - Files: drivers/pcmcia/: pcmcia_ioctl.c 122 - Why: With the 16-bit PCMCIA subsystem now behaving (almost) like a 123 - normal hotpluggable bus, and with it using the default kernel 124 - infrastructure (hotplug, driver core, sysfs) keeping the PCMCIA 125 - control ioctl needed by cardmgr and cardctl from pcmcia-cs is 126 - unnecessary and potentially harmful (it does not provide for 127 - proper locking), and makes further cleanups and integration of the 128 - PCMCIA subsystem into the Linux kernel device driver model more 129 - difficult. The features provided by cardmgr and cardctl are either 130 - handled by the kernel itself now or are available in the new 131 - pcmciautils package available at 132 - http://kernel.org/pub/linux/utils/kernel/pcmcia/ 133 - 134 - For all architectures except ARM, the associated config symbol 135 - has been removed from kernel 2.6.34; for ARM, it will be likely 136 - be removed from kernel 2.6.35. The actual code will then likely 137 - be removed from kernel 2.6.36. 138 - Who: Dominik Brodowski <linux@dominikbrodowski.net> 139 - 140 - --------------------------- 141 - 142 119 What: sys_sysctl 143 120 When: September 2010 144 121 Option: CONFIG_SYSCTL_SYSCALL
+12
Documentation/pcmcia/driver-changes.txt
··· 1 1 This file details changes in 2.6 which affect PCMCIA card driver authors: 2 + * pcmcia_request_io changes (as of 2.6.36) 3 + Instead of io_req_t, drivers are now requested to fill out 4 + struct pcmcia_device *p_dev->resource[0,1] for up to two ioport 5 + ranges. After a call to pcmcia_request_io(), the ports found there 6 + are reserved, after calling pcmcia_request_configuration(), they may 7 + be used. 8 + 9 + * No dev_info_t, no cs_types.h (as of 2.6.36) 10 + dev_info_t and a few other typedefs are removed. No longer use them 11 + in PCMCIA device drivers. Also, do not include pcmcia/cs_types.h, as 12 + this file is gone. 13 + 2 14 * No dev_node_t (as of 2.6.35) 3 15 There is no more need to fill out a "dev_node_t" structure. 4 16
+19 -19
drivers/ata/pata_pcmcia.c
··· 34 34 #include <linux/ata.h> 35 35 #include <linux/libata.h> 36 36 37 - #include <pcmcia/cs_types.h> 38 37 #include <pcmcia/cs.h> 39 38 #include <pcmcia/cistpl.h> 40 39 #include <pcmcia/ds.h> ··· 200 201 201 202 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 202 203 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 203 - pdev->io.BasePort1 = io->win[0].base; 204 - pdev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 205 - if (!(io->flags & CISTPL_IO_16BIT)) 206 - pdev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 204 + pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 205 + pdev->resource[0]->start = io->win[0].base; 206 + if (!(io->flags & CISTPL_IO_16BIT)) { 207 + pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 208 + pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 209 + } 207 210 if (io->nwin == 2) { 208 - pdev->io.NumPorts1 = 8; 209 - pdev->io.BasePort2 = io->win[1].base; 210 - pdev->io.NumPorts2 = (stk->is_kme) ? 2 : 1; 211 - if (pcmcia_request_io(pdev, &pdev->io) != 0) 211 + pdev->resource[0]->end = 8; 212 + pdev->resource[1]->start = io->win[1].base; 213 + pdev->resource[1]->end = (stk->is_kme) ? 2 : 1; 214 + if (pcmcia_request_io(pdev) != 0) 212 215 return -ENODEV; 213 - stk->ctl_base = pdev->io.BasePort2; 216 + stk->ctl_base = pdev->resource[1]->start; 214 217 } else if ((io->nwin == 1) && (io->win[0].len >= 16)) { 215 - pdev->io.NumPorts1 = io->win[0].len; 216 - pdev->io.NumPorts2 = 0; 217 - if (pcmcia_request_io(pdev, &pdev->io) != 0) 218 + pdev->resource[0]->end = io->win[0].len; 219 + pdev->resource[1]->end = 0; 220 + if (pcmcia_request_io(pdev) != 0) 218 221 return -ENODEV; 219 - stk->ctl_base = pdev->io.BasePort1 + 0x0e; 222 + stk->ctl_base = pdev->resource[0]->start + 0x0e; 220 223 } else 221 224 return -ENODEV; 222 225 /* If we've got this far, we're done */ ··· 247 246 struct ata_port_operations *ops = &pcmcia_port_ops; 248 247 249 248 /* Set up attributes in order to probe card and get resources */ 250 - pdev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 251 - pdev->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 252 - pdev->io.IOAddrLines = 3; 249 + pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 250 + pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 253 251 pdev->conf.Attributes = CONF_ENABLE_IRQ; 254 252 pdev->conf.IntType = INT_MEMORY_AND_IO; 255 253 ··· 271 271 if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) 272 272 goto failed; /* No suitable config found */ 273 273 } 274 - io_base = pdev->io.BasePort1; 274 + io_base = pdev->resource[0]->start; 275 275 ctl_base = stk->ctl_base; 276 276 if (!pdev->irq) 277 277 goto failed; ··· 294 294 295 295 /* FIXME: Could be more ports at base + 0x10 but we only deal with 296 296 one right now */ 297 - if (pdev->io.NumPorts1 >= 0x20) 297 + if (resource_size(pdev->resource[0]) >= 0x20) 298 298 n_ports = 2; 299 299 300 300 if (pdev->manf_id == 0x0097 && pdev->card_id == 0x1620)
+15 -17
drivers/bluetooth/bluecard_cs.c
··· 39 39 #include <linux/skbuff.h> 40 40 #include <linux/io.h> 41 41 42 - #include <pcmcia/cs_types.h> 43 42 #include <pcmcia/cs.h> 44 43 #include <pcmcia/cistpl.h> 45 44 #include <pcmcia/ciscode.h> ··· 159 160 static void bluecard_activity_led_timeout(u_long arg) 160 161 { 161 162 bluecard_info_t *info = (bluecard_info_t *)arg; 162 - unsigned int iobase = info->p_dev->io.BasePort1; 163 + unsigned int iobase = info->p_dev->resource[0]->start; 163 164 164 165 if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) 165 166 return; ··· 176 177 177 178 static void bluecard_enable_activity_led(bluecard_info_t *info) 178 179 { 179 - unsigned int iobase = info->p_dev->io.BasePort1; 180 + unsigned int iobase = info->p_dev->resource[0]->start; 180 181 181 182 if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) 182 183 return; ··· 232 233 } 233 234 234 235 do { 235 - register unsigned int iobase = info->p_dev->io.BasePort1; 236 + register unsigned int iobase = info->p_dev->resource[0]->start; 236 237 register unsigned int offset; 237 238 register unsigned char command; 238 239 register unsigned long ready_bit; ··· 379 380 return; 380 381 } 381 382 382 - iobase = info->p_dev->io.BasePort1; 383 + iobase = info->p_dev->resource[0]->start; 383 384 384 385 if (test_bit(XMIT_SENDING_READY, &(info->tx_state))) 385 386 bluecard_enable_activity_led(info); ··· 508 509 if (!test_bit(CARD_READY, &(info->hw_state))) 509 510 return IRQ_HANDLED; 510 511 511 - iobase = info->p_dev->io.BasePort1; 512 + iobase = info->p_dev->resource[0]->start; 512 513 513 514 spin_lock(&(info->lock)); 514 515 ··· 622 623 static int bluecard_hci_open(struct hci_dev *hdev) 623 624 { 624 625 bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data); 625 - unsigned int iobase = info->p_dev->io.BasePort1; 626 + unsigned int iobase = info->p_dev->resource[0]->start; 626 627 627 628 if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) 628 629 bluecard_hci_set_baud_rate(hdev, DEFAULT_BAUD_RATE); ··· 642 643 static int bluecard_hci_close(struct hci_dev *hdev) 643 644 { 644 645 bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data); 645 - unsigned int iobase = info->p_dev->io.BasePort1; 646 + unsigned int iobase = info->p_dev->resource[0]->start; 646 647 647 648 if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags))) 648 649 return 0; ··· 709 710 710 711 static int bluecard_open(bluecard_info_t *info) 711 712 { 712 - unsigned int iobase = info->p_dev->io.BasePort1; 713 + unsigned int iobase = info->p_dev->resource[0]->start; 713 714 struct hci_dev *hdev; 714 715 unsigned char id; 715 716 ··· 828 829 829 830 static int bluecard_close(bluecard_info_t *info) 830 831 { 831 - unsigned int iobase = info->p_dev->io.BasePort1; 832 + unsigned int iobase = info->p_dev->resource[0]->start; 832 833 struct hci_dev *hdev = info->hdev; 833 834 834 835 if (!hdev) ··· 865 866 info->p_dev = link; 866 867 link->priv = info; 867 868 868 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 869 - link->io.NumPorts1 = 8; 870 - 871 869 link->conf.Attributes = CONF_ENABLE_IRQ; 872 870 link->conf.IntType = INT_MEMORY_AND_IO; 873 871 ··· 887 891 int i, n; 888 892 889 893 link->conf.ConfigIndex = 0x20; 890 - link->io.NumPorts1 = 64; 891 - link->io.IOAddrLines = 6; 894 + 895 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 896 + link->resource[0]->end = 64; 897 + link->io_lines = 6; 892 898 893 899 for (n = 0; n < 0x400; n += 0x40) { 894 - link->io.BasePort1 = n ^ 0x300; 895 - i = pcmcia_request_io(link, &link->io); 900 + link->resource[0]->start = n ^ 0x300; 901 + i = pcmcia_request_io(link); 896 902 if (i == 0) 897 903 break; 898 904 }
+13 -14
drivers/bluetooth/bt3c_cs.c
··· 45 45 #include <linux/device.h> 46 46 #include <linux/firmware.h> 47 47 48 - #include <pcmcia/cs_types.h> 49 48 #include <pcmcia/cs.h> 50 49 #include <pcmcia/cistpl.h> 51 50 #include <pcmcia/ciscode.h> ··· 188 189 return; 189 190 190 191 do { 191 - register unsigned int iobase = info->p_dev->io.BasePort1; 192 + register unsigned int iobase = info->p_dev->resource[0]->start; 192 193 register struct sk_buff *skb; 193 194 register int len; 194 195 ··· 226 227 return; 227 228 } 228 229 229 - iobase = info->p_dev->io.BasePort1; 230 + iobase = info->p_dev->resource[0]->start; 230 231 231 232 avail = bt3c_read(iobase, 0x7006); 232 233 //printk("bt3c_cs: receiving %d bytes\n", avail); ··· 347 348 /* our irq handler is shared */ 348 349 return IRQ_NONE; 349 350 350 - iobase = info->p_dev->io.BasePort1; 351 + iobase = info->p_dev->resource[0]->start; 351 352 352 353 spin_lock(&(info->lock)); 353 354 ··· 480 481 unsigned int iobase, size, addr, fcs, tmp; 481 482 int i, err = 0; 482 483 483 - iobase = info->p_dev->io.BasePort1; 484 + iobase = info->p_dev->resource[0]->start; 484 485 485 486 /* Reset */ 486 487 bt3c_io_write(iobase, 0x8040, 0x0404); ··· 657 658 info->p_dev = link; 658 659 link->priv = info; 659 660 660 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 661 - link->io.NumPorts1 = 8; 661 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 662 + link->resource[0]->end = 8; 662 663 663 664 link->conf.Attributes = CONF_ENABLE_IRQ; 664 665 link->conf.IntType = INT_MEMORY_AND_IO; ··· 683 684 { 684 685 unsigned long try = (unsigned long) priv_data; 685 686 687 + p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; 688 + 686 689 if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) 687 690 p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; 688 691 if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && 689 692 (cf->io.win[0].base != 0)) { 690 - p_dev->io.BasePort1 = cf->io.win[0].base; 691 - p_dev->io.IOAddrLines = (try == 0) ? 16 : 692 - cf->io.flags & CISTPL_IO_LINES_MASK; 693 - if (!pcmcia_request_io(p_dev, &p_dev->io)) 693 + p_dev->resource[0]->start = cf->io.win[0].base; 694 + if (!pcmcia_request_io(p_dev)) 694 695 return 0; 695 696 } 696 697 return -ENODEV; ··· 707 708 708 709 if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { 709 710 for (j = 0; j < 5; j++) { 710 - p_dev->io.BasePort1 = base[j]; 711 - p_dev->io.IOAddrLines = base[j] ? 16 : 3; 712 - if (!pcmcia_request_io(p_dev, &p_dev->io)) 711 + p_dev->resource[0]->start = base[j]; 712 + p_dev->io_lines = base[j] ? 16 : 3; 713 + if (!pcmcia_request_io(p_dev)) 713 714 return 0; 714 715 } 715 716 }
+15 -16
drivers/bluetooth/btuart_cs.c
··· 41 41 #include <asm/system.h> 42 42 #include <asm/io.h> 43 43 44 - #include <pcmcia/cs_types.h> 45 44 #include <pcmcia/cs.h> 46 45 #include <pcmcia/cistpl.h> 47 46 #include <pcmcia/ciscode.h> ··· 142 143 } 143 144 144 145 do { 145 - register unsigned int iobase = info->p_dev->io.BasePort1; 146 + register unsigned int iobase = info->p_dev->resource[0]->start; 146 147 register struct sk_buff *skb; 147 148 register int len; 148 149 ··· 183 184 return; 184 185 } 185 186 186 - iobase = info->p_dev->io.BasePort1; 187 + iobase = info->p_dev->resource[0]->start; 187 188 188 189 do { 189 190 info->hdev->stat.byte_rx++; ··· 297 298 /* our irq handler is shared */ 298 299 return IRQ_NONE; 299 300 300 - iobase = info->p_dev->io.BasePort1; 301 + iobase = info->p_dev->resource[0]->start; 301 302 302 303 spin_lock(&(info->lock)); 303 304 ··· 354 355 return; 355 356 } 356 357 357 - iobase = info->p_dev->io.BasePort1; 358 + iobase = info->p_dev->resource[0]->start; 358 359 359 360 spin_lock_irqsave(&(info->lock), flags); 360 361 ··· 478 479 static int btuart_open(btuart_info_t *info) 479 480 { 480 481 unsigned long flags; 481 - unsigned int iobase = info->p_dev->io.BasePort1; 482 + unsigned int iobase = info->p_dev->resource[0]->start; 482 483 struct hci_dev *hdev; 483 484 484 485 spin_lock_init(&(info->lock)); ··· 548 549 static int btuart_close(btuart_info_t *info) 549 550 { 550 551 unsigned long flags; 551 - unsigned int iobase = info->p_dev->io.BasePort1; 552 + unsigned int iobase = info->p_dev->resource[0]->start; 552 553 struct hci_dev *hdev = info->hdev; 553 554 554 555 if (!hdev) ··· 586 587 info->p_dev = link; 587 588 link->priv = info; 588 589 589 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 590 - link->io.NumPorts1 = 8; 590 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 591 + link->resource[0]->end = 8; 591 592 592 593 link->conf.Attributes = CONF_ENABLE_IRQ; 593 594 link->conf.IntType = INT_MEMORY_AND_IO; ··· 612 613 { 613 614 int *try = priv_data; 614 615 616 + p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; 617 + 615 618 if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) 616 619 p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; 617 620 if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && 618 621 (cf->io.win[0].base != 0)) { 619 - p_dev->io.BasePort1 = cf->io.win[0].base; 620 - p_dev->io.IOAddrLines = (*try == 0) ? 16 : 621 - cf->io.flags & CISTPL_IO_LINES_MASK; 622 - if (!pcmcia_request_io(p_dev, &p_dev->io)) 622 + p_dev->resource[0]->start = cf->io.win[0].base; 623 + if (!pcmcia_request_io(p_dev)) 623 624 return 0; 624 625 } 625 626 return -ENODEV; ··· 636 637 637 638 if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { 638 639 for (j = 0; j < 5; j++) { 639 - p_dev->io.BasePort1 = base[j]; 640 - p_dev->io.IOAddrLines = base[j] ? 16 : 3; 641 - if (!pcmcia_request_io(p_dev, &p_dev->io)) 640 + p_dev->resource[0]->start = base[j]; 641 + p_dev->io_lines = base[j] ? 16 : 3; 642 + if (!pcmcia_request_io(p_dev)) 642 643 return 0; 643 644 } 644 645 }
+17 -18
drivers/bluetooth/dtl1_cs.c
··· 41 41 #include <asm/system.h> 42 42 #include <asm/io.h> 43 43 44 - #include <pcmcia/cs_types.h> 45 44 #include <pcmcia/cs.h> 46 45 #include <pcmcia/cistpl.h> 47 46 #include <pcmcia/ciscode.h> ··· 149 150 } 150 151 151 152 do { 152 - register unsigned int iobase = info->p_dev->io.BasePort1; 153 + register unsigned int iobase = info->p_dev->resource[0]->start; 153 154 register struct sk_buff *skb; 154 155 register int len; 155 156 ··· 214 215 return; 215 216 } 216 217 217 - iobase = info->p_dev->io.BasePort1; 218 + iobase = info->p_dev->resource[0]->start; 218 219 219 220 do { 220 221 info->hdev->stat.byte_rx++; ··· 301 302 /* our irq handler is shared */ 302 303 return IRQ_NONE; 303 304 304 - iobase = info->p_dev->io.BasePort1; 305 + iobase = info->p_dev->resource[0]->start; 305 306 306 307 spin_lock(&(info->lock)); 307 308 ··· 461 462 static int dtl1_open(dtl1_info_t *info) 462 463 { 463 464 unsigned long flags; 464 - unsigned int iobase = info->p_dev->io.BasePort1; 465 + unsigned int iobase = info->p_dev->resource[0]->start; 465 466 struct hci_dev *hdev; 466 467 467 468 spin_lock_init(&(info->lock)); ··· 508 509 outb(UART_LCR_WLEN8, iobase + UART_LCR); /* Reset DLAB */ 509 510 outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase + UART_MCR); 510 511 511 - info->ri_latch = inb(info->p_dev->io.BasePort1 + UART_MSR) & UART_MSR_RI; 512 + info->ri_latch = inb(info->p_dev->resource[0]->start + UART_MSR) 513 + & UART_MSR_RI; 512 514 513 515 /* Turn on interrupts */ 514 516 outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER); ··· 534 534 static int dtl1_close(dtl1_info_t *info) 535 535 { 536 536 unsigned long flags; 537 - unsigned int iobase = info->p_dev->io.BasePort1; 537 + unsigned int iobase = info->p_dev->resource[0]->start; 538 538 struct hci_dev *hdev = info->hdev; 539 539 540 540 if (!hdev) ··· 572 572 info->p_dev = link; 573 573 link->priv = info; 574 574 575 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 576 - link->io.NumPorts1 = 8; 575 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 576 + link->resource[0]->end = 8; 577 577 578 578 link->conf.Attributes = CONF_ENABLE_IRQ; 579 579 link->conf.IntType = INT_MEMORY_AND_IO; ··· 597 597 unsigned int vcc, 598 598 void *priv_data) 599 599 { 600 - if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { 601 - p_dev->io.BasePort1 = cf->io.win[0].base; 602 - p_dev->io.NumPorts1 = cf->io.win[0].len; /*yo */ 603 - p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; 604 - if (!pcmcia_request_io(p_dev, &p_dev->io)) 605 - return 0; 606 - } 607 - return -ENODEV; 600 + if ((cf->io.nwin != 1) || (cf->io.win[0].len <= 8)) 601 + return -ENODEV; 602 + 603 + p_dev->resource[0]->start = cf->io.win[0].base; 604 + p_dev->resource[0]->end = cf->io.win[0].len; /*yo */ 605 + p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; 606 + return pcmcia_request_io(p_dev); 608 607 } 609 608 610 609 static int dtl1_config(struct pcmcia_device *link) ··· 612 613 int i; 613 614 614 615 /* Look for a generic full-sized window */ 615 - link->io.NumPorts1 = 8; 616 + link->resource[0]->end = 8; 616 617 if (pcmcia_loop_config(link, dtl1_confcheck, NULL) < 0) 617 618 goto failed; 618 619
+11 -17
drivers/char/pcmcia/cm4000_cs.c
··· 34 34 #include <linux/uaccess.h> 35 35 #include <linux/io.h> 36 36 37 - #include <pcmcia/cs_types.h> 38 37 #include <pcmcia/cs.h> 39 38 #include <pcmcia/cistpl.h> 40 39 #include <pcmcia/cisreg.h> ··· 421 422 static void set_cardparameter(struct cm4000_dev *dev) 422 423 { 423 424 int i; 424 - unsigned int iobase = dev->p_dev->io.BasePort1; 425 + unsigned int iobase = dev->p_dev->resource[0]->start; 425 426 u_int8_t stopbits = 0x02; /* ISO default */ 426 427 427 428 DEBUGP(3, dev, "-> set_cardparameter\n"); ··· 454 455 unsigned short num_bytes_read; 455 456 unsigned char pts_reply[4]; 456 457 ssize_t rc; 457 - unsigned int iobase = dev->p_dev->io.BasePort1; 458 + unsigned int iobase = dev->p_dev->resource[0]->start; 458 459 459 460 rc = 0; 460 461 ··· 663 664 static void monitor_card(unsigned long p) 664 665 { 665 666 struct cm4000_dev *dev = (struct cm4000_dev *) p; 666 - unsigned int iobase = dev->p_dev->io.BasePort1; 667 + unsigned int iobase = dev->p_dev->resource[0]->start; 667 668 unsigned short s; 668 669 struct ptsreq ptsreq; 669 670 int i, atrc; ··· 924 925 loff_t *ppos) 925 926 { 926 927 struct cm4000_dev *dev = filp->private_data; 927 - unsigned int iobase = dev->p_dev->io.BasePort1; 928 + unsigned int iobase = dev->p_dev->resource[0]->start; 928 929 ssize_t rc; 929 930 int i, j, k; 930 931 ··· 1047 1048 size_t count, loff_t *ppos) 1048 1049 { 1049 1050 struct cm4000_dev *dev = filp->private_data; 1050 - unsigned int iobase = dev->p_dev->io.BasePort1; 1051 + unsigned int iobase = dev->p_dev->resource[0]->start; 1051 1052 unsigned short s; 1052 1053 unsigned char tmp; 1053 1054 unsigned char infolen; ··· 1400 1401 static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) 1401 1402 { 1402 1403 struct cm4000_dev *dev = filp->private_data; 1403 - unsigned int iobase = dev->p_dev->io.BasePort1; 1404 + unsigned int iobase = dev->p_dev->resource[0]->start; 1404 1405 struct inode *inode = filp->f_path.dentry->d_inode; 1405 1406 struct pcmcia_device *link; 1406 1407 int size; ··· 1751 1752 if (!cfg->io.nwin) 1752 1753 return -ENODEV; 1753 1754 1754 - /* Get the IOaddr */ 1755 - p_dev->io.BasePort1 = cfg->io.win[0].base; 1756 - p_dev->io.NumPorts1 = cfg->io.win[0].len; 1757 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 1758 - if (!(cfg->io.flags & CISTPL_IO_8BIT)) 1759 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 1760 - if (!(cfg->io.flags & CISTPL_IO_16BIT)) 1761 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 1762 - p_dev->io.IOAddrLines = cfg->io.flags & CISTPL_IO_LINES_MASK; 1755 + p_dev->resource[0]->start = cfg->io.win[0].base; 1756 + p_dev->resource[0]->end = cfg->io.win[0].len; 1757 + p_dev->resource[0]->flags |= pcmcia_io_cfg_data_width(cfg->io.flags); 1758 + p_dev->io_lines = cfg->io.flags & CISTPL_IO_LINES_MASK; 1763 1759 1764 - return pcmcia_request_io(p_dev, &p_dev->io); 1760 + return pcmcia_request_io(p_dev); 1765 1761 } 1766 1762 1767 1763 static int cm4000_config(struct pcmcia_device * link, int devno)
+13 -22
drivers/char/pcmcia/cm4040_cs.c
··· 29 29 #include <asm/uaccess.h> 30 30 #include <asm/io.h> 31 31 32 - #include <pcmcia/cs_types.h> 33 32 #include <pcmcia/cs.h> 34 33 #include <pcmcia/cistpl.h> 35 34 #include <pcmcia/cisreg.h> ··· 109 110 static void cm4040_do_poll(unsigned long dummy) 110 111 { 111 112 struct reader_dev *dev = (struct reader_dev *) dummy; 112 - unsigned int obs = xinb(dev->p_dev->io.BasePort1 113 + unsigned int obs = xinb(dev->p_dev->resource[0]->start 113 114 + REG_OFFSET_BUFFER_STATUS); 114 115 115 116 if ((obs & BSR_BULK_IN_FULL)) { ··· 140 141 static int wait_for_bulk_out_ready(struct reader_dev *dev) 141 142 { 142 143 int i, rc; 143 - int iobase = dev->p_dev->io.BasePort1; 144 + int iobase = dev->p_dev->resource[0]->start; 144 145 145 146 for (i = 0; i < POLL_LOOP_COUNT; i++) { 146 147 if ((xinb(iobase + REG_OFFSET_BUFFER_STATUS) ··· 170 171 /* Write to Sync Control Register */ 171 172 static int write_sync_reg(unsigned char val, struct reader_dev *dev) 172 173 { 173 - int iobase = dev->p_dev->io.BasePort1; 174 + int iobase = dev->p_dev->resource[0]->start; 174 175 int rc; 175 176 176 177 rc = wait_for_bulk_out_ready(dev); ··· 188 189 static int wait_for_bulk_in_ready(struct reader_dev *dev) 189 190 { 190 191 int i, rc; 191 - int iobase = dev->p_dev->io.BasePort1; 192 + int iobase = dev->p_dev->resource[0]->start; 192 193 193 194 for (i = 0; i < POLL_LOOP_COUNT; i++) { 194 195 if ((xinb(iobase + REG_OFFSET_BUFFER_STATUS) ··· 218 219 size_t count, loff_t *ppos) 219 220 { 220 221 struct reader_dev *dev = filp->private_data; 221 - int iobase = dev->p_dev->io.BasePort1; 222 + int iobase = dev->p_dev->resource[0]->start; 222 223 size_t bytes_to_read; 223 224 unsigned long i; 224 225 size_t min_bytes_to_read; ··· 320 321 size_t count, loff_t *ppos) 321 322 { 322 323 struct reader_dev *dev = filp->private_data; 323 - int iobase = dev->p_dev->io.BasePort1; 324 + int iobase = dev->p_dev->resource[0]->start; 324 325 ssize_t rc; 325 326 int i; 326 327 unsigned int bytes_to_write; ··· 527 528 return -ENODEV; 528 529 529 530 /* Get the IOaddr */ 530 - p_dev->io.BasePort1 = cfg->io.win[0].base; 531 - p_dev->io.NumPorts1 = cfg->io.win[0].len; 532 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 533 - if (!(cfg->io.flags & CISTPL_IO_8BIT)) 534 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 535 - if (!(cfg->io.flags & CISTPL_IO_16BIT)) 536 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 537 - p_dev->io.IOAddrLines = cfg->io.flags & CISTPL_IO_LINES_MASK; 531 + p_dev->resource[0]->start = cfg->io.win[0].base; 532 + p_dev->resource[0]->end = cfg->io.win[0].len; 533 + p_dev->resource[0]->flags |= pcmcia_io_cfg_data_width(cfg->io.flags); 534 + p_dev->io_lines = cfg->io.flags & CISTPL_IO_LINES_MASK; 535 + rc = pcmcia_request_io(p_dev); 538 536 539 - rc = pcmcia_request_io(p_dev, &p_dev->io); 540 537 dev_printk(KERN_INFO, &p_dev->dev, 541 538 "pcmcia_request_io returned 0x%x\n", rc); 542 539 return rc; ··· 543 548 { 544 549 struct reader_dev *dev; 545 550 int fail_rc; 546 - 547 - link->io.BasePort2 = 0; 548 - link->io.NumPorts2 = 0; 549 - link->io.Attributes2 = 0; 550 551 551 552 if (pcmcia_loop_config(link, cm4040_config_check, NULL)) 552 553 goto cs_release; ··· 559 568 560 569 dev = link->priv; 561 570 562 - DEBUGP(2, dev, "device " DEVICE_NAME "%d at 0x%.4x-0x%.4x\n", devno, 563 - link->io.BasePort1, link->io.BasePort1+link->io.NumPorts1); 571 + DEBUGP(2, dev, "device " DEVICE_NAME "%d at %pR\n", devno, 572 + link->resource[0]); 564 573 DEBUGP(2, dev, "<- reader_config (succ)\n"); 565 574 566 575 return 0;
+13 -34
drivers/char/pcmcia/ipwireless/main.c
··· 84 84 { 85 85 struct ipw_dev *ipw = priv_data; 86 86 struct resource *io_resource; 87 - memreq_t memreq_attr_memory; 88 - memreq_t memreq_common_memory; 89 87 int ret; 90 88 91 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 92 - p_dev->io.BasePort1 = cfg->io.win[0].base; 93 - p_dev->io.NumPorts1 = cfg->io.win[0].len; 94 - p_dev->io.IOAddrLines = 16; 89 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 90 + p_dev->resource[0]->start = cfg->io.win[0].base; 91 + p_dev->resource[0]->end = cfg->io.win[0].len; 95 92 96 93 /* 0x40 causes it to generate level mode interrupts. */ 97 94 /* 0x04 enables IREQ pin. */ 98 95 p_dev->conf.ConfigIndex = cfg->index | 0x44; 99 - ret = pcmcia_request_io(p_dev, &p_dev->io); 96 + p_dev->io_lines = 16; 97 + ret = pcmcia_request_io(p_dev); 100 98 if (ret) 101 99 return ret; 102 100 103 - io_resource = request_region(p_dev->io.BasePort1, p_dev->io.NumPorts1, 101 + io_resource = request_region(p_dev->resource[0]->start, 102 + resource_size(p_dev->resource[0]), 104 103 IPWIRELESS_PCCARD_NAME); 105 104 106 105 if (cfg->mem.nwin == 0) ··· 119 120 if (ret != 0) 120 121 goto exit1; 121 122 122 - memreq_common_memory.CardOffset = cfg->mem.win[0].card_addr; 123 - memreq_common_memory.Page = 0; 124 - 125 123 ret = pcmcia_map_mem_page(p_dev, ipw->handle_common_memory, 126 - &memreq_common_memory); 124 + cfg->mem.win[0].card_addr); 127 125 128 126 if (ret != 0) 129 127 goto exit2; ··· 145 149 if (ret != 0) 146 150 goto exit2; 147 151 148 - memreq_attr_memory.CardOffset = 0; 149 - memreq_attr_memory.Page = 0; 150 - 151 - ret = pcmcia_map_mem_page(p_dev, ipw->handle_attr_memory, 152 - &memreq_attr_memory); 153 - 152 + ret = pcmcia_map_mem_page(p_dev, ipw->handle_attr_memory, 0); 154 153 if (ret != 0) 155 154 goto exit3; 156 155 ··· 157 166 return 0; 158 167 159 168 exit3: 160 - pcmcia_release_window(p_dev, ipw->handle_attr_memory); 161 169 exit2: 162 170 if (ipw->common_memory) { 163 171 release_mem_region(ipw->request_common_memory.Base, 164 172 ipw->request_common_memory.Size); 165 173 iounmap(ipw->common_memory); 166 - pcmcia_release_window(p_dev, ipw->handle_common_memory); 167 - } else 168 - pcmcia_release_window(p_dev, ipw->handle_common_memory); 174 + } 169 175 exit1: 170 176 release_resource(io_resource); 171 177 pcmcia_disable_device(p_dev); ··· 185 197 186 198 INIT_WORK(&ipw->work_reboot, signalled_reboot_work); 187 199 188 - ipwireless_init_hardware_v1(ipw->hardware, link->io.BasePort1, 200 + ipwireless_init_hardware_v1(ipw->hardware, link->resource[0]->start, 189 201 ipw->attr_memory, ipw->common_memory, 190 202 ipw->is_v2_card, signalled_reboot_callback, 191 203 ipw); ··· 197 209 printk(KERN_INFO IPWIRELESS_PCCARD_NAME ": Card type %s\n", 198 210 ipw->is_v2_card ? "V2/V3" : "V1"); 199 211 printk(KERN_INFO IPWIRELESS_PCCARD_NAME 200 - ": I/O ports 0x%04x-0x%04x, irq %d\n", 201 - (unsigned int) link->io.BasePort1, 202 - (unsigned int) (link->io.BasePort1 + 203 - link->io.NumPorts1 - 1), 212 + ": I/O ports %pR, irq %d\n", link->resource[0], 204 213 (unsigned int) link->irq); 205 214 if (ipw->attr_memory && ipw->common_memory) 206 215 printk(KERN_INFO IPWIRELESS_PCCARD_NAME ··· 235 250 release_mem_region(ipw->request_attr_memory.Base, 236 251 ipw->request_attr_memory.Size); 237 252 iounmap(ipw->attr_memory); 238 - pcmcia_release_window(link, ipw->handle_attr_memory); 253 + 239 254 } 240 255 if (ipw->common_memory) { 241 256 release_mem_region(ipw->request_common_memory.Base, 242 257 ipw->request_common_memory.Size); 243 258 iounmap(ipw->common_memory); 244 - pcmcia_release_window(link, ipw->handle_common_memory); 245 259 } 246 260 pcmcia_disable_device(link); 247 261 return -1; ··· 258 274 ipw->request_attr_memory.Size); 259 275 iounmap(ipw->attr_memory); 260 276 } 261 - if (ipw->common_memory) 262 - pcmcia_release_window(ipw->link, ipw->handle_common_memory); 263 - if (ipw->attr_memory) 264 - pcmcia_release_window(ipw->link, ipw->handle_attr_memory); 265 - 266 277 pcmcia_disable_device(ipw->link); 267 278 } 268 279
-1
drivers/char/pcmcia/ipwireless/main.h
··· 21 21 #include <linux/sched.h> 22 22 #include <linux/types.h> 23 23 24 - #include <pcmcia/cs_types.h> 25 24 #include <pcmcia/cs.h> 26 25 #include <pcmcia/cistpl.h> 27 26 #include <pcmcia/ds.h>
-1
drivers/char/pcmcia/ipwireless/tty.h
··· 21 21 #include <linux/types.h> 22 22 #include <linux/sched.h> 23 23 24 - #include <pcmcia/cs_types.h> 25 24 #include <pcmcia/cs.h> 26 25 #include <pcmcia/cistpl.h> 27 26 #include <pcmcia/ds.h>
+20 -19
drivers/ide/ide-cs.c
··· 43 43 #include <asm/io.h> 44 44 #include <asm/system.h> 45 45 46 - #include <pcmcia/cs_types.h> 47 46 #include <pcmcia/cs.h> 48 47 #include <pcmcia/cistpl.h> 49 48 #include <pcmcia/ds.h> ··· 97 98 info->p_dev = link; 98 99 link->priv = info; 99 100 100 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 101 - link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 102 - link->io.IOAddrLines = 3; 101 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 102 + link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 103 103 link->conf.Attributes = CONF_ENABLE_IRQ; 104 104 link->conf.IntType = INT_MEMORY_AND_IO; 105 105 ··· 227 229 228 230 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 229 231 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 232 + pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 233 + 230 234 pdev->conf.ConfigIndex = cfg->index; 231 - pdev->io.BasePort1 = io->win[0].base; 232 - pdev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 233 - if (!(io->flags & CISTPL_IO_16BIT)) 234 - pdev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 235 + pdev->resource[0]->start = io->win[0].base; 236 + if (!(io->flags & CISTPL_IO_16BIT)) { 237 + pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 238 + pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 239 + } 235 240 if (io->nwin == 2) { 236 - pdev->io.NumPorts1 = 8; 237 - pdev->io.BasePort2 = io->win[1].base; 238 - pdev->io.NumPorts2 = (stk->is_kme) ? 2 : 1; 239 - if (pcmcia_request_io(pdev, &pdev->io) != 0) 241 + pdev->resource[0]->end = 8; 242 + pdev->resource[1]->start = io->win[1].base; 243 + pdev->resource[1]->end = (stk->is_kme) ? 2 : 1; 244 + if (pcmcia_request_io(pdev) != 0) 240 245 return -ENODEV; 241 - stk->ctl_base = pdev->io.BasePort2; 246 + stk->ctl_base = pdev->resource[1]->start; 242 247 } else if ((io->nwin == 1) && (io->win[0].len >= 16)) { 243 - pdev->io.NumPorts1 = io->win[0].len; 244 - pdev->io.NumPorts2 = 0; 245 - if (pcmcia_request_io(pdev, &pdev->io) != 0) 248 + pdev->resource[0]->end = io->win[0].len; 249 + pdev->resource[1]->end = 0; 250 + if (pcmcia_request_io(pdev) != 0) 246 251 return -ENODEV; 247 - stk->ctl_base = pdev->io.BasePort1 + 0x0e; 252 + stk->ctl_base = pdev->resource[0]->start + 0x0e; 248 253 } else 249 254 return -ENODEV; 250 255 /* If we've got this far, we're done */ ··· 281 280 if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) 282 281 goto failed; /* No suitable config found */ 283 282 } 284 - io_base = link->io.BasePort1; 283 + io_base = link->resource[0]->start; 285 284 ctl_base = stk->ctl_base; 286 285 287 286 if (!link->irq) ··· 298 297 outb(0x81, ctl_base+1); 299 298 300 299 host = idecs_register(io_base, ctl_base, link->irq, link); 301 - if (host == NULL && link->io.NumPorts1 == 0x20) { 300 + if (host == NULL && resource_size(link->resource[0]) == 0x20) { 302 301 outb(0x02, ctl_base + 0x10); 303 302 host = idecs_register(io_base + 0x10, ctl_base + 0x10, 304 303 link->irq, link);
+10 -15
drivers/isdn/hardware/avm/avm_cs.c
··· 20 20 #include <asm/io.h> 21 21 #include <asm/system.h> 22 22 23 - #include <pcmcia/cs_types.h> 24 23 #include <pcmcia/cs.h> 25 24 #include <pcmcia/cistpl.h> 26 25 #include <pcmcia/ciscode.h> ··· 75 76 { 76 77 77 78 /* The io structure describes IO port mapping */ 78 - p_dev->io.NumPorts1 = 16; 79 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 80 - p_dev->io.NumPorts2 = 0; 79 + p_dev->resource[0]->end = 16; 80 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 81 81 82 82 /* General socket configuration */ 83 83 p_dev->conf.Attributes = CONF_ENABLE_IRQ; ··· 118 120 if (cf->io.nwin <= 0) 119 121 return -ENODEV; 120 122 121 - p_dev->io.BasePort1 = cf->io.win[0].base; 122 - p_dev->io.NumPorts1 = cf->io.win[0].len; 123 - p_dev->io.NumPorts2 = 0; 124 - printk(KERN_INFO "avm_cs: testing i/o %#x-%#x\n", 125 - p_dev->io.BasePort1, 126 - p_dev->io.BasePort1+p_dev->io.NumPorts1-1); 127 - return pcmcia_request_io(p_dev, &p_dev->io); 123 + p_dev->resource[0]->start = cf->io.win[0].base; 124 + p_dev->resource[0]->end = cf->io.win[0].len; 125 + return pcmcia_request_io(p_dev); 128 126 } 129 127 130 128 static int avmcs_config(struct pcmcia_device *link) ··· 186 192 default: 187 193 case AVM_CARDTYPE_B1: addcard = b1pcmcia_addcard_b1; break; 188 194 } 189 - if ((i = (*addcard)(link->io.BasePort1, link->irq)) < 0) { 190 - dev_err(&link->dev, "avm_cs: failed to add AVM-Controller at i/o %#x, irq %d\n", 191 - link->io.BasePort1, link->irq); 195 + if ((i = (*addcard)(link->resource[0]->start, link->irq)) < 0) { 196 + dev_err(&link->dev, 197 + "avm_cs: failed to add AVM-Controller at i/o %#x, irq %d\n", 198 + (unsigned int) link->resource[0]->start, link->irq); 192 199 avmcs_release(link); 193 200 return -ENODEV; 194 201 } ··· 207 212 208 213 static void avmcs_release(struct pcmcia_device *link) 209 214 { 210 - b1pcmcia_delcard(link->io.BasePort1, link->irq); 215 + b1pcmcia_delcard(link->resource[0]->start, link->irq); 211 216 pcmcia_disable_device(link); 212 217 } /* avmcs_release */ 213 218
+13 -16
drivers/isdn/hisax/avma1_cs.c
··· 20 20 #include <asm/io.h> 21 21 #include <asm/system.h> 22 22 23 - #include <pcmcia/cs_types.h> 24 23 #include <pcmcia/cs.h> 25 24 #include <pcmcia/cistpl.h> 26 25 #include <pcmcia/ds.h> ··· 78 79 dev_dbg(&p_dev->dev, "avma1cs_attach()\n"); 79 80 80 81 /* The io structure describes IO port mapping */ 81 - p_dev->io.NumPorts1 = 16; 82 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 83 - p_dev->io.NumPorts2 = 16; 84 - p_dev->io.Attributes2 = IO_DATA_PATH_WIDTH_16; 85 - p_dev->io.IOAddrLines = 5; 82 + p_dev->resource[0]->end = 16; 83 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 84 + p_dev->resource[1]->end = 16; 85 + p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_16; 86 86 87 87 /* General socket configuration */ 88 88 p_dev->conf.Attributes = CONF_ENABLE_IRQ; ··· 125 127 if (cf->io.nwin <= 0) 126 128 return -ENODEV; 127 129 128 - p_dev->io.BasePort1 = cf->io.win[0].base; 129 - p_dev->io.NumPorts1 = cf->io.win[0].len; 130 - p_dev->io.NumPorts2 = 0; 131 - printk(KERN_INFO "avma1_cs: testing i/o %#x-%#x\n", 132 - p_dev->io.BasePort1, 133 - p_dev->io.BasePort1+p_dev->io.NumPorts1-1); 134 - return pcmcia_request_io(p_dev, &p_dev->io); 130 + p_dev->resource[0]->start = cf->io.win[0].base; 131 + p_dev->resource[0]->end = cf->io.win[0].len; 132 + p_dev->io_lines = 5; 133 + return pcmcia_request_io(p_dev); 135 134 } 136 135 137 136 ··· 176 181 } 177 182 178 183 printk(KERN_NOTICE "avma1_cs: checking at i/o %#x, irq %d\n", 179 - link->io.BasePort1, link->irq); 184 + (unsigned int) link->resource[0]->start, link->irq); 180 185 181 186 icard.para[0] = link->irq; 182 - icard.para[1] = link->io.BasePort1; 187 + icard.para[1] = link->resource[0]->start; 183 188 icard.protocol = isdnprot; 184 189 icard.typ = ISDN_CTYPE_A1_PCMCIA; 185 190 186 191 i = hisax_init_pcmcia(link, &busy, &icard); 187 192 if (i < 0) { 188 - printk(KERN_ERR "avma1_cs: failed to initialize AVM A1 PCMCIA %d at i/o %#x\n", i, link->io.BasePort1); 193 + printk(KERN_ERR "avma1_cs: failed to initialize AVM A1 " 194 + "PCMCIA %d at i/o %#x\n", i, 195 + (unsigned int) link->resource[0]->start); 189 196 avma1cs_release(link); 190 197 return -ENODEV; 191 198 }
+15 -17
drivers/isdn/hisax/elsa_cs.c
··· 46 46 #include <asm/io.h> 47 47 #include <asm/system.h> 48 48 49 - #include <pcmcia/cs_types.h> 50 49 #include <pcmcia/cs.h> 51 50 #include <pcmcia/cistpl.h> 52 51 #include <pcmcia/cisreg.h> ··· 126 127 and attributes of IO windows) are fixed by the nature of the 127 128 device, and can be hard-wired here. 128 129 */ 129 - link->io.NumPorts1 = 8; 130 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 131 - link->io.IOAddrLines = 3; 130 + link->resource[0]->end = 8; 131 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 132 132 133 133 link->conf.Attributes = CONF_ENABLE_IRQ; 134 134 link->conf.IntType = INT_MEMORY_AND_IO; ··· 172 174 { 173 175 int j; 174 176 177 + p_dev->io_lines = 3; 178 + 175 179 if ((cf->io.nwin > 0) && cf->io.win[0].base) { 176 180 printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n"); 177 - p_dev->io.BasePort1 = cf->io.win[0].base; 178 - if (!pcmcia_request_io(p_dev, &p_dev->io)) 181 + p_dev->resource[0]->start = cf->io.win[0].base; 182 + if (!pcmcia_request_io(p_dev)) 179 183 return 0; 180 184 } else { 181 185 printk(KERN_INFO "(elsa_cs: looks like the 97 model)\n"); 182 186 for (j = 0x2f0; j > 0x100; j -= 0x10) { 183 - p_dev->io.BasePort1 = j; 184 - if (!pcmcia_request_io(p_dev, &p_dev->io)) 187 + p_dev->resource[0]->start = j; 188 + if (!pcmcia_request_io(p_dev)) 185 189 return 0; 186 190 } 187 191 } ··· 215 215 link->conf.ConfigIndex); 216 216 if (link->conf.Attributes & CONF_ENABLE_IRQ) 217 217 printk(", irq %d", link->irq); 218 - if (link->io.NumPorts1) 219 - printk(", io 0x%04x-0x%04x", link->io.BasePort1, 220 - link->io.BasePort1+link->io.NumPorts1-1); 221 - if (link->io.NumPorts2) 222 - printk(" & 0x%04x-0x%04x", link->io.BasePort2, 223 - link->io.BasePort2+link->io.NumPorts2-1); 218 + if (link->resource[0]) 219 + printk(" & %pR", link->resource[0]); 220 + if (link->resource[1]) 221 + printk(" & %pR", link->resource[1]); 224 222 printk("\n"); 225 223 226 224 icard.para[0] = link->irq; 227 - icard.para[1] = link->io.BasePort1; 225 + icard.para[1] = link->resource[0]->start; 228 226 icard.protocol = protocol; 229 227 icard.typ = ISDN_CTYPE_ELSA_PCMCIA; 230 228 231 229 i = hisax_init_pcmcia(link, &(((local_info_t*)link->priv)->busy), &icard); 232 230 if (i < 0) { 233 - printk(KERN_ERR "elsa_cs: failed to initialize Elsa PCMCIA %d at i/o %#x\n", 234 - i, link->io.BasePort1); 231 + printk(KERN_ERR "elsa_cs: failed to initialize Elsa " 232 + "PCMCIA %d with %pR\n", i, link->resource[0]); 235 233 elsa_cs_release(link); 236 234 } else 237 235 ((local_info_t*)link->priv)->cardnr = i;
+21 -62
drivers/isdn/hisax/sedlbauer_cs.c
··· 46 46 #include <asm/io.h> 47 47 #include <asm/system.h> 48 48 49 - #include <pcmcia/cs_types.h> 50 49 #include <pcmcia/cs.h> 51 50 #include <pcmcia/cistpl.h> 52 51 #include <pcmcia/cisreg.h> ··· 129 130 /* from old sedl_cs 130 131 */ 131 132 /* The io structure describes IO port mapping */ 132 - link->io.NumPorts1 = 8; 133 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 134 - link->io.IOAddrLines = 3; 133 + link->resource[0]->end = 8; 134 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 135 135 136 136 link->conf.Attributes = 0; 137 137 link->conf.IntType = INT_MEMORY_AND_IO; ··· 171 173 unsigned int vcc, 172 174 void *priv_data) 173 175 { 174 - win_req_t *req = priv_data; 175 - 176 176 if (cfg->index == 0) 177 177 return -ENODEV; 178 178 ··· 198 202 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 199 203 200 204 /* IO window settings */ 201 - p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 205 + p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 202 206 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 203 207 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 204 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 205 - if (!(io->flags & CISTPL_IO_8BIT)) 206 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 207 - if (!(io->flags & CISTPL_IO_16BIT)) 208 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 209 - p_dev->io.BasePort1 = io->win[0].base; 210 - p_dev->io.NumPorts1 = io->win[0].len; 208 + p_dev->resource[0]->start = io->win[0].base; 209 + p_dev->resource[0]->end = io->win[0].len; 210 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 211 + p_dev->resource[0]->flags |= 212 + pcmcia_io_cfg_data_width(io->flags); 211 213 if (io->nwin > 1) { 212 - p_dev->io.Attributes2 = p_dev->io.Attributes1; 213 - p_dev->io.BasePort2 = io->win[1].base; 214 - p_dev->io.NumPorts2 = io->win[1].len; 214 + p_dev->resource[1]->flags = p_dev->resource[0]->flags; 215 + p_dev->resource[1]->start = io->win[1].base; 216 + p_dev->resource[1]->end = io->win[1].len; 215 217 } 216 218 /* This reserves IO space but doesn't actually enable it */ 217 - if (pcmcia_request_io(p_dev, &p_dev->io) != 0) 219 + p_dev->io_lines = 3; 220 + if (pcmcia_request_io(p_dev) != 0) 218 221 return -ENODEV; 219 222 } 220 223 221 - /* 222 - Now set up a common memory window, if needed. There is room 223 - in the struct pcmcia_device structure for one memory window handle, 224 - but if the base addresses need to be saved, or if multiple 225 - windows are needed, the info should go in the private data 226 - structure for this device. 227 - 228 - Note that the memory window base is a physical address, and 229 - needs to be mapped to virtual space with ioremap() before it 230 - is used. 231 - */ 232 - if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { 233 - cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; 234 - memreq_t map; 235 - req->Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; 236 - req->Attributes |= WIN_ENABLE; 237 - req->Base = mem->win[0].host_addr; 238 - req->Size = mem->win[0].len; 239 - req->AccessSpeed = 0; 240 - if (pcmcia_request_window(p_dev, req, &p_dev->win) != 0) 241 - return -ENODEV; 242 - map.Page = 0; 243 - map.CardOffset = mem->win[0].card_addr; 244 - if (pcmcia_map_mem_page(p_dev, p_dev->win, &map) != 0) 245 - return -ENODEV; 246 - } 247 224 return 0; 248 225 } 249 226 ··· 224 255 225 256 static int __devinit sedlbauer_config(struct pcmcia_device *link) 226 257 { 227 - win_req_t *req; 228 258 int ret; 229 259 IsdnCard_t icard; 230 260 231 261 dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link); 232 - 233 - req = kzalloc(sizeof(win_req_t), GFP_KERNEL); 234 - if (!req) 235 - return -ENOMEM; 236 262 237 263 /* 238 264 In this loop, we scan the CIS for configuration table entries, ··· 241 277 these things without consulting the CIS, and most client drivers 242 278 will only use the CIS to fill in implementation-defined details. 243 279 */ 244 - ret = pcmcia_loop_config(link, sedlbauer_config_check, req); 280 + ret = pcmcia_loop_config(link, sedlbauer_config_check, NULL); 245 281 if (ret) 246 282 goto failed; 247 283 ··· 261 297 printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); 262 298 if (link->conf.Attributes & CONF_ENABLE_IRQ) 263 299 printk(", irq %d", link->irq); 264 - if (link->io.NumPorts1) 265 - printk(", io 0x%04x-0x%04x", link->io.BasePort1, 266 - link->io.BasePort1+link->io.NumPorts1-1); 267 - if (link->io.NumPorts2) 268 - printk(" & 0x%04x-0x%04x", link->io.BasePort2, 269 - link->io.BasePort2+link->io.NumPorts2-1); 270 - if (link->win) 271 - printk(", mem 0x%06lx-0x%06lx", req->Base, 272 - req->Base+req->Size-1); 300 + if (link->resource[0]) 301 + printk(" & %pR", link->resource[0]); 302 + if (link->resource[1]) 303 + printk(" & %pR", link->resource[1]); 273 304 printk("\n"); 274 305 275 306 icard.para[0] = link->irq; 276 - icard.para[1] = link->io.BasePort1; 307 + icard.para[1] = link->resource[0]->start; 277 308 icard.protocol = protocol; 278 309 icard.typ = ISDN_CTYPE_SEDLBAUER_PCMCIA; 279 310 280 311 ret = hisax_init_pcmcia(link, 281 312 &(((local_info_t *)link->priv)->stop), &icard); 282 313 if (ret < 0) { 283 - printk(KERN_ERR "sedlbauer_cs: failed to initialize SEDLBAUER PCMCIA %d at i/o %#x\n", 284 - ret, link->io.BasePort1); 314 + printk(KERN_ERR "sedlbauer_cs: failed to initialize SEDLBAUER PCMCIA %d with %pR\n", 315 + ret, link->resource[0]); 285 316 sedlbauer_release(link); 286 317 return -ENODEV; 287 318 } else
+14 -16
drivers/isdn/hisax/teles_cs.c
··· 27 27 #include <asm/io.h> 28 28 #include <asm/system.h> 29 29 30 - #include <pcmcia/cs_types.h> 31 30 #include <pcmcia/cs.h> 32 31 #include <pcmcia/cistpl.h> 33 32 #include <pcmcia/cisreg.h> ··· 106 107 and attributes of IO windows) are fixed by the nature of the 107 108 device, and can be hard-wired here. 108 109 */ 109 - link->io.NumPorts1 = 96; 110 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 111 - link->io.IOAddrLines = 5; 110 + link->resource[0]->end = 96; 111 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 112 112 113 113 link->conf.Attributes = CONF_ENABLE_IRQ; 114 114 link->conf.IntType = INT_MEMORY_AND_IO; ··· 152 154 { 153 155 int j; 154 156 157 + p_dev->io_lines = 5; 158 + 155 159 if ((cf->io.nwin > 0) && cf->io.win[0].base) { 156 160 printk(KERN_INFO "(teles_cs: looks like the 96 model)\n"); 157 - p_dev->io.BasePort1 = cf->io.win[0].base; 158 - if (!pcmcia_request_io(p_dev, &p_dev->io)) 161 + p_dev->resource[0]->start = cf->io.win[0].base; 162 + if (!pcmcia_request_io(p_dev)) 159 163 return 0; 160 164 } else { 161 165 printk(KERN_INFO "(teles_cs: looks like the 97 model)\n"); 162 166 for (j = 0x2f0; j > 0x100; j -= 0x10) { 163 - p_dev->io.BasePort1 = j; 164 - if (!pcmcia_request_io(p_dev, &p_dev->io)) 167 + p_dev->resource[0]->start = j; 168 + if (!pcmcia_request_io(p_dev)) 165 169 return 0; 166 170 } 167 171 } ··· 195 195 link->conf.ConfigIndex); 196 196 if (link->conf.Attributes & CONF_ENABLE_IRQ) 197 197 printk(", irq %d", link->irq); 198 - if (link->io.NumPorts1) 199 - printk(", io 0x%04x-0x%04x", link->io.BasePort1, 200 - link->io.BasePort1+link->io.NumPorts1-1); 201 - if (link->io.NumPorts2) 202 - printk(" & 0x%04x-0x%04x", link->io.BasePort2, 203 - link->io.BasePort2+link->io.NumPorts2-1); 198 + if (link->resource[0]) 199 + printk(" & %pR", link->resource[0]); 200 + if (link->resource[1]) 201 + printk(" & %pR", link->resource[1]); 204 202 printk("\n"); 205 203 206 204 icard.para[0] = link->irq; 207 - icard.para[1] = link->io.BasePort1; 205 + icard.para[1] = link->resource[0]->start; 208 206 icard.protocol = protocol; 209 207 icard.typ = ISDN_CTYPE_TELESPCMCIA; 210 208 211 209 i = hisax_init_pcmcia(link, &(((local_info_t*)link->priv)->busy), &icard); 212 210 if (i < 0) { 213 211 printk(KERN_ERR "teles_cs: failed to initialize Teles PCMCIA %d at i/o %#x\n", 214 - i, link->io.BasePort1); 212 + i, (unsigned int) link->resource[0]->start); 215 213 teles_cs_release(link); 216 214 return -ENODEV; 217 215 }
-1
drivers/mmc/host/sdricoh_cs.c
··· 30 30 #include <linux/ioport.h> 31 31 #include <linux/scatterlist.h> 32 32 33 - #include <pcmcia/cs_types.h> 34 33 #include <pcmcia/cs.h> 35 34 #include <pcmcia/cistpl.h> 36 35 #include <pcmcia/ds.h>
+6 -9
drivers/mtd/maps/pcmciamtd.c
··· 16 16 #include <asm/io.h> 17 17 #include <asm/system.h> 18 18 19 - #include <pcmcia/cs_types.h> 20 19 #include <pcmcia/cs.h> 21 20 #include <pcmcia/cistpl.h> 22 21 #include <pcmcia/ds.h> ··· 102 103 { 103 104 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; 104 105 window_handle_t win = (window_handle_t)map->map_priv_2; 105 - memreq_t mrq; 106 + unsigned int offset; 106 107 int ret; 107 108 108 109 if (!pcmcia_dev_present(dev->p_dev)) { ··· 110 111 return 0; 111 112 } 112 113 113 - mrq.CardOffset = to & ~(dev->win_size-1); 114 - if(mrq.CardOffset != dev->offset) { 114 + offset = to & ~(dev->win_size-1); 115 + if (offset != dev->offset) { 115 116 DEBUG(2, "Remapping window from 0x%8.8x to 0x%8.8x", 116 - dev->offset, mrq.CardOffset); 117 - mrq.Page = 0; 118 - ret = pcmcia_map_mem_page(dev->p_dev, win, &mrq); 117 + dev->offset, offset); 118 + ret = pcmcia_map_mem_page(dev->p_dev, win, offset); 119 119 if (ret != 0) 120 120 return NULL; 121 - dev->offset = mrq.CardOffset; 121 + dev->offset = offset; 122 122 } 123 123 return dev->win_base + (to & (dev->win_size-1)); 124 124 } ··· 344 346 iounmap(dev->win_base); 345 347 dev->win_base = NULL; 346 348 } 347 - pcmcia_release_window(link, link->win); 348 349 } 349 350 pcmcia_disable_device(link); 350 351 }
+7 -7
drivers/net/pcmcia/3c574_cs.c
··· 87 87 #include <linux/bitops.h> 88 88 #include <linux/mii.h> 89 89 90 - #include <pcmcia/cs_types.h> 91 90 #include <pcmcia/cs.h> 92 91 #include <pcmcia/cistpl.h> 93 92 #include <pcmcia/cisreg.h> ··· 278 279 lp->p_dev = link; 279 280 280 281 spin_lock_init(&lp->window_lock); 281 - link->io.NumPorts1 = 32; 282 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 282 + link->resource[0]->end = 32; 283 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 283 284 link->conf.Attributes = CONF_ENABLE_IRQ; 284 285 link->conf.IntType = INT_MEMORY_AND_IO; 285 286 link->conf.ConfigIndex = 1; ··· 337 338 338 339 dev_dbg(&link->dev, "3c574_config()\n"); 339 340 340 - link->io.IOAddrLines = 16; 341 + link->io_lines = 16; 342 + 341 343 for (i = j = 0; j < 0x400; j += 0x20) { 342 - link->io.BasePort1 = j ^ 0x300; 343 - i = pcmcia_request_io(link, &link->io); 344 + link->resource[0]->start = j ^ 0x300; 345 + i = pcmcia_request_io(link); 344 346 if (i == 0) 345 347 break; 346 348 } ··· 357 357 goto failed; 358 358 359 359 dev->irq = link->irq; 360 - dev->base_addr = link->io.BasePort1; 360 + dev->base_addr = link->resource[0]->start; 361 361 362 362 ioaddr = dev->base_addr; 363 363
+7 -7
drivers/net/pcmcia/3c589_cs.c
··· 41 41 #include <linux/bitops.h> 42 42 #include <linux/jiffies.h> 43 43 44 - #include <pcmcia/cs_types.h> 45 44 #include <pcmcia/cs.h> 46 45 #include <pcmcia/cistpl.h> 47 46 #include <pcmcia/cisreg.h> ··· 213 214 lp->p_dev = link; 214 215 215 216 spin_lock_init(&lp->lock); 216 - link->io.NumPorts1 = 16; 217 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 217 + link->resource[0]->end = 16; 218 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 218 219 219 220 link->conf.Attributes = CONF_ENABLE_IRQ; 220 221 link->conf.IntType = INT_MEMORY_AND_IO; ··· 277 278 "3Com card??\n"); 278 279 multi = (link->card_id == PRODID_3COM_3C562); 279 280 281 + link->io_lines = 16; 282 + 280 283 /* For the 3c562, the base address must be xx00-xx7f */ 281 - link->io.IOAddrLines = 16; 282 284 for (i = j = 0; j < 0x400; j += 0x10) { 283 285 if (multi && (j & 0x80)) continue; 284 - link->io.BasePort1 = j ^ 0x300; 285 - i = pcmcia_request_io(link, &link->io); 286 + link->resource[0]->start = j ^ 0x300; 287 + i = pcmcia_request_io(link); 286 288 if (i == 0) 287 289 break; 288 290 } ··· 299 299 goto failed; 300 300 301 301 dev->irq = link->irq; 302 - dev->base_addr = link->io.BasePort1; 302 + dev->base_addr = link->resource[0]->start; 303 303 ioaddr = dev->base_addr; 304 304 EL3WINDOW(0); 305 305
+24 -24
drivers/net/pcmcia/axnet_cs.c
··· 39 39 #include <linux/mii.h> 40 40 #include "../8390.h" 41 41 42 - #include <pcmcia/cs_types.h> 43 42 #include <pcmcia/cs.h> 44 43 #include <pcmcia/cistpl.h> 45 44 #include <pcmcia/ciscode.h> ··· 259 260 static int try_io_port(struct pcmcia_device *link) 260 261 { 261 262 int j, ret; 262 - if (link->io.NumPorts1 == 32) { 263 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 263 + link->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 264 + link->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; 265 + if (link->resource[0]->end == 32) { 266 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 264 267 /* for master/slave multifunction cards */ 265 - if (link->io.NumPorts2 > 0) 266 - link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 268 + if (link->resource[1]->end > 0) 269 + link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 267 270 } else { 268 271 /* This should be two 16-port windows */ 269 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 270 - link->io.Attributes2 = IO_DATA_PATH_WIDTH_16; 272 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 273 + link->resource[1]->flags |= IO_DATA_PATH_WIDTH_16; 271 274 } 272 - if (link->io.BasePort1 == 0) { 273 - link->io.IOAddrLines = 16; 275 + if (link->resource[0]->start == 0) { 274 276 for (j = 0; j < 0x400; j += 0x20) { 275 - link->io.BasePort1 = j ^ 0x300; 276 - link->io.BasePort2 = (j ^ 0x300) + 0x10; 277 - ret = pcmcia_request_io(link, &link->io); 277 + link->resource[0]->start = j ^ 0x300; 278 + link->resource[1]->start = (j ^ 0x300) + 0x10; 279 + link->io_lines = 16; 280 + ret = pcmcia_request_io(link); 278 281 if (ret == 0) 279 282 return ret; 280 283 } 281 284 return ret; 282 285 } else { 283 - return pcmcia_request_io(link, &link->io); 286 + return pcmcia_request_io(link); 284 287 } 285 288 } 286 289 ··· 303 302 network function with window 0, and serial with window 1 */ 304 303 if (io->nwin > 1) { 305 304 i = (io->win[1].len > io->win[0].len); 306 - p_dev->io.BasePort2 = io->win[1-i].base; 307 - p_dev->io.NumPorts2 = io->win[1-i].len; 305 + p_dev->resource[1]->start = io->win[1-i].base; 306 + p_dev->resource[1]->end = io->win[1-i].len; 308 307 } else { 309 - i = p_dev->io.NumPorts2 = 0; 308 + i = p_dev->resource[1]->end = 0; 310 309 } 311 - p_dev->io.BasePort1 = io->win[i].base; 312 - p_dev->io.NumPorts1 = io->win[i].len; 313 - p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 314 - if (p_dev->io.NumPorts1 + p_dev->io.NumPorts2 >= 32) 310 + p_dev->resource[0]->start = io->win[i].base; 311 + p_dev->resource[0]->end = io->win[i].len; 312 + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 313 + if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32) 315 314 return try_io_port(p_dev); 316 315 317 316 return -ENODEV; ··· 334 333 if (!link->irq) 335 334 goto failed; 336 335 337 - if (link->io.NumPorts2 == 8) { 336 + if (resource_size(link->resource[1]) == 8) { 338 337 link->conf.Attributes |= CONF_ENABLE_SPKR; 339 338 link->conf.Status = CCSR_AUDIO_ENA; 340 339 } ··· 344 343 goto failed; 345 344 346 345 dev->irq = link->irq; 347 - dev->base_addr = link->io.BasePort1; 346 + dev->base_addr = link->resource[0]->start; 348 347 349 348 if (!get_prom(link)) { 350 349 printk(KERN_NOTICE "axnet_cs: this is not an AX88190 card!\n"); ··· 380 379 /* Maybe PHY is in power down mode. (PPD_SET = 1) 381 380 Bit 2 of CCSR is active low. */ 382 381 if (i == 32) { 383 - conf_reg_t reg = { 0, CS_WRITE, CISREG_CCSR, 0x04 }; 384 - pcmcia_access_configuration_register(link, &reg); 382 + pcmcia_write_config_byte(link, CISREG_CCSR, 0x04); 385 383 for (i = 0; i < 32; i++) { 386 384 j = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 1); 387 385 j2 = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 2);
+12 -10
drivers/net/pcmcia/com20020_cs.c
··· 43 43 #include <linux/arcdevice.h> 44 44 #include <linux/com20020.h> 45 45 46 - #include <pcmcia/cs_types.h> 47 46 #include <pcmcia/cs.h> 48 47 #include <pcmcia/cistpl.h> 49 48 #include <pcmcia/ds.h> ··· 158 159 /* fill in our module parameters as defaults */ 159 160 dev->dev_addr[0] = node; 160 161 161 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 162 - p_dev->io.NumPorts1 = 16; 163 - p_dev->io.IOAddrLines = 16; 162 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 163 + p_dev->resource[0]->end = 16; 164 164 p_dev->conf.Attributes = CONF_ENABLE_IRQ; 165 165 p_dev->conf.IntType = INT_MEMORY_AND_IO; 166 166 ··· 244 246 245 247 dev_dbg(&link->dev, "com20020_config\n"); 246 248 247 - dev_dbg(&link->dev, "baseport1 is %Xh\n", link->io.BasePort1); 249 + dev_dbg(&link->dev, "baseport1 is %Xh\n", 250 + (unsigned int) link->resource[0]->start); 251 + 248 252 i = -ENODEV; 249 - if (!link->io.BasePort1) 253 + link->io_lines = 16; 254 + 255 + if (!link->resource[0]->start) 250 256 { 251 257 for (ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x10) 252 258 { 253 - link->io.BasePort1 = ioaddr; 254 - i = pcmcia_request_io(link, &link->io); 259 + link->resource[0]->start = ioaddr; 260 + i = pcmcia_request_io(link); 255 261 if (i == 0) 256 262 break; 257 263 } 258 264 } 259 265 else 260 - i = pcmcia_request_io(link, &link->io); 266 + i = pcmcia_request_io(link); 261 267 262 268 if (i != 0) 263 269 { ··· 269 267 goto failed; 270 268 } 271 269 272 - ioaddr = dev->base_addr = link->io.BasePort1; 270 + ioaddr = dev->base_addr = link->resource[0]->start; 273 271 dev_dbg(&link->dev, "got ioaddr %Xh\n", ioaddr); 274 272 275 273 dev_dbg(&link->dev, "request IRQ %d\n",
+21 -27
drivers/net/pcmcia/fmvj18x_cs.c
··· 49 49 #include <linux/ioport.h> 50 50 #include <linux/crc32.h> 51 51 52 - #include <pcmcia/cs_types.h> 53 52 #include <pcmcia/cs.h> 54 53 #include <pcmcia/cistpl.h> 55 54 #include <pcmcia/ciscode.h> ··· 248 249 lp->base = NULL; 249 250 250 251 /* The io structure describes IO port mapping */ 251 - link->io.NumPorts1 = 32; 252 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 253 - link->io.IOAddrLines = 5; 252 + link->resource[0]->end = 32; 253 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 254 254 255 255 /* General socket configuration */ 256 256 link->conf.Attributes = CONF_ENABLE_IRQ; ··· 287 289 { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 288 290 289 291 for (i = 0; i < 5; i++) { 290 - link->io.BasePort2 = serial_base[i]; 291 - link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 292 - if (link->io.BasePort2 == 0) { 293 - link->io.NumPorts2 = 0; 292 + link->resource[1]->start = serial_base[i]; 293 + link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 294 + if (link->resource[1]->start == 0) { 295 + link->resource[1]->end = 0; 294 296 printk(KERN_NOTICE "fmvj18x_cs: out of resource for serial\n"); 295 297 } 296 - ret = pcmcia_request_io(link, &link->io); 298 + ret = pcmcia_request_io(link); 297 299 if (ret == 0) 298 300 return ret; 299 301 } ··· 309 311 0x380,0x3c0 only for ioport. 310 312 */ 311 313 for (ioaddr = 0x300; ioaddr < 0x3e0; ioaddr += 0x20) { 312 - link->io.BasePort1 = ioaddr; 313 - ret = pcmcia_request_io(link, &link->io); 314 + link->resource[0]->start = ioaddr; 315 + ret = pcmcia_request_io(link); 314 316 if (ret == 0) { 315 317 /* calculate ConfigIndex value */ 316 318 link->conf.ConfigIndex = 317 - ((link->io.BasePort1 & 0x0f0) >> 3) | 0x22; 319 + ((link->resource[0]->start & 0x0f0) >> 3) | 0x22; 318 320 return ret; 319 321 } 320 322 } ··· 344 346 345 347 dev_dbg(&link->dev, "fmvj18x_config\n"); 346 348 349 + link->io_lines = 5; 350 + 347 351 len = pcmcia_get_tuple(link, CISTPL_FUNCE, &buf); 348 352 kfree(buf); 349 353 ··· 364 364 /* MultiFunction Card */ 365 365 link->conf.ConfigBase = 0x800; 366 366 link->conf.ConfigIndex = 0x47; 367 - link->io.NumPorts2 = 8; 367 + link->resource[1]->end = 8; 368 368 } 369 369 break; 370 370 case MANFID_NEC: 371 371 cardtype = NEC; /* MultiFunction Card */ 372 372 link->conf.ConfigBase = 0x800; 373 373 link->conf.ConfigIndex = 0x47; 374 - link->io.NumPorts2 = 8; 374 + link->resource[1]->end = 8; 375 375 break; 376 376 case MANFID_KME: 377 377 cardtype = KME; /* MultiFunction Card */ 378 378 link->conf.ConfigBase = 0x800; 379 379 link->conf.ConfigIndex = 0x47; 380 - link->io.NumPorts2 = 8; 380 + link->resource[1]->end = 8; 381 381 break; 382 382 case MANFID_CONTEC: 383 383 cardtype = CONTEC; ··· 418 418 } 419 419 } 420 420 421 - if (link->io.NumPorts2 != 0) { 421 + if (link->resource[1]->end != 0) { 422 422 ret = mfc_try_io_port(link); 423 423 if (ret != 0) goto failed; 424 424 } else if (cardtype == UNGERMANN) { 425 425 ret = ungermann_try_io_port(link); 426 426 if (ret != 0) goto failed; 427 427 } else { 428 - ret = pcmcia_request_io(link, &link->io); 428 + ret = pcmcia_request_io(link); 429 429 if (ret) 430 430 goto failed; 431 431 } ··· 437 437 goto failed; 438 438 439 439 dev->irq = link->irq; 440 - dev->base_addr = link->io.BasePort1; 440 + dev->base_addr = link->resource[0]->start; 441 441 442 - if (link->io.BasePort2 != 0) { 442 + if (resource_size(link->resource[1]) != 0) { 443 443 ret = fmvj18x_setup_mfc(link); 444 444 if (ret != 0) goto failed; 445 445 } ··· 545 545 static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) 546 546 { 547 547 win_req_t req; 548 - memreq_t mem; 549 548 u_char __iomem *base; 550 549 int i, j; 551 550 ··· 557 558 return -1; 558 559 559 560 base = ioremap(req.Base, req.Size); 560 - mem.Page = 0; 561 - mem.CardOffset = 0; 562 - pcmcia_map_mem_page(link, link->win, &mem); 561 + pcmcia_map_mem_page(link, link->win, 0); 563 562 564 563 /* 565 564 * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format ··· 591 594 static int fmvj18x_setup_mfc(struct pcmcia_device *link) 592 595 { 593 596 win_req_t req; 594 - memreq_t mem; 595 597 int i; 596 598 struct net_device *dev = link->priv; 597 599 unsigned int ioaddr; ··· 610 614 return -1; 611 615 } 612 616 613 - mem.Page = 0; 614 - mem.CardOffset = 0; 615 - i = pcmcia_map_mem_page(link, link->win, &mem); 617 + i = pcmcia_map_mem_page(link, link->win, 0); 616 618 if (i != 0) { 617 619 iounmap(lp->base); 618 620 lp->base = NULL;
+11 -18
drivers/net/pcmcia/ibmtr_cs.c
··· 57 57 #include <linux/trdevice.h> 58 58 #include <linux/ibmtr.h> 59 59 60 - #include <pcmcia/cs_types.h> 61 60 #include <pcmcia/cs.h> 62 61 #include <pcmcia/cistpl.h> 63 62 #include <pcmcia/ds.h> ··· 151 152 link->priv = info; 152 153 info->ti = netdev_priv(dev); 153 154 154 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 155 - link->io.NumPorts1 = 4; 156 - link->io.IOAddrLines = 16; 155 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 156 + link->resource[0]->end = 4; 157 157 link->conf.Attributes = CONF_ENABLE_IRQ; 158 158 link->conf.IntType = INT_MEMORY_AND_IO; 159 159 link->conf.Present = PRESENT_OPTION; ··· 211 213 struct net_device *dev = info->dev; 212 214 struct tok_info *ti = netdev_priv(dev); 213 215 win_req_t req; 214 - memreq_t mem; 215 216 int i, ret; 216 217 217 218 dev_dbg(&link->dev, "ibmtr_config\n"); 218 219 219 220 link->conf.ConfigIndex = 0x61; 221 + link->io_lines = 16; 220 222 221 223 /* Determine if this is PRIMARY or ALTERNATE. */ 222 224 223 225 /* Try PRIMARY card at 0xA20-0xA23 */ 224 - link->io.BasePort1 = 0xA20; 225 - i = pcmcia_request_io(link, &link->io); 226 + link->resource[0]->start = 0xA20; 227 + i = pcmcia_request_io(link); 226 228 if (i != 0) { 227 229 /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */ 228 - link->io.BasePort1 = 0xA24; 229 - ret = pcmcia_request_io(link, &link->io); 230 + link->resource[0]->start = 0xA24; 231 + ret = pcmcia_request_io(link); 230 232 if (ret) 231 233 goto failed; 232 234 } 233 - dev->base_addr = link->io.BasePort1; 235 + dev->base_addr = link->resource[0]->start; 234 236 235 237 ret = pcmcia_request_exclusive_irq(link, ibmtr_interrupt); 236 238 if (ret) ··· 249 251 if (ret) 250 252 goto failed; 251 253 252 - mem.CardOffset = mmiobase; 253 - mem.Page = 0; 254 - ret = pcmcia_map_mem_page(link, link->win, &mem); 254 + ret = pcmcia_map_mem_page(link, link->win, mmiobase); 255 255 if (ret) 256 256 goto failed; 257 257 ti->mmio = ioremap(req.Base, req.Size); ··· 264 268 if (ret) 265 269 goto failed; 266 270 267 - mem.CardOffset = srambase; 268 - mem.Page = 0; 269 - ret = pcmcia_map_mem_page(link, info->sram_win_handle, &mem); 271 + ret = pcmcia_map_mem_page(link, info->sram_win_handle, srambase); 270 272 if (ret) 271 273 goto failed; 272 274 273 - ti->sram_base = mem.CardOffset >> 12; 275 + ti->sram_base = srambase >> 12; 274 276 ti->sram_virt = ioremap(req.Base, req.Size); 275 277 ti->sram_phys = req.Base; 276 278 ··· 319 325 if (link->win) { 320 326 struct tok_info *ti = netdev_priv(dev); 321 327 iounmap(ti->mmio); 322 - pcmcia_release_window(link, info->sram_win_handle); 323 328 } 324 329 pcmcia_disable_device(link); 325 330 }
+11 -21
drivers/net/pcmcia/nmclan_cs.c
··· 146 146 #include <linux/ioport.h> 147 147 #include <linux/bitops.h> 148 148 149 - #include <pcmcia/cs_types.h> 150 149 #include <pcmcia/cs.h> 151 150 #include <pcmcia/cisreg.h> 152 151 #include <pcmcia/cistpl.h> ··· 458 459 link->priv = dev; 459 460 460 461 spin_lock_init(&lp->bank_lock); 461 - link->io.NumPorts1 = 32; 462 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 463 - link->io.IOAddrLines = 5; 462 + link->resource[0]->end = 32; 463 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 464 464 link->conf.Attributes = CONF_ENABLE_IRQ; 465 465 link->conf.IntType = INT_MEMORY_AND_IO; 466 466 link->conf.ConfigIndex = 1; ··· 643 645 644 646 dev_dbg(&link->dev, "nmclan_config\n"); 645 647 646 - ret = pcmcia_request_io(link, &link->io); 648 + link->io_lines = 5; 649 + ret = pcmcia_request_io(link); 647 650 if (ret) 648 651 goto failed; 649 652 ret = pcmcia_request_exclusive_irq(link, mace_interrupt); ··· 655 656 goto failed; 656 657 657 658 dev->irq = link->irq; 658 - dev->base_addr = link->io.BasePort1; 659 + dev->base_addr = link->resource[0]->start; 659 660 660 661 ioaddr = dev->base_addr; 661 662 ··· 757 758 758 759 #if RESET_XILINX 759 760 struct pcmcia_device *link = &lp->link; 760 - conf_reg_t reg; 761 - u_long OrigCorValue; 761 + u8 OrigCorValue; 762 762 763 763 /* Save original COR value */ 764 - reg.Function = 0; 765 - reg.Action = CS_READ; 766 - reg.Offset = CISREG_COR; 767 - reg.Value = 0; 768 - pcmcia_access_configuration_register(link, &reg); 769 - OrigCorValue = reg.Value; 764 + pcmcia_read_config_byte(link, CISREG_COR, &OrigCorValue); 770 765 771 766 /* Reset Xilinx */ 772 - reg.Action = CS_WRITE; 773 - reg.Offset = CISREG_COR; 774 - dev_dbg(&link->dev, "nmclan_reset: OrigCorValue=0x%lX, resetting...\n", 767 + dev_dbg(&link->dev, "nmclan_reset: OrigCorValue=0x%x, resetting...\n", 775 768 OrigCorValue); 776 - reg.Value = COR_SOFT_RESET; 777 - pcmcia_access_configuration_register(link, &reg); 769 + pcmcia_write_config_byte(link, CISREG_COR, COR_SOFT_RESET); 778 770 /* Need to wait for 20 ms for PCMCIA to finish reset. */ 779 771 780 772 /* Restore original COR configuration index */ 781 - reg.Value = COR_LEVEL_REQ | (OrigCorValue & COR_CONFIG_MASK); 782 - pcmcia_access_configuration_register(link, &reg); 773 + pcmcia_write_config_byte(link, CISREG_COR, 774 + (COR_LEVEL_REQ | (OrigCorValue & COR_CONFIG_MASK))); 783 775 /* Xilinx is now completely reset along with the MACE chip. */ 784 776 lp->tx_free_frames=AM2150_MAX_TX_FRAMES; 785 777
+28 -35
drivers/net/pcmcia/pcnet_cs.c
··· 42 42 #include <linux/mii.h> 43 43 #include "../8390.h" 44 44 45 - #include <pcmcia/cs_types.h> 46 45 #include <pcmcia/cs.h> 47 46 #include <pcmcia/cistpl.h> 48 47 #include <pcmcia/ciscode.h> ··· 111 112 int stop_pg); 112 113 113 114 static void pcnet_detach(struct pcmcia_device *p_dev); 114 - 115 - static dev_info_t dev_info = "pcnet_cs"; 116 115 117 116 /*====================================================================*/ 118 117 ··· 301 304 { 302 305 struct net_device *dev = link->priv; 303 306 win_req_t req; 304 - memreq_t mem; 305 307 u_char __iomem *base, *virt; 306 308 int i, j; 307 309 ··· 313 317 return NULL; 314 318 315 319 virt = ioremap(req.Base, req.Size); 316 - mem.Page = 0; 317 320 for (i = 0; i < NR_INFO; i++) { 318 - mem.CardOffset = hw_info[i].offset & ~(req.Size-1); 319 - pcmcia_map_mem_page(link, link->win, &mem); 321 + pcmcia_map_mem_page(link, link->win, hw_info[i].offset & ~(req.Size-1)); 320 322 base = &virt[hw_info[i].offset & (req.Size-1)]; 321 323 if ((readb(base+0) == hw_info[i].a0) && 322 324 (readb(base+2) == hw_info[i].a1) && ··· 474 480 static int try_io_port(struct pcmcia_device *link) 475 481 { 476 482 int j, ret; 477 - if (link->io.NumPorts1 == 32) { 478 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 479 - if (link->io.NumPorts2 > 0) { 483 + link->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 484 + link->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; 485 + if (link->resource[0]->end == 32) { 486 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 487 + if (link->resource[1]->end > 0) { 480 488 /* for master/slave multifunction cards */ 481 - link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 489 + link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 482 490 } 483 491 } else { 484 492 /* This should be two 16-port windows */ 485 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 486 - link->io.Attributes2 = IO_DATA_PATH_WIDTH_16; 493 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 494 + link->resource[1]->flags |= IO_DATA_PATH_WIDTH_16; 487 495 } 488 - if (link->io.BasePort1 == 0) { 489 - link->io.IOAddrLines = 16; 496 + if (link->resource[0]->start == 0) { 490 497 for (j = 0; j < 0x400; j += 0x20) { 491 - link->io.BasePort1 = j ^ 0x300; 492 - link->io.BasePort2 = (j ^ 0x300) + 0x10; 493 - ret = pcmcia_request_io(link, &link->io); 498 + link->resource[0]->start = j ^ 0x300; 499 + link->resource[1]->start = (j ^ 0x300) + 0x10; 500 + link->io_lines = 16; 501 + ret = pcmcia_request_io(link); 494 502 if (ret == 0) 495 503 return ret; 496 504 } 497 505 return ret; 498 506 } else { 499 - return pcmcia_request_io(link, &link->io); 507 + return pcmcia_request_io(link); 500 508 } 501 509 } 502 510 ··· 519 523 network function with window 0, and serial with window 1 */ 520 524 if (io->nwin > 1) { 521 525 i = (io->win[1].len > io->win[0].len); 522 - p_dev->io.BasePort2 = io->win[1-i].base; 523 - p_dev->io.NumPorts2 = io->win[1-i].len; 526 + p_dev->resource[1]->start = io->win[1-i].base; 527 + p_dev->resource[1]->end = io->win[1-i].len; 524 528 } else { 525 - i = p_dev->io.NumPorts2 = 0; 529 + i = p_dev->resource[1]->end = 0; 526 530 } 527 531 528 532 *has_shmem = ((cfg->mem.nwin == 1) && 529 533 (cfg->mem.win[0].len >= 0x4000)); 530 - p_dev->io.BasePort1 = io->win[i].base; 531 - p_dev->io.NumPorts1 = io->win[i].len; 532 - p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 533 - if (p_dev->io.NumPorts1 + p_dev->io.NumPorts2 >= 32) 534 + p_dev->resource[0]->start = io->win[i].base; 535 + p_dev->resource[0]->end = io->win[i].len; 536 + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 537 + if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32) 534 538 return try_io_port(p_dev); 535 539 536 540 return 0; ··· 553 557 if (!link->irq) 554 558 goto failed; 555 559 556 - if (link->io.NumPorts2 == 8) { 560 + if (resource_size(link->resource[1]) == 8) { 557 561 link->conf.Attributes |= CONF_ENABLE_SPKR; 558 562 link->conf.Status = CCSR_AUDIO_ENA; 559 563 } ··· 565 569 if (ret) 566 570 goto failed; 567 571 dev->irq = link->irq; 568 - dev->base_addr = link->io.BasePort1; 572 + dev->base_addr = link->resource[0]->start; 569 573 if (info->flags & HAS_MISC_REG) { 570 574 if ((if_port == 1) || (if_port == 2)) 571 575 dev->if_port = if_port; ··· 952 956 set_misc_reg(dev); 953 957 954 958 outb_p(0xFF, nic_base + EN0_ISR); /* Clear bogus intr. */ 955 - ret = request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, dev_info, dev); 959 + ret = request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, dev->name, dev); 956 960 if (ret) 957 961 return ret; 958 962 ··· 1460 1464 struct net_device *dev = link->priv; 1461 1465 pcnet_dev_t *info = PRIV(dev); 1462 1466 win_req_t req; 1463 - memreq_t mem; 1464 1467 int i, window_size, offset, ret; 1465 1468 1466 1469 window_size = (stop_pg - start_pg) << 8; ··· 1478 1483 if (ret) 1479 1484 goto failed; 1480 1485 1481 - mem.CardOffset = (start_pg << 8) + cm_offset; 1482 - offset = mem.CardOffset % window_size; 1483 - mem.CardOffset -= offset; 1484 - mem.Page = 0; 1485 - ret = pcmcia_map_mem_page(link, link->win, &mem); 1486 + offset = (start_pg << 8) + cm_offset; 1487 + offset -= offset % window_size; 1488 + ret = pcmcia_map_mem_page(link, link->win, offset); 1486 1489 if (ret) 1487 1490 goto failed; 1488 1491
+33 -38
drivers/net/pcmcia/smc91c92_cs.c
··· 44 44 #include <linux/jiffies.h> 45 45 #include <linux/firmware.h> 46 46 47 - #include <pcmcia/cs_types.h> 48 47 #include <pcmcia/cs.h> 49 48 #include <pcmcia/cistpl.h> 50 49 #include <pcmcia/cisreg.h> ··· 324 325 link->priv = dev; 325 326 326 327 spin_lock_init(&smc->lock); 327 - link->io.NumPorts1 = 16; 328 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 329 - link->io.IOAddrLines = 4; 328 + link->resource[0]->end = 16; 329 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 330 330 link->conf.Attributes = CONF_ENABLE_IRQ; 331 331 link->conf.IntType = INT_MEMORY_AND_IO; 332 332 ··· 426 428 void *priv_data) 427 429 { 428 430 int k; 429 - p_dev->io.BasePort2 = cf->io.win[0].base; 431 + p_dev->resource[1]->start = cf->io.win[0].base; 430 432 for (k = 0; k < 0x400; k += 0x10) { 431 433 if (k & 0x80) 432 434 continue; 433 - p_dev->io.BasePort1 = k ^ 0x300; 434 - if (!pcmcia_request_io(p_dev, &p_dev->io)) 435 + p_dev->resource[0]->start = k ^ 0x300; 436 + p_dev->io_lines = 16; 437 + if (!pcmcia_request_io(p_dev)) 435 438 return 0; 436 439 } 437 440 return -ENODEV; ··· 443 444 struct net_device *dev = link->priv; 444 445 struct smc_private *smc = netdev_priv(dev); 445 446 win_req_t req; 446 - memreq_t mem; 447 + unsigned int offset; 447 448 int i; 448 449 449 450 link->conf.Attributes |= CONF_ENABLE_SPKR; 450 451 link->conf.Status = CCSR_AUDIO_ENA; 451 - link->io.IOAddrLines = 16; 452 - link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 453 - link->io.NumPorts2 = 8; 452 + link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 453 + link->resource[1]->end = 8; 454 454 455 455 /* The Megahertz combo cards have modem-like CIS entries, so 456 456 we have to explicitly try a bunch of port combinations. */ 457 457 if (pcmcia_loop_config(link, mhz_mfc_config_check, NULL)) 458 458 return -ENODEV; 459 459 460 - dev->base_addr = link->io.BasePort1; 460 + dev->base_addr = link->resource[0]->start; 461 461 462 462 /* Allocate a memory window, for accessing the ISR */ 463 463 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; ··· 467 469 return -ENODEV; 468 470 469 471 smc->base = ioremap(req.Base, req.Size); 470 - mem.CardOffset = mem.Page = 0; 471 - if (smc->manfid == MANFID_MOTOROLA) 472 - mem.CardOffset = link->conf.ConfigBase; 473 - i = pcmcia_map_mem_page(link, link->win, &mem); 474 - 472 + offset = (smc->manfid == MANFID_MOTOROLA) ? link->conf.ConfigBase : 0; 473 + i = pcmcia_map_mem_page(link, link->win, offset); 475 474 if ((i == 0) && 476 475 (smc->manfid == MANFID_MEGAHERTZ) && 477 476 (smc->cardid == PRODID_MEGAHERTZ_EM3288)) ··· 541 546 struct net_device *dev = link->priv; 542 547 struct smc_private *smc = netdev_priv(dev); 543 548 unsigned int ioaddr = dev->base_addr; 544 - unsigned int iouart = link->io.BasePort2; 549 + unsigned int iouart = link->resource[1]->start; 545 550 546 551 /* Set UART base address and force map with COR bit 1 */ 547 552 writeb(iouart & 0xff, smc->base + MOT_UART + CISREG_IOBASE_0); ··· 597 602 unsigned int vcc, 598 603 void *priv_data) 599 604 { 600 - p_dev->io.BasePort1 = cf->io.win[0].base; 601 - p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; 602 - return pcmcia_request_io(p_dev, &p_dev->io); 605 + p_dev->resource[0]->start = cf->io.win[0].base; 606 + p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; 607 + return pcmcia_request_io(p_dev); 603 608 } 604 609 605 610 static int smc_config(struct pcmcia_device *link) ··· 607 612 struct net_device *dev = link->priv; 608 613 int i; 609 614 610 - link->io.NumPorts1 = 16; 615 + link->resource[0]->end = 16; 611 616 i = pcmcia_loop_config(link, smc_configcheck, NULL); 612 617 if (!i) 613 - dev->base_addr = link->io.BasePort1; 618 + dev->base_addr = link->resource[0]->start; 614 619 615 620 return i; 616 621 } ··· 642 647 643 648 link->conf.Attributes |= CONF_ENABLE_SPKR; 644 649 link->conf.Status = CCSR_AUDIO_ENA; 645 - link->io.NumPorts1 = 64; 646 - link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 647 - link->io.NumPorts2 = 8; 648 - link->io.IOAddrLines = 16; 650 + link->resource[0]->end = 64; 651 + link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 652 + link->resource[1]->end = 8; 649 653 650 654 /* Enable Hard Decode, LAN, Modem */ 651 655 link->conf.ConfigIndex = 0x23; 656 + link->io_lines = 16; 652 657 653 658 for (i = j = 0; j < 4; j++) { 654 - link->io.BasePort2 = com[j]; 655 - i = pcmcia_request_io(link, &link->io); 659 + link->resource[1]->start = com[j]; 660 + i = pcmcia_request_io(link); 656 661 if (i == 0) 657 662 break; 658 663 } 659 664 if (i != 0) { 660 665 /* Fallback: turn off hard decode */ 661 666 link->conf.ConfigIndex = 0x03; 662 - link->io.NumPorts2 = 0; 663 - i = pcmcia_request_io(link, &link->io); 667 + link->resource[1]->end = 0; 668 + i = pcmcia_request_io(link); 664 669 } 665 - dev->base_addr = link->io.BasePort1 + 0x10; 670 + dev->base_addr = link->resource[0]->start + 0x10; 666 671 return i; 667 672 } 668 673 ··· 679 684 680 685 /* Download the Seven of Diamonds firmware */ 681 686 for (i = 0; i < fw->size; i++) { 682 - outb(fw->data[i], link->io.BasePort1 + 2); 687 + outb(fw->data[i], link->resource[0]->start + 2); 683 688 udelay(50); 684 689 } 685 690 release_firmware(fw); ··· 721 726 return rc; 722 727 } else if (manfid == MANFID_OSITECH) { 723 728 /* Make sure both functions are powered up */ 724 - set_bits(0x300, link->io.BasePort1 + OSITECH_AUI_PWR); 729 + set_bits(0x300, link->resource[0]->start + OSITECH_AUI_PWR); 725 730 /* Now, turn on the interrupt for both card functions */ 726 - set_bits(0x300, link->io.BasePort1 + OSITECH_RESET_ISR); 731 + set_bits(0x300, link->resource[0]->start + OSITECH_RESET_ISR); 727 732 dev_dbg(&link->dev, "AUI/PWR: %4.4x RESET/ISR: %4.4x\n", 728 - inw(link->io.BasePort1 + OSITECH_AUI_PWR), 729 - inw(link->io.BasePort1 + OSITECH_RESET_ISR)); 733 + inw(link->resource[0]->start + OSITECH_AUI_PWR), 734 + inw(link->resource[0]->start + OSITECH_RESET_ISR)); 730 735 } 731 736 return 0; 732 737 } ··· 799 804 } 800 805 801 806 /* Try setting bus width */ 802 - width = (link->io.Attributes1 == IO_DATA_PATH_WIDTH_AUTO); 807 + width = (link->resource[0]->flags == IO_DATA_PATH_WIDTH_AUTO); 803 808 s = inb(ioaddr + CONFIG); 804 809 if (width) 805 810 s |= CFG_16BIT;
+27 -33
drivers/net/pcmcia/xirc2ps_cs.c
··· 82 82 #include <linux/bitops.h> 83 83 #include <linux/mii.h> 84 84 85 - #include <pcmcia/cs_types.h> 86 85 #include <pcmcia/cs.h> 87 86 #include <pcmcia/cistpl.h> 88 87 #include <pcmcia/cisreg.h> ··· 677 678 678 679 if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { 679 680 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { 680 - p_dev->io.BasePort2 = cf->io.win[0].base; 681 - p_dev->io.BasePort1 = ioaddr; 682 - if (!pcmcia_request_io(p_dev, &p_dev->io)) 681 + p_dev->resource[1]->start = cf->io.win[0].base; 682 + p_dev->resource[0]->start = ioaddr; 683 + if (!pcmcia_request_io(p_dev)) 683 684 return 0; 684 685 } 685 686 } ··· 696 697 int *pass = priv_data; 697 698 698 699 if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { 699 - p_dev->io.BasePort2 = cf->io.win[0].base; 700 - p_dev->io.BasePort1 = p_dev->io.BasePort2 700 + p_dev->resource[1]->start = cf->io.win[0].base; 701 + p_dev->resource[0]->start = p_dev->resource[1]->start 701 702 + (*pass ? (cf->index & 0x20 ? -24:8) 702 703 : (cf->index & 0x20 ? 8:-24)); 703 - if (!pcmcia_request_io(p_dev, &p_dev->io)) 704 + if (!pcmcia_request_io(p_dev)) 704 705 return 0; 705 706 } 706 707 return -ENODEV; ··· 807 808 goto failure; 808 809 } 809 810 810 - link->io.IOAddrLines =10; 811 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 811 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 812 812 if (local->modem) { 813 813 int pass; 814 814 ··· 815 817 link->conf.Attributes |= CONF_ENABLE_SPKR; 816 818 link->conf.Status |= CCSR_AUDIO_ENA; 817 819 } 818 - link->io.NumPorts2 = 8; 819 - link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 820 + link->resource[1]->end = 8; 821 + link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 820 822 if (local->dingo) { 821 823 /* Take the Modem IO port from the CIS and scan for a free 822 824 * Ethernet port */ 823 - link->io.NumPorts1 = 16; /* no Mako stuff anymore */ 825 + link->resource[0]->end = 16; /* no Mako stuff anymore */ 824 826 if (!pcmcia_loop_config(link, xirc2ps_config_modem, NULL)) 825 827 goto port_found; 826 828 } else { 827 - link->io.NumPorts1 = 18; 829 + link->resource[0]->end = 18; 828 830 /* We do 2 passes here: The first one uses the regular mapping and 829 831 * the second tries again, thereby considering that the 32 ports are 830 832 * mirrored every 32 bytes. Actually we use a mirrored port for ··· 839 841 } 840 842 printk(KNOT_XIRC "no ports available\n"); 841 843 } else { 842 - link->io.NumPorts1 = 16; 844 + link->io_lines = 10; 845 + link->resource[0]->end = 16; 843 846 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { 844 - link->io.BasePort1 = ioaddr; 845 - if (!(err=pcmcia_request_io(link, &link->io))) 847 + link->resource[0]->start = ioaddr; 848 + if (!(err = pcmcia_request_io(link))) 846 849 goto port_found; 847 850 } 848 - link->io.BasePort1 = 0; /* let CS decide */ 849 - if ((err=pcmcia_request_io(link, &link->io))) 851 + link->resource[0]->start = 0; /* let CS decide */ 852 + if ((err = pcmcia_request_io(link))) 850 853 goto config_error; 851 854 } 852 855 port_found: ··· 869 870 goto config_error; 870 871 871 872 if (local->dingo) { 872 - conf_reg_t reg; 873 873 win_req_t req; 874 - memreq_t mem; 875 874 876 875 /* Reset the modem's BAR to the correct value 877 876 * This is necessary because in the RequestConfiguration call, 878 877 * the base address of the ethernet port (BasePort1) is written 879 878 * to the BAR registers of the modem. 880 879 */ 881 - reg.Action = CS_WRITE; 882 - reg.Offset = CISREG_IOBASE_0; 883 - reg.Value = link->io.BasePort2 & 0xff; 884 - if ((err = pcmcia_access_configuration_register(link, &reg))) 880 + err = pcmcia_write_config_byte(link, CISREG_IOBASE_0, (u8) 881 + link->resource[1]->start & 0xff); 882 + if (err) 885 883 goto config_error; 886 - reg.Action = CS_WRITE; 887 - reg.Offset = CISREG_IOBASE_1; 888 - reg.Value = (link->io.BasePort2 >> 8) & 0xff; 889 - if ((err = pcmcia_access_configuration_register(link, &reg))) 884 + 885 + err = pcmcia_write_config_byte(link, CISREG_IOBASE_1, 886 + (link->resource[1]->start >> 8) & 0xff); 887 + if (err) 890 888 goto config_error; 891 889 892 890 /* There is no config entry for the Ethernet part which ··· 897 901 goto config_error; 898 902 899 903 local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800; 900 - mem.CardOffset = 0x0; 901 - mem.Page = 0; 902 - if ((err = pcmcia_map_mem_page(link, link->win, &mem))) 904 + if ((err = pcmcia_map_mem_page(link, link->win, 0))) 903 905 goto config_error; 904 906 905 907 /* Setup the CCRs; there are no infos in the CIS about the Ethernet 906 908 * part. 907 909 */ 908 910 writeb(0x47, local->dingo_ccr + CISREG_COR); 909 - ioaddr = link->io.BasePort1; 911 + ioaddr = link->resource[0]->start; 910 912 writeb(ioaddr & 0xff , local->dingo_ccr + CISREG_IOBASE_0); 911 913 writeb((ioaddr >> 8)&0xff , local->dingo_ccr + CISREG_IOBASE_1); 912 914 ··· 951 957 952 958 /* we can now register the device with the net subsystem */ 953 959 dev->irq = link->irq; 954 - dev->base_addr = link->io.BasePort1; 960 + dev->base_addr = link->resource[0]->start; 955 961 956 962 if (local->dingo) 957 963 do_reset(dev, 1); /* a kludge to make the cem56 work */
+16 -58
drivers/net/wireless/airo_cs.c
··· 32 32 #include <linux/timer.h> 33 33 #include <linux/netdevice.h> 34 34 35 - #include <pcmcia/cs_types.h> 36 35 #include <pcmcia/cs.h> 37 36 #include <pcmcia/cistpl.h> 38 37 #include <pcmcia/cisreg.h> ··· 154 155 unsigned int vcc, 155 156 void *priv_data) 156 157 { 157 - win_req_t *req = priv_data; 158 - 159 158 if (cfg->index == 0) 160 159 return -ENODEV; 161 160 ··· 173 176 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 174 177 175 178 /* IO window settings */ 176 - p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 179 + p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 177 180 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 178 181 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 179 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 180 - if (!(io->flags & CISTPL_IO_8BIT)) 181 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 182 - if (!(io->flags & CISTPL_IO_16BIT)) 183 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 184 - p_dev->io.BasePort1 = io->win[0].base; 185 - p_dev->io.NumPorts1 = io->win[0].len; 182 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 183 + p_dev->resource[0]->flags |= 184 + pcmcia_io_cfg_data_width(io->flags); 185 + p_dev->resource[0]->start = io->win[0].base; 186 + p_dev->resource[0]->end = io->win[0].len; 186 187 if (io->nwin > 1) { 187 - p_dev->io.Attributes2 = p_dev->io.Attributes1; 188 - p_dev->io.BasePort2 = io->win[1].base; 189 - p_dev->io.NumPorts2 = io->win[1].len; 188 + p_dev->resource[1]->flags = p_dev->resource[0]->flags; 189 + p_dev->resource[1]->start = io->win[1].base; 190 + p_dev->resource[1]->end = io->win[1].len; 190 191 } 191 192 } 192 193 193 194 /* This reserves IO space but doesn't actually enable it */ 194 - if (pcmcia_request_io(p_dev, &p_dev->io) != 0) 195 + if (pcmcia_request_io(p_dev) != 0) 195 196 return -ENODEV; 196 197 197 - /* 198 - Now set up a common memory window, if needed. There is room 199 - in the struct pcmcia_device structure for one memory window handle, 200 - but if the base addresses need to be saved, or if multiple 201 - windows are needed, the info should go in the private data 202 - structure for this device. 203 - 204 - Note that the memory window base is a physical address, and 205 - needs to be mapped to virtual space with ioremap() before it 206 - is used. 207 - */ 208 - if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { 209 - cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; 210 - memreq_t map; 211 - req->Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; 212 - req->Base = mem->win[0].host_addr; 213 - req->Size = mem->win[0].len; 214 - req->AccessSpeed = 0; 215 - if (pcmcia_request_window(p_dev, req, &p_dev->win) != 0) 216 - return -ENODEV; 217 - map.Page = 0; 218 - map.CardOffset = mem->win[0].card_addr; 219 - if (pcmcia_map_mem_page(p_dev, p_dev->win, &map) != 0) 220 - return -ENODEV; 221 - } 222 198 /* If we got this far, we're cool! */ 223 199 return 0; 224 200 } ··· 200 230 static int airo_config(struct pcmcia_device *link) 201 231 { 202 232 local_info_t *dev; 203 - win_req_t *req; 204 233 int ret; 205 234 206 235 dev = link->priv; 207 236 208 237 dev_dbg(&link->dev, "airo_config\n"); 209 - 210 - req = kzalloc(sizeof(win_req_t), GFP_KERNEL); 211 - if (!req) 212 - return -ENOMEM; 213 238 214 239 /* 215 240 * In this loop, we scan the CIS for configuration table ··· 220 255 * and most client drivers will only use the CIS to fill in 221 256 * implementation-defined details. 222 257 */ 223 - ret = pcmcia_loop_config(link, airo_cs_config_check, req); 258 + ret = pcmcia_loop_config(link, airo_cs_config_check, NULL); 224 259 if (ret) 225 260 goto failed; 226 261 ··· 237 272 goto failed; 238 273 ((local_info_t *)link->priv)->eth_dev = 239 274 init_airo_card(link->irq, 240 - link->io.BasePort1, 1, &link->dev); 275 + link->resource[0]->start, 1, &link->dev); 241 276 if (!((local_info_t *)link->priv)->eth_dev) 242 277 goto failed; 243 278 ··· 247 282 if (link->conf.Vpp) 248 283 printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); 249 284 printk(", irq %d", link->irq); 250 - if (link->io.NumPorts1) 251 - printk(", io 0x%04x-0x%04x", link->io.BasePort1, 252 - link->io.BasePort1+link->io.NumPorts1-1); 253 - if (link->io.NumPorts2) 254 - printk(" & 0x%04x-0x%04x", link->io.BasePort2, 255 - link->io.BasePort2+link->io.NumPorts2-1); 256 - if (link->win) 257 - printk(", mem 0x%06lx-0x%06lx", req->Base, 258 - req->Base+req->Size-1); 285 + if (link->resource[0]) 286 + printk(" & %pR", link->resource[0]); 287 + if (link->resource[1]) 288 + printk(" & %pR", link->resource[1]); 259 289 printk("\n"); 260 - kfree(req); 261 290 return 0; 262 291 263 292 failed: 264 293 airo_release(link); 265 - kfree(req); 266 294 return -ENODEV; 267 295 } /* airo_config */ 268 296
+11 -14
drivers/net/wireless/atmel_cs.c
··· 42 42 #include <linux/moduleparam.h> 43 43 #include <linux/device.h> 44 44 45 - #include <pcmcia/cs_types.h> 46 45 #include <pcmcia/cs.h> 47 46 #include <pcmcia/cistpl.h> 48 47 #include <pcmcia/cisreg.h> ··· 190 191 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 191 192 192 193 /* IO window settings */ 193 - p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 194 + p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 194 195 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 195 196 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 196 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 197 - if (!(io->flags & CISTPL_IO_8BIT)) 198 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 199 - if (!(io->flags & CISTPL_IO_16BIT)) 200 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 201 - p_dev->io.BasePort1 = io->win[0].base; 202 - p_dev->io.NumPorts1 = io->win[0].len; 197 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 198 + p_dev->resource[0]->flags |= 199 + pcmcia_io_cfg_data_width(io->flags); 200 + p_dev->resource[0]->start = io->win[0].base; 201 + p_dev->resource[0]->end = io->win[0].len; 203 202 if (io->nwin > 1) { 204 - p_dev->io.Attributes2 = p_dev->io.Attributes1; 205 - p_dev->io.BasePort2 = io->win[1].base; 206 - p_dev->io.NumPorts2 = io->win[1].len; 203 + p_dev->resource[1]->flags = p_dev->resource[0]->flags; 204 + p_dev->resource[1]->start = io->win[1].base; 205 + p_dev->resource[1]->end = io->win[1].len; 207 206 } 208 207 } 209 208 210 209 /* This reserves IO space but doesn't actually enable it */ 211 - return pcmcia_request_io(p_dev, &p_dev->io); 210 + return pcmcia_request_io(p_dev); 212 211 } 213 212 214 213 static int atmel_config(struct pcmcia_device *link) ··· 251 254 252 255 ((local_info_t*)link->priv)->eth_dev = 253 256 init_atmel_card(link->irq, 254 - link->io.BasePort1, 257 + link->resource[0]->start, 255 258 did ? did->driver_info : ATMEL_FW_TYPE_NONE, 256 259 &link->dev, 257 260 card_present,
+2 -11
drivers/net/wireless/b43/pcmcia.c
··· 26 26 #include <linux/ssb/ssb.h> 27 27 #include <linux/slab.h> 28 28 29 - #include <pcmcia/cs_types.h> 30 29 #include <pcmcia/cs.h> 31 30 #include <pcmcia/cistpl.h> 32 31 #include <pcmcia/ciscode.h> ··· 64 65 { 65 66 struct ssb_bus *ssb; 66 67 win_req_t win; 67 - memreq_t mem; 68 68 int err = -ENOMEM; 69 69 int res = 0; 70 70 ··· 76 78 dev->conf.Attributes = CONF_ENABLE_IRQ; 77 79 dev->conf.IntType = INT_MEMORY_AND_IO; 78 80 79 - dev->io.BasePort2 = 0; 80 - dev->io.NumPorts2 = 0; 81 - dev->io.Attributes2 = 0; 82 - 83 - win.Attributes = WIN_ADDR_SPACE_MEM | WIN_MEMORY_TYPE_CM | 84 - WIN_ENABLE | WIN_DATA_WIDTH_16 | 81 + win.Attributes = WIN_ENABLE | WIN_DATA_WIDTH_16 | 85 82 WIN_USE_WAIT; 86 83 win.Base = 0; 87 84 win.Size = SSB_CORE_SIZE; ··· 85 92 if (res != 0) 86 93 goto err_kfree_ssb; 87 94 88 - mem.CardOffset = 0; 89 - mem.Page = 0; 90 - res = pcmcia_map_mem_page(dev, dev->win, &mem); 95 + res = pcmcia_map_mem_page(dev, dev->win, 0); 91 96 if (res != 0) 92 97 goto err_disable; 93 98
+43 -93
drivers/net/wireless/hostap/hostap_cs.c
··· 12 12 #include <linux/wireless.h> 13 13 #include <net/iw_handler.h> 14 14 15 - #include <pcmcia/cs_types.h> 16 15 #include <pcmcia/cs.h> 17 16 #include <pcmcia/cistpl.h> 18 17 #include <pcmcia/cisreg.h> ··· 22 23 #include "hostap_wlan.h" 23 24 24 25 25 - static dev_info_t dev_info = "hostap_cs"; 26 + static char *dev_info = "hostap_cs"; 26 27 27 28 MODULE_AUTHOR("Jouni Malinen"); 28 29 MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN " ··· 224 225 static void sandisk_set_iobase(local_info_t *local) 225 226 { 226 227 int res; 227 - conf_reg_t reg; 228 228 struct hostap_cs_priv *hw_priv = local->hw_priv; 229 229 230 - reg.Function = 0; 231 - reg.Action = CS_WRITE; 232 - reg.Offset = 0x10; /* 0x3f0 IO base 1 */ 233 - reg.Value = hw_priv->link->io.BasePort1 & 0x00ff; 234 - res = pcmcia_access_configuration_register(hw_priv->link, 235 - &reg); 230 + res = pcmcia_write_config_byte(hw_priv->link, 0x10, 231 + hw_priv->link->resource[0]->start & 0x00ff); 236 232 if (res != 0) { 237 233 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -" 238 234 " res=%d\n", res); 239 235 } 240 236 udelay(10); 241 237 242 - reg.Function = 0; 243 - reg.Action = CS_WRITE; 244 - reg.Offset = 0x12; /* 0x3f2 IO base 2 */ 245 - reg.Value = (hw_priv->link->io.BasePort1 & 0xff00) >> 8; 246 - res = pcmcia_access_configuration_register(hw_priv->link, 247 - &reg); 238 + res = pcmcia_write_config_byte(hw_priv->link, 0x12, 239 + (hw_priv->link->resource[0]->start >> 8) & 0x00ff); 248 240 if (res != 0) { 249 241 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -" 250 242 " res=%d\n", res); ··· 261 271 static int sandisk_enable_wireless(struct net_device *dev) 262 272 { 263 273 int res, ret = 0; 264 - conf_reg_t reg; 265 274 struct hostap_interface *iface = netdev_priv(dev); 266 275 local_info_t *local = iface->local; 267 276 struct hostap_cs_priv *hw_priv = local->hw_priv; 268 277 269 - if (hw_priv->link->io.NumPorts1 < 0x42) { 278 + if (resource_size(hw_priv->link->resource[0]) < 0x42) { 270 279 /* Not enough ports to be SanDisk multi-function card */ 271 280 ret = -ENODEV; 272 281 goto done; ··· 287 298 " - using vendor-specific initialization\n", dev->name); 288 299 hw_priv->sandisk_connectplus = 1; 289 300 290 - reg.Function = 0; 291 - reg.Action = CS_WRITE; 292 - reg.Offset = CISREG_COR; 293 - reg.Value = COR_SOFT_RESET; 294 - res = pcmcia_access_configuration_register(hw_priv->link, 295 - &reg); 301 + res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, 302 + COR_SOFT_RESET); 296 303 if (res != 0) { 297 304 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", 298 305 dev->name, res); ··· 296 311 } 297 312 mdelay(5); 298 313 299 - reg.Function = 0; 300 - reg.Action = CS_WRITE; 301 - reg.Offset = CISREG_COR; 302 314 /* 303 315 * Do not enable interrupts here to avoid some bogus events. Interrupts 304 316 * will be enabled during the first cor_sreset call. 305 317 */ 306 - reg.Value = COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | COR_FUNC_ENA; 307 - res = pcmcia_access_configuration_register(hw_priv->link, 308 - &reg); 318 + res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, 319 + (COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | 320 + COR_FUNC_ENA)); 309 321 if (res != 0) { 310 322 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", 311 323 dev->name, res); ··· 325 343 static void prism2_pccard_cor_sreset(local_info_t *local) 326 344 { 327 345 int res; 328 - conf_reg_t reg; 346 + u8 val; 329 347 struct hostap_cs_priv *hw_priv = local->hw_priv; 330 348 331 349 if (!prism2_pccard_card_present(local)) 332 350 return; 333 351 334 - reg.Function = 0; 335 - reg.Action = CS_READ; 336 - reg.Offset = CISREG_COR; 337 - reg.Value = 0; 338 - res = pcmcia_access_configuration_register(hw_priv->link, 339 - &reg); 352 + res = pcmcia_read_config_byte(hw_priv->link, CISREG_COR, &val); 340 353 if (res != 0) { 341 354 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n", 342 355 res); 343 356 return; 344 357 } 345 358 printk(KERN_DEBUG "prism2_pccard_cor_sreset: original COR %02x\n", 346 - reg.Value); 359 + val); 347 360 348 - reg.Action = CS_WRITE; 349 - reg.Value |= COR_SOFT_RESET; 350 - res = pcmcia_access_configuration_register(hw_priv->link, 351 - &reg); 361 + val |= COR_SOFT_RESET; 362 + res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, val); 352 363 if (res != 0) { 353 364 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n", 354 365 res); ··· 350 375 351 376 mdelay(hw_priv->sandisk_connectplus ? 5 : 2); 352 377 353 - reg.Value &= ~COR_SOFT_RESET; 378 + val &= ~COR_SOFT_RESET; 354 379 if (hw_priv->sandisk_connectplus) 355 - reg.Value |= COR_IREQ_ENA; 356 - res = pcmcia_access_configuration_register(hw_priv->link, 357 - &reg); 380 + val |= COR_IREQ_ENA; 381 + res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, val); 358 382 if (res != 0) { 359 383 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n", 360 384 res); ··· 370 396 static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) 371 397 { 372 398 int res; 373 - conf_reg_t reg; 374 - int old_cor; 399 + u8 old_cor; 375 400 struct hostap_cs_priv *hw_priv = local->hw_priv; 376 401 377 402 if (!prism2_pccard_card_present(local)) ··· 381 408 return; 382 409 } 383 410 384 - reg.Function = 0; 385 - reg.Action = CS_READ; 386 - reg.Offset = CISREG_COR; 387 - reg.Value = 0; 388 - res = pcmcia_access_configuration_register(hw_priv->link, 389 - &reg); 411 + res = pcmcia_read_config_byte(hw_priv->link, CISREG_COR, &old_cor); 390 412 if (res != 0) { 391 413 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 " 392 414 "(%d)\n", res); 393 415 return; 394 416 } 395 417 printk(KERN_DEBUG "prism2_pccard_genesis_sreset: original COR %02x\n", 396 - reg.Value); 397 - old_cor = reg.Value; 418 + old_cor); 398 419 399 - reg.Action = CS_WRITE; 400 - reg.Value |= COR_SOFT_RESET; 401 - res = pcmcia_access_configuration_register(hw_priv->link, 402 - &reg); 420 + res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, 421 + old_cor | COR_SOFT_RESET); 403 422 if (res != 0) { 404 423 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 " 405 424 "(%d)\n", res); ··· 401 436 mdelay(10); 402 437 403 438 /* Setup Genesis mode */ 404 - reg.Action = CS_WRITE; 405 - reg.Value = hcr; 406 - reg.Offset = CISREG_CCSR; 407 - res = pcmcia_access_configuration_register(hw_priv->link, 408 - &reg); 439 + res = pcmcia_write_config_byte(hw_priv->link, CISREG_CCSR, hcr); 409 440 if (res != 0) { 410 441 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 " 411 442 "(%d)\n", res); ··· 409 448 } 410 449 mdelay(10); 411 450 412 - reg.Action = CS_WRITE; 413 - reg.Offset = CISREG_COR; 414 - reg.Value = old_cor & ~COR_SOFT_RESET; 415 - res = pcmcia_access_configuration_register(hw_priv->link, 416 - &reg); 451 + res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, 452 + old_cor & ~COR_SOFT_RESET); 417 453 if (res != 0) { 418 454 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 " 419 455 "(%d)\n", res); ··· 519 561 PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d " 520 562 "dflt->io.nwin=%d\n", 521 563 cfg->io.nwin, dflt->io.nwin); 522 - p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 564 + p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 523 565 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 524 566 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 525 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 526 - PDEBUG(DEBUG_EXTRA, "io->flags = 0x%04X, " 527 - "io.base=0x%04x, len=%d\n", io->flags, 528 - io->win[0].base, io->win[0].len); 529 - if (!(io->flags & CISTPL_IO_8BIT)) 530 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 531 - if (!(io->flags & CISTPL_IO_16BIT)) 532 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 533 - p_dev->io.IOAddrLines = io->flags & 534 - CISTPL_IO_LINES_MASK; 535 - p_dev->io.BasePort1 = io->win[0].base; 536 - p_dev->io.NumPorts1 = io->win[0].len; 567 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 568 + p_dev->resource[0]->flags |= 569 + pcmcia_io_cfg_data_width(io->flags); 570 + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 571 + p_dev->resource[0]->start = io->win[0].base; 572 + p_dev->resource[0]->end = io->win[0].len; 537 573 if (io->nwin > 1) { 538 - p_dev->io.Attributes2 = p_dev->io.Attributes1; 539 - p_dev->io.BasePort2 = io->win[1].base; 540 - p_dev->io.NumPorts2 = io->win[1].len; 574 + p_dev->resource[1]->flags = p_dev->resource[0]->flags; 575 + p_dev->resource[1]->start = io->win[1].base; 576 + p_dev->resource[1]->end = io->win[1].len; 541 577 } 542 578 } 543 579 544 580 /* This reserves IO space but doesn't actually enable it */ 545 - return pcmcia_request_io(p_dev, &p_dev->io); 581 + return pcmcia_request_io(p_dev); 546 582 } 547 583 548 584 static int prism2_config(struct pcmcia_device *link) ··· 598 646 goto failed_unlock; 599 647 600 648 dev->irq = link->irq; 601 - dev->base_addr = link->io.BasePort1; 649 + dev->base_addr = link->resource[0]->start; 602 650 603 651 spin_unlock_irqrestore(&local->irq_init_lock, flags); 604 652 ··· 610 658 link->conf.Vpp % 10); 611 659 if (link->conf.Attributes & CONF_ENABLE_IRQ) 612 660 printk(", irq %d", link->irq); 613 - if (link->io.NumPorts1) 614 - printk(", io 0x%04x-0x%04x", link->io.BasePort1, 615 - link->io.BasePort1+link->io.NumPorts1-1); 616 - if (link->io.NumPorts2) 617 - printk(" & 0x%04x-0x%04x", link->io.BasePort2, 618 - link->io.BasePort2+link->io.NumPorts2-1); 661 + if (link->resource[0]) 662 + printk(" & %pR", link->resource[0]); 663 + if (link->resource[1]) 664 + printk(" & %pR", link->resource[1]); 619 665 printk("\n"); 620 666 621 667 local->shutdown = 0;
+7 -9
drivers/net/wireless/libertas/if_cs.c
··· 28 28 #include <linux/firmware.h> 29 29 #include <linux/netdevice.h> 30 30 31 - #include <pcmcia/cs_types.h> 32 31 #include <pcmcia/cs.h> 33 32 #include <pcmcia/cistpl.h> 34 33 #include <pcmcia/ds.h> ··· 801 802 unsigned int vcc, 802 803 void *priv_data) 803 804 { 804 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 805 - p_dev->io.BasePort1 = cfg->io.win[0].base; 806 - p_dev->io.NumPorts1 = cfg->io.win[0].len; 805 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 806 + p_dev->resource[0]->start = cfg->io.win[0].base; 807 + p_dev->resource[0]->end = cfg->io.win[0].len; 807 808 808 809 /* Do we need to allocate an interrupt? */ 809 810 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; ··· 815 816 } 816 817 817 818 /* This reserves IO space but doesn't actually enable it */ 818 - return pcmcia_request_io(p_dev, &p_dev->io); 819 + return pcmcia_request_io(p_dev); 819 820 } 820 821 821 822 static int if_cs_probe(struct pcmcia_device *p_dev) ··· 853 854 goto out1; 854 855 855 856 /* Initialize io access */ 856 - card->iobase = ioport_map(p_dev->io.BasePort1, p_dev->io.NumPorts1); 857 + card->iobase = ioport_map(p_dev->resource[0]->start, 858 + resource_size(p_dev->resource[0])); 857 859 if (!card->iobase) { 858 860 lbs_pr_err("error in ioport_map\n"); 859 861 ret = -EIO; ··· 873 873 } 874 874 875 875 /* Finally, report what we've done */ 876 - lbs_deb_cs("irq %d, io 0x%04x-0x%04x\n", 877 - p_dev->irq, p_dev->io.BasePort1, 878 - p_dev->io.BasePort1 + p_dev->io.NumPorts1 - 1); 876 + lbs_deb_cs("irq %d, io %pR", p_dev->irq, p_dev->resource[0]); 879 877 880 878 /* 881 879 * Most of the libertas cards can do unaligned register access, but some
+14 -16
drivers/net/wireless/orinoco/orinoco_cs.c
··· 17 17 #include <linux/kernel.h> 18 18 #include <linux/init.h> 19 19 #include <linux/delay.h> 20 - #include <pcmcia/cs_types.h> 21 20 #include <pcmcia/cs.h> 22 21 #include <pcmcia/cistpl.h> 23 22 #include <pcmcia/cisreg.h> ··· 191 192 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 192 193 193 194 /* IO window settings */ 194 - p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 195 + p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 195 196 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 196 197 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 197 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 198 - if (!(io->flags & CISTPL_IO_8BIT)) 199 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 200 - if (!(io->flags & CISTPL_IO_16BIT)) 201 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 202 - p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 203 - p_dev->io.BasePort1 = io->win[0].base; 204 - p_dev->io.NumPorts1 = io->win[0].len; 198 + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 199 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 200 + p_dev->resource[0]->flags |= 201 + pcmcia_io_cfg_data_width(io->flags); 202 + p_dev->resource[0]->start = io->win[0].base; 203 + p_dev->resource[0]->end = io->win[0].len; 205 204 if (io->nwin > 1) { 206 - p_dev->io.Attributes2 = p_dev->io.Attributes1; 207 - p_dev->io.BasePort2 = io->win[1].base; 208 - p_dev->io.NumPorts2 = io->win[1].len; 205 + p_dev->resource[1]->flags = p_dev->resource[0]->flags; 206 + p_dev->resource[1]->start = io->win[1].base; 207 + p_dev->resource[1]->end = io->win[1].len; 209 208 } 210 209 211 210 /* This reserves IO space but doesn't actually enable it */ 212 - if (pcmcia_request_io(p_dev, &p_dev->io) != 0) 211 + if (pcmcia_request_io(p_dev) != 0) 213 212 goto next_entry; 214 213 } 215 214 return 0; ··· 255 258 /* We initialize the hermes structure before completing PCMCIA 256 259 * configuration just in case the interrupt handler gets 257 260 * called. */ 258 - mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); 261 + mem = ioport_map(link->resource[0]->start, 262 + resource_size(link->resource[0])); 259 263 if (!mem) 260 264 goto failed; 261 265 ··· 278 280 } 279 281 280 282 /* Register an interface with the stack */ 281 - if (orinoco_if_add(priv, link->io.BasePort1, 283 + if (orinoco_if_add(priv, link->resource[0]->start, 282 284 link->irq, NULL) != 0) { 283 285 printk(KERN_ERR PFX "orinoco_if_add() failed\n"); 284 286 goto failed;
+24 -38
drivers/net/wireless/orinoco/spectrum_cs.c
··· 25 25 #include <linux/kernel.h> 26 26 #include <linux/init.h> 27 27 #include <linux/delay.h> 28 - #include <pcmcia/cs_types.h> 29 28 #include <pcmcia/cs.h> 30 29 #include <pcmcia/cistpl.h> 31 30 #include <pcmcia/cisreg.h> ··· 79 80 spectrum_reset(struct pcmcia_device *link, int idle) 80 81 { 81 82 int ret; 82 - conf_reg_t reg; 83 - u_int save_cor; 83 + u8 save_cor; 84 + u8 ccsr; 84 85 85 86 /* Doing it if hardware is gone is guaranteed crash */ 86 87 if (!pcmcia_dev_present(link)) 87 88 return -ENODEV; 88 89 89 90 /* Save original COR value */ 90 - reg.Function = 0; 91 - reg.Action = CS_READ; 92 - reg.Offset = CISREG_COR; 93 - ret = pcmcia_access_configuration_register(link, &reg); 91 + ret = pcmcia_read_config_byte(link, CISREG_COR, &save_cor); 94 92 if (ret) 95 93 goto failed; 96 - save_cor = reg.Value; 97 94 98 95 /* Soft-Reset card */ 99 - reg.Action = CS_WRITE; 100 - reg.Offset = CISREG_COR; 101 - reg.Value = (save_cor | COR_SOFT_RESET); 102 - ret = pcmcia_access_configuration_register(link, &reg); 96 + ret = pcmcia_write_config_byte(link, CISREG_COR, 97 + (save_cor | COR_SOFT_RESET)); 103 98 if (ret) 104 99 goto failed; 105 100 udelay(1000); 106 101 107 102 /* Read CCSR */ 108 - reg.Action = CS_READ; 109 - reg.Offset = CISREG_CCSR; 110 - ret = pcmcia_access_configuration_register(link, &reg); 103 + ret = pcmcia_read_config_byte(link, CISREG_CCSR, &ccsr); 111 104 if (ret) 112 105 goto failed; 113 106 ··· 107 116 * Start or stop the firmware. Memory width bit should be 108 117 * preserved from the value we've just read. 109 118 */ 110 - reg.Action = CS_WRITE; 111 - reg.Offset = CISREG_CCSR; 112 - reg.Value = (idle ? HCR_IDLE : HCR_RUN) | (reg.Value & HCR_MEM16); 113 - ret = pcmcia_access_configuration_register(link, &reg); 119 + ccsr = (idle ? HCR_IDLE : HCR_RUN) | (ccsr & HCR_MEM16); 120 + ret = pcmcia_write_config_byte(link, CISREG_CCSR, ccsr); 114 121 if (ret) 115 122 goto failed; 116 123 udelay(1000); 117 124 118 125 /* Restore original COR configuration index */ 119 - reg.Action = CS_WRITE; 120 - reg.Offset = CISREG_COR; 121 - reg.Value = (save_cor & ~COR_SOFT_RESET); 122 - ret = pcmcia_access_configuration_register(link, &reg); 126 + ret = pcmcia_write_config_byte(link, CISREG_COR, 127 + (save_cor & ~COR_SOFT_RESET)); 123 128 if (ret) 124 129 goto failed; 125 130 udelay(1000); ··· 253 266 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 254 267 255 268 /* IO window settings */ 256 - p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 269 + p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 257 270 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 258 271 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 259 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 260 - if (!(io->flags & CISTPL_IO_8BIT)) 261 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 262 - if (!(io->flags & CISTPL_IO_16BIT)) 263 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 264 - p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 265 - p_dev->io.BasePort1 = io->win[0].base; 266 - p_dev->io.NumPorts1 = io->win[0].len; 272 + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 273 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 274 + p_dev->resource[0]->flags |= 275 + pcmcia_io_cfg_data_width(io->flags); 276 + p_dev->resource[0]->start = io->win[0].base; 277 + p_dev->resource[0]->end = io->win[0].len; 267 278 if (io->nwin > 1) { 268 - p_dev->io.Attributes2 = p_dev->io.Attributes1; 269 - p_dev->io.BasePort2 = io->win[1].base; 270 - p_dev->io.NumPorts2 = io->win[1].len; 279 + p_dev->resource[1]->flags = p_dev->resource[0]->flags; 280 + p_dev->resource[1]->start = io->win[1].base; 281 + p_dev->resource[1]->end = io->win[1].len; 271 282 } 272 283 273 284 /* This reserves IO space but doesn't actually enable it */ 274 - if (pcmcia_request_io(p_dev, &p_dev->io) != 0) 285 + if (pcmcia_request_io(p_dev) != 0) 275 286 goto next_entry; 276 287 } 277 288 return 0; ··· 317 332 /* We initialize the hermes structure before completing PCMCIA 318 333 * configuration just in case the interrupt handler gets 319 334 * called. */ 320 - mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); 335 + mem = ioport_map(link->resource[0]->start, 336 + resource_size(link->resource[0])); 321 337 if (!mem) 322 338 goto failed; 323 339 ··· 345 359 } 346 360 347 361 /* Register an interface with the stack */ 348 - if (orinoco_if_add(priv, link->io.BasePort1, 362 + if (orinoco_if_add(priv, link->resource[0]->start, 349 363 link->irq, NULL) != 0) { 350 364 printk(KERN_ERR PFX "orinoco_if_add() failed\n"); 351 365 goto failed;
+5 -22
drivers/net/wireless/ray_cs.c
··· 46 46 #include <linux/ethtool.h> 47 47 #include <linux/ieee80211.h> 48 48 49 - #include <pcmcia/cs_types.h> 50 49 #include <pcmcia/cs.h> 51 50 #include <pcmcia/cistpl.h> 52 51 #include <pcmcia/cisreg.h> ··· 314 315 local->finder = p_dev; 315 316 316 317 /* The io structure describes IO port mapping. None used here */ 317 - p_dev->io.NumPorts1 = 0; 318 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 319 - p_dev->io.IOAddrLines = 5; 318 + p_dev->resource[0]->end = 0; 319 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 320 320 321 321 /* General socket configuration */ 322 322 p_dev->conf.Attributes = CONF_ENABLE_IRQ; ··· 392 394 int ret = 0; 393 395 int i; 394 396 win_req_t req; 395 - memreq_t mem; 396 397 struct net_device *dev = (struct net_device *)link->priv; 397 398 ray_dev_t *local = netdev_priv(dev); 398 399 ··· 428 431 ret = pcmcia_request_window(link, &req, &link->win); 429 432 if (ret) 430 433 goto failed; 431 - mem.CardOffset = 0x0000; 432 - mem.Page = 0; 433 - ret = pcmcia_map_mem_page(link, link->win, &mem); 434 + ret = pcmcia_map_mem_page(link, link->win, 0); 434 435 if (ret) 435 436 goto failed; 436 437 local->sram = ioremap(req.Base, req.Size); ··· 442 447 ret = pcmcia_request_window(link, &req, &local->rmem_handle); 443 448 if (ret) 444 449 goto failed; 445 - mem.CardOffset = 0x8000; 446 - mem.Page = 0; 447 - ret = pcmcia_map_mem_page(link, local->rmem_handle, &mem); 450 + ret = pcmcia_map_mem_page(link, local->rmem_handle, 0x8000); 448 451 if (ret) 449 452 goto failed; 450 453 local->rmem = ioremap(req.Base, req.Size); ··· 456 463 ret = pcmcia_request_window(link, &req, &local->amem_handle); 457 464 if (ret) 458 465 goto failed; 459 - mem.CardOffset = 0x0000; 460 - mem.Page = 0; 461 - ret = pcmcia_map_mem_page(link, local->amem_handle, &mem); 466 + ret = pcmcia_map_mem_page(link, local->amem_handle, 0); 462 467 if (ret) 463 468 goto failed; 464 469 local->amem = ioremap(req.Base, req.Size); ··· 784 793 { 785 794 struct net_device *dev = link->priv; 786 795 ray_dev_t *local = netdev_priv(dev); 787 - int i; 788 796 789 797 dev_dbg(&link->dev, "ray_release\n"); 790 798 ··· 792 802 iounmap(local->sram); 793 803 iounmap(local->rmem); 794 804 iounmap(local->amem); 795 - /* Do bother checking to see if these succeed or not */ 796 - i = pcmcia_release_window(link, local->amem_handle); 797 - if (i != 0) 798 - dev_dbg(&link->dev, "ReleaseWindow(local->amem) ret = %x\n", i); 799 - i = pcmcia_release_window(link, local->rmem_handle); 800 - if (i != 0) 801 - dev_dbg(&link->dev, "ReleaseWindow(local->rmem) ret = %x\n", i); 802 805 pcmcia_disable_device(link); 803 806 804 807 dev_dbg(&link->dev, "ray_release ending\n");
+8 -16
drivers/net/wireless/wl3501_cs.c
··· 48 48 49 49 #include <net/iw_handler.h> 50 50 51 - #include <pcmcia/cs_types.h> 52 51 #include <pcmcia/cs.h> 53 52 #include <pcmcia/cistpl.h> 54 53 #include <pcmcia/cisreg.h> ··· 87 88 */ 88 89 static int wl3501_config(struct pcmcia_device *link); 89 90 static void wl3501_release(struct pcmcia_device *link); 90 - 91 - /* 92 - * The dev_info variable is the "key" that is used to match up this 93 - * device driver with appropriate cards, through the card configuration 94 - * database. 95 - */ 96 - static dev_info_t wl3501_dev_info = "wl3501_cs"; 97 91 98 92 static const struct { 99 93 int reg_domain; ··· 1413 1421 1414 1422 static void wl3501_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) 1415 1423 { 1416 - strlcpy(info->driver, wl3501_dev_info, sizeof(info->driver)); 1424 + strlcpy(info->driver, "wl3501_cs", sizeof(info->driver)); 1417 1425 } 1418 1426 1419 1427 static const struct ethtool_ops ops = { ··· 1884 1892 struct wl3501_card *this; 1885 1893 1886 1894 /* The io structure describes IO port mapping */ 1887 - p_dev->io.NumPorts1 = 16; 1888 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 1889 - p_dev->io.IOAddrLines = 5; 1895 + p_dev->resource[0]->end = 16; 1896 + p_dev->resource[0]->flags = IO_DATA_PATH_WIDTH_8; 1890 1897 1891 1898 /* General socket configuration */ 1892 1899 p_dev->conf.Attributes = CONF_ENABLE_IRQ; ··· 1931 1940 /* Try allocating IO ports. This tries a few fixed addresses. If you 1932 1941 * want, you can also read the card's config table to pick addresses -- 1933 1942 * see the serial driver for an example. */ 1943 + link->io_lines = 5; 1934 1944 1935 1945 for (j = 0x280; j < 0x400; j += 0x20) { 1936 1946 /* The '^0x300' is so that we probe 0x300-0x3ff first, then 1937 1947 * 0x200-0x2ff, and so on, because this seems safer */ 1938 - link->io.BasePort1 = j; 1939 - link->io.BasePort2 = link->io.BasePort1 + 0x10; 1940 - i = pcmcia_request_io(link, &link->io); 1948 + link->resource[0]->start = j; 1949 + link->resource[1]->start = link->resource[0]->start + 0x10; 1950 + i = pcmcia_request_io(link); 1941 1951 if (i == 0) 1942 1952 break; 1943 1953 } ··· 1960 1968 goto failed; 1961 1969 1962 1970 dev->irq = link->irq; 1963 - dev->base_addr = link->io.BasePort1; 1971 + dev->base_addr = link->resource[0]->start; 1964 1972 SET_NETDEV_DEV(dev, &link->dev); 1965 1973 if (register_netdev(dev)) { 1966 1974 printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n");
+12 -11
drivers/parport/parport_cs.c
··· 48 48 #include <linux/parport.h> 49 49 #include <linux/parport_pc.h> 50 50 51 - #include <pcmcia/cs_types.h> 52 51 #include <pcmcia/cs.h> 53 52 #include <pcmcia/cistpl.h> 54 53 #include <pcmcia/ds.h> ··· 101 102 link->priv = info; 102 103 info->p_dev = link; 103 104 104 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 105 - link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 105 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 106 + link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 106 107 link->conf.Attributes = CONF_ENABLE_IRQ; 107 108 link->conf.IntType = INT_MEMORY_AND_IO; 108 109 ··· 143 144 { 144 145 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 145 146 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 147 + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 146 148 if (epp_mode) 147 149 p_dev->conf.ConfigIndex |= FORCE_EPP_MODE; 148 - p_dev->io.BasePort1 = io->win[0].base; 149 - p_dev->io.NumPorts1 = io->win[0].len; 150 - p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 150 + p_dev->resource[0]->start = io->win[0].base; 151 + p_dev->resource[0]->end = io->win[0].len; 151 152 if (io->nwin == 2) { 152 - p_dev->io.BasePort2 = io->win[1].base; 153 - p_dev->io.NumPorts2 = io->win[1].len; 153 + p_dev->resource[1]->start = io->win[1].base; 154 + p_dev->resource[1]->end = io->win[1].len; 154 155 } 155 - if (pcmcia_request_io(p_dev, &p_dev->io) != 0) 156 + if (pcmcia_request_io(p_dev) != 0) 156 157 return -ENODEV; 157 158 return 0; 158 159 } ··· 177 178 if (ret) 178 179 goto failed; 179 180 180 - p = parport_pc_probe_port(link->io.BasePort1, link->io.BasePort2, 181 + p = parport_pc_probe_port(link->resource[0]->start, 182 + link->resource[1]->start, 181 183 link->irq, PARPORT_DMA_NONE, 182 184 &link->dev, IRQF_SHARED); 183 185 if (p == NULL) { 184 186 printk(KERN_NOTICE "parport_cs: parport_pc_probe_port() at " 185 - "0x%3x, irq %u failed\n", link->io.BasePort1, 187 + "0x%3x, irq %u failed\n", 188 + (unsigned int) link->resource[0]->start, 186 189 link->irq); 187 190 goto failed; 188 191 }
-1
drivers/pcmcia/Makefile
··· 7 7 obj-$(CONFIG_PCCARD) += pcmcia_core.o 8 8 9 9 pcmcia-y += ds.o pcmcia_resource.o cistpl.o pcmcia_cis.o 10 - pcmcia-$(CONFIG_PCMCIA_IOCTL) += pcmcia_ioctl.o 11 10 obj-$(CONFIG_PCMCIA) += pcmcia.o 12 11 13 12 pcmcia_rsrc-y += rsrc_mgr.o
-1
drivers/pcmcia/au1000_generic.h
··· 23 23 24 24 /* include the world */ 25 25 26 - #include <pcmcia/cs_types.h> 27 26 #include <pcmcia/cs.h> 28 27 #include <pcmcia/ss.h> 29 28 #include <pcmcia/cistpl.h>
-2
drivers/pcmcia/au1000_pb1x00.c
··· 31 31 #include <linux/proc_fs.h> 32 32 #include <linux/types.h> 33 33 34 - #include <pcmcia/cs_types.h> 35 34 #include <pcmcia/cs.h> 36 35 #include <pcmcia/ss.h> 37 36 #include <pcmcia/cistpl.h> 38 - #include <pcmcia/bus_ops.h> 39 37 40 38 #include <asm/io.h> 41 39 #include <asm/irq.h>
+7 -4
drivers/pcmcia/cistpl.c
··· 27 27 #include <asm/byteorder.h> 28 28 #include <asm/unaligned.h> 29 29 30 - #include <pcmcia/cs_types.h> 31 30 #include <pcmcia/ss.h> 32 31 #include <pcmcia/cs.h> 33 32 #include <pcmcia/cisreg.h> ··· 52 53 53 54 /* Upper limit on reasonable # of tuples */ 54 55 #define MAX_TUPLES 200 56 + 57 + /* Bits in IRQInfo1 field */ 58 + #define IRQ_INFO2_VALID 0x10 55 59 56 60 /* 16-bit CIS? */ 57 61 static int cis_width; ··· 212 210 * Probably only useful for writing one-byte registers. Must be called 213 211 * with ops_mutex held. 214 212 */ 215 - void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, 213 + int pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, 216 214 u_int len, void *ptr) 217 215 { 218 216 void __iomem *sys, *end; ··· 234 232 ((cis_width) ? MAP_16BIT : 0)); 235 233 if (!sys) { 236 234 dev_dbg(&s->dev, "could not map memory\n"); 237 - return; /* FIXME: Error */ 235 + return -EINVAL; 238 236 } 239 237 240 238 writeb(flags, sys+CISREG_ICTRL0); ··· 259 257 sys = set_cis_map(s, card_offset, flags); 260 258 if (!sys) { 261 259 dev_dbg(&s->dev, "could not map memory\n"); 262 - return; /* FIXME: error */ 260 + return -EINVAL; 263 261 } 264 262 265 263 end = sys + s->map_size; ··· 273 271 addr = 0; 274 272 } 275 273 } 274 + return 0; 276 275 } 277 276 278 277
+16 -63
drivers/pcmcia/cs.c
··· 32 32 #include <asm/system.h> 33 33 #include <asm/irq.h> 34 34 35 - #include <pcmcia/cs_types.h> 36 35 #include <pcmcia/ss.h> 37 36 #include <pcmcia/cs.h> 38 37 #include <pcmcia/cistpl.h> ··· 251 252 } 252 253 EXPORT_SYMBOL(pcmcia_get_socket_by_nr); 253 254 254 - /* 255 - * The central event handler. Send_event() sends an event to the 256 - * 16-bit subsystem, which then calls the relevant device drivers. 257 - * Parse_events() interprets the event bits from 258 - * a card status change report. Do_shutdown() handles the high 259 - * priority stuff associated with a card removal. 260 - */ 261 - 262 - /* NOTE: send_event needs to be called with skt->sem held. */ 263 - 264 - static int send_event(struct pcmcia_socket *s, event_t event, int priority) 265 - { 266 - int ret; 267 - 268 - if ((s->state & SOCKET_CARDBUS) && (event != CS_EVENT_CARD_REMOVAL)) 269 - return 0; 270 - 271 - dev_dbg(&s->dev, "send_event(event %d, pri %d, callback 0x%p)\n", 272 - event, priority, s->callback); 273 - 274 - if (!s->callback) 275 - return 0; 276 - if (!try_module_get(s->callback->owner)) 277 - return 0; 278 - 279 - ret = s->callback->event(s, event, priority); 280 - 281 - module_put(s->callback->owner); 282 - 283 - return ret; 284 - } 285 - 286 255 static int socket_reset(struct pcmcia_socket *skt) 287 256 { 288 257 int status, i; ··· 293 326 294 327 dev_dbg(&s->dev, "shutdown\n"); 295 328 296 - send_event(s, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH); 329 + if (s->callback) 330 + s->callback->remove(s); 297 331 298 332 mutex_lock(&s->ops_mutex); 299 333 s->state &= SOCKET_INUSE | SOCKET_PRESENT; ··· 445 477 dev_dbg(&skt->dev, "insert done\n"); 446 478 mutex_unlock(&skt->ops_mutex); 447 479 448 - send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW); 480 + if (!(skt->state & SOCKET_CARDBUS) && (skt->callback)) 481 + skt->callback->add(skt); 449 482 } else { 450 483 mutex_unlock(&skt->ops_mutex); 451 484 socket_shutdown(skt); ··· 463 494 mutex_lock(&skt->ops_mutex); 464 495 skt->suspended_state = skt->state; 465 496 466 - send_event(skt, CS_EVENT_PM_SUSPEND, CS_EVENT_PRI_LOW); 467 497 skt->socket = dead_socket; 468 498 skt->ops->set_socket(skt, &skt->socket); 469 499 if (skt->ops->suspend) ··· 523 555 return 0; 524 556 } 525 557 #endif 526 - 527 - send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW); 558 + if (!(skt->state & SOCKET_CARDBUS) && (skt->callback)) 559 + skt->callback->early_resume(skt); 528 560 return 0; 529 561 } 530 562 ··· 622 654 spin_unlock_irqrestore(&skt->thread_lock, flags); 623 655 624 656 mutex_lock(&skt->skt_mutex); 625 - if (events) { 626 - if (events & SS_DETECT) 627 - socket_detect_change(skt); 628 - if (events & SS_BATDEAD) 629 - send_event(skt, CS_EVENT_BATTERY_DEAD, CS_EVENT_PRI_LOW); 630 - if (events & SS_BATWARN) 631 - send_event(skt, CS_EVENT_BATTERY_LOW, CS_EVENT_PRI_LOW); 632 - if (events & SS_READY) 633 - send_event(skt, CS_EVENT_READY_CHANGE, CS_EVENT_PRI_LOW); 634 - } 657 + if (events & SS_DETECT) 658 + socket_detect_change(skt); 635 659 636 660 if (sysfs_events) { 637 661 if (sysfs_events & PCMCIA_UEVENT_EJECT) ··· 743 783 s->callback = c; 744 784 745 785 if ((s->state & (SOCKET_PRESENT|SOCKET_CARDBUS)) == SOCKET_PRESENT) 746 - send_event(s, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW); 786 + s->callback->add(s); 747 787 } else 748 788 s->callback = NULL; 749 789 err: ··· 783 823 break; 784 824 } 785 825 786 - ret = send_event(skt, CS_EVENT_RESET_REQUEST, CS_EVENT_PRI_LOW); 787 - if (ret == 0) { 788 - send_event(skt, CS_EVENT_RESET_PHYSICAL, CS_EVENT_PRI_LOW); 789 - if (skt->callback) 790 - skt->callback->suspend(skt); 791 - mutex_lock(&skt->ops_mutex); 792 - ret = socket_reset(skt); 793 - mutex_unlock(&skt->ops_mutex); 794 - if (ret == 0) { 795 - send_event(skt, CS_EVENT_CARD_RESET, CS_EVENT_PRI_LOW); 796 - if (skt->callback) 797 - skt->callback->resume(skt); 798 - } 799 - } 826 + if (skt->callback) 827 + skt->callback->suspend(skt); 828 + mutex_lock(&skt->ops_mutex); 829 + ret = socket_reset(skt); 830 + mutex_unlock(&skt->ops_mutex); 831 + if ((ret == 0) && (skt->callback)) 832 + skt->callback->resume(skt); 800 833 801 834 ret = 0; 802 835 } while (0);
+17 -45
drivers/pcmcia/cs_internal.h
··· 10 10 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 11 11 * 12 12 * (C) 1999 David A. Hinds 13 - * (C) 2003 - 2008 Dominik Brodowski 13 + * (C) 2003 - 2010 Dominik Brodowski 14 14 * 15 15 * 16 16 * This file contains definitions _only_ needed by the PCMCIA core modules. ··· 26 26 /* Flags in client state */ 27 27 #define CLIENT_WIN_REQ(i) (0x1<<(i)) 28 28 29 + /* Flag to access all functions */ 30 + #define BIND_FN_ALL 0xff 31 + 29 32 /* Each card function gets one of these guys */ 30 33 typedef struct config_t { 31 34 struct kref ref; ··· 38 35 unsigned int ConfigBase; 39 36 unsigned char Status, Pin, Copy, Option, ExtStatus; 40 37 unsigned int CardValues; 41 - io_req_t io; 38 + 39 + struct resource io[MAX_IO_WIN]; /* io ports */ 40 + struct resource mem[MAX_WIN]; /* mem areas */ 41 + 42 42 struct { 43 43 u_int Attributes; 44 44 } irq; ··· 62 56 unsigned int attr, 63 57 unsigned int *base, 64 58 unsigned int num, 65 - unsigned int align); 59 + unsigned int align, 60 + struct resource **parent); 66 61 struct resource* (*find_mem) (unsigned long base, unsigned long num, 67 62 unsigned long align, int low, 68 63 struct pcmcia_socket *s); 69 - int (*add_io) (struct pcmcia_socket *s, 70 - unsigned int action, 71 - unsigned long r_start, 72 - unsigned long r_end); 73 - int (*add_mem) (struct pcmcia_socket *s, 74 - unsigned int action, 75 - unsigned long r_start, 76 - unsigned long r_end); 77 64 int (*init) (struct pcmcia_socket *s); 78 65 void (*exit) (struct pcmcia_socket *s); 79 66 }; ··· 113 114 114 115 struct pcmcia_callback{ 115 116 struct module *owner; 116 - int (*event) (struct pcmcia_socket *s, 117 - event_t event, int priority); 117 + int (*add) (struct pcmcia_socket *s); 118 + int (*remove) (struct pcmcia_socket *s); 118 119 void (*requery) (struct pcmcia_socket *s); 119 120 int (*validate) (struct pcmcia_socket *s, unsigned int *i); 120 121 int (*suspend) (struct pcmcia_socket *s); 122 + int (*early_resume) (struct pcmcia_socket *s); 121 123 int (*resume) (struct pcmcia_socket *s); 122 124 }; 123 125 ··· 146 146 /* ds.c */ 147 147 extern struct bus_type pcmcia_bus_type; 148 148 149 + struct pcmcia_device; 150 + 149 151 /* pcmcia_resource.c */ 150 152 extern int pcmcia_release_configuration(struct pcmcia_device *p_dev); 151 153 extern int pcmcia_validate_mem(struct pcmcia_socket *s); ··· 165 163 166 164 int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, 167 165 u_int addr, u_int len, void *ptr); 168 - void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, 169 - u_int addr, u_int len, void *ptr); 166 + int pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, 167 + u_int addr, u_int len, void *ptr); 170 168 void release_cis_mem(struct pcmcia_socket *s); 171 169 void destroy_cis_cache(struct pcmcia_socket *s); 172 170 int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, ··· 189 187 tuple_t *tuple); 190 188 191 189 int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple); 192 - 193 - 194 - #ifdef CONFIG_PCMCIA_IOCTL 195 - /* ds.c */ 196 - extern struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev); 197 - extern void pcmcia_put_dev(struct pcmcia_device *p_dev); 198 - 199 - struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, 200 - unsigned int function); 201 - 202 - /* pcmcia_ioctl.c */ 203 - extern void __init pcmcia_setup_ioctl(void); 204 - extern void __exit pcmcia_cleanup_ioctl(void); 205 - extern void handle_event(struct pcmcia_socket *s, event_t event); 206 - extern int handle_request(struct pcmcia_socket *s, event_t event); 207 - 208 - #else /* CONFIG_PCMCIA_IOCTL */ 209 - 210 - static inline void __init pcmcia_setup_ioctl(void) { return; } 211 - static inline void __exit pcmcia_cleanup_ioctl(void) { return; } 212 - static inline void handle_event(struct pcmcia_socket *s, event_t event) 213 - { 214 - return; 215 - } 216 - static inline int handle_request(struct pcmcia_socket *s, event_t event) 217 - { 218 - return 0; 219 - } 220 - 221 - #endif /* CONFIG_PCMCIA_IOCTL */ 222 190 223 191 #endif /* _LINUX_CS_INTERNAL_H */
-1
drivers/pcmcia/db1xxx_ss.c
··· 29 29 #include <linux/slab.h> 30 30 #include <linux/spinlock.h> 31 31 32 - #include <pcmcia/cs_types.h> 33 32 #include <pcmcia/ss.h> 34 33 35 34 #include <asm/mach-au1x00/au1000.h>
+88 -104
drivers/pcmcia/ds.c
··· 10 10 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 11 11 * 12 12 * (C) 1999 David A. Hinds 13 - * (C) 2003 - 2006 Dominik Brodowski 13 + * (C) 2003 - 2010 Dominik Brodowski 14 14 */ 15 15 16 16 #include <linux/kernel.h> ··· 26 26 #include <linux/dma-mapping.h> 27 27 #include <linux/slab.h> 28 28 29 - #include <pcmcia/cs_types.h> 30 29 #include <pcmcia/cs.h> 31 30 #include <pcmcia/cistpl.h> 32 31 #include <pcmcia/ds.h> ··· 212 213 213 214 /* pcmcia_device handling */ 214 215 215 - struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev) 216 + static struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev) 216 217 { 217 218 struct device *tmp_dev; 218 219 tmp_dev = get_device(&p_dev->dev); ··· 221 222 return to_pcmcia_dev(tmp_dev); 222 223 } 223 224 224 - void pcmcia_put_dev(struct pcmcia_device *p_dev) 225 + static void pcmcia_put_dev(struct pcmcia_device *p_dev) 225 226 { 226 227 if (p_dev) 227 228 put_device(&p_dev->dev); ··· 293 294 } 294 295 295 296 mutex_lock(&s->ops_mutex); 296 - if ((s->pcmcia_state.has_pfc) && 297 + if ((s->pcmcia_pfc) && 297 298 (p_dev->socket->device_count == 1) && (p_dev->device_no == 0)) 298 299 pcmcia_parse_uevents(s, PCMCIA_UEVENT_REQUERY); 299 300 mutex_unlock(&s->ops_mutex); ··· 358 359 * pseudo multi-function card, we need to unbind 359 360 * all devices 360 361 */ 361 - if ((p_dev->socket->pcmcia_state.has_pfc) && 362 + if ((p_dev->socket->pcmcia_pfc) && 362 363 (p_dev->socket->device_count > 0) && 363 364 (p_dev->device_no == 0)) 364 365 pcmcia_card_remove(p_dev->socket, p_dev); ··· 476 477 } 477 478 478 479 479 - struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int function) 480 + static struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, 481 + unsigned int function) 480 482 { 481 483 struct pcmcia_device *p_dev, *tmp_dev; 482 484 int i; ··· 531 531 list_for_each_entry(tmp_dev, &s->devices_list, socket_device_list) 532 532 if (p_dev->func == tmp_dev->func) { 533 533 p_dev->function_config = tmp_dev->function_config; 534 - p_dev->io = tmp_dev->io; 535 534 p_dev->irq = tmp_dev->irq; 536 535 kref_get(&p_dev->function_config->ref); 537 536 } ··· 543 544 "IRQ setup failed -- device might not work\n"); 544 545 545 546 if (!p_dev->function_config) { 547 + config_t *c; 546 548 dev_dbg(&p_dev->dev, "creating config_t\n"); 547 - p_dev->function_config = kzalloc(sizeof(struct config_t), 548 - GFP_KERNEL); 549 - if (!p_dev->function_config) { 549 + c = kzalloc(sizeof(struct config_t), GFP_KERNEL); 550 + if (!c) { 550 551 mutex_unlock(&s->ops_mutex); 551 552 goto err_unreg; 552 553 } 553 - kref_init(&p_dev->function_config->ref); 554 + p_dev->function_config = c; 555 + kref_init(&c->ref); 556 + for (i = 0; i < MAX_IO_WIN; i++) { 557 + c->io[i].name = p_dev->devname; 558 + c->io[i].flags = IORESOURCE_IO; 559 + } 560 + for (i = 0; i< MAX_WIN; i++) { 561 + c->mem[i].name = p_dev->devname; 562 + c->mem[i].flags = IORESOURCE_MEM; 563 + } 554 564 } 565 + for (i = 0; i < MAX_IO_WIN; i++) 566 + p_dev->resource[i] = &p_dev->function_config->io[i]; 567 + for (; i < (MAX_IO_WIN + MAX_WIN); i++) 568 + p_dev->resource[i] = &p_dev->function_config->mem[i-MAX_IO_WIN]; 569 + 555 570 mutex_unlock(&s->ops_mutex); 556 571 557 572 dev_printk(KERN_NOTICE, &p_dev->dev, ··· 693 680 * call pcmcia_device_add() -- which will fail if both 694 681 * devices are already registered. */ 695 682 mutex_lock(&s->ops_mutex); 696 - has_pfc = s->pcmcia_state.has_pfc; 683 + has_pfc = s->pcmcia_pfc; 697 684 mutex_unlock(&s->ops_mutex); 698 685 if (has_pfc) 699 686 pcmcia_device_add(s, 0); ··· 825 812 if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) { 826 813 dev_dbg(&dev->dev, "this is a pseudo-multi-function device\n"); 827 814 mutex_lock(&dev->socket->ops_mutex); 828 - dev->socket->pcmcia_state.has_pfc = 1; 815 + dev->socket->pcmcia_pfc = 1; 829 816 mutex_unlock(&dev->socket->ops_mutex); 830 817 if (dev->device_no != did->device_no) 831 818 return 0; ··· 839 826 840 827 /* if this is a pseudo-multi-function device, 841 828 * we need explicit matches */ 842 - if (dev->socket->pcmcia_state.has_pfc) 829 + if (dev->socket->pcmcia_pfc) 843 830 return 0; 844 831 if (dev->device_no) 845 832 return 0; ··· 897 884 } 898 885 } 899 886 mutex_unlock(&p_drv->dynids.lock); 900 - 901 - #ifdef CONFIG_PCMCIA_IOCTL 902 - /* matching by cardmgr */ 903 - if (p_dev->cardmgr == p_drv) { 904 - dev_dbg(dev, "cardmgr matched to %s\n", drv->name); 905 - return 1; 906 - } 907 - #endif 908 887 909 888 while (did && did->match_flags) { 910 889 dev_dbg(dev, "trying to match to %s\n", drv->name); ··· 1011 1006 pcmcia_device_stringattr(prod_id3, prod_id[2]); 1012 1007 pcmcia_device_stringattr(prod_id4, prod_id[3]); 1013 1008 1009 + static ssize_t pcmcia_show_resources(struct device *dev, 1010 + struct device_attribute *attr, char *buf) 1011 + { 1012 + struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 1013 + char *str = buf; 1014 + int i; 1015 + 1016 + for (i = 0; i < PCMCIA_NUM_RESOURCES; i++) 1017 + str += sprintf(str, "%pr\n", p_dev->resource[i]); 1018 + 1019 + return str - buf; 1020 + } 1014 1021 1015 1022 static ssize_t pcmcia_show_pm_state(struct device *dev, struct device_attribute *attr, char *buf) 1016 1023 { ··· 1093 1076 static struct device_attribute pcmcia_dev_attrs[] = { 1094 1077 __ATTR(function, 0444, func_show, NULL), 1095 1078 __ATTR(pm_state, 0644, pcmcia_show_pm_state, pcmcia_store_pm_state), 1079 + __ATTR(resources, 0444, pcmcia_show_resources, NULL), 1096 1080 __ATTR_RO(func_id), 1097 1081 __ATTR_RO(manf_id), 1098 1082 __ATTR_RO(card_id), ··· 1233 1215 return 0; 1234 1216 } 1235 1217 1236 - 1237 - /*====================================================================== 1238 - 1239 - The card status event handler. 1240 - 1241 - ======================================================================*/ 1242 - 1243 - /* Normally, the event is passed to individual drivers after 1244 - * informing userspace. Only for CS_EVENT_CARD_REMOVAL this 1245 - * is inversed to maintain historic compatibility. 1246 - */ 1247 - 1248 - static int ds_event(struct pcmcia_socket *skt, event_t event, int priority) 1218 + static int pcmcia_bus_remove(struct pcmcia_socket *skt) 1249 1219 { 1250 - struct pcmcia_socket *s = pcmcia_get_socket(skt); 1220 + atomic_set(&skt->present, 0); 1221 + pcmcia_card_remove(skt, NULL); 1251 1222 1252 - if (!s) { 1253 - dev_printk(KERN_ERR, &skt->dev, 1254 - "PCMCIA obtaining reference to socket " \ 1255 - "failed, event 0x%x lost!\n", event); 1256 - return -ENODEV; 1223 + mutex_lock(&skt->ops_mutex); 1224 + destroy_cis_cache(skt); 1225 + pcmcia_cleanup_irq(skt); 1226 + mutex_unlock(&skt->ops_mutex); 1227 + 1228 + return 0; 1229 + } 1230 + 1231 + static int pcmcia_bus_add(struct pcmcia_socket *skt) 1232 + { 1233 + atomic_set(&skt->present, 1); 1234 + 1235 + mutex_lock(&skt->ops_mutex); 1236 + skt->pcmcia_pfc = 0; 1237 + destroy_cis_cache(skt); /* to be on the safe side... */ 1238 + mutex_unlock(&skt->ops_mutex); 1239 + 1240 + pcmcia_card_add(skt); 1241 + 1242 + return 0; 1243 + } 1244 + 1245 + static int pcmcia_bus_early_resume(struct pcmcia_socket *skt) 1246 + { 1247 + if (!verify_cis_cache(skt)) { 1248 + pcmcia_put_socket(skt); 1249 + return 0; 1257 1250 } 1258 1251 1259 - dev_dbg(&skt->dev, "ds_event(0x%06x, %d, 0x%p)\n", 1260 - event, priority, skt); 1252 + dev_dbg(&skt->dev, "cis mismatch - different card\n"); 1261 1253 1262 - switch (event) { 1263 - case CS_EVENT_CARD_REMOVAL: 1264 - atomic_set(&skt->present, 0); 1265 - pcmcia_card_remove(skt, NULL); 1266 - handle_event(skt, event); 1267 - mutex_lock(&s->ops_mutex); 1268 - destroy_cis_cache(s); 1269 - pcmcia_cleanup_irq(s); 1270 - mutex_unlock(&s->ops_mutex); 1271 - break; 1254 + /* first, remove the card */ 1255 + pcmcia_bus_remove(skt); 1272 1256 1273 - case CS_EVENT_CARD_INSERTION: 1274 - atomic_set(&skt->present, 1); 1275 - mutex_lock(&s->ops_mutex); 1276 - s->pcmcia_state.has_pfc = 0; 1277 - destroy_cis_cache(s); /* to be on the safe side... */ 1278 - mutex_unlock(&s->ops_mutex); 1279 - pcmcia_card_add(skt); 1280 - handle_event(skt, event); 1281 - break; 1257 + mutex_lock(&skt->ops_mutex); 1258 + destroy_cis_cache(skt); 1259 + kfree(skt->fake_cis); 1260 + skt->fake_cis = NULL; 1261 + skt->functions = 0; 1262 + mutex_unlock(&skt->ops_mutex); 1282 1263 1283 - case CS_EVENT_EJECTION_REQUEST: 1284 - break; 1264 + /* now, add the new card */ 1265 + pcmcia_bus_add(skt); 1266 + return 0; 1267 + } 1285 1268 1286 - case CS_EVENT_PM_RESUME: 1287 - if (verify_cis_cache(skt) != 0) { 1288 - dev_dbg(&skt->dev, "cis mismatch - different card\n"); 1289 - /* first, remove the card */ 1290 - ds_event(skt, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH); 1291 - mutex_lock(&s->ops_mutex); 1292 - destroy_cis_cache(skt); 1293 - kfree(skt->fake_cis); 1294 - skt->fake_cis = NULL; 1295 - s->functions = 0; 1296 - mutex_unlock(&s->ops_mutex); 1297 - /* now, add the new card */ 1298 - ds_event(skt, CS_EVENT_CARD_INSERTION, 1299 - CS_EVENT_PRI_LOW); 1300 - } 1301 - handle_event(skt, event); 1302 - break; 1303 - 1304 - case CS_EVENT_PM_SUSPEND: 1305 - case CS_EVENT_RESET_PHYSICAL: 1306 - case CS_EVENT_CARD_RESET: 1307 - default: 1308 - handle_event(skt, event); 1309 - break; 1310 - } 1311 - 1312 - pcmcia_put_socket(s); 1313 - 1314 - return 0; 1315 - } /* ds_event */ 1316 1269 1317 1270 /* 1318 1271 * NOTE: This is racy. There's no guarantee the card will still be ··· 1312 1323 1313 1324 static struct pcmcia_callback pcmcia_bus_callback = { 1314 1325 .owner = THIS_MODULE, 1315 - .event = ds_event, 1326 + .add = pcmcia_bus_add, 1327 + .remove = pcmcia_bus_remove, 1316 1328 .requery = pcmcia_requery, 1317 1329 .validate = pccard_validate_cis, 1318 1330 .suspend = pcmcia_bus_suspend, 1331 + .early_resume = pcmcia_bus_early_resume, 1319 1332 .resume = pcmcia_bus_resume, 1320 1333 }; 1321 1334 ··· 1341 1350 return ret; 1342 1351 } 1343 1352 1344 - #ifdef CONFIG_PCMCIA_IOCTL 1345 - init_waitqueue_head(&socket->queue); 1346 - #endif 1347 1353 INIT_LIST_HEAD(&socket->devices_list); 1348 - memset(&socket->pcmcia_state, 0, sizeof(u8)); 1354 + socket->pcmcia_pfc = 0; 1349 1355 socket->device_count = 0; 1350 1356 atomic_set(&socket->present, 0); 1351 1357 ··· 1417 1429 return ret; 1418 1430 } 1419 1431 1420 - pcmcia_setup_ioctl(); 1421 - 1422 1432 return 0; 1423 1433 } 1424 1434 fs_initcall(init_pcmcia_bus); /* one level after subsys_initcall so that ··· 1425 1439 1426 1440 static void __exit exit_pcmcia_bus(void) 1427 1441 { 1428 - pcmcia_cleanup_ioctl(); 1429 - 1430 1442 class_interface_unregister(&pcmcia_bus_interface); 1431 1443 1432 1444 bus_unregister(&pcmcia_bus_type);
-1
drivers/pcmcia/i82092.c
··· 15 15 #include <linux/interrupt.h> 16 16 #include <linux/device.h> 17 17 18 - #include <pcmcia/cs_types.h> 19 18 #include <pcmcia/ss.h> 20 19 #include <pcmcia/cs.h> 21 20
-1
drivers/pcmcia/i82365.c
··· 50 50 #include <asm/io.h> 51 51 #include <asm/system.h> 52 52 53 - #include <pcmcia/cs_types.h> 54 53 #include <pcmcia/ss.h> 55 54 #include <pcmcia/cs.h> 56 55
-1
drivers/pcmcia/m32r_cfc.c
··· 26 26 #include <asm/io.h> 27 27 #include <asm/system.h> 28 28 29 - #include <pcmcia/cs_types.h> 30 29 #include <pcmcia/ss.h> 31 30 #include <pcmcia/cs.h> 32 31
-1
drivers/pcmcia/m32r_pcc.c
··· 27 27 #include <asm/system.h> 28 28 #include <asm/addrspace.h> 29 29 30 - #include <pcmcia/cs_types.h> 31 30 #include <pcmcia/ss.h> 32 31 #include <pcmcia/cs.h> 33 32
-1
drivers/pcmcia/m8xx_pcmcia.c
··· 59 59 #include <asm/irq.h> 60 60 #include <asm/fs_pd.h> 61 61 62 - #include <pcmcia/cs_types.h> 63 62 #include <pcmcia/cs.h> 64 63 #include <pcmcia/ss.h> 65 64
-1
drivers/pcmcia/pcmcia_cis.c
··· 19 19 #include <linux/kernel.h> 20 20 #include <linux/netdevice.h> 21 21 22 - #include <pcmcia/cs_types.h> 23 22 #include <pcmcia/cisreg.h> 24 23 #include <pcmcia/cistpl.h> 25 24 #include <pcmcia/ss.h>
-1077
drivers/pcmcia/pcmcia_ioctl.c
··· 1 - /* 2 - * pcmcia_ioctl.c -- ioctl interface for cardmgr and cardctl 3 - * 4 - * This program is free software; you can redistribute it and/or modify 5 - * it under the terms of the GNU General Public License version 2 as 6 - * published by the Free Software Foundation. 7 - * 8 - * The initial developer of the original code is David A. Hinds 9 - * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds 10 - * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 11 - * 12 - * (C) 1999 David A. Hinds 13 - * (C) 2003 - 2004 Dominik Brodowski 14 - */ 15 - 16 - /* 17 - * This file will go away soon. 18 - */ 19 - 20 - 21 - #include <linux/kernel.h> 22 - #include <linux/module.h> 23 - #include <linux/init.h> 24 - #include <linux/major.h> 25 - #include <linux/errno.h> 26 - #include <linux/ioctl.h> 27 - #include <linux/proc_fs.h> 28 - #include <linux/poll.h> 29 - #include <linux/pci.h> 30 - #include <linux/slab.h> 31 - #include <linux/seq_file.h> 32 - #include <linux/smp_lock.h> 33 - #include <linux/workqueue.h> 34 - 35 - #include <pcmcia/cs_types.h> 36 - #include <pcmcia/cs.h> 37 - #include <pcmcia/cistpl.h> 38 - #include <pcmcia/cisreg.h> 39 - #include <pcmcia/ds.h> 40 - #include <pcmcia/ss.h> 41 - 42 - #include "cs_internal.h" 43 - 44 - static int major_dev = -1; 45 - 46 - 47 - /* Device user information */ 48 - #define MAX_EVENTS 32 49 - #define USER_MAGIC 0x7ea4 50 - #define CHECK_USER(u) \ 51 - (((u) == NULL) || ((u)->user_magic != USER_MAGIC)) 52 - 53 - typedef struct user_info_t { 54 - u_int user_magic; 55 - int event_head, event_tail; 56 - event_t event[MAX_EVENTS]; 57 - struct user_info_t *next; 58 - struct pcmcia_socket *socket; 59 - } user_info_t; 60 - 61 - 62 - static struct pcmcia_device *get_pcmcia_device(struct pcmcia_socket *s, 63 - unsigned int function) 64 - { 65 - struct pcmcia_device *p_dev = NULL; 66 - 67 - mutex_lock(&s->ops_mutex); 68 - list_for_each_entry(p_dev, &s->devices_list, socket_device_list) { 69 - if (p_dev->func == function) { 70 - mutex_unlock(&s->ops_mutex); 71 - return pcmcia_get_dev(p_dev); 72 - } 73 - } 74 - mutex_unlock(&s->ops_mutex); 75 - return NULL; 76 - } 77 - 78 - /* backwards-compatible accessing of driver --- by name! */ 79 - 80 - static struct pcmcia_driver *get_pcmcia_driver(dev_info_t *dev_info) 81 - { 82 - struct device_driver *drv; 83 - struct pcmcia_driver *p_drv; 84 - 85 - drv = driver_find((char *) dev_info, &pcmcia_bus_type); 86 - if (!drv) 87 - return NULL; 88 - 89 - p_drv = container_of(drv, struct pcmcia_driver, drv); 90 - 91 - return p_drv; 92 - } 93 - 94 - 95 - #ifdef CONFIG_PROC_FS 96 - static struct proc_dir_entry *proc_pccard; 97 - 98 - static int proc_read_drivers_callback(struct device_driver *driver, void *_m) 99 - { 100 - struct seq_file *m = _m; 101 - struct pcmcia_driver *p_drv = container_of(driver, 102 - struct pcmcia_driver, drv); 103 - 104 - seq_printf(m, "%-24.24s 1 %d\n", p_drv->drv.name, 105 - #ifdef CONFIG_MODULE_UNLOAD 106 - (p_drv->owner) ? module_refcount(p_drv->owner) : 1 107 - #else 108 - 1 109 - #endif 110 - ); 111 - return 0; 112 - } 113 - 114 - static int pccard_drivers_proc_show(struct seq_file *m, void *v) 115 - { 116 - return bus_for_each_drv(&pcmcia_bus_type, NULL, 117 - m, proc_read_drivers_callback); 118 - } 119 - 120 - static int pccard_drivers_proc_open(struct inode *inode, struct file *file) 121 - { 122 - return single_open(file, pccard_drivers_proc_show, NULL); 123 - } 124 - 125 - static const struct file_operations pccard_drivers_proc_fops = { 126 - .owner = THIS_MODULE, 127 - .open = pccard_drivers_proc_open, 128 - .read = seq_read, 129 - .llseek = seq_lseek, 130 - .release = single_release, 131 - }; 132 - #endif 133 - 134 - 135 - #ifdef CONFIG_PCMCIA_PROBE 136 - 137 - static int adjust_irq(struct pcmcia_socket *s, adjust_t *adj) 138 - { 139 - int irq; 140 - u32 mask; 141 - 142 - irq = adj->resource.irq.IRQ; 143 - if ((irq < 0) || (irq > 15)) 144 - return -EINVAL; 145 - 146 - if (adj->Action != REMOVE_MANAGED_RESOURCE) 147 - return 0; 148 - 149 - mask = 1 << irq; 150 - 151 - if (!(s->irq_mask & mask)) 152 - return 0; 153 - 154 - s->irq_mask &= ~mask; 155 - 156 - return 0; 157 - } 158 - 159 - #else 160 - 161 - static inline int adjust_irq(struct pcmcia_socket *s, adjust_t *adj) 162 - { 163 - return 0; 164 - } 165 - 166 - #endif 167 - 168 - static int pcmcia_adjust_resource_info(adjust_t *adj) 169 - { 170 - struct pcmcia_socket *s; 171 - int ret = -ENOSYS; 172 - 173 - down_read(&pcmcia_socket_list_rwsem); 174 - list_for_each_entry(s, &pcmcia_socket_list, socket_list) { 175 - 176 - if (adj->Resource == RES_IRQ) 177 - ret = adjust_irq(s, adj); 178 - 179 - else if (s->resource_ops->add_io) { 180 - unsigned long begin, end; 181 - 182 - /* you can't use the old interface if the new 183 - * one was used before */ 184 - mutex_lock(&s->ops_mutex); 185 - if ((s->resource_setup_new) && 186 - !(s->resource_setup_old)) { 187 - mutex_unlock(&s->ops_mutex); 188 - continue; 189 - } else if (!(s->resource_setup_old)) 190 - s->resource_setup_old = 1; 191 - 192 - switch (adj->Resource) { 193 - case RES_MEMORY_RANGE: 194 - begin = adj->resource.memory.Base; 195 - end = adj->resource.memory.Base + adj->resource.memory.Size - 1; 196 - if (s->resource_ops->add_mem) 197 - ret = s->resource_ops->add_mem(s, adj->Action, begin, end); 198 - case RES_IO_RANGE: 199 - begin = adj->resource.io.BasePort; 200 - end = adj->resource.io.BasePort + adj->resource.io.NumPorts - 1; 201 - if (s->resource_ops->add_io) 202 - ret = s->resource_ops->add_io(s, adj->Action, begin, end); 203 - } 204 - if (!ret) { 205 - /* as there's no way we know this is the 206 - * last call to adjust_resource_info, we 207 - * always need to assume this is the latest 208 - * one... */ 209 - s->resource_setup_done = 1; 210 - } 211 - mutex_unlock(&s->ops_mutex); 212 - } 213 - } 214 - up_read(&pcmcia_socket_list_rwsem); 215 - 216 - return ret; 217 - } 218 - 219 - 220 - /** pcmcia_get_window 221 - */ 222 - static int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *wh_out, 223 - window_handle_t wh, win_req_t *req) 224 - { 225 - pccard_mem_map *win; 226 - window_handle_t w; 227 - 228 - wh--; 229 - if (!s || !(s->state & SOCKET_PRESENT)) 230 - return -ENODEV; 231 - if (wh >= MAX_WIN) 232 - return -EINVAL; 233 - for (w = wh; w < MAX_WIN; w++) 234 - if (s->state & SOCKET_WIN_REQ(w)) 235 - break; 236 - if (w == MAX_WIN) 237 - return -EINVAL; 238 - win = &s->win[w]; 239 - req->Base = win->res->start; 240 - req->Size = win->res->end - win->res->start + 1; 241 - req->AccessSpeed = win->speed; 242 - req->Attributes = 0; 243 - if (win->flags & MAP_ATTRIB) 244 - req->Attributes |= WIN_MEMORY_TYPE_AM; 245 - if (win->flags & MAP_ACTIVE) 246 - req->Attributes |= WIN_ENABLE; 247 - if (win->flags & MAP_16BIT) 248 - req->Attributes |= WIN_DATA_WIDTH_16; 249 - if (win->flags & MAP_USE_WAIT) 250 - req->Attributes |= WIN_USE_WAIT; 251 - 252 - *wh_out = w + 1; 253 - return 0; 254 - } /* pcmcia_get_window */ 255 - 256 - 257 - /** pcmcia_get_mem_page 258 - * 259 - * Change the card address of an already open memory window. 260 - */ 261 - static int pcmcia_get_mem_page(struct pcmcia_socket *skt, window_handle_t wh, 262 - memreq_t *req) 263 - { 264 - wh--; 265 - if (wh >= MAX_WIN) 266 - return -EINVAL; 267 - 268 - req->Page = 0; 269 - req->CardOffset = skt->win[wh].card_start; 270 - return 0; 271 - } /* pcmcia_get_mem_page */ 272 - 273 - 274 - /** pccard_get_status 275 - * 276 - * Get the current socket state bits. We don't support the latched 277 - * SocketState yet: I haven't seen any point for it. 278 - */ 279 - 280 - static int pccard_get_status(struct pcmcia_socket *s, 281 - struct pcmcia_device *p_dev, 282 - cs_status_t *status) 283 - { 284 - config_t *c; 285 - int val; 286 - 287 - s->ops->get_status(s, &val); 288 - status->CardState = status->SocketState = 0; 289 - status->CardState |= (val & SS_DETECT) ? CS_EVENT_CARD_DETECT : 0; 290 - status->CardState |= (val & SS_CARDBUS) ? CS_EVENT_CB_DETECT : 0; 291 - status->CardState |= (val & SS_3VCARD) ? CS_EVENT_3VCARD : 0; 292 - status->CardState |= (val & SS_XVCARD) ? CS_EVENT_XVCARD : 0; 293 - if (s->state & SOCKET_SUSPEND) 294 - status->CardState |= CS_EVENT_PM_SUSPEND; 295 - if (!(s->state & SOCKET_PRESENT)) 296 - return -ENODEV; 297 - 298 - c = (p_dev) ? p_dev->function_config : NULL; 299 - 300 - if ((c != NULL) && (c->state & CONFIG_LOCKED) && 301 - (c->IntType & (INT_MEMORY_AND_IO | INT_ZOOMED_VIDEO))) { 302 - u_char reg; 303 - if (c->CardValues & PRESENT_PIN_REPLACE) { 304 - mutex_lock(&s->ops_mutex); 305 - pcmcia_read_cis_mem(s, 1, (c->ConfigBase+CISREG_PRR)>>1, 1, &reg); 306 - mutex_unlock(&s->ops_mutex); 307 - status->CardState |= 308 - (reg & PRR_WP_STATUS) ? CS_EVENT_WRITE_PROTECT : 0; 309 - status->CardState |= 310 - (reg & PRR_READY_STATUS) ? CS_EVENT_READY_CHANGE : 0; 311 - status->CardState |= 312 - (reg & PRR_BVD2_STATUS) ? CS_EVENT_BATTERY_LOW : 0; 313 - status->CardState |= 314 - (reg & PRR_BVD1_STATUS) ? CS_EVENT_BATTERY_DEAD : 0; 315 - } else { 316 - /* No PRR? Then assume we're always ready */ 317 - status->CardState |= CS_EVENT_READY_CHANGE; 318 - } 319 - if (c->CardValues & PRESENT_EXT_STATUS) { 320 - mutex_lock(&s->ops_mutex); 321 - pcmcia_read_cis_mem(s, 1, (c->ConfigBase+CISREG_ESR)>>1, 1, &reg); 322 - mutex_unlock(&s->ops_mutex); 323 - status->CardState |= 324 - (reg & ESR_REQ_ATTN) ? CS_EVENT_REQUEST_ATTENTION : 0; 325 - } 326 - return 0; 327 - } 328 - status->CardState |= 329 - (val & SS_WRPROT) ? CS_EVENT_WRITE_PROTECT : 0; 330 - status->CardState |= 331 - (val & SS_BATDEAD) ? CS_EVENT_BATTERY_DEAD : 0; 332 - status->CardState |= 333 - (val & SS_BATWARN) ? CS_EVENT_BATTERY_LOW : 0; 334 - status->CardState |= 335 - (val & SS_READY) ? CS_EVENT_READY_CHANGE : 0; 336 - return 0; 337 - } /* pccard_get_status */ 338 - 339 - static int pccard_get_configuration_info(struct pcmcia_socket *s, 340 - struct pcmcia_device *p_dev, 341 - config_info_t *config) 342 - { 343 - config_t *c; 344 - 345 - if (!(s->state & SOCKET_PRESENT)) 346 - return -ENODEV; 347 - 348 - 349 - #ifdef CONFIG_CARDBUS 350 - if (s->state & SOCKET_CARDBUS) { 351 - memset(config, 0, sizeof(config_info_t)); 352 - config->Vcc = s->socket.Vcc; 353 - config->Vpp1 = config->Vpp2 = s->socket.Vpp; 354 - config->Option = s->cb_dev->subordinate->number; 355 - if (s->state & SOCKET_CARDBUS_CONFIG) { 356 - config->Attributes = CONF_VALID_CLIENT; 357 - config->IntType = INT_CARDBUS; 358 - config->AssignedIRQ = s->pcmcia_irq; 359 - if (config->AssignedIRQ) 360 - config->Attributes |= CONF_ENABLE_IRQ; 361 - if (s->io[0].res) { 362 - config->BasePort1 = s->io[0].res->start; 363 - config->NumPorts1 = s->io[0].res->end - 364 - config->BasePort1 + 1; 365 - } 366 - } 367 - return 0; 368 - } 369 - #endif 370 - 371 - if (p_dev) { 372 - c = p_dev->function_config; 373 - config->Function = p_dev->func; 374 - } else { 375 - c = NULL; 376 - config->Function = 0; 377 - } 378 - 379 - if ((c == NULL) || !(c->state & CONFIG_LOCKED)) { 380 - config->Attributes = 0; 381 - config->Vcc = s->socket.Vcc; 382 - config->Vpp1 = config->Vpp2 = s->socket.Vpp; 383 - return 0; 384 - } 385 - 386 - config->Attributes = c->Attributes | CONF_VALID_CLIENT; 387 - config->Vcc = s->socket.Vcc; 388 - config->Vpp1 = config->Vpp2 = s->socket.Vpp; 389 - config->IntType = c->IntType; 390 - config->ConfigBase = c->ConfigBase; 391 - config->Status = c->Status; 392 - config->Pin = c->Pin; 393 - config->Copy = c->Copy; 394 - config->Option = c->Option; 395 - config->ExtStatus = c->ExtStatus; 396 - config->Present = config->CardValues = c->CardValues; 397 - config->IRQAttributes = c->irq.Attributes; 398 - config->AssignedIRQ = s->pcmcia_irq; 399 - config->BasePort1 = c->io.BasePort1; 400 - config->NumPorts1 = c->io.NumPorts1; 401 - config->Attributes1 = c->io.Attributes1; 402 - config->BasePort2 = c->io.BasePort2; 403 - config->NumPorts2 = c->io.NumPorts2; 404 - config->Attributes2 = c->io.Attributes2; 405 - config->IOAddrLines = c->io.IOAddrLines; 406 - 407 - return 0; 408 - } /* pccard_get_configuration_info */ 409 - 410 - 411 - /*====================================================================== 412 - 413 - These manage a ring buffer of events pending for one user process 414 - 415 - ======================================================================*/ 416 - 417 - 418 - static int queue_empty(user_info_t *user) 419 - { 420 - return (user->event_head == user->event_tail); 421 - } 422 - 423 - static event_t get_queued_event(user_info_t *user) 424 - { 425 - user->event_tail = (user->event_tail+1) % MAX_EVENTS; 426 - return user->event[user->event_tail]; 427 - } 428 - 429 - static void queue_event(user_info_t *user, event_t event) 430 - { 431 - user->event_head = (user->event_head+1) % MAX_EVENTS; 432 - if (user->event_head == user->event_tail) 433 - user->event_tail = (user->event_tail+1) % MAX_EVENTS; 434 - user->event[user->event_head] = event; 435 - } 436 - 437 - void handle_event(struct pcmcia_socket *s, event_t event) 438 - { 439 - user_info_t *user; 440 - for (user = s->user; user; user = user->next) 441 - queue_event(user, event); 442 - wake_up_interruptible(&s->queue); 443 - } 444 - 445 - 446 - /*====================================================================== 447 - 448 - bind_request() and bind_device() are merged by now. Register_client() 449 - is called right at the end of bind_request(), during the driver's 450 - ->attach() call. Individual descriptions: 451 - 452 - bind_request() connects a socket to a particular client driver. 453 - It looks up the specified device ID in the list of registered 454 - drivers, binds it to the socket, and tries to create an instance 455 - of the device. unbind_request() deletes a driver instance. 456 - 457 - Bind_device() associates a device driver with a particular socket. 458 - It is normally called by Driver Services after it has identified 459 - a newly inserted card. An instance of that driver will then be 460 - eligible to register as a client of this socket. 461 - 462 - Register_client() uses the dev_info_t handle to match the 463 - caller with a socket. The driver must have already been bound 464 - to a socket with bind_device() -- in fact, bind_device() 465 - allocates the client structure that will be used. 466 - 467 - ======================================================================*/ 468 - 469 - static int bind_request(struct pcmcia_socket *s, bind_info_t *bind_info) 470 - { 471 - struct pcmcia_driver *p_drv; 472 - struct pcmcia_device *p_dev; 473 - int ret = 0; 474 - 475 - s = pcmcia_get_socket(s); 476 - if (!s) 477 - return -EINVAL; 478 - 479 - pr_debug("bind_request(%d, '%s')\n", s->sock, 480 - (char *)bind_info->dev_info); 481 - 482 - p_drv = get_pcmcia_driver(&bind_info->dev_info); 483 - if (!p_drv) { 484 - ret = -EINVAL; 485 - goto err_put; 486 - } 487 - 488 - if (!try_module_get(p_drv->owner)) { 489 - ret = -EINVAL; 490 - goto err_put_driver; 491 - } 492 - 493 - mutex_lock(&s->ops_mutex); 494 - list_for_each_entry(p_dev, &s->devices_list, socket_device_list) { 495 - if (p_dev->func == bind_info->function) { 496 - if ((p_dev->dev.driver == &p_drv->drv)) { 497 - if (p_dev->cardmgr) { 498 - /* if there's already a device 499 - * registered, and it was registered 500 - * by userspace before, we need to 501 - * return the "instance". */ 502 - mutex_unlock(&s->ops_mutex); 503 - bind_info->instance = p_dev; 504 - ret = -EBUSY; 505 - goto err_put_module; 506 - } else { 507 - /* the correct driver managed to bind 508 - * itself magically to the correct 509 - * device. */ 510 - mutex_unlock(&s->ops_mutex); 511 - p_dev->cardmgr = p_drv; 512 - ret = 0; 513 - goto err_put_module; 514 - } 515 - } else if (!p_dev->dev.driver) { 516 - /* there's already a device available where 517 - * no device has been bound to yet. So we don't 518 - * need to register a device! */ 519 - mutex_unlock(&s->ops_mutex); 520 - goto rescan; 521 - } 522 - } 523 - } 524 - mutex_unlock(&s->ops_mutex); 525 - 526 - p_dev = pcmcia_device_add(s, bind_info->function); 527 - if (!p_dev) { 528 - ret = -EIO; 529 - goto err_put_module; 530 - } 531 - 532 - rescan: 533 - p_dev->cardmgr = p_drv; 534 - 535 - /* if a driver is already running, we can abort */ 536 - if (p_dev->dev.driver) 537 - goto err_put_module; 538 - 539 - /* 540 - * Prevent this racing with a card insertion. 541 - */ 542 - mutex_lock(&s->skt_mutex); 543 - ret = bus_rescan_devices(&pcmcia_bus_type); 544 - mutex_unlock(&s->skt_mutex); 545 - if (ret) 546 - goto err_put_module; 547 - 548 - /* check whether the driver indeed matched. I don't care if this 549 - * is racy or not, because it can only happen on cardmgr access 550 - * paths... 551 - */ 552 - if (!(p_dev->dev.driver == &p_drv->drv)) 553 - p_dev->cardmgr = NULL; 554 - 555 - err_put_module: 556 - module_put(p_drv->owner); 557 - err_put_driver: 558 - put_driver(&p_drv->drv); 559 - err_put: 560 - pcmcia_put_socket(s); 561 - 562 - return ret; 563 - } /* bind_request */ 564 - 565 - #ifdef CONFIG_CARDBUS 566 - 567 - static struct pci_bus *pcmcia_lookup_bus(struct pcmcia_socket *s) 568 - { 569 - if (!s || !(s->state & SOCKET_CARDBUS)) 570 - return NULL; 571 - 572 - return s->cb_dev->subordinate; 573 - } 574 - #endif 575 - 576 - static int get_device_info(struct pcmcia_socket *s, bind_info_t *bind_info, int first) 577 - { 578 - struct pcmcia_device *p_dev; 579 - struct pcmcia_driver *p_drv; 580 - int ret = 0; 581 - 582 - #ifdef CONFIG_CARDBUS 583 - /* 584 - * Some unbelievably ugly code to associate the PCI cardbus 585 - * device and its driver with the PCMCIA "bind" information. 586 - */ 587 - { 588 - struct pci_bus *bus; 589 - 590 - bus = pcmcia_lookup_bus(s); 591 - if (bus) { 592 - struct list_head *list; 593 - struct pci_dev *dev = NULL; 594 - 595 - list = bus->devices.next; 596 - while (list != &bus->devices) { 597 - struct pci_dev *pdev = pci_dev_b(list); 598 - list = list->next; 599 - 600 - if (first) { 601 - dev = pdev; 602 - break; 603 - } 604 - 605 - /* Try to handle "next" here some way? */ 606 - } 607 - if (dev && dev->driver) { 608 - strlcpy(bind_info->name, dev->driver->name, DEV_NAME_LEN); 609 - bind_info->major = 0; 610 - bind_info->minor = 0; 611 - bind_info->next = NULL; 612 - return 0; 613 - } 614 - } 615 - } 616 - #endif 617 - 618 - mutex_lock(&s->ops_mutex); 619 - list_for_each_entry(p_dev, &s->devices_list, socket_device_list) { 620 - if (p_dev->func == bind_info->function) { 621 - p_dev = pcmcia_get_dev(p_dev); 622 - if (!p_dev) 623 - continue; 624 - goto found; 625 - } 626 - } 627 - mutex_unlock(&s->ops_mutex); 628 - return -ENODEV; 629 - 630 - found: 631 - mutex_unlock(&s->ops_mutex); 632 - 633 - p_drv = to_pcmcia_drv(p_dev->dev.driver); 634 - if (p_drv && !p_dev->_locked) { 635 - ret = -EAGAIN; 636 - goto err_put; 637 - } 638 - 639 - if (!first) { 640 - ret = -ENODEV; 641 - goto err_put; 642 - } 643 - 644 - strlcpy(bind_info->name, dev_name(&p_dev->dev), DEV_NAME_LEN); 645 - bind_info->next = NULL; 646 - 647 - err_put: 648 - pcmcia_put_dev(p_dev); 649 - return ret; 650 - } /* get_device_info */ 651 - 652 - 653 - static int ds_open(struct inode *inode, struct file *file) 654 - { 655 - socket_t i = iminor(inode); 656 - struct pcmcia_socket *s; 657 - user_info_t *user; 658 - static int warning_printed; 659 - int ret = 0; 660 - 661 - pr_debug("ds_open(socket %d)\n", i); 662 - 663 - lock_kernel(); 664 - s = pcmcia_get_socket_by_nr(i); 665 - if (!s) { 666 - ret = -ENODEV; 667 - goto out; 668 - } 669 - s = pcmcia_get_socket(s); 670 - if (!s) { 671 - ret = -ENODEV; 672 - goto out; 673 - } 674 - 675 - if ((file->f_flags & O_ACCMODE) != O_RDONLY) { 676 - if (s->pcmcia_state.busy) { 677 - pcmcia_put_socket(s); 678 - ret = -EBUSY; 679 - goto out; 680 - } 681 - else 682 - s->pcmcia_state.busy = 1; 683 - } 684 - 685 - user = kmalloc(sizeof(user_info_t), GFP_KERNEL); 686 - if (!user) { 687 - pcmcia_put_socket(s); 688 - ret = -ENOMEM; 689 - goto out; 690 - } 691 - user->event_tail = user->event_head = 0; 692 - user->next = s->user; 693 - user->user_magic = USER_MAGIC; 694 - user->socket = s; 695 - s->user = user; 696 - file->private_data = user; 697 - 698 - if (!warning_printed) { 699 - printk(KERN_INFO "pcmcia: Detected deprecated PCMCIA ioctl " 700 - "usage from process: %s.\n", current->comm); 701 - printk(KERN_INFO "pcmcia: This interface will soon be removed from " 702 - "the kernel; please expect breakage unless you upgrade " 703 - "to new tools.\n"); 704 - printk(KERN_INFO "pcmcia: see http://www.kernel.org/pub/linux/" 705 - "utils/kernel/pcmcia/pcmcia.html for details.\n"); 706 - warning_printed = 1; 707 - } 708 - 709 - if (atomic_read(&s->present)) 710 - queue_event(user, CS_EVENT_CARD_INSERTION); 711 - out: 712 - unlock_kernel(); 713 - return ret; 714 - } /* ds_open */ 715 - 716 - /*====================================================================*/ 717 - 718 - static int ds_release(struct inode *inode, struct file *file) 719 - { 720 - struct pcmcia_socket *s; 721 - user_info_t *user, **link; 722 - 723 - pr_debug("ds_release(socket %d)\n", iminor(inode)); 724 - 725 - user = file->private_data; 726 - if (CHECK_USER(user)) 727 - goto out; 728 - 729 - s = user->socket; 730 - 731 - /* Unlink user data structure */ 732 - if ((file->f_flags & O_ACCMODE) != O_RDONLY) 733 - s->pcmcia_state.busy = 0; 734 - 735 - file->private_data = NULL; 736 - for (link = &s->user; *link; link = &(*link)->next) 737 - if (*link == user) 738 - break; 739 - if (link == NULL) 740 - goto out; 741 - *link = user->next; 742 - user->user_magic = 0; 743 - kfree(user); 744 - pcmcia_put_socket(s); 745 - out: 746 - return 0; 747 - } /* ds_release */ 748 - 749 - /*====================================================================*/ 750 - 751 - static ssize_t ds_read(struct file *file, char __user *buf, 752 - size_t count, loff_t *ppos) 753 - { 754 - struct pcmcia_socket *s; 755 - user_info_t *user; 756 - int ret; 757 - 758 - pr_debug("ds_read(socket %d)\n", iminor(file->f_path.dentry->d_inode)); 759 - 760 - if (count < 4) 761 - return -EINVAL; 762 - 763 - user = file->private_data; 764 - if (CHECK_USER(user)) 765 - return -EIO; 766 - 767 - s = user->socket; 768 - ret = wait_event_interruptible(s->queue, !queue_empty(user)); 769 - if (ret == 0) 770 - ret = put_user(get_queued_event(user), (int __user *)buf) ? -EFAULT : 4; 771 - 772 - return ret; 773 - } /* ds_read */ 774 - 775 - /*====================================================================*/ 776 - 777 - static ssize_t ds_write(struct file *file, const char __user *buf, 778 - size_t count, loff_t *ppos) 779 - { 780 - pr_debug("ds_write(socket %d)\n", iminor(file->f_path.dentry->d_inode)); 781 - 782 - if (count != 4) 783 - return -EINVAL; 784 - if ((file->f_flags & O_ACCMODE) == O_RDONLY) 785 - return -EBADF; 786 - 787 - return -EIO; 788 - } /* ds_write */ 789 - 790 - /*====================================================================*/ 791 - 792 - /* No kernel lock - fine */ 793 - static u_int ds_poll(struct file *file, poll_table *wait) 794 - { 795 - struct pcmcia_socket *s; 796 - user_info_t *user; 797 - 798 - pr_debug("ds_poll(socket %d)\n", iminor(file->f_path.dentry->d_inode)); 799 - 800 - user = file->private_data; 801 - if (CHECK_USER(user)) 802 - return POLLERR; 803 - s = user->socket; 804 - /* 805 - * We don't check for a dead socket here since that 806 - * will send cardmgr into an endless spin. 807 - */ 808 - poll_wait(file, &s->queue, wait); 809 - if (!queue_empty(user)) 810 - return POLLIN | POLLRDNORM; 811 - return 0; 812 - } /* ds_poll */ 813 - 814 - /*====================================================================*/ 815 - 816 - static int ds_ioctl(struct file *file, u_int cmd, u_long arg) 817 - { 818 - struct pcmcia_socket *s; 819 - void __user *uarg = (char __user *)arg; 820 - u_int size; 821 - int ret, err; 822 - ds_ioctl_arg_t *buf; 823 - user_info_t *user; 824 - 825 - pr_debug("ds_ioctl(socket %d, %#x, %#lx)\n", iminor(inode), cmd, arg); 826 - 827 - user = file->private_data; 828 - if (CHECK_USER(user)) 829 - return -EIO; 830 - 831 - s = user->socket; 832 - 833 - size = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT; 834 - if (size > sizeof(ds_ioctl_arg_t)) 835 - return -EINVAL; 836 - 837 - /* Permission check */ 838 - if (!(cmd & IOC_OUT) && !capable(CAP_SYS_ADMIN)) 839 - return -EPERM; 840 - 841 - if (cmd & IOC_IN) { 842 - if (!access_ok(VERIFY_READ, uarg, size)) { 843 - pr_debug("ds_ioctl(): verify_read = %d\n", -EFAULT); 844 - return -EFAULT; 845 - } 846 - } 847 - if (cmd & IOC_OUT) { 848 - if (!access_ok(VERIFY_WRITE, uarg, size)) { 849 - pr_debug("ds_ioctl(): verify_write = %d\n", -EFAULT); 850 - return -EFAULT; 851 - } 852 - } 853 - buf = kmalloc(sizeof(ds_ioctl_arg_t), GFP_KERNEL); 854 - if (!buf) 855 - return -ENOMEM; 856 - 857 - err = ret = 0; 858 - 859 - if (cmd & IOC_IN) { 860 - if (__copy_from_user((char *)buf, uarg, size)) { 861 - err = -EFAULT; 862 - goto free_out; 863 - } 864 - } 865 - 866 - switch (cmd) { 867 - case DS_ADJUST_RESOURCE_INFO: 868 - ret = pcmcia_adjust_resource_info(&buf->adjust); 869 - break; 870 - case DS_GET_CONFIGURATION_INFO: 871 - if (buf->config.Function && 872 - (buf->config.Function >= s->functions)) 873 - ret = -EINVAL; 874 - else { 875 - struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->config.Function); 876 - ret = pccard_get_configuration_info(s, p_dev, &buf->config); 877 - pcmcia_put_dev(p_dev); 878 - } 879 - break; 880 - case DS_GET_FIRST_TUPLE: 881 - mutex_lock(&s->skt_mutex); 882 - pcmcia_validate_mem(s); 883 - mutex_unlock(&s->skt_mutex); 884 - ret = pccard_get_first_tuple(s, BIND_FN_ALL, &buf->tuple); 885 - break; 886 - case DS_GET_NEXT_TUPLE: 887 - ret = pccard_get_next_tuple(s, BIND_FN_ALL, &buf->tuple); 888 - break; 889 - case DS_GET_TUPLE_DATA: 890 - buf->tuple.TupleData = buf->tuple_parse.data; 891 - buf->tuple.TupleDataMax = sizeof(buf->tuple_parse.data); 892 - ret = pccard_get_tuple_data(s, &buf->tuple); 893 - break; 894 - case DS_PARSE_TUPLE: 895 - buf->tuple.TupleData = buf->tuple_parse.data; 896 - ret = pcmcia_parse_tuple(&buf->tuple, &buf->tuple_parse.parse); 897 - break; 898 - case DS_RESET_CARD: 899 - ret = pcmcia_reset_card(s); 900 - break; 901 - case DS_GET_STATUS: 902 - if (buf->status.Function && 903 - (buf->status.Function >= s->functions)) 904 - ret = -EINVAL; 905 - else { 906 - struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function); 907 - ret = pccard_get_status(s, p_dev, &buf->status); 908 - pcmcia_put_dev(p_dev); 909 - } 910 - break; 911 - case DS_VALIDATE_CIS: 912 - mutex_lock(&s->skt_mutex); 913 - pcmcia_validate_mem(s); 914 - mutex_unlock(&s->skt_mutex); 915 - ret = pccard_validate_cis(s, &buf->cisinfo.Chains); 916 - break; 917 - case DS_SUSPEND_CARD: 918 - pcmcia_parse_uevents(s, PCMCIA_UEVENT_SUSPEND); 919 - break; 920 - case DS_RESUME_CARD: 921 - pcmcia_parse_uevents(s, PCMCIA_UEVENT_RESUME); 922 - break; 923 - case DS_EJECT_CARD: 924 - pcmcia_parse_uevents(s, PCMCIA_UEVENT_EJECT); 925 - break; 926 - case DS_INSERT_CARD: 927 - pcmcia_parse_uevents(s, PCMCIA_UEVENT_INSERT); 928 - break; 929 - case DS_ACCESS_CONFIGURATION_REGISTER: 930 - if ((buf->conf_reg.Action == CS_WRITE) && !capable(CAP_SYS_ADMIN)) { 931 - err = -EPERM; 932 - goto free_out; 933 - } 934 - 935 - ret = -EINVAL; 936 - 937 - if (!(buf->conf_reg.Function && 938 - (buf->conf_reg.Function >= s->functions))) { 939 - struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->conf_reg.Function); 940 - if (p_dev) { 941 - ret = pcmcia_access_configuration_register(p_dev, &buf->conf_reg); 942 - pcmcia_put_dev(p_dev); 943 - } 944 - } 945 - break; 946 - case DS_GET_FIRST_REGION: 947 - case DS_GET_NEXT_REGION: 948 - case DS_BIND_MTD: 949 - if (!capable(CAP_SYS_ADMIN)) { 950 - err = -EPERM; 951 - goto free_out; 952 - } else { 953 - printk_once(KERN_WARNING 954 - "2.6. kernels use pcmciamtd instead of memory_cs.c and do not require special\n"); 955 - printk_once(KERN_WARNING "MTD handling any more.\n"); 956 - } 957 - err = -EINVAL; 958 - goto free_out; 959 - break; 960 - case DS_GET_FIRST_WINDOW: 961 - ret = pcmcia_get_window(s, &buf->win_info.handle, 1, 962 - &buf->win_info.window); 963 - break; 964 - case DS_GET_NEXT_WINDOW: 965 - ret = pcmcia_get_window(s, &buf->win_info.handle, 966 - buf->win_info.handle + 1, &buf->win_info.window); 967 - break; 968 - case DS_GET_MEM_PAGE: 969 - ret = pcmcia_get_mem_page(s, buf->win_info.handle, 970 - &buf->win_info.map); 971 - break; 972 - case DS_REPLACE_CIS: 973 - ret = pcmcia_replace_cis(s, buf->cisdump.Data, buf->cisdump.Length); 974 - break; 975 - case DS_BIND_REQUEST: 976 - if (!capable(CAP_SYS_ADMIN)) { 977 - err = -EPERM; 978 - goto free_out; 979 - } 980 - err = bind_request(s, &buf->bind_info); 981 - break; 982 - case DS_GET_DEVICE_INFO: 983 - err = get_device_info(s, &buf->bind_info, 1); 984 - break; 985 - case DS_GET_NEXT_DEVICE: 986 - err = get_device_info(s, &buf->bind_info, 0); 987 - break; 988 - case DS_UNBIND_REQUEST: 989 - err = 0; 990 - break; 991 - default: 992 - err = -EINVAL; 993 - } 994 - 995 - if ((err == 0) && (ret != 0)) { 996 - pr_debug("ds_ioctl: ret = %d\n", ret); 997 - switch (ret) { 998 - case -ENODEV: 999 - case -EINVAL: 1000 - case -EBUSY: 1001 - case -ENOSYS: 1002 - err = ret; 1003 - break; 1004 - case -ENOMEM: 1005 - err = -ENOSPC; break; 1006 - case -ENOSPC: 1007 - err = -ENODATA; break; 1008 - default: 1009 - err = -EIO; break; 1010 - } 1011 - } 1012 - 1013 - if (cmd & IOC_OUT) { 1014 - if (__copy_to_user(uarg, (char *)buf, size)) 1015 - err = -EFAULT; 1016 - } 1017 - 1018 - free_out: 1019 - kfree(buf); 1020 - return err; 1021 - } /* ds_ioctl */ 1022 - 1023 - static long ds_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 1024 - { 1025 - int ret; 1026 - 1027 - lock_kernel(); 1028 - ret = ds_ioctl(file, cmd, arg); 1029 - unlock_kernel(); 1030 - 1031 - return ret; 1032 - } 1033 - 1034 - 1035 - /*====================================================================*/ 1036 - 1037 - static const struct file_operations ds_fops = { 1038 - .owner = THIS_MODULE, 1039 - .open = ds_open, 1040 - .release = ds_release, 1041 - .unlocked_ioctl = ds_unlocked_ioctl, 1042 - .read = ds_read, 1043 - .write = ds_write, 1044 - .poll = ds_poll, 1045 - }; 1046 - 1047 - void __init pcmcia_setup_ioctl(void) 1048 - { 1049 - int i; 1050 - 1051 - /* Set up character device for user mode clients */ 1052 - i = register_chrdev(0, "pcmcia", &ds_fops); 1053 - if (i < 0) 1054 - printk(KERN_NOTICE "unable to find a free device # for " 1055 - "Driver Services (error=%d)\n", i); 1056 - else 1057 - major_dev = i; 1058 - 1059 - #ifdef CONFIG_PROC_FS 1060 - proc_pccard = proc_mkdir("bus/pccard", NULL); 1061 - if (proc_pccard) 1062 - proc_create("drivers", 0, proc_pccard, &pccard_drivers_proc_fops); 1063 - #endif 1064 - } 1065 - 1066 - 1067 - void __exit pcmcia_cleanup_ioctl(void) 1068 - { 1069 - #ifdef CONFIG_PROC_FS 1070 - if (proc_pccard) { 1071 - remove_proc_entry("drivers", proc_pccard); 1072 - remove_proc_entry("bus/pccard", NULL); 1073 - } 1074 - #endif 1075 - if (major_dev != -1) 1076 - unregister_chrdev(major_dev, "pcmcia"); 1077 - }
+188 -153
drivers/pcmcia/pcmcia_resource.c
··· 25 25 26 26 #include <asm/irq.h> 27 27 28 - #include <pcmcia/cs_types.h> 29 28 #include <pcmcia/ss.h> 30 29 #include <pcmcia/cs.h> 31 30 #include <pcmcia/cistpl.h> ··· 56 57 } 57 58 58 59 59 - /** alloc_io_space 60 - * 61 - * Special stuff for managing IO windows, because they are scarce 62 - */ 63 - 64 - static int alloc_io_space(struct pcmcia_socket *s, u_int attr, 65 - unsigned int *base, unsigned int num, u_int lines) 60 + static void release_io_space(struct pcmcia_socket *s, struct resource *res) 66 61 { 67 - unsigned int align; 68 - 69 - align = (*base) ? (lines ? 1<<lines : 0) : 1; 70 - if (align && (align < num)) { 71 - if (*base) { 72 - dev_dbg(&s->dev, "odd IO request: num %#x align %#x\n", 73 - num, align); 74 - align = 0; 75 - } else 76 - while (align && (align < num)) 77 - align <<= 1; 78 - } 79 - if (*base & ~(align-1)) { 80 - dev_dbg(&s->dev, "odd IO request: base %#x align %#x\n", 81 - *base, align); 82 - align = 0; 83 - } 84 - 85 - return s->resource_ops->find_io(s, attr, base, num, align); 86 - } /* alloc_io_space */ 87 - 88 - 89 - static void release_io_space(struct pcmcia_socket *s, unsigned int base, 90 - unsigned int num) 91 - { 62 + resource_size_t num = resource_size(res); 92 63 int i; 64 + 65 + dev_dbg(&s->dev, "release_io_space for %pR\n", res); 93 66 94 67 for (i = 0; i < MAX_IO_WIN; i++) { 95 68 if (!s->io[i].res) 96 69 continue; 97 - if ((s->io[i].res->start <= base) && 98 - (s->io[i].res->end >= base+num-1)) { 70 + if ((s->io[i].res->start <= res->start) && 71 + (s->io[i].res->end >= res->end)) { 99 72 s->io[i].InUse -= num; 73 + if (res->parent) 74 + release_resource(res); 75 + res->start = res->end = 0; 76 + res->flags = IORESOURCE_IO; 100 77 /* Free the window if no one else is using it */ 101 78 if (s->io[i].InUse == 0) { 102 79 release_resource(s->io[i].res); ··· 83 108 } 84 109 } /* release_io_space */ 85 110 86 - 87 - /** pccard_access_configuration_register 111 + /** alloc_io_space 88 112 * 89 - * Access_configuration_register() reads and writes configuration 90 - * registers in attribute memory. Memory window 0 is reserved for 91 - * this and the tuple reading services. 113 + * Special stuff for managing IO windows, because they are scarce 92 114 */ 115 + static int alloc_io_space(struct pcmcia_socket *s, struct resource *res, 116 + unsigned int lines) 117 + { 118 + unsigned int align; 119 + unsigned int base = res->start; 120 + unsigned int num = res->end; 121 + int ret; 93 122 94 - int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, 95 - conf_reg_t *reg) 123 + res->flags |= IORESOURCE_IO; 124 + 125 + dev_dbg(&s->dev, "alloc_io_space request for %pR, %d lines\n", 126 + res, lines); 127 + 128 + align = base ? (lines ? 1<<lines : 0) : 1; 129 + if (align && (align < num)) { 130 + if (base) { 131 + dev_dbg(&s->dev, "odd IO request\n"); 132 + align = 0; 133 + } else 134 + while (align && (align < num)) 135 + align <<= 1; 136 + } 137 + if (base & ~(align-1)) { 138 + dev_dbg(&s->dev, "odd IO request\n"); 139 + align = 0; 140 + } 141 + 142 + ret = s->resource_ops->find_io(s, res->flags, &base, num, align, 143 + &res->parent); 144 + if (ret) { 145 + dev_dbg(&s->dev, "alloc_io_space request failed (%d)\n", ret); 146 + return -EINVAL; 147 + } 148 + 149 + res->start = base; 150 + res->end = res->start + num - 1; 151 + 152 + if (res->parent) { 153 + ret = request_resource(res->parent, res); 154 + if (ret) { 155 + dev_warn(&s->dev, 156 + "request_resource %pR failed: %d\n", res, ret); 157 + res->parent = NULL; 158 + release_io_space(s, res); 159 + } 160 + } 161 + dev_dbg(&s->dev, "alloc_io_space request result %d: %pR\n", ret, res); 162 + return ret; 163 + } /* alloc_io_space */ 164 + 165 + 166 + /** 167 + * pcmcia_access_config() - read or write card configuration registers 168 + * 169 + * pcmcia_access_config() reads and writes configuration registers in 170 + * attribute memory. Memory window 0 is reserved for this and the tuple 171 + * reading services. Drivers must use pcmcia_read_config_byte() or 172 + * pcmcia_write_config_byte(). 173 + */ 174 + static int pcmcia_access_config(struct pcmcia_device *p_dev, 175 + off_t where, u8 *val, 176 + int (*accessf) (struct pcmcia_socket *s, 177 + int attr, unsigned int addr, 178 + unsigned int len, void *ptr)) 96 179 { 97 180 struct pcmcia_socket *s; 98 181 config_t *c; 99 182 int addr; 100 - u_char val; 101 183 int ret = 0; 102 - 103 - if (!p_dev || !p_dev->function_config) 104 - return -EINVAL; 105 184 106 185 s = p_dev->socket; 107 186 ··· 168 139 return -EACCES; 169 140 } 170 141 171 - addr = (c->ConfigBase + reg->Offset) >> 1; 142 + addr = (c->ConfigBase + where) >> 1; 172 143 173 - switch (reg->Action) { 174 - case CS_READ: 175 - ret = pcmcia_read_cis_mem(s, 1, addr, 1, &val); 176 - reg->Value = val; 177 - break; 178 - case CS_WRITE: 179 - val = reg->Value; 180 - pcmcia_write_cis_mem(s, 1, addr, 1, &val); 181 - break; 182 - default: 183 - dev_dbg(&s->dev, "Invalid conf register request\n"); 184 - ret = -EINVAL; 185 - break; 186 - } 144 + ret = accessf(s, 1, addr, 1, val); 145 + 187 146 mutex_unlock(&s->ops_mutex); 147 + 188 148 return ret; 189 - } /* pcmcia_access_configuration_register */ 190 - EXPORT_SYMBOL(pcmcia_access_configuration_register); 149 + } /* pcmcia_access_config */ 150 + 151 + 152 + /** 153 + * pcmcia_read_config_byte() - read a byte from a card configuration register 154 + * 155 + * pcmcia_read_config_byte() reads a byte from a configuration register in 156 + * attribute memory. 157 + */ 158 + int pcmcia_read_config_byte(struct pcmcia_device *p_dev, off_t where, u8 *val) 159 + { 160 + return pcmcia_access_config(p_dev, where, val, pcmcia_read_cis_mem); 161 + } 162 + EXPORT_SYMBOL(pcmcia_read_config_byte); 163 + 164 + 165 + /** 166 + * pcmcia_write_config_byte() - write a byte to a card configuration register 167 + * 168 + * pcmcia_write_config_byte() writes a byte to a configuration register in 169 + * attribute memory. 170 + */ 171 + int pcmcia_write_config_byte(struct pcmcia_device *p_dev, off_t where, u8 val) 172 + { 173 + return pcmcia_access_config(p_dev, where, &val, pcmcia_write_cis_mem); 174 + } 175 + EXPORT_SYMBOL(pcmcia_write_config_byte); 191 176 192 177 193 178 int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh, 194 - memreq_t *req) 179 + unsigned int offset) 195 180 { 196 181 struct pcmcia_socket *s = p_dev->socket; 182 + struct resource *res = wh; 183 + unsigned int w; 197 184 int ret; 198 185 199 - wh--; 200 - if (wh >= MAX_WIN) 186 + w = ((res->flags & IORESOURCE_BITS & WIN_FLAGS_REQ) >> 2) - 1; 187 + if (w >= MAX_WIN) 201 188 return -EINVAL; 202 - if (req->Page != 0) { 203 - dev_dbg(&s->dev, "failure: requested page is zero\n"); 204 - return -EINVAL; 205 - } 189 + 206 190 mutex_lock(&s->ops_mutex); 207 - s->win[wh].card_start = req->CardOffset; 208 - ret = s->ops->set_mem_map(s, &s->win[wh]); 191 + s->win[w].card_start = offset; 192 + ret = s->ops->set_mem_map(s, &s->win[w]); 209 193 if (ret) 210 194 dev_warn(&s->dev, "failed to set_mem_map\n"); 211 195 mutex_unlock(&s->ops_mutex); ··· 358 316 * don't bother checking the port ranges against the current socket 359 317 * values. 360 318 */ 361 - static int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req) 319 + static int pcmcia_release_io(struct pcmcia_device *p_dev) 362 320 { 363 321 struct pcmcia_socket *s = p_dev->socket; 364 322 int ret = -EINVAL; 365 323 config_t *c; 366 324 367 325 mutex_lock(&s->ops_mutex); 368 - c = p_dev->function_config; 369 - 370 326 if (!p_dev->_io) 371 327 goto out; 372 328 329 + c = p_dev->function_config; 330 + 331 + release_io_space(s, &c->io[0]); 332 + 333 + if (c->io[1].end) 334 + release_io_space(s, &c->io[1]); 335 + 373 336 p_dev->_io = 0; 374 - 375 - if ((c->io.BasePort1 != req->BasePort1) || 376 - (c->io.NumPorts1 != req->NumPorts1) || 377 - (c->io.BasePort2 != req->BasePort2) || 378 - (c->io.NumPorts2 != req->NumPorts2)) 379 - goto out; 380 - 381 337 c->state &= ~CONFIG_IO_REQ; 382 - 383 - release_io_space(s, req->BasePort1, req->NumPorts1); 384 - if (req->NumPorts2) 385 - release_io_space(s, req->BasePort2, req->NumPorts2); 386 338 387 339 out: 388 340 mutex_unlock(&s->ops_mutex); ··· 385 349 } /* pcmcia_release_io */ 386 350 387 351 388 - int pcmcia_release_window(struct pcmcia_device *p_dev, window_handle_t wh) 352 + int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res) 389 353 { 390 354 struct pcmcia_socket *s = p_dev->socket; 391 355 pccard_mem_map *win; 356 + unsigned int w; 392 357 393 - wh--; 394 - if (wh >= MAX_WIN) 358 + dev_dbg(&p_dev->dev, "releasing window %pR\n", res); 359 + 360 + w = ((res->flags & IORESOURCE_BITS & WIN_FLAGS_REQ) >> 2) - 1; 361 + if (w >= MAX_WIN) 395 362 return -EINVAL; 396 363 397 364 mutex_lock(&s->ops_mutex); 398 - win = &s->win[wh]; 365 + win = &s->win[w]; 399 366 400 - if (!(p_dev->_win & CLIENT_WIN_REQ(wh))) { 367 + if (!(p_dev->_win & CLIENT_WIN_REQ(w))) { 401 368 dev_dbg(&s->dev, "not releasing unknown window\n"); 402 369 mutex_unlock(&s->ops_mutex); 403 370 return -EINVAL; ··· 409 370 /* Shut down memory window */ 410 371 win->flags &= ~MAP_ACTIVE; 411 372 s->ops->set_mem_map(s, win); 412 - s->state &= ~SOCKET_WIN_REQ(wh); 373 + s->state &= ~SOCKET_WIN_REQ(w); 413 374 414 375 /* Release system memory */ 415 376 if (win->res) { 377 + release_resource(res); 416 378 release_resource(win->res); 417 379 kfree(win->res); 418 380 win->res = NULL; 419 381 } 420 - p_dev->_win &= ~CLIENT_WIN_REQ(wh); 382 + p_dev->_win &= ~CLIENT_WIN_REQ(w); 421 383 mutex_unlock(&s->ops_mutex); 422 384 423 385 return 0; ··· 513 473 pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1, &c->ExtStatus); 514 474 } 515 475 if (req->Present & PRESENT_IOBASE_0) { 516 - u_char b = c->io.BasePort1 & 0xff; 476 + u8 b = c->io[0].start & 0xff; 517 477 pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b); 518 - b = (c->io.BasePort1 >> 8) & 0xff; 478 + b = (c->io[0].start >> 8) & 0xff; 519 479 pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_1)>>1, 1, &b); 520 480 } 521 481 if (req->Present & PRESENT_IOSIZE) { 522 - u_char b = c->io.NumPorts1 + c->io.NumPorts2 - 1; 482 + u8 b = resource_size(&c->io[0]) + resource_size(&c->io[1]) - 1; 523 483 pcmcia_write_cis_mem(s, 1, (base + CISREG_IOSIZE)>>1, 1, &b); 524 484 } 525 485 ··· 553 513 EXPORT_SYMBOL(pcmcia_request_configuration); 554 514 555 515 556 - /** pcmcia_request_io 516 + /** 517 + * pcmcia_request_io() - attempt to reserve port ranges for PCMCIA devices 557 518 * 558 - * Request_io() reserves ranges of port addresses for a socket. 559 - * I have not implemented range sharing or alias addressing. 519 + * pcmcia_request_io() attepts to reserve the IO port ranges specified in 520 + * &struct pcmcia_device @p_dev->resource[0] and @p_dev->resource[1]. The 521 + * "start" value is the requested start of the IO port resource; "end" 522 + * reflects the number of ports requested. The number of IO lines requested 523 + * is specified in &struct pcmcia_device @p_dev->io_lines. 560 524 */ 561 - int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req) 525 + int pcmcia_request_io(struct pcmcia_device *p_dev) 562 526 { 563 527 struct pcmcia_socket *s = p_dev->socket; 564 - config_t *c; 528 + config_t *c = p_dev->function_config; 565 529 int ret = -EINVAL; 566 530 567 531 mutex_lock(&s->ops_mutex); 532 + dev_dbg(&s->dev, "pcmcia_request_io: %pR , %pR", &c->io[0], &c->io[1]); 568 533 569 534 if (!(s->state & SOCKET_PRESENT)) { 570 - dev_dbg(&s->dev, "No card present\n"); 535 + dev_dbg(&s->dev, "pcmcia_request_io: No card present\n"); 571 536 goto out; 572 537 } 573 538 574 - if (!req) 575 - goto out; 576 - 577 - c = p_dev->function_config; 578 539 if (c->state & CONFIG_LOCKED) { 579 540 dev_dbg(&s->dev, "Configuration is locked\n"); 580 541 goto out; ··· 584 543 dev_dbg(&s->dev, "IO already configured\n"); 585 544 goto out; 586 545 } 587 - if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)) { 588 - dev_dbg(&s->dev, "bad attribute setting for IO region 1\n"); 589 - goto out; 590 - } 591 - if ((req->NumPorts2 > 0) && 592 - (req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))) { 593 - dev_dbg(&s->dev, "bad attribute setting for IO region 2\n"); 594 - goto out; 595 - } 596 546 597 - dev_dbg(&s->dev, "trying to allocate resource 1\n"); 598 - ret = alloc_io_space(s, req->Attributes1, &req->BasePort1, 599 - req->NumPorts1, req->IOAddrLines); 600 - if (ret) { 601 - dev_dbg(&s->dev, "allocation of resource 1 failed\n"); 547 + ret = alloc_io_space(s, &c->io[0], p_dev->io_lines); 548 + if (ret) 602 549 goto out; 603 - } 604 550 605 - if (req->NumPorts2) { 606 - dev_dbg(&s->dev, "trying to allocate resource 2\n"); 607 - ret = alloc_io_space(s, req->Attributes2, &req->BasePort2, 608 - req->NumPorts2, req->IOAddrLines); 551 + if (c->io[1].end) { 552 + ret = alloc_io_space(s, &c->io[1], p_dev->io_lines); 609 553 if (ret) { 610 - dev_dbg(&s->dev, "allocation of resource 2 failed\n"); 611 - release_io_space(s, req->BasePort1, req->NumPorts1); 554 + release_io_space(s, &c->io[0]); 612 555 goto out; 613 556 } 614 - } 557 + } else 558 + c->io[1].start = 0; 615 559 616 - c->io = *req; 617 560 c->state |= CONFIG_IO_REQ; 618 561 p_dev->_io = 1; 619 - dev_dbg(&s->dev, "allocating resources succeeded: %d\n", ret); 620 562 563 + dev_dbg(&s->dev, "pcmcia_request_io succeeded: %pR , %pR", 564 + &c->io[0], &c->io[1]); 621 565 out: 622 566 mutex_unlock(&s->ops_mutex); 623 567 ··· 677 651 #ifdef CONFIG_PCMCIA_PROBE 678 652 679 653 /* mask of IRQs already reserved by other cards, we should avoid using them */ 680 - static u8 pcmcia_used_irq[NR_IRQS]; 654 + static u8 pcmcia_used_irq[32]; 681 655 682 656 static irqreturn_t test_action(int cpl, void *dev_id) 683 657 { ··· 699 673 700 674 for (try = 0; try < 64; try++) { 701 675 irq = try % 32; 676 + 677 + if (irq > NR_IRQS) 678 + continue; 702 679 703 680 /* marked as available by driver, not blocked by userspace? */ 704 681 if (!((mask >> irq) & 1)) ··· 796 767 struct pcmcia_socket *s = p_dev->socket; 797 768 pccard_mem_map *win; 798 769 u_long align; 770 + struct resource *res; 799 771 int w; 800 772 801 773 if (!(s->state & SOCKET_PRESENT)) { 802 774 dev_dbg(&s->dev, "No card present\n"); 803 775 return -ENODEV; 804 776 } 805 - if (req->Attributes & (WIN_PAGED | WIN_SHARED)) { 806 - dev_dbg(&s->dev, "bad attribute setting for iomem region\n"); 807 - return -EINVAL; 808 - } 809 777 810 778 /* Window size defaults to smallest available */ 811 779 if (req->Size == 0) 812 780 req->Size = s->map_size; 813 - align = (((s->features & SS_CAP_MEM_ALIGN) || 814 - (req->Attributes & WIN_STRICT_ALIGN)) ? 815 - req->Size : s->map_size); 781 + align = (s->features & SS_CAP_MEM_ALIGN) ? req->Size : s->map_size; 816 782 if (req->Size & (s->map_size-1)) { 817 783 dev_dbg(&s->dev, "invalid map size\n"); 818 784 return -EINVAL; ··· 821 797 align = 0; 822 798 823 799 /* Allocate system memory window */ 800 + mutex_lock(&s->ops_mutex); 824 801 for (w = 0; w < MAX_WIN; w++) 825 802 if (!(s->state & SOCKET_WIN_REQ(w))) 826 803 break; 827 804 if (w == MAX_WIN) { 828 805 dev_dbg(&s->dev, "all windows are used already\n"); 806 + mutex_unlock(&s->ops_mutex); 829 807 return -EINVAL; 830 808 } 831 809 832 - mutex_lock(&s->ops_mutex); 833 810 win = &s->win[w]; 834 811 835 812 if (!(s->features & SS_CAP_STATIC_MAP)) { 836 813 win->res = pcmcia_find_mem_region(req->Base, req->Size, align, 837 - (req->Attributes & WIN_MAP_BELOW_1MB), s); 814 + 0, s); 838 815 if (!win->res) { 839 816 dev_dbg(&s->dev, "allocating mem region failed\n"); 840 817 mutex_unlock(&s->ops_mutex); ··· 846 821 847 822 /* Configure the socket controller */ 848 823 win->map = w+1; 849 - win->flags = 0; 824 + win->flags = req->Attributes; 850 825 win->speed = req->AccessSpeed; 851 - if (req->Attributes & WIN_MEMORY_TYPE) 852 - win->flags |= MAP_ATTRIB; 853 - if (req->Attributes & WIN_ENABLE) 854 - win->flags |= MAP_ACTIVE; 855 - if (req->Attributes & WIN_DATA_WIDTH_16) 856 - win->flags |= MAP_16BIT; 857 - if (req->Attributes & WIN_USE_WAIT) 858 - win->flags |= MAP_USE_WAIT; 859 826 win->card_start = 0; 860 827 861 828 if (s->ops->set_mem_map(s, win) != 0) { ··· 863 846 else 864 847 req->Base = win->res->start; 865 848 849 + /* convert to new-style resources */ 850 + res = p_dev->resource[w + MAX_IO_WIN]; 851 + res->start = req->Base; 852 + res->end = req->Base + req->Size - 1; 853 + res->flags &= ~IORESOURCE_BITS; 854 + res->flags |= (req->Attributes & WIN_FLAGS_MAP) | (win->map << 2); 855 + res->flags |= IORESOURCE_MEM; 856 + res->parent = win->res; 857 + if (win->res) 858 + request_resource(&iomem_resource, res); 859 + 860 + dev_dbg(&s->dev, "request_window results in %pR\n", res); 861 + 866 862 mutex_unlock(&s->ops_mutex); 867 - *wh = w + 1; 863 + *wh = res; 868 864 869 865 return 0; 870 866 } /* pcmcia_request_window */ ··· 885 855 886 856 void pcmcia_disable_device(struct pcmcia_device *p_dev) 887 857 { 858 + int i; 859 + for (i = 0; i < MAX_WIN; i++) { 860 + struct resource *res = p_dev->resource[MAX_IO_WIN + i]; 861 + if (res->flags & WIN_FLAGS_REQ) 862 + pcmcia_release_window(p_dev, res); 863 + } 864 + 888 865 pcmcia_release_configuration(p_dev); 889 - pcmcia_release_io(p_dev, &p_dev->io); 866 + pcmcia_release_io(p_dev); 890 867 if (p_dev->_irq) { 891 868 free_irq(p_dev->irq, p_dev->priv); 892 869 p_dev->_irq = 0; 893 870 } 894 - if (p_dev->win) 895 - pcmcia_release_window(p_dev, p_dev->win); 896 871 } 897 872 EXPORT_SYMBOL(pcmcia_disable_device);
-1
drivers/pcmcia/pd6729.c
··· 17 17 #include <linux/device.h> 18 18 #include <linux/io.h> 19 19 20 - #include <pcmcia/cs_types.h> 21 20 #include <pcmcia/ss.h> 22 21 #include <pcmcia/cs.h> 23 22
-1
drivers/pcmcia/pxa2xx_base.c
··· 32 32 #include <mach/pxa2xx-regs.h> 33 33 #include <asm/mach-types.h> 34 34 35 - #include <pcmcia/cs_types.h> 36 35 #include <pcmcia/ss.h> 37 36 #include <pcmcia/cistpl.h> 38 37
+4 -4
drivers/pcmcia/rsrc_iodyn.c
··· 16 16 #include <linux/module.h> 17 17 #include <linux/kernel.h> 18 18 19 - #include <pcmcia/cs_types.h> 20 19 #include <pcmcia/ss.h> 21 20 #include <pcmcia/cs.h> 22 21 #include <pcmcia/cistpl.h> ··· 87 88 88 89 static int iodyn_find_io(struct pcmcia_socket *s, unsigned int attr, 89 90 unsigned int *base, unsigned int num, 90 - unsigned int align) 91 + unsigned int align, struct resource **parent) 91 92 { 92 93 int i, ret = 0; 93 94 ··· 128 129 ((res->flags & ~IORESOURCE_BITS) | 129 130 (attr & IORESOURCE_BITS)); 130 131 s->io[i].InUse = num; 132 + *parent = res; 131 133 return 0; 132 134 } 133 135 ··· 140 140 continue; 141 141 *base = try; 142 142 s->io[i].InUse += num; 143 + *parent = res; 143 144 return 0; 144 145 } 145 146 ··· 153 152 continue; 154 153 *base = try; 155 154 s->io[i].InUse += num; 155 + *parent = res; 156 156 return 0; 157 157 } 158 158 } ··· 166 164 .validate_mem = NULL, 167 165 .find_io = iodyn_find_io, 168 166 .find_mem = NULL, 169 - .add_io = NULL, 170 - .add_mem = NULL, 171 167 .init = static_init, 172 168 .exit = NULL, 173 169 };
+2 -4
drivers/pcmcia/rsrc_mgr.c
··· 16 16 #include <linux/module.h> 17 17 #include <linux/kernel.h> 18 18 19 - #include <pcmcia/cs_types.h> 20 19 #include <pcmcia/ss.h> 21 20 #include <pcmcia/cs.h> 22 21 #include <pcmcia/cistpl.h> ··· 47 48 48 49 static int static_find_io(struct pcmcia_socket *s, unsigned int attr, 49 50 unsigned int *base, unsigned int num, 50 - unsigned int align) 51 + unsigned int align, struct resource **parent) 51 52 { 52 53 if (!s->io_offset) 53 54 return -EINVAL; 54 55 *base = s->io_offset | (*base & 0x0fff); 56 + *parent = NULL; 55 57 56 58 return 0; 57 59 } ··· 62 62 .validate_mem = NULL, 63 63 .find_io = static_find_io, 64 64 .find_mem = NULL, 65 - .add_io = NULL, 66 - .add_mem = NULL, 67 65 .init = static_init, 68 66 .exit = NULL, 69 67 };
+7 -8
drivers/pcmcia/rsrc_nonstatic.c
··· 28 28 29 29 #include <asm/irq.h> 30 30 31 - #include <pcmcia/cs_types.h> 32 31 #include <pcmcia/ss.h> 33 32 #include <pcmcia/cs.h> 34 33 #include <pcmcia/cistpl.h> ··· 63 64 #define MEM_PROBE_LOW (1 << 0) 64 65 #define MEM_PROBE_HIGH (1 << 1) 65 66 67 + /* Action field */ 68 + #define REMOVE_MANAGED_RESOURCE 1 69 + #define ADD_MANAGED_RESOURCE 2 66 70 67 71 /*====================================================================== 68 72 ··· 718 716 719 717 static int nonstatic_find_io(struct pcmcia_socket *s, unsigned int attr, 720 718 unsigned int *base, unsigned int num, 721 - unsigned int align) 719 + unsigned int align, struct resource **parent) 722 720 { 723 721 int i, ret = 0; 724 722 ··· 760 758 ((res->flags & ~IORESOURCE_BITS) | 761 759 (attr & IORESOURCE_BITS)); 762 760 s->io[i].InUse = num; 761 + *parent = res; 763 762 return 0; 764 763 } 765 764 ··· 776 773 continue; 777 774 *base = try; 778 775 s->io[i].InUse += num; 776 + *parent = res; 779 777 return 0; 780 778 } 781 779 } ··· 795 791 continue; 796 792 *base = try; 797 793 s->io[i].InUse += num; 794 + *parent = res; 798 795 return 0; 799 796 } 800 797 } ··· 1060 1055 .validate_mem = pcmcia_nonstatic_validate_mem, 1061 1056 .find_io = nonstatic_find_io, 1062 1057 .find_mem = nonstatic_find_mem_region, 1063 - .add_io = adjust_io, 1064 - .add_mem = adjust_memory, 1065 1058 .init = nonstatic_init, 1066 1059 .exit = nonstatic_release_resource_db, 1067 1060 }; ··· 1118 1115 1119 1116 mutex_lock(&s->ops_mutex); 1120 1117 ret = adjust_io(s, add, start_addr, end_addr); 1121 - if (!ret) 1122 - s->resource_setup_new = 1; 1123 1118 mutex_unlock(&s->ops_mutex); 1124 1119 1125 1120 return ret ? ret : count; ··· 1184 1183 1185 1184 mutex_lock(&s->ops_mutex); 1186 1185 ret = adjust_memory(s, add, start_addr, end_addr); 1187 - if (!ret) 1188 - s->resource_setup_new = 1; 1189 1186 mutex_unlock(&s->ops_mutex); 1190 1187 1191 1188 return ret ? ret : count;
-1
drivers/pcmcia/sa1100_generic.c
··· 35 35 #include <linux/slab.h> 36 36 #include <linux/platform_device.h> 37 37 38 - #include <pcmcia/cs_types.h> 39 38 #include <pcmcia/cs.h> 40 39 #include <pcmcia/ss.h> 41 40
-1
drivers/pcmcia/soc_common.h
··· 11 11 12 12 /* include the world */ 13 13 #include <linux/cpufreq.h> 14 - #include <pcmcia/cs_types.h> 15 14 #include <pcmcia/cs.h> 16 15 #include <pcmcia/ss.h> 17 16 #include <pcmcia/cistpl.h>
-1
drivers/pcmcia/socket_sysfs.c
··· 26 26 #include <asm/system.h> 27 27 #include <asm/irq.h> 28 28 29 - #include <pcmcia/cs_types.h> 30 29 #include <pcmcia/ss.h> 31 30 #include <pcmcia/cs.h> 32 31 #include <pcmcia/cistpl.h>
-1
drivers/pcmcia/tcic.c
··· 49 49 #include <asm/io.h> 50 50 #include <asm/system.h> 51 51 52 - #include <pcmcia/cs_types.h> 53 52 #include <pcmcia/cs.h> 54 53 #include <pcmcia/ss.h> 55 54 #include "tcic.h"
-1
drivers/pcmcia/xxs1500_ss.c
··· 17 17 #include <linux/slab.h> 18 18 #include <linux/spinlock.h> 19 19 20 - #include <pcmcia/cs_types.h> 21 20 #include <pcmcia/cs.h> 22 21 #include <pcmcia/ss.h> 23 22 #include <pcmcia/cistpl.h>
-1
drivers/pcmcia/yenta_socket.c
··· 19 19 #include <linux/io.h> 20 20 #include <linux/slab.h> 21 21 22 - #include <pcmcia/cs_types.h> 23 22 #include <pcmcia/ss.h> 24 23 #include <pcmcia/cs.h> 25 24
+8 -9
drivers/scsi/pcmcia/aha152x_stub.c
··· 49 49 #include <scsi/scsi_host.h> 50 50 #include "aha152x.h" 51 51 52 - #include <pcmcia/cs_types.h> 53 52 #include <pcmcia/cs.h> 54 53 #include <pcmcia/cistpl.h> 55 54 #include <pcmcia/ds.h> ··· 100 101 info->p_dev = link; 101 102 link->priv = info; 102 103 103 - link->io.NumPorts1 = 0x20; 104 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 105 - link->io.IOAddrLines = 10; 104 + link->resource[0]->end = 0x20; 105 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 106 106 link->conf.Attributes = CONF_ENABLE_IRQ; 107 107 link->conf.IntType = INT_MEMORY_AND_IO; 108 108 link->conf.Present = PRESENT_OPTION; ··· 129 131 unsigned int vcc, 130 132 void *priv_data) 131 133 { 134 + p_dev->io_lines = 10; 132 135 /* For New Media T&J, look for a SCSI window */ 133 136 if (cfg->io.win[0].len >= 0x20) 134 - p_dev->io.BasePort1 = cfg->io.win[0].base; 137 + p_dev->resource[0]->start = cfg->io.win[0].base; 135 138 else if ((cfg->io.nwin > 1) && 136 139 (cfg->io.win[1].len >= 0x20)) 137 - p_dev->io.BasePort1 = cfg->io.win[1].base; 140 + p_dev->resource[0]->start = cfg->io.win[1].base; 138 141 if ((cfg->io.nwin > 0) && 139 - (p_dev->io.BasePort1 < 0xffff)) { 140 - if (!pcmcia_request_io(p_dev, &p_dev->io)) 142 + (p_dev->resource[0]->start < 0xffff)) { 143 + if (!pcmcia_request_io(p_dev)) 141 144 return 0; 142 145 } 143 146 return -EINVAL; ··· 167 168 /* Set configuration options for the aha152x driver */ 168 169 memset(&s, 0, sizeof(s)); 169 170 s.conf = "PCMCIA setup"; 170 - s.io_port = link->io.BasePort1; 171 + s.io_port = link->resource[0]->start; 171 172 s.irq = link->irq; 172 173 s.scsiid = host_id; 173 174 s.reconnect = reconnect;
+7 -8
drivers/scsi/pcmcia/fdomain_stub.c
··· 46 46 #include <scsi/scsi_host.h> 47 47 #include "fdomain.h" 48 48 49 - #include <pcmcia/cs_types.h> 50 49 #include <pcmcia/cs.h> 51 50 #include <pcmcia/cistpl.h> 52 51 #include <pcmcia/ds.h> ··· 83 84 84 85 info->p_dev = link; 85 86 link->priv = info; 86 - link->io.NumPorts1 = 0x10; 87 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 88 - link->io.IOAddrLines = 10; 87 + link->resource[0]->end = 0x10; 88 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 89 89 link->conf.Attributes = CONF_ENABLE_IRQ; 90 90 link->conf.IntType = INT_MEMORY_AND_IO; 91 91 link->conf.Present = PRESENT_OPTION; ··· 111 113 unsigned int vcc, 112 114 void *priv_data) 113 115 { 114 - p_dev->io.BasePort1 = cfg->io.win[0].base; 115 - return pcmcia_request_io(p_dev, &p_dev->io); 116 + p_dev->io_lines = 10; 117 + p_dev->resource[0]->start = cfg->io.win[0].base; 118 + return pcmcia_request_io(p_dev); 116 119 } 117 120 118 121 ··· 137 138 goto failed; 138 139 139 140 /* A bad hack... */ 140 - release_region(link->io.BasePort1, link->io.NumPorts1); 141 + release_region(link->resource[0]->start, resource_size(link->resource[0])); 141 142 142 143 /* Set configuration options for the fdomain driver */ 143 - sprintf(str, "%d,%d", link->io.BasePort1, link->irq); 144 + sprintf(str, "%d,%d", (unsigned int) link->resource[0]->start, link->irq); 144 145 fdomain_setup(str); 145 146 146 147 host = __fdomain_16x0_detect(&fdomain_driver_template);
+28 -33
drivers/scsi/pcmcia/nsp_cs.c
··· 47 47 #include <scsi/scsi.h> 48 48 #include <scsi/scsi_ioctl.h> 49 49 50 - #include <pcmcia/cs_types.h> 51 50 #include <pcmcia/cs.h> 52 51 #include <pcmcia/cistpl.h> 53 52 #include <pcmcia/cisreg.h> ··· 1558 1559 nsp_dbg(NSP_DEBUG_INIT, "info=0x%p", info); 1559 1560 1560 1561 /* The io structure describes IO port mapping */ 1561 - link->io.NumPorts1 = 0x10; 1562 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 1563 - link->io.IOAddrLines = 10; /* not used */ 1562 + link->resource[0]->end = 0x10; 1563 + link->resource[0]->flags = IO_DATA_PATH_WIDTH_AUTO; 1564 1564 1565 1565 /* General socket configuration */ 1566 1566 link->conf.Attributes = CONF_ENABLE_IRQ; ··· 1640 1642 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 1641 1643 1642 1644 /* IO window settings */ 1643 - p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 1645 + p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 1644 1646 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 1645 1647 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 1646 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 1647 - if (!(io->flags & CISTPL_IO_8BIT)) 1648 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 1649 - if (!(io->flags & CISTPL_IO_16BIT)) 1650 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 1651 - p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 1652 - p_dev->io.BasePort1 = io->win[0].base; 1653 - p_dev->io.NumPorts1 = io->win[0].len; 1648 + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 1649 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 1650 + p_dev->resource[0]->flags |= 1651 + pcmcia_io_cfg_data_width(io->flags); 1652 + p_dev->resource[0]->start = io->win[0].base; 1653 + p_dev->resource[0]->end = io->win[0].len; 1654 1654 if (io->nwin > 1) { 1655 - p_dev->io.Attributes2 = p_dev->io.Attributes1; 1656 - p_dev->io.BasePort2 = io->win[1].base; 1657 - p_dev->io.NumPorts2 = io->win[1].len; 1655 + p_dev->resource[1]->flags = 1656 + p_dev->resource[0]->flags; 1657 + p_dev->resource[1]->start = io->win[1].base; 1658 + p_dev->resource[1]->end = io->win[1].len; 1658 1659 } 1659 1660 /* This reserves IO space but doesn't actually enable it */ 1660 - if (pcmcia_request_io(p_dev, &p_dev->io) != 0) 1661 + if (pcmcia_request_io(p_dev) != 0) 1661 1662 goto next_entry; 1662 1663 } 1663 1664 1664 1665 if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { 1665 - memreq_t map; 1666 1666 cistpl_mem_t *mem = 1667 1667 (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; 1668 1668 cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; ··· 1672 1676 cfg_mem->req.AccessSpeed = 0; 1673 1677 if (pcmcia_request_window(p_dev, &cfg_mem->req, &p_dev->win) != 0) 1674 1678 goto next_entry; 1675 - map.Page = 0; map.CardOffset = mem->win[0].card_addr; 1676 - if (pcmcia_map_mem_page(p_dev, p_dev->win, &map) != 0) 1679 + if (pcmcia_map_mem_page(p_dev, p_dev->win, 1680 + mem->win[0].card_addr) != 0) 1677 1681 goto next_entry; 1678 1682 1679 1683 cfg_mem->data->MmioAddress = (unsigned long) ioremap_nocache(cfg_mem->req.Base, cfg_mem->req.Size); ··· 1716 1720 goto cs_failed; 1717 1721 1718 1722 if (free_ports) { 1719 - if (link->io.BasePort1) { 1720 - release_region(link->io.BasePort1, link->io.NumPorts1); 1723 + if (link->resource[0]) { 1724 + release_region(link->resource[0]->start, 1725 + resource_size(link->resource[0])); 1721 1726 } 1722 - if (link->io.BasePort2) { 1723 - release_region(link->io.BasePort2, link->io.NumPorts2); 1727 + if (link->resource[1]) { 1728 + release_region(link->resource[1]->start, 1729 + resource_size(link->resource[1])); 1724 1730 } 1725 1731 } 1726 1732 1727 1733 /* Set port and IRQ */ 1728 - data->BaseAddress = link->io.BasePort1; 1729 - data->NumAddress = link->io.NumPorts1; 1734 + data->BaseAddress = link->resource[0]->start; 1735 + data->NumAddress = resource_size(link->resource[0]); 1730 1736 data->IrqNumber = link->irq; 1731 1737 1732 1738 nsp_dbg(NSP_DEBUG_INIT, "I/O[0x%x+0x%x] IRQ %d", ··· 1763 1765 if (link->conf.Attributes & CONF_ENABLE_IRQ) { 1764 1766 printk(", irq %d", link->irq); 1765 1767 } 1766 - if (link->io.NumPorts1) { 1767 - printk(", io 0x%04x-0x%04x", link->io.BasePort1, 1768 - link->io.BasePort1+link->io.NumPorts1-1); 1769 - } 1770 - if (link->io.NumPorts2) 1771 - printk(" & 0x%04x-0x%04x", link->io.BasePort2, 1772 - link->io.BasePort2+link->io.NumPorts2-1); 1768 + if (link->resource[0]) 1769 + printk(", io %pR", link->resource[0]); 1770 + if (link->resource[1]) 1771 + printk(" & %pR", link->resource[1]); 1773 1772 if (link->win) 1774 1773 printk(", mem 0x%06lx-0x%06lx", cfg_mem->req.Base, 1775 1774 cfg_mem->req.Base+cfg_mem->req.Size-1);
+16 -17
drivers/scsi/pcmcia/qlogic_stub.c
··· 48 48 #include <scsi/scsi_host.h> 49 49 #include "../qlogicfas408.h" 50 50 51 - #include <pcmcia/cs_types.h> 52 51 #include <pcmcia/cs.h> 53 52 #include <pcmcia/cistpl.h> 54 53 #include <pcmcia/ds.h> ··· 156 157 return -ENOMEM; 157 158 info->p_dev = link; 158 159 link->priv = info; 159 - link->io.NumPorts1 = 16; 160 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 161 - link->io.IOAddrLines = 10; 160 + link->resource[0]->end = 16; 161 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 162 162 link->conf.Attributes = CONF_ENABLE_IRQ; 163 163 link->conf.IntType = INT_MEMORY_AND_IO; 164 164 link->conf.Present = PRESENT_OPTION; ··· 184 186 unsigned int vcc, 185 187 void *priv_data) 186 188 { 187 - p_dev->io.BasePort1 = cfg->io.win[0].base; 188 - p_dev->io.NumPorts1 = cfg->io.win[0].len; 189 + p_dev->io_lines = 10; 190 + p_dev->resource[0]->start = cfg->io.win[0].base; 191 + p_dev->resource[0]->end = cfg->io.win[0].len; 189 192 190 - if (p_dev->io.BasePort1 == 0) 193 + if (p_dev->resource[0]->start == 0) 191 194 return -ENODEV; 192 195 193 - return pcmcia_request_io(p_dev, &p_dev->io); 196 + return pcmcia_request_io(p_dev); 194 197 } 195 198 196 199 static int qlogic_config(struct pcmcia_device * link) ··· 215 216 216 217 if ((info->manf_id == MANFID_MACNICA) || (info->manf_id == MANFID_PIONEER) || (info->manf_id == 0x0098)) { 217 218 /* set ATAcmd */ 218 - outb(0xb4, link->io.BasePort1 + 0xd); 219 - outb(0x24, link->io.BasePort1 + 0x9); 220 - outb(0x04, link->io.BasePort1 + 0xd); 219 + outb(0xb4, link->resource[0]->start + 0xd); 220 + outb(0x24, link->resource[0]->start + 0x9); 221 + outb(0x04, link->resource[0]->start + 0xd); 221 222 } 222 223 223 224 /* The KXL-810AN has a bigger IO port window */ 224 - if (link->io.NumPorts1 == 32) 225 + if (resource_size(link->resource[0]) == 32) 225 226 host = qlogic_detect(&qlogicfas_driver_template, link, 226 - link->io.BasePort1 + 16, link->irq); 227 + link->resource[0]->start + 16, link->irq); 227 228 else 228 229 host = qlogic_detect(&qlogicfas_driver_template, link, 229 - link->io.BasePort1, link->irq); 230 + link->resource[0]->start, link->irq); 230 231 231 232 if (!host) { 232 233 printk(KERN_INFO "%s: no SCSI devices found\n", qlogic_name); ··· 268 269 if ((info->manf_id == MANFID_MACNICA) || 269 270 (info->manf_id == MANFID_PIONEER) || 270 271 (info->manf_id == 0x0098)) { 271 - outb(0x80, link->io.BasePort1 + 0xd); 272 - outb(0x24, link->io.BasePort1 + 0x9); 273 - outb(0x04, link->io.BasePort1 + 0xd); 272 + outb(0x80, link->resource[0]->start + 0xd); 273 + outb(0x24, link->resource[0]->start + 0x9); 274 + outb(0x04, link->resource[0]->start + 0xd); 274 275 } 275 276 /* Ugggglllyyyy!!! */ 276 277 qlogicfas408_bus_reset(NULL);
+15 -16
drivers/scsi/pcmcia/sym53c500_cs.c
··· 71 71 #include <scsi/scsi.h> 72 72 #include <scsi/scsi_host.h> 73 73 74 - #include <pcmcia/cs_types.h> 75 74 #include <pcmcia/cs.h> 76 75 #include <pcmcia/cistpl.h> 77 76 #include <pcmcia/ds.h> ··· 690 691 unsigned int vcc, 691 692 void *priv_data) 692 693 { 693 - p_dev->io.BasePort1 = cfg->io.win[0].base; 694 - p_dev->io.NumPorts1 = cfg->io.win[0].len; 694 + p_dev->io_lines = 10; 695 + p_dev->resource[0]->start = cfg->io.win[0].base; 696 + p_dev->resource[0]->end = cfg->io.win[0].len; 695 697 696 - if (p_dev->io.BasePort1 == 0) 698 + if (p_dev->resource[0]->start == 0) 697 699 return -ENODEV; 698 700 699 - return pcmcia_request_io(p_dev, &p_dev->io); 701 + return pcmcia_request_io(p_dev); 700 702 } 701 703 702 704 static int ··· 734 734 (info->manf_id == MANFID_PIONEER) || 735 735 (info->manf_id == 0x0098)) { 736 736 /* set ATAcmd */ 737 - outb(0xb4, link->io.BasePort1 + 0xd); 738 - outb(0x24, link->io.BasePort1 + 0x9); 739 - outb(0x04, link->io.BasePort1 + 0xd); 737 + outb(0xb4, link->resource[0]->start + 0xd); 738 + outb(0x24, link->resource[0]->start + 0x9); 739 + outb(0x04, link->resource[0]->start + 0xd); 740 740 } 741 741 742 742 /* ··· 749 749 * 0x130, 0x230, 0x280, 0x290, 750 750 * 0x320, 0x330, 0x340, 0x350 751 751 */ 752 - port_base = link->io.BasePort1; 752 + port_base = link->resource[0]->start; 753 753 irq_level = link->irq; 754 754 755 755 DEB(printk("SYM53C500: port_base=0x%x, irq=%d, fast_pio=%d\n", ··· 822 822 if ((info->manf_id == MANFID_MACNICA) || 823 823 (info->manf_id == MANFID_PIONEER) || 824 824 (info->manf_id == 0x0098)) { 825 - outb(0x80, link->io.BasePort1 + 0xd); 826 - outb(0x24, link->io.BasePort1 + 0x9); 827 - outb(0x04, link->io.BasePort1 + 0xd); 825 + outb(0x80, link->resource[0]->start + 0xd); 826 + outb(0x24, link->resource[0]->start + 0x9); 827 + outb(0x04, link->resource[0]->start + 0xd); 828 828 } 829 829 /* 830 830 * If things don't work after a "resume", 831 831 * this is a good place to start looking. 832 832 */ 833 - SYM53C500_int_host_reset(link->io.BasePort1); 833 + SYM53C500_int_host_reset(link->resource[0]->start); 834 834 835 835 return 0; 836 836 } ··· 859 859 return -ENOMEM; 860 860 info->p_dev = link; 861 861 link->priv = info; 862 - link->io.NumPorts1 = 16; 863 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 864 - link->io.IOAddrLines = 10; 862 + link->resource[0]->end = 16; 863 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 865 864 link->conf.Attributes = CONF_ENABLE_IRQ; 866 865 link->conf.IntType = INT_MEMORY_AND_IO; 867 866
+33 -35
drivers/serial/serial_cs.c
··· 45 45 #include <asm/io.h> 46 46 #include <asm/system.h> 47 47 48 - #include <pcmcia/cs_types.h> 49 48 #include <pcmcia/cs.h> 50 49 #include <pcmcia/cistpl.h> 51 50 #include <pcmcia/ciscode.h> ··· 114 115 115 116 static int quirk_post_ibm(struct pcmcia_device *link) 116 117 { 117 - conf_reg_t reg = { 0, CS_READ, 0x800, 0 }; 118 + u8 val; 118 119 int ret; 119 120 120 - ret = pcmcia_access_configuration_register(link, &reg); 121 + ret = pcmcia_read_config_byte(link, 0x800, &val); 121 122 if (ret) 122 123 goto failed; 123 124 124 - reg.Action = CS_WRITE; 125 - reg.Value = reg.Value | 1; 126 - ret = pcmcia_access_configuration_register(link, &reg); 125 + ret = pcmcia_write_config_byte(link, 0x800, val | 1); 127 126 if (ret) 128 127 goto failed; 129 128 return 0; ··· 335 338 info->p_dev = link; 336 339 link->priv = info; 337 340 338 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 339 - link->io.NumPorts1 = 8; 341 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 342 + link->resource[0]->end = 8; 340 343 link->conf.Attributes = CONF_ENABLE_IRQ; 341 344 if (do_sound) { 342 345 link->conf.Attributes |= CONF_ENABLE_SPKR; ··· 424 427 p_dev->conf.Vpp = 425 428 cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; 426 429 430 + p_dev->io_lines = ((*try & 0x1) == 0) ? 431 + 16 : cf->io.flags & CISTPL_IO_LINES_MASK; 432 + 427 433 if ((cf->io.nwin > 0) && (cf->io.win[0].len == size_table[(*try >> 1)]) 428 434 && (cf->io.win[0].base != 0)) { 429 - p_dev->io.BasePort1 = cf->io.win[0].base; 430 - p_dev->io.IOAddrLines = ((*try & 0x1) == 0) ? 431 - 16 : cf->io.flags & CISTPL_IO_LINES_MASK; 432 - if (!pcmcia_request_io(p_dev, &p_dev->io)) 435 + p_dev->resource[0]->start = cf->io.win[0].base; 436 + if (!pcmcia_request_io(p_dev)) 433 437 return 0; 434 438 } 435 439 return -EINVAL; ··· 447 449 448 450 if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { 449 451 for (j = 0; j < 5; j++) { 450 - p_dev->io.BasePort1 = base[j]; 451 - p_dev->io.IOAddrLines = base[j] ? 16 : 3; 452 - if (!pcmcia_request_io(p_dev, &p_dev->io)) 452 + p_dev->resource[0]->start = base[j]; 453 + p_dev->io_lines = base[j] ? 16 : 3; 454 + if (!pcmcia_request_io(p_dev)) 453 455 return 0; 454 456 } 455 457 } ··· 464 466 /* If the card is already configured, look up the port and irq */ 465 467 if (link->function_config) { 466 468 unsigned int port = 0; 467 - if ((link->io.BasePort2 != 0) && 468 - (link->io.NumPorts2 == 8)) { 469 - port = link->io.BasePort2; 469 + if ((link->resource[1]->end != 0) && 470 + (resource_size(link->resource[1]) == 8)) { 471 + port = link->resource[1]->end; 470 472 info->slave = 1; 471 473 } else if ((info->manfid == MANFID_OSITECH) && 472 - (link->io.NumPorts1 == 0x40)) { 473 - port = link->io.BasePort1 + 0x28; 474 + (resource_size(link->resource[0]) == 0x40)) { 475 + port = link->resource[0]->start + 0x28; 474 476 info->slave = 1; 475 477 } 476 478 if (info->slave) { ··· 508 510 i = pcmcia_request_configuration(link, &link->conf); 509 511 if (i != 0) 510 512 return -1; 511 - return setup_serial(link, info, link->io.BasePort1, link->irq); 513 + return setup_serial(link, info, link->resource[0]->start, link->irq); 512 514 } 513 515 514 516 static int multi_config_check(struct pcmcia_device *p_dev, ··· 522 524 /* The quad port cards have bad CIS's, so just look for a 523 525 window larger than 8 ports and assume it will be right */ 524 526 if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { 525 - p_dev->io.BasePort1 = cf->io.win[0].base; 526 - p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; 527 - if (!pcmcia_request_io(p_dev, &p_dev->io)) { 528 - *base2 = p_dev->io.BasePort1 + 8; 527 + p_dev->resource[0]->start = cf->io.win[0].base; 528 + p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; 529 + if (!pcmcia_request_io(p_dev)) { 530 + *base2 = p_dev->resource[0]->start + 8; 529 531 return 0; 530 532 } 531 533 } ··· 541 543 int *base2 = priv_data; 542 544 543 545 if (cf->io.nwin == 2) { 544 - p_dev->io.BasePort1 = cf->io.win[0].base; 545 - p_dev->io.BasePort2 = cf->io.win[1].base; 546 - p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; 547 - if (!pcmcia_request_io(p_dev, &p_dev->io)) { 548 - *base2 = p_dev->io.BasePort2; 546 + p_dev->resource[0]->start = cf->io.win[0].base; 547 + p_dev->resource[1]->start = cf->io.win[1].base; 548 + p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; 549 + if (!pcmcia_request_io(p_dev)) { 550 + *base2 = p_dev->resource[1]->start; 549 551 return 0; 550 552 } 551 553 } ··· 558 560 int i, base2 = 0; 559 561 560 562 /* First, look for a generic full-sized window */ 561 - link->io.NumPorts1 = info->multi * 8; 563 + link->resource[0]->end = info->multi * 8; 562 564 if (pcmcia_loop_config(link, multi_config_check, &base2)) { 563 565 /* If that didn't work, look for two windows */ 564 - link->io.NumPorts1 = link->io.NumPorts2 = 8; 566 + link->resource[0]->end = link->resource[1]->end = 8; 565 567 info->multi = 2; 566 568 if (pcmcia_loop_config(link, multi_config_check_notpicky, 567 569 &base2)) { ··· 597 599 link->conf.ConfigIndex == 3) { 598 600 err = setup_serial(link, info, base2, 599 601 link->irq); 600 - base2 = link->io.BasePort1; 602 + base2 = link->resource[0]->start;; 601 603 } else { 602 - err = setup_serial(link, info, link->io.BasePort1, 604 + err = setup_serial(link, info, link->resource[0]->start, 603 605 link->irq); 604 606 } 605 607 info->c950ctrl = base2; ··· 614 616 return 0; 615 617 } 616 618 617 - setup_serial(link, info, link->io.BasePort1, link->irq); 619 + setup_serial(link, info, link->resource[0]->start, link->irq); 618 620 for (i = 0; i < info->multi - 1; i++) 619 621 setup_serial(link, info, base2 + (8 * i), 620 622 link->irq);
-1
drivers/ssb/main.c
··· 20 20 #include <linux/mmc/sdio_func.h> 21 21 #include <linux/slab.h> 22 22 23 - #include <pcmcia/cs_types.h> 24 23 #include <pcmcia/cs.h> 25 24 #include <pcmcia/cistpl.h> 26 25 #include <pcmcia/ds.h>
+2 -13
drivers/ssb/pcmcia.c
··· 13 13 #include <linux/io.h> 14 14 #include <linux/etherdevice.h> 15 15 16 - #include <pcmcia/cs_types.h> 17 16 #include <pcmcia/cs.h> 18 17 #include <pcmcia/cistpl.h> 19 18 #include <pcmcia/ciscode.h> ··· 71 72 /* Write to a PCMCIA configuration register. */ 72 73 static int ssb_pcmcia_cfg_write(struct ssb_bus *bus, u8 offset, u8 value) 73 74 { 74 - conf_reg_t reg; 75 75 int res; 76 76 77 - memset(&reg, 0, sizeof(reg)); 78 - reg.Offset = offset; 79 - reg.Action = CS_WRITE; 80 - reg.Value = value; 81 - res = pcmcia_access_configuration_register(bus->host_pcmcia, &reg); 77 + res = pcmcia_write_config_byte(bus->host_pcmcia, offset, value); 82 78 if (unlikely(res != 0)) 83 79 return -EBUSY; 84 80 ··· 83 89 /* Read from a PCMCIA configuration register. */ 84 90 static int ssb_pcmcia_cfg_read(struct ssb_bus *bus, u8 offset, u8 *value) 85 91 { 86 - conf_reg_t reg; 87 92 int res; 88 93 89 - memset(&reg, 0, sizeof(reg)); 90 - reg.Offset = offset; 91 - reg.Action = CS_READ; 92 - res = pcmcia_access_configuration_register(bus->host_pcmcia, &reg); 94 + res = pcmcia_read_config_byte(bus->host_pcmcia, offset, value); 93 95 if (unlikely(res != 0)) 94 96 return -EBUSY; 95 - *value = reg.Value; 96 97 97 98 return 0; 98 99 }
-1
drivers/ssb/scan.c
··· 17 17 #include <linux/pci.h> 18 18 #include <linux/io.h> 19 19 20 - #include <pcmcia/cs_types.h> 21 20 #include <pcmcia/cs.h> 22 21 #include <pcmcia/cistpl.h> 23 22 #include <pcmcia/ds.h>
+17 -30
drivers/staging/comedi/drivers/cb_das16_cs.c
··· 37 37 #include <linux/delay.h> 38 38 #include <linux/pci.h> 39 39 40 - #include <pcmcia/cs_types.h> 41 40 #include <pcmcia/cs.h> 42 41 #include <pcmcia/cistpl.h> 43 42 #include <pcmcia/ds.h> ··· 170 171 if (!link) 171 172 return -EIO; 172 173 173 - dev->iobase = link->io.BasePort1; 174 + dev->iobase = link->resource[0]->start;; 174 175 printk("I/O base=0x%04lx ", dev->iobase); 175 176 176 177 printk("fingerprint:\n"); ··· 661 662 less on other parts of the kernel. 662 663 */ 663 664 664 - /* 665 - The dev_info variable is the "key" that is used to match up this 666 - device driver with appropriate cards, through the card configuration 667 - database. 668 - */ 669 - 670 - static dev_info_t dev_info = "cb_das16_cs"; 671 - 672 665 struct local_info_t { 673 666 struct pcmcia_device *link; 674 667 int stop; ··· 727 736 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 728 737 729 738 /* IO window settings */ 730 - p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 739 + p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 731 740 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 732 741 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 733 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 734 - if (!(io->flags & CISTPL_IO_8BIT)) 735 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 736 - if (!(io->flags & CISTPL_IO_16BIT)) 737 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 738 - p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 739 - p_dev->io.BasePort1 = io->win[0].base; 740 - p_dev->io.NumPorts1 = io->win[0].len; 742 + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 743 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 744 + p_dev->resource[0]->flags |= 745 + pcmcia_io_cfg_data_width(io->flags); 746 + p_dev->resource[0]->start = io->win[0].base; 747 + p_dev->resource[0]->end = io->win[0].len; 741 748 if (io->nwin > 1) { 742 - p_dev->io.Attributes2 = p_dev->io.Attributes1; 743 - p_dev->io.BasePort2 = io->win[1].base; 744 - p_dev->io.NumPorts2 = io->win[1].len; 749 + p_dev->resource[1]->flags = p_dev->resource[0]->flags; 750 + p_dev->resource[1]->start = io->win[1].base; 751 + p_dev->resource[1]->end = io->win[1].len; 745 752 } 746 753 /* This reserves IO space but doesn't actually enable it */ 747 - return pcmcia_request_io(p_dev, &p_dev->io); 754 + return pcmcia_request_io(p_dev); 748 755 } 749 756 750 757 return 0; ··· 776 787 dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); 777 788 if (link->conf.Attributes & CONF_ENABLE_IRQ) 778 789 printk(", irq %u", link->irq); 779 - if (link->io.NumPorts1) 780 - printk(", io 0x%04x-0x%04x", link->io.BasePort1, 781 - link->io.BasePort1 + link->io.NumPorts1 - 1); 782 - if (link->io.NumPorts2) 783 - printk(" & 0x%04x-0x%04x", link->io.BasePort2, 784 - link->io.BasePort2 + link->io.NumPorts2 - 1); 790 + if (link->resource[0]) 791 + printk(", io %pR", link->resource[0]); 792 + if (link->resource[1]) 793 + printk(", io %pR", link->resource[1]); 785 794 printk("\n"); 786 795 787 796 return; ··· 833 846 .id_table = das16cs_id_table, 834 847 .owner = THIS_MODULE, 835 848 .drv = { 836 - .name = dev_info, 849 + .name = "cb_das16_cs", 837 850 }, 838 851 }; 839 852
+17 -29
drivers/staging/comedi/drivers/das08_cs.c
··· 48 48 #include "das08.h" 49 49 50 50 /* pcmcia includes */ 51 - #include <pcmcia/cs_types.h> 52 51 #include <pcmcia/cs.h> 53 52 #include <pcmcia/cistpl.h> 54 53 #include <pcmcia/ds.h> ··· 88 89 printk(" no pcmcia cards found\n"); 89 90 return -EIO; 90 91 } 91 - iobase = link->io.BasePort1; 92 + iobase = link->resource[0]->start; 92 93 } else { 93 94 printk(" bug! board does not have PCMCIA bustype\n"); 94 95 return -EINVAL; ··· 130 131 of a fully self-sufficient driver; the other drivers rely more or 131 132 less on other parts of the kernel. 132 133 */ 133 - 134 - /* 135 - The dev_info variable is the "key" that is used to match up this 136 - device driver with appropriate cards, through the card configuration 137 - database. 138 - */ 139 - 140 - static const dev_info_t dev_info = "pcm-das08"; 141 134 142 135 struct local_info_t { 143 136 struct pcmcia_device *link; ··· 215 224 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 216 225 217 226 /* IO window settings */ 218 - p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 227 + p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 219 228 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 220 229 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 221 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 222 - if (!(io->flags & CISTPL_IO_8BIT)) 223 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 224 - if (!(io->flags & CISTPL_IO_16BIT)) 225 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 230 + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 231 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 232 + p_dev->resource[0]->flags |= 233 + pcmcia_io_cfg_data_width(io->flags); 226 234 p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 227 - p_dev->io.BasePort1 = io->win[0].base; 228 - p_dev->io.NumPorts1 = io->win[0].len; 235 + p_dev->resource[0]->start = io->win[0].base; 236 + p_dev->resource[0]->end = io->win[0].len; 229 237 if (io->nwin > 1) { 230 - p_dev->io.Attributes2 = p_dev->io.Attributes1; 231 - p_dev->io.BasePort2 = io->win[1].base; 232 - p_dev->io.NumPorts2 = io->win[1].len; 238 + p_dev->resource[1]->flags = p_dev->resource[0]->flags; 239 + p_dev->resource[1]->start = io->win[1].base; 240 + p_dev->resource[1]->end = io->win[1].len; 233 241 } 234 242 /* This reserves IO space but doesn't actually enable it */ 235 - return pcmcia_request_io(p_dev, &p_dev->io); 243 + return pcmcia_request_io(p_dev); 236 244 } 237 245 return 0; 238 246 } ··· 273 283 dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); 274 284 if (link->conf.Attributes & CONF_ENABLE_IRQ) 275 285 printk(", irq %u", link->irq); 276 - if (link->io.NumPorts1) 277 - printk(", io 0x%04x-0x%04x", link->io.BasePort1, 278 - link->io.BasePort1 + link->io.NumPorts1 - 1); 279 - if (link->io.NumPorts2) 280 - printk(" & 0x%04x-0x%04x", link->io.BasePort2, 281 - link->io.BasePort2 + link->io.NumPorts2 - 1); 286 + if (link->resource[0]) 287 + printk(", io %pR", link->resource[0]); 288 + if (link->resource[1]) 289 + printk(" & %pR", link->resource[1]); 282 290 printk("\n"); 283 291 284 292 return; ··· 350 362 .id_table = das08_cs_id_table, 351 363 .owner = THIS_MODULE, 352 364 .drv = { 353 - .name = dev_info, 365 + .name = "pcm-das08", 354 366 }, 355 367 }; 356 368
+18 -54
drivers/staging/comedi/drivers/ni_daq_700.c
··· 47 47 48 48 #include <linux/ioport.h> 49 49 50 - #include <pcmcia/cs_types.h> 51 50 #include <pcmcia/cs.h> 52 51 #include <pcmcia/cistpl.h> 53 52 #include <pcmcia/cisreg.h> ··· 376 377 link = pcmcia_cur_dev; /* XXX hack */ 377 378 if (!link) 378 379 return -EIO; 379 - iobase = link->io.BasePort1; 380 + iobase = link->resource[0]->start; 380 381 #ifdef incomplete 381 382 irq = link->irq; 382 383 #endif ··· 457 458 of a fully self-sufficient driver; the other drivers rely more or 458 459 less on other parts of the kernel. 459 460 */ 460 - 461 - /* 462 - The dev_info variable is the "key" that is used to match up this 463 - device driver with appropriate cards, through the card configuration 464 - database. 465 - */ 466 - 467 - static const dev_info_t dev_info = "ni_daq_700"; 468 461 469 462 struct local_info_t { 470 463 struct pcmcia_device *link; ··· 546 555 unsigned int vcc, 547 556 void *priv_data) 548 557 { 549 - win_req_t *req = priv_data; 550 - memreq_t map; 551 - 552 558 if (cfg->index == 0) 553 559 return -ENODEV; 554 560 ··· 559 571 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 560 572 561 573 /* IO window settings */ 562 - p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 574 + p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 563 575 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 564 576 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 565 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 566 - if (!(io->flags & CISTPL_IO_8BIT)) 567 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 568 - if (!(io->flags & CISTPL_IO_16BIT)) 569 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 570 - p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 571 - p_dev->io.BasePort1 = io->win[0].base; 572 - p_dev->io.NumPorts1 = io->win[0].len; 577 + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 578 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 579 + p_dev->resource[0]->flags |= 580 + pcmcia_io_cfg_data_width(io->flags); 581 + p_dev->resource[0]->start = io->win[0].base; 582 + p_dev->resource[0]->end = io->win[0].len; 573 583 if (io->nwin > 1) { 574 - p_dev->io.Attributes2 = p_dev->io.Attributes1; 575 - p_dev->io.BasePort2 = io->win[1].base; 576 - p_dev->io.NumPorts2 = io->win[1].len; 584 + p_dev->resource[1]->flags = p_dev->resource[0]->flags; 585 + p_dev->resource[1]->start = io->win[1].base; 586 + p_dev->resource[1]->end = io->win[1].len; 577 587 } 578 588 /* This reserves IO space but doesn't actually enable it */ 579 - if (pcmcia_request_io(p_dev, &p_dev->io) != 0) 589 + if (pcmcia_request_io(p_dev) != 0) 580 590 return -ENODEV; 581 591 } 582 592 583 - if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { 584 - cistpl_mem_t *mem = 585 - (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; 586 - req->Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM; 587 - req->Attributes |= WIN_ENABLE; 588 - req->Base = mem->win[0].host_addr; 589 - req->Size = mem->win[0].len; 590 - if (req->Size < 0x1000) 591 - req->Size = 0x1000; 592 - req->AccessSpeed = 0; 593 - if (pcmcia_request_window(p_dev, req, &p_dev->win)) 594 - return -ENODEV; 595 - map.Page = 0; 596 - map.CardOffset = mem->win[0].card_addr; 597 - if (pcmcia_map_mem_page(p_dev, p_dev->win, &map)) 598 - return -ENODEV; 599 - } 600 593 /* If we got this far, we're cool! */ 601 594 return 0; 602 595 } ··· 591 622 592 623 dev_dbg(&link->dev, "dio700_config\n"); 593 624 594 - ret = pcmcia_loop_config(link, dio700_pcmcia_config_loop, &req); 625 + ret = pcmcia_loop_config(link, dio700_pcmcia_config_loop, NULL); 595 626 if (ret) { 596 627 dev_warn(&link->dev, "no configuration found\n"); 597 628 goto failed; ··· 613 644 dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); 614 645 if (link->conf.Attributes & CONF_ENABLE_IRQ) 615 646 printk(", irq %d", link->irq); 616 - if (link->io.NumPorts1) 617 - printk(", io 0x%04x-0x%04x", link->io.BasePort1, 618 - link->io.BasePort1 + link->io.NumPorts1 - 1); 619 - if (link->io.NumPorts2) 620 - printk(" & 0x%04x-0x%04x", link->io.BasePort2, 621 - link->io.BasePort2 + link->io.NumPorts2 - 1); 622 - if (link->win) 623 - printk(", mem 0x%06lx-0x%06lx", req.Base, 624 - req.Base + req.Size - 1); 647 + if (link->resource[0]) 648 + printk(", io %pR", link->resource[0]); 649 + if (link->resource[1]) 650 + printk(" & %pR", link->resource[1]); 625 651 printk("\n"); 626 652 627 653 return; ··· 686 722 .id_table = dio700_cs_ids, 687 723 .owner = THIS_MODULE, 688 724 .drv = { 689 - .name = dev_info, 725 + .name = "ni_daq_700", 690 726 }, 691 727 }; 692 728
+18 -55
drivers/staging/comedi/drivers/ni_daq_dio24.c
··· 48 48 49 49 #include "8255.h" 50 50 51 - #include <pcmcia/cs_types.h> 52 51 #include <pcmcia/cs.h> 53 52 #include <pcmcia/cistpl.h> 54 53 #include <pcmcia/cisreg.h> ··· 128 129 link = pcmcia_cur_dev; /* XXX hack */ 129 130 if (!link) 130 131 return -EIO; 131 - iobase = link->io.BasePort1; 132 + iobase = link->resource[0]->start; 132 133 #ifdef incomplete 133 134 irq = link->irq; 134 135 #endif ··· 209 210 of a fully self-sufficient driver; the other drivers rely more or 210 211 less on other parts of the kernel. 211 212 */ 212 - 213 - /* 214 - The dev_info variable is the "key" that is used to match up this 215 - device driver with appropriate cards, through the card configuration 216 - database. 217 - */ 218 - 219 - static const dev_info_t dev_info = "ni_daq_dio24"; 220 213 221 214 struct local_info_t { 222 215 struct pcmcia_device *link; ··· 298 307 unsigned int vcc, 299 308 void *priv_data) 300 309 { 301 - win_req_t *req = priv_data; 302 - memreq_t map; 303 - 304 310 if (cfg->index == 0) 305 311 return -ENODEV; 306 312 ··· 311 323 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 312 324 313 325 /* IO window settings */ 314 - p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 326 + p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 315 327 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 316 328 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 317 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 318 - if (!(io->flags & CISTPL_IO_8BIT)) 319 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 320 - if (!(io->flags & CISTPL_IO_16BIT)) 321 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 322 - p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 323 - p_dev->io.BasePort1 = io->win[0].base; 324 - p_dev->io.NumPorts1 = io->win[0].len; 329 + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 330 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 331 + p_dev->resource[0]->flags |= 332 + pcmcia_io_cfg_data_width(io->flags); 333 + p_dev->resource[0]->start = io->win[0].base; 334 + p_dev->resource[0]->end = io->win[0].len; 325 335 if (io->nwin > 1) { 326 - p_dev->io.Attributes2 = p_dev->io.Attributes1; 327 - p_dev->io.BasePort2 = io->win[1].base; 328 - p_dev->io.NumPorts2 = io->win[1].len; 336 + p_dev->resource[1]->flags = p_dev->resource[0]->flags; 337 + p_dev->resource[1]->start = io->win[1].base; 338 + p_dev->resource[1]->end = io->win[1].len; 329 339 } 330 340 /* This reserves IO space but doesn't actually enable it */ 331 - if (pcmcia_request_io(p_dev, &p_dev->io) != 0) 341 + if (pcmcia_request_io(p_dev) != 0) 332 342 return -ENODEV; 333 343 } 334 344 335 - if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { 336 - cistpl_mem_t *mem = 337 - (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; 338 - req->Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM; 339 - req->Attributes |= WIN_ENABLE; 340 - req->Base = mem->win[0].host_addr; 341 - req->Size = mem->win[0].len; 342 - if (req->Size < 0x1000) 343 - req->Size = 0x1000; 344 - req->AccessSpeed = 0; 345 - if (pcmcia_request_window(p_dev, req, &p_dev->win)) 346 - return -ENODEV; 347 - map.Page = 0; 348 - map.CardOffset = mem->win[0].card_addr; 349 - if (pcmcia_map_mem_page(p_dev, p_dev->win, &map)) 350 - return -ENODEV; 351 - } 352 345 /* If we got this far, we're cool! */ 353 346 return 0; 354 347 } ··· 337 368 static void dio24_config(struct pcmcia_device *link) 338 369 { 339 370 int ret; 340 - win_req_t req; 341 371 342 372 printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO! - config\n"); 343 373 344 374 dev_dbg(&link->dev, "dio24_config\n"); 345 375 346 - ret = pcmcia_loop_config(link, dio24_pcmcia_config_loop, &req); 376 + ret = pcmcia_loop_config(link, dio24_pcmcia_config_loop, NULL); 347 377 if (ret) { 348 378 dev_warn(&link->dev, "no configuration found\n"); 349 379 goto failed; ··· 364 396 dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); 365 397 if (link->conf.Attributes & CONF_ENABLE_IRQ) 366 398 printk(", irq %d", link->irq); 367 - if (link->io.NumPorts1) 368 - printk(", io 0x%04x-0x%04x", link->io.BasePort1, 369 - link->io.BasePort1 + link->io.NumPorts1 - 1); 370 - if (link->io.NumPorts2) 371 - printk(" & 0x%04x-0x%04x", link->io.BasePort2, 372 - link->io.BasePort2 + link->io.NumPorts2 - 1); 373 - if (link->win) 374 - printk(", mem 0x%06lx-0x%06lx", req.Base, 375 - req.Base + req.Size - 1); 399 + if (link->resource[0]) 400 + printk(" & %pR", link->resource[0]); 401 + if (link->resource[1]) 402 + printk(" & %pR", link->resource[1]); 376 403 printk("\n"); 377 404 378 405 return; ··· 436 473 .id_table = dio24_cs_ids, 437 474 .owner = THIS_MODULE, 438 475 .drv = { 439 - .name = dev_info, 476 + .name = "ni_daq_dio24", 440 477 }, 441 478 }; 442 479
+18 -55
drivers/staging/comedi/drivers/ni_labpc_cs.c
··· 71 71 #include "comedi_fc.h" 72 72 #include "ni_labpc.h" 73 73 74 - #include <pcmcia/cs_types.h> 75 74 #include <pcmcia/cs.h> 76 75 #include <pcmcia/cistpl.h> 77 76 #include <pcmcia/cisreg.h> ··· 142 143 link = pcmcia_cur_dev; /* XXX hack */ 143 144 if (!link) 144 145 return -EIO; 145 - iobase = link->io.BasePort1; 146 + iobase = link->resource[0]->start; 146 147 irq = link->irq; 147 148 break; 148 149 default: ··· 187 188 of a fully self-sufficient driver; the other drivers rely more or 188 189 less on other parts of the kernel. 189 190 */ 190 - 191 - /* 192 - The dev_info variable is the "key" that is used to match up this 193 - device driver with appropriate cards, through the card configuration 194 - database. 195 - */ 196 - 197 - static const dev_info_t dev_info = "daqcard-1200"; 198 191 199 192 struct local_info_t { 200 193 struct pcmcia_device *link; ··· 277 286 unsigned int vcc, 278 287 void *priv_data) 279 288 { 280 - win_req_t *req = priv_data; 281 - memreq_t map; 282 - 283 289 if (cfg->index == 0) 284 290 return -ENODEV; 285 291 ··· 290 302 p_dev->conf.Attributes |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; 291 303 292 304 /* IO window settings */ 293 - p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 305 + p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 294 306 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 295 307 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 296 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 297 - if (!(io->flags & CISTPL_IO_8BIT)) 298 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 299 - if (!(io->flags & CISTPL_IO_16BIT)) 300 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 301 - p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 302 - p_dev->io.BasePort1 = io->win[0].base; 303 - p_dev->io.NumPorts1 = io->win[0].len; 308 + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 309 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 310 + p_dev->resource[0]->flags |= 311 + pcmcia_io_cfg_data_width(io->flags); 312 + p_dev->resource[0]->start = io->win[0].base; 313 + p_dev->resource[0]->end = io->win[0].len; 304 314 if (io->nwin > 1) { 305 - p_dev->io.Attributes2 = p_dev->io.Attributes1; 306 - p_dev->io.BasePort2 = io->win[1].base; 307 - p_dev->io.NumPorts2 = io->win[1].len; 315 + p_dev->resource[1]->flags = p_dev->resource[0]->flags; 316 + p_dev->resource[1]->start = io->win[1].base; 317 + p_dev->resource[1]->end = io->win[1].len; 308 318 } 309 319 /* This reserves IO space but doesn't actually enable it */ 310 - if (pcmcia_request_io(p_dev, &p_dev->io) != 0) 320 + if (pcmcia_request_io(p_dev) != 0) 311 321 return -ENODEV; 312 322 } 313 323 314 - if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { 315 - cistpl_mem_t *mem = 316 - (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; 317 - req->Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM; 318 - req->Attributes |= WIN_ENABLE; 319 - req->Base = mem->win[0].host_addr; 320 - req->Size = mem->win[0].len; 321 - if (req->Size < 0x1000) 322 - req->Size = 0x1000; 323 - req->AccessSpeed = 0; 324 - if (pcmcia_request_window(p_dev, req, &p_dev->win)) 325 - return -ENODEV; 326 - map.Page = 0; 327 - map.CardOffset = mem->win[0].card_addr; 328 - if (pcmcia_map_mem_page(p_dev, p_dev->win, &map)) 329 - return -ENODEV; 330 - } 331 324 /* If we got this far, we're cool! */ 332 325 return 0; 333 326 } ··· 317 348 static void labpc_config(struct pcmcia_device *link) 318 349 { 319 350 int ret; 320 - win_req_t req; 321 351 322 352 dev_dbg(&link->dev, "labpc_config\n"); 323 353 324 - ret = pcmcia_loop_config(link, labpc_pcmcia_config_loop, &req); 354 + ret = pcmcia_loop_config(link, labpc_pcmcia_config_loop, NULL); 325 355 if (ret) { 326 356 dev_warn(&link->dev, "no configuration found\n"); 327 357 goto failed; ··· 342 374 dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); 343 375 if (link->conf.Attributes & CONF_ENABLE_IRQ) 344 376 printk(", irq %d", link->irq); 345 - if (link->io.NumPorts1) 346 - printk(", io 0x%04x-0x%04x", link->io.BasePort1, 347 - link->io.BasePort1 + link->io.NumPorts1 - 1); 348 - if (link->io.NumPorts2) 349 - printk(" & 0x%04x-0x%04x", link->io.BasePort2, 350 - link->io.BasePort2 + link->io.NumPorts2 - 1); 351 - if (link->win) 352 - printk(", mem 0x%06lx-0x%06lx", req.Base, 353 - req.Base + req.Size - 1); 377 + if (link->resource[0]) 378 + printk(" & %pR", link->resource[0]); 379 + if (link->resource[1]) 380 + printk(" & %pR", link->resource[1]); 354 381 printk("\n"); 355 382 356 383 return; ··· 412 449 .id_table = labpc_cs_ids, 413 450 .owner = THIS_MODULE, 414 451 .drv = { 415 - .name = dev_info, 452 + .name = "daqcard-1200", 416 453 }, 417 454 }; 418 455
+8 -11
drivers/staging/comedi/drivers/ni_mio_cs.c
··· 48 48 #include "ni_stc.h" 49 49 #include "8255.h" 50 50 51 - #include <pcmcia/cs_types.h> 52 51 #include <pcmcia/cs.h> 53 52 #include <pcmcia/cistpl.h> 54 53 #include <pcmcia/ds.h> ··· 260 261 static void cs_detach(struct pcmcia_device *); 261 262 262 263 static struct pcmcia_device *cur_dev = NULL; 263 - static const dev_info_t dev_info = "ni_mio_cs"; 264 264 265 265 static int cs_attach(struct pcmcia_device *link) 266 266 { 267 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 268 - link->io.NumPorts1 = 16; 267 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 268 + link->resource[0]->end = 16; 269 269 link->conf.Attributes = CONF_ENABLE_IRQ; 270 270 link->conf.IntType = INT_MEMORY_AND_IO; 271 271 ··· 309 311 { 310 312 int base, ret; 311 313 312 - p_dev->io.NumPorts1 = cfg->io.win[0].len; 313 - p_dev->io.IOAddrLines = cfg->io.flags & CISTPL_IO_LINES_MASK; 314 - p_dev->io.NumPorts2 = 0; 314 + p_dev->resource[0]->end = cfg->io.win[0].len; 315 + p_dev->io_lines = cfg->io.flags & CISTPL_IO_LINES_MASK; 315 316 316 317 for (base = 0x000; base < 0x400; base += 0x20) { 317 - p_dev->io.BasePort1 = base; 318 - ret = pcmcia_request_io(p_dev, &p_dev->io); 318 + p_dev->resource[0]->start = base; 319 + ret = pcmcia_request_io(p_dev); 319 320 if (!ret) 320 321 return 0; 321 322 } ··· 353 356 return -EIO; 354 357 355 358 dev->driver = &driver_ni_mio_cs; 356 - dev->iobase = link->io.BasePort1; 359 + dev->iobase = link->resource[0]->start; 357 360 358 361 irq = link->irq; 359 362 ··· 447 450 .id_table = ni_mio_cs_ids, 448 451 .owner = THIS_MODULE, 449 452 .drv = { 450 - .name = dev_info, 453 + .name = "ni_mio_cs", 451 454 }, 452 455 }; 453 456
+18 -31
drivers/staging/comedi/drivers/quatech_daqp_cs.c
··· 50 50 #include "../comedidev.h" 51 51 #include <linux/semaphore.h> 52 52 53 - #include <pcmcia/cs_types.h> 54 53 #include <pcmcia/cs.h> 55 54 #include <pcmcia/cistpl.h> 56 55 #include <pcmcia/cisreg.h> ··· 870 871 } 871 872 } 872 873 873 - dev->iobase = local->link->io.BasePort1; 874 + dev->iobase = local->link->resource[0]->start; 874 875 875 876 ret = alloc_subdevices(dev, 4); 876 877 if (ret < 0) ··· 994 995 static int daqp_cs_attach(struct pcmcia_device *); 995 996 static void daqp_cs_detach(struct pcmcia_device *); 996 997 997 - /* 998 - The dev_info variable is the "key" that is used to match up this 999 - device driver with appropriate cards, through the card configuration 1000 - database. 1001 - */ 1002 - 1003 - static const dev_info_t dev_info = "quatech_daqp_cs"; 1004 - 1005 998 /*====================================================================== 1006 999 1007 1000 daqp_cs_attach() creates an "instance" of the driver, allocating ··· 1092 1101 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 1093 1102 1094 1103 /* IO window settings */ 1095 - p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 1104 + p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 1096 1105 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 1097 1106 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 1098 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 1099 - if (!(io->flags & CISTPL_IO_8BIT)) 1100 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 1101 - if (!(io->flags & CISTPL_IO_16BIT)) 1102 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 1103 - p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 1104 - p_dev->io.BasePort1 = io->win[0].base; 1105 - p_dev->io.NumPorts1 = io->win[0].len; 1107 + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 1108 + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 1109 + p_dev->resource[0]->flags |= 1110 + pcmcia_io_cfg_data_width(io->flags); 1111 + p_dev->resource[0]->start = io->win[0].base; 1112 + p_dev->resource[0]->end = io->win[0].len; 1106 1113 if (io->nwin > 1) { 1107 - p_dev->io.Attributes2 = p_dev->io.Attributes1; 1108 - p_dev->io.BasePort2 = io->win[1].base; 1109 - p_dev->io.NumPorts2 = io->win[1].len; 1114 + p_dev->resource[1]->flags = p_dev->resource[0]->flags; 1115 + p_dev->resource[1]->start = io->win[1].base; 1116 + p_dev->resource[1]->end = io->win[1].len; 1110 1117 } 1111 1118 } 1112 1119 1113 1120 /* This reserves IO space but doesn't actually enable it */ 1114 - return pcmcia_request_io(p_dev, &p_dev->io); 1121 + return pcmcia_request_io(p_dev); 1115 1122 } 1116 1123 1117 1124 static void daqp_cs_config(struct pcmcia_device *link) ··· 1140 1151 /* Finally, report what we've done */ 1141 1152 dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); 1142 1153 if (link->conf.Attributes & CONF_ENABLE_IRQ) 1143 - printk(KERN_INFO ", irq %u", link->irq); 1144 - if (link->io.NumPorts1) 1145 - printk(", io 0x%04x-0x%04x", link->io.BasePort1, 1146 - link->io.BasePort1 + link->io.NumPorts1 - 1); 1147 - if (link->io.NumPorts2) 1148 - printk(" & 0x%04x-0x%04x", link->io.BasePort2, 1149 - link->io.BasePort2 + link->io.NumPorts2 - 1); 1154 + printk(", irq %u", link->irq); 1155 + if (link->resource[0]) 1156 + printk(" & %pR", link->resource[0]); 1157 + if (link->resource[1]) 1158 + printk(" & %pR", link->resource[1]); 1150 1159 printk("\n"); 1151 1160 1152 1161 return; ··· 1213 1226 .id_table = daqp_cs_id_table, 1214 1227 .owner = THIS_MODULE, 1215 1228 .drv = { 1216 - .name = dev_info, 1229 + .name = "quatech_daqp_cs", 1217 1230 }, 1218 1231 }; 1219 1232
+5 -6
drivers/staging/wlags49_h2/wl_cs.c
··· 83 83 #include <linux/if_arp.h> 84 84 #include <linux/ioport.h> 85 85 86 - #include <pcmcia/cs_types.h> 87 86 #include <pcmcia/cs.h> 88 87 #include <pcmcia/cistpl.h> 89 88 #include <pcmcia/cisreg.h> ··· 145 146 return -ENOMEM; 146 147 } 147 148 148 - link->io.NumPorts1 = HCF_NUM_IO_PORTS; 149 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 150 - link->io.IOAddrLines = 6; 149 + link->resource[0]->end = HCF_NUM_IO_PORTS; 150 + link->resource[0]->flags= IO_DATA_PATH_WIDTH_16; 151 151 link->conf.Attributes = CONF_ENABLE_IRQ; 152 152 link->conf.IntType = INT_MEMORY_AND_IO; 153 153 link->conf.ConfigIndex = 5; ··· 303 305 304 306 /* Do we need to allocate an interrupt? */ 305 307 link->conf.Attributes |= CONF_ENABLE_IRQ; 308 + link->io_lines = 6; 306 309 307 - ret = pcmcia_request_io(link, &link->io); 310 + ret = pcmcia_request_io(link); 308 311 if (ret != 0) 309 312 goto failed; 310 313 ··· 318 319 goto failed; 319 320 320 321 dev->irq = link->irq; 321 - dev->base_addr = link->io.BasePort1; 322 + dev->base_addr = link->resource[0]->start; 322 323 323 324 SET_NETDEV_DEV(dev, &link->dev); 324 325 if (register_netdev(dev) != 0) {
-1
drivers/staging/wlags49_h2/wl_internal.h
··· 69 69 ******************************************************************************/ 70 70 #include <linux/version.h> 71 71 #ifdef BUS_PCMCIA 72 - #include <pcmcia/cs_types.h> 73 72 #include <pcmcia/cs.h> 74 73 #include <pcmcia/cistpl.h> 75 74 #include <pcmcia/cisreg.h>
+10 -10
drivers/telephony/ixj_pcmcia.c
··· 8 8 #include <linux/errno.h> /* error codes */ 9 9 #include <linux/slab.h> 10 10 11 - #include <pcmcia/cs_types.h> 12 11 #include <pcmcia/cs.h> 13 12 #include <pcmcia/cistpl.h> 14 13 #include <pcmcia/ds.h> ··· 32 33 { 33 34 dev_dbg(&p_dev->dev, "ixj_attach()\n"); 34 35 /* Create new ixj device */ 35 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 36 - p_dev->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 37 - p_dev->io.IOAddrLines = 3; 36 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 37 + p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 38 38 p_dev->conf.IntType = INT_MEMORY_AND_IO; 39 39 p_dev->priv = kzalloc(sizeof(struct ixj_info_t), GFP_KERNEL); 40 40 if (!p_dev->priv) { ··· 119 121 { 120 122 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 121 123 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 122 - p_dev->io.BasePort1 = io->win[0].base; 123 - p_dev->io.NumPorts1 = io->win[0].len; 124 + p_dev->resource[0]->start = io->win[0].base; 125 + p_dev->resource[0]->end = io->win[0].len; 126 + p_dev->io_lines = 3; 124 127 if (io->nwin == 2) { 125 - p_dev->io.BasePort2 = io->win[1].base; 126 - p_dev->io.NumPorts2 = io->win[1].len; 128 + p_dev->resource[1]->start = io->win[1].base; 129 + p_dev->resource[1]->end = io->win[1].len; 127 130 } 128 - if (!pcmcia_request_io(p_dev, &p_dev->io)) 131 + if (!pcmcia_request_io(p_dev)) 129 132 return 0; 130 133 } 131 134 return -ENODEV; ··· 150 151 /* 151 152 * Register the card with the core. 152 153 */ 153 - j = ixj_pcmcia_probe(link->io.BasePort1, link->io.BasePort1 + 0x10); 154 + j = ixj_pcmcia_probe(link->resource[0]->start, 155 + link->resource[0]->start + 0x10); 154 156 155 157 info->ndev = 1; 156 158 ixj_get_serial(link, j);
+10 -14
drivers/usb/host/sl811_cs.c
··· 20 20 #include <linux/ioport.h> 21 21 #include <linux/platform_device.h> 22 22 23 - #include <pcmcia/cs_types.h> 24 23 #include <pcmcia/cs.h> 25 24 #include <pcmcia/cistpl.h> 26 25 #include <pcmcia/cisreg.h> ··· 41 42 /*====================================================================*/ 42 43 /* VARIABLES */ 43 44 /*====================================================================*/ 44 - 45 - static const char driver_name[DEV_NAME_LEN] = "sl811_cs"; 46 45 47 46 typedef struct local_info_t { 48 47 struct pcmcia_device *p_dev; ··· 162 165 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 163 166 164 167 /* IO window settings */ 165 - p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 168 + p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 166 169 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 167 170 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 171 + p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 168 172 169 - p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 170 - p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 171 - p_dev->io.BasePort1 = io->win[0].base; 172 - p_dev->io.NumPorts1 = io->win[0].len; 173 + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 174 + p_dev->resource[0]->start = io->win[0].base; 175 + p_dev->resource[0]->end = io->win[0].len; 173 176 174 - return pcmcia_request_io(p_dev, &p_dev->io); 177 + return pcmcia_request_io(p_dev); 175 178 } 176 179 pcmcia_disable_device(p_dev); 177 180 return -ENODEV; ··· 189 192 goto failed; 190 193 191 194 /* require an IRQ and two registers */ 192 - if (!link->io.NumPorts1 || link->io.NumPorts1 < 2) 195 + if (resource_size(link->resource[0]) < 2) 193 196 goto failed; 194 197 195 198 if (!link->irq) ··· 204 207 if (link->conf.Vpp) 205 208 printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); 206 209 printk(", irq %d", link->irq); 207 - printk(", io 0x%04x-0x%04x", link->io.BasePort1, 208 - link->io.BasePort1+link->io.NumPorts1-1); 210 + printk(", io %pR", link->resource[0]); 209 211 printk("\n"); 210 212 211 - if (sl811_hc_init(parent, link->io.BasePort1, link->irq) 213 + if (sl811_hc_init(parent, link->resource[0]->start, link->irq) 212 214 < 0) { 213 215 failed: 214 216 printk(KERN_WARNING "sl811_cs_config failed\n"); ··· 242 246 static struct pcmcia_driver sl811_cs_driver = { 243 247 .owner = THIS_MODULE, 244 248 .drv = { 245 - .name = (char *)driver_name, 249 + .name = "sl811_cs", 246 250 }, 247 251 .probe = sl811_cs_probe, 248 252 .remove = sl811_cs_detach,
+2
include/pcmcia/cistpl.h
··· 15 15 #ifndef _LINUX_CISTPL_H 16 16 #define _LINUX_CISTPL_H 17 17 18 + typedef unsigned char cisdata_t; 19 + 18 20 #define CISTPL_NULL 0x00 19 21 #define CISTPL_DEVICE 0x01 20 22 #define CISTPL_LONGLINK_CB 0x02
+13 -142
include/pcmcia/cs.h
··· 19 19 #include <linux/interrupt.h> 20 20 #endif 21 21 22 - /* For AccessConfigurationRegister */ 23 - typedef struct conf_reg_t { 24 - u_char Function; 25 - u_int Action; 26 - off_t Offset; 27 - u_int Value; 28 - } conf_reg_t; 29 - 30 - /* Actions */ 31 - #define CS_READ 1 32 - #define CS_WRITE 2 33 - 34 - /* for AdjustResourceInfo */ 35 - /* Action field */ 36 - #define REMOVE_MANAGED_RESOURCE 1 37 - #define ADD_MANAGED_RESOURCE 2 38 - 39 - 40 - typedef struct event_callback_args_t { 41 - struct pcmcia_device *client_handle; 42 - void *client_data; 43 - } event_callback_args_t; 44 - 45 - /* For CardValues field */ 46 - #define CV_OPTION_VALUE 0x01 47 - #define CV_STATUS_VALUE 0x02 48 - #define CV_PIN_REPLACEMENT 0x04 49 - #define CV_COPY_VALUE 0x08 50 - #define CV_EXT_STATUS 0x10 51 - 52 - /* For GetFirst/NextClient */ 53 - typedef struct client_req_t { 54 - socket_t Socket; 55 - u_int Attributes; 56 - } client_req_t; 57 - 58 - #define CLIENT_THIS_SOCKET 0x01 59 - 60 22 /* ModifyConfiguration */ 61 23 typedef struct modconf_t { 62 24 u_int Attributes; ··· 56 94 #define INT_CARDBUS 0x04 57 95 #define INT_ZOOMED_VIDEO 0x08 58 96 59 - /* For RequestIO and ReleaseIO */ 60 - typedef struct io_req_t { 61 - u_int BasePort1; 62 - u_int NumPorts1; 63 - u_int Attributes1; 64 - u_int BasePort2; 65 - u_int NumPorts2; 66 - u_int Attributes2; 67 - u_int IOAddrLines; 68 - } io_req_t; 69 - 70 - /* Attributes for RequestIO and ReleaseIO */ 71 - #define IO_SHARED 0x01 72 - #define IO_FIRST_SHARED 0x02 73 - #define IO_FORCE_ALIAS_ACCESS 0x04 74 - #define IO_DATA_PATH_WIDTH 0x18 75 - #define IO_DATA_PATH_WIDTH_8 0x00 76 - #define IO_DATA_PATH_WIDTH_16 0x08 77 - #define IO_DATA_PATH_WIDTH_AUTO 0x10 78 - 79 - /* Bits in IRQInfo1 field */ 80 - #define IRQ_NMI_ID 0x01 81 - #define IRQ_IOCK_ID 0x02 82 - #define IRQ_BERR_ID 0x04 83 - #define IRQ_VEND_ID 0x08 84 - #define IRQ_INFO2_VALID 0x10 85 - #define IRQ_LEVEL_ID 0x20 86 - #define IRQ_PULSE_ID 0x40 87 - #define IRQ_SHARE_ID 0x80 88 - 89 - typedef struct eventmask_t { 90 - u_int Attributes; 91 - u_int EventMask; 92 - } eventmask_t; 93 - 94 - #define CONF_EVENT_MASK_VALID 0x01 95 - 96 97 /* Configuration registers present */ 97 98 #define PRESENT_OPTION 0x001 98 99 #define PRESENT_STATUS 0x002 ··· 68 143 #define PRESENT_IOBASE_3 0x100 69 144 #define PRESENT_IOSIZE 0x200 70 145 71 - /* For GetMemPage, MapMemPage */ 72 - typedef struct memreq_t { 73 - u_int CardOffset; 74 - page_t Page; 75 - } memreq_t; 76 - 77 - /* For ModifyWindow */ 78 - typedef struct modwin_t { 79 - u_int Attributes; 80 - u_int AccessSpeed; 81 - } modwin_t; 82 - 83 146 /* For RequestWindow */ 84 147 typedef struct win_req_t { 85 148 u_int Attributes; ··· 77 164 } win_req_t; 78 165 79 166 /* Attributes for RequestWindow */ 80 - #define WIN_ADDR_SPACE 0x0001 81 - #define WIN_ADDR_SPACE_MEM 0x0000 82 - #define WIN_ADDR_SPACE_IO 0x0001 83 - #define WIN_MEMORY_TYPE 0x0002 84 - #define WIN_MEMORY_TYPE_CM 0x0000 85 - #define WIN_MEMORY_TYPE_AM 0x0002 86 - #define WIN_ENABLE 0x0004 87 - #define WIN_DATA_WIDTH 0x0018 88 - #define WIN_DATA_WIDTH_8 0x0000 89 - #define WIN_DATA_WIDTH_16 0x0008 90 - #define WIN_DATA_WIDTH_32 0x0010 91 - #define WIN_PAGED 0x0020 92 - #define WIN_SHARED 0x0040 93 - #define WIN_FIRST_SHARED 0x0080 94 - #define WIN_USE_WAIT 0x0100 95 - #define WIN_STRICT_ALIGN 0x0200 96 - #define WIN_MAP_BELOW_1MB 0x0400 97 - #define WIN_PREFETCH 0x0800 98 - #define WIN_CACHEABLE 0x1000 99 - #define WIN_BAR_MASK 0xe000 100 - #define WIN_BAR_SHIFT 13 167 + #define WIN_MEMORY_TYPE_CM 0x00 /* default */ 168 + #define WIN_MEMORY_TYPE_AM 0x20 /* MAP_ATTRIB */ 169 + #define WIN_DATA_WIDTH_8 0x00 /* default */ 170 + #define WIN_DATA_WIDTH_16 0x02 /* MAP_16BIT */ 171 + #define WIN_ENABLE 0x01 /* MAP_ACTIVE */ 172 + #define WIN_USE_WAIT 0x40 /* MAP_USE_WAIT */ 101 173 102 - typedef struct error_info_t { 103 - int func; 104 - int retcode; 105 - } error_info_t; 106 - 107 - /* Flag to bind to all functions */ 108 - #define BIND_FN_ALL 0xff 109 - 110 - /* Events */ 111 - #define CS_EVENT_PRI_LOW 0 112 - #define CS_EVENT_PRI_HIGH 1 113 - 114 - #define CS_EVENT_WRITE_PROTECT 0x000001 115 - #define CS_EVENT_CARD_LOCK 0x000002 116 - #define CS_EVENT_CARD_INSERTION 0x000004 117 - #define CS_EVENT_CARD_REMOVAL 0x000008 118 - #define CS_EVENT_BATTERY_DEAD 0x000010 119 - #define CS_EVENT_BATTERY_LOW 0x000020 120 - #define CS_EVENT_READY_CHANGE 0x000040 121 - #define CS_EVENT_CARD_DETECT 0x000080 122 - #define CS_EVENT_RESET_REQUEST 0x000100 123 - #define CS_EVENT_RESET_PHYSICAL 0x000200 124 - #define CS_EVENT_CARD_RESET 0x000400 125 - #define CS_EVENT_REGISTRATION_COMPLETE 0x000800 126 - #define CS_EVENT_PM_SUSPEND 0x002000 127 - #define CS_EVENT_PM_RESUME 0x004000 128 - #define CS_EVENT_INSERTION_REQUEST 0x008000 129 - #define CS_EVENT_EJECTION_REQUEST 0x010000 130 - #define CS_EVENT_MTD_REQUEST 0x020000 131 - #define CS_EVENT_ERASE_COMPLETE 0x040000 132 - #define CS_EVENT_REQUEST_ATTENTION 0x080000 133 - #define CS_EVENT_CB_DETECT 0x100000 134 - #define CS_EVENT_3VCARD 0x200000 135 - #define CS_EVENT_XVCARD 0x400000 174 + #define WIN_FLAGS_MAP 0x63 /* MAP_ATTRIB | MAP_16BIT | MAP_ACTIVE | 175 + MAP_USE_WAIT */ 176 + #define WIN_FLAGS_REQ 0x1c /* mapping to socket->win[i]: 177 + 0x04 -> 0 178 + 0x08 -> 1 179 + 0x0c -> 2 180 + 0x10 -> 3 */ 136 181 137 182 #endif /* _LINUX_CS_H */
-40
include/pcmcia/cs_types.h
··· 1 - /* 2 - * cs_types.h 3 - * 4 - * This program is free software; you can redistribute it and/or modify 5 - * it under the terms of the GNU General Public License version 2 as 6 - * published by the Free Software Foundation. 7 - * 8 - * The initial developer of the original code is David A. Hinds 9 - * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds 10 - * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 11 - * 12 - * (C) 1999 David A. Hinds 13 - */ 14 - 15 - #ifndef _LINUX_CS_TYPES_H 16 - #define _LINUX_CS_TYPES_H 17 - 18 - #ifdef __KERNEL__ 19 - #include <linux/types.h> 20 - #else 21 - #include <sys/types.h> 22 - #endif 23 - 24 - typedef u_short socket_t; 25 - typedef u_int event_t; 26 - typedef u_char cisdata_t; 27 - typedef u_short page_t; 28 - 29 - typedef unsigned long window_handle_t; 30 - 31 - struct region_t; 32 - typedef struct region_t *memory_handle_t; 33 - 34 - #ifndef DEV_NAME_LEN 35 - #define DEV_NAME_LEN 32 36 - #endif 37 - 38 - typedef char dev_info_t[DEV_NAME_LEN]; 39 - 40 - #endif /* _LINUX_CS_TYPES_H */
+37 -216
include/pcmcia/ds.h
··· 20 20 #include <linux/mod_devicetable.h> 21 21 #endif 22 22 23 - #include <pcmcia/cs_types.h> 24 23 #include <pcmcia/device_id.h> 25 24 26 25 #ifdef __KERNEL__ ··· 35 36 struct pcmcia_device; 36 37 struct config_t; 37 38 struct net_device; 39 + 40 + typedef struct resource *window_handle_t; 38 41 39 42 /* dynamic device IDs for PCMCIA device drivers. See 40 43 * Documentation/pcmcia/driver.txt for details. ··· 63 62 int pcmcia_register_driver(struct pcmcia_driver *driver); 64 63 void pcmcia_unregister_driver(struct pcmcia_driver *driver); 65 64 65 + /* for struct resource * array embedded in struct pcmcia_device */ 66 + enum { 67 + PCMCIA_IOPORT_0, 68 + PCMCIA_IOPORT_1, 69 + PCMCIA_IOMEM_0, 70 + PCMCIA_IOMEM_1, 71 + PCMCIA_IOMEM_2, 72 + PCMCIA_IOMEM_3, 73 + PCMCIA_NUM_RESOURCES, 74 + }; 75 + 66 76 struct pcmcia_device { 67 77 /* the socket and the device_no [for multifunction devices] 68 78 uniquely define a pcmcia_device */ ··· 91 79 struct list_head socket_device_list; 92 80 93 81 /* deprecated, will be cleaned up soon */ 94 - u_int open; 95 - io_req_t io; 96 82 config_req_t conf; 97 83 window_handle_t win; 98 84 99 85 /* device setup */ 100 86 unsigned int irq; 87 + struct resource *resource[PCMCIA_NUM_RESOURCES]; 88 + 89 + unsigned int io_lines; /* number of I/O lines */ 101 90 102 91 /* Is the device suspended? */ 103 92 u16 suspended:1; ··· 130 117 u64 dma_mask; 131 118 struct device dev; 132 119 133 - #ifdef CONFIG_PCMCIA_IOCTL 134 - /* device driver wanted by cardmgr */ 135 - struct pcmcia_driver *cardmgr; 136 - #endif 137 - 138 120 /* data private to drivers */ 139 121 void *priv; 122 + unsigned int open; 140 123 }; 141 124 142 125 #define to_pcmcia_dev(n) container_of(n, struct pcmcia_device, dev) ··· 187 178 int pcmcia_reset_card(struct pcmcia_socket *skt); 188 179 189 180 /* CIS config */ 190 - int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, 191 - conf_reg_t *reg); 181 + int pcmcia_read_config_byte(struct pcmcia_device *p_dev, off_t where, u8 *val); 182 + int pcmcia_write_config_byte(struct pcmcia_device *p_dev, off_t where, u8 val); 192 183 193 184 /* device configuration */ 194 - int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req); 185 + int pcmcia_request_io(struct pcmcia_device *p_dev); 195 186 196 187 int __must_check 197 188 __pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev, ··· 213 204 window_handle_t *wh); 214 205 int pcmcia_release_window(struct pcmcia_device *p_dev, window_handle_t win); 215 206 int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t win, 216 - memreq_t *req); 207 + unsigned int offset); 217 208 218 209 int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); 219 210 void pcmcia_disable_device(struct pcmcia_device *p_dev); 220 211 212 + /* IO ports */ 213 + #define IO_DATA_PATH_WIDTH 0x18 214 + #define IO_DATA_PATH_WIDTH_8 0x00 215 + #define IO_DATA_PATH_WIDTH_16 0x08 216 + #define IO_DATA_PATH_WIDTH_AUTO 0x10 217 + 218 + /* convert flag found in cfgtable to data path width parameter */ 219 + static inline int pcmcia_io_cfg_data_width(unsigned int flags) 220 + { 221 + if (!(flags & CISTPL_IO_8BIT)) 222 + return IO_DATA_PATH_WIDTH_16; 223 + if (!(flags & CISTPL_IO_16BIT)) 224 + return IO_DATA_PATH_WIDTH_8; 225 + return IO_DATA_PATH_WIDTH_AUTO; 226 + } 227 + 221 228 #endif /* __KERNEL__ */ 222 - 223 - 224 - 225 - /* Below, there are only definitions which are used by 226 - * - the PCMCIA ioctl 227 - * - deprecated PCMCIA userspace tools only 228 - * 229 - * here be dragons ... here be dragons ... here be dragons ... here be drag 230 - */ 231 - 232 - #if defined(CONFIG_PCMCIA_IOCTL) || !defined(__KERNEL__) 233 - 234 - #if defined(__arm__) || defined(__mips__) || defined(__avr32__) || \ 235 - defined(__bfin__) 236 - /* This (ioaddr_t) is exposed to userspace & hence cannot be changed. */ 237 - typedef u_int ioaddr_t; 238 - #else 239 - typedef u_short ioaddr_t; 240 - #endif 241 - 242 - /* for AdjustResourceInfo */ 243 - typedef struct adjust_t { 244 - u_int Action; 245 - u_int Resource; 246 - u_int Attributes; 247 - union { 248 - struct memory { 249 - u_long Base; 250 - u_long Size; 251 - } memory; 252 - struct io { 253 - ioaddr_t BasePort; 254 - ioaddr_t NumPorts; 255 - u_int IOAddrLines; 256 - } io; 257 - struct irq { 258 - u_int IRQ; 259 - } irq; 260 - } resource; 261 - } adjust_t; 262 - 263 - /* Action field */ 264 - #define REMOVE_MANAGED_RESOURCE 1 265 - #define ADD_MANAGED_RESOURCE 2 266 - #define GET_FIRST_MANAGED_RESOURCE 3 267 - #define GET_NEXT_MANAGED_RESOURCE 4 268 - /* Resource field */ 269 - #define RES_MEMORY_RANGE 1 270 - #define RES_IO_RANGE 2 271 - #define RES_IRQ 3 272 - /* Attribute field */ 273 - #define RES_IRQ_TYPE 0x03 274 - #define RES_IRQ_TYPE_EXCLUSIVE 0 275 - #define RES_IRQ_TYPE_TIME 1 276 - #define RES_IRQ_TYPE_DYNAMIC 2 277 - #define RES_IRQ_CSC 0x04 278 - #define RES_SHARED 0x08 279 - #define RES_RESERVED 0x10 280 - #define RES_ALLOCATED 0x20 281 - #define RES_REMOVED 0x40 282 - 283 - 284 - typedef struct tuple_parse_t { 285 - tuple_t tuple; 286 - cisdata_t data[255]; 287 - cisparse_t parse; 288 - } tuple_parse_t; 289 - 290 - typedef struct win_info_t { 291 - window_handle_t handle; 292 - win_req_t window; 293 - memreq_t map; 294 - } win_info_t; 295 - 296 - typedef struct bind_info_t { 297 - dev_info_t dev_info; 298 - u_char function; 299 - struct pcmcia_device *instance; 300 - char name[DEV_NAME_LEN]; 301 - u_short major, minor; 302 - void *next; 303 - } bind_info_t; 304 - 305 - typedef struct mtd_info_t { 306 - dev_info_t dev_info; 307 - u_int Attributes; 308 - u_int CardOffset; 309 - } mtd_info_t; 310 - 311 - typedef struct region_info_t { 312 - u_int Attributes; 313 - u_int CardOffset; 314 - u_int RegionSize; 315 - u_int AccessSpeed; 316 - u_int BlockSize; 317 - u_int PartMultiple; 318 - u_char JedecMfr, JedecInfo; 319 - memory_handle_t next; 320 - } region_info_t; 321 - 322 - #define REGION_TYPE 0x0001 323 - #define REGION_TYPE_CM 0x0000 324 - #define REGION_TYPE_AM 0x0001 325 - #define REGION_PREFETCH 0x0008 326 - #define REGION_CACHEABLE 0x0010 327 - #define REGION_BAR_MASK 0xe000 328 - #define REGION_BAR_SHIFT 13 329 - 330 - /* For ReplaceCIS */ 331 - typedef struct cisdump_t { 332 - u_int Length; 333 - cisdata_t Data[CISTPL_MAX_CIS_SIZE]; 334 - } cisdump_t; 335 - 336 - /* for GetConfigurationInfo */ 337 - typedef struct config_info_t { 338 - u_char Function; 339 - u_int Attributes; 340 - u_int Vcc, Vpp1, Vpp2; 341 - u_int IntType; 342 - u_int ConfigBase; 343 - u_char Status, Pin, Copy, Option, ExtStatus; 344 - u_int Present; 345 - u_int CardValues; 346 - u_int AssignedIRQ; 347 - u_int IRQAttributes; 348 - ioaddr_t BasePort1; 349 - ioaddr_t NumPorts1; 350 - u_int Attributes1; 351 - ioaddr_t BasePort2; 352 - ioaddr_t NumPorts2; 353 - u_int Attributes2; 354 - u_int IOAddrLines; 355 - } config_info_t; 356 - 357 - /* For ValidateCIS */ 358 - typedef struct cisinfo_t { 359 - u_int Chains; 360 - } cisinfo_t; 361 - 362 - typedef struct cs_status_t { 363 - u_char Function; 364 - event_t CardState; 365 - event_t SocketState; 366 - } cs_status_t; 367 - 368 - typedef union ds_ioctl_arg_t { 369 - adjust_t adjust; 370 - config_info_t config; 371 - tuple_t tuple; 372 - tuple_parse_t tuple_parse; 373 - client_req_t client_req; 374 - cs_status_t status; 375 - conf_reg_t conf_reg; 376 - cisinfo_t cisinfo; 377 - region_info_t region; 378 - bind_info_t bind_info; 379 - mtd_info_t mtd_info; 380 - win_info_t win_info; 381 - cisdump_t cisdump; 382 - } ds_ioctl_arg_t; 383 - 384 - #define DS_ADJUST_RESOURCE_INFO _IOWR('d', 2, adjust_t) 385 - #define DS_GET_CONFIGURATION_INFO _IOWR('d', 3, config_info_t) 386 - #define DS_GET_FIRST_TUPLE _IOWR('d', 4, tuple_t) 387 - #define DS_GET_NEXT_TUPLE _IOWR('d', 5, tuple_t) 388 - #define DS_GET_TUPLE_DATA _IOWR('d', 6, tuple_parse_t) 389 - #define DS_PARSE_TUPLE _IOWR('d', 7, tuple_parse_t) 390 - #define DS_RESET_CARD _IO ('d', 8) 391 - #define DS_GET_STATUS _IOWR('d', 9, cs_status_t) 392 - #define DS_ACCESS_CONFIGURATION_REGISTER _IOWR('d', 10, conf_reg_t) 393 - #define DS_VALIDATE_CIS _IOR ('d', 11, cisinfo_t) 394 - #define DS_SUSPEND_CARD _IO ('d', 12) 395 - #define DS_RESUME_CARD _IO ('d', 13) 396 - #define DS_EJECT_CARD _IO ('d', 14) 397 - #define DS_INSERT_CARD _IO ('d', 15) 398 - #define DS_GET_FIRST_REGION _IOWR('d', 16, region_info_t) 399 - #define DS_GET_NEXT_REGION _IOWR('d', 17, region_info_t) 400 - #define DS_REPLACE_CIS _IOWR('d', 18, cisdump_t) 401 - #define DS_GET_FIRST_WINDOW _IOR ('d', 19, win_info_t) 402 - #define DS_GET_NEXT_WINDOW _IOWR('d', 20, win_info_t) 403 - #define DS_GET_MEM_PAGE _IOWR('d', 21, win_info_t) 404 - 405 - #define DS_BIND_REQUEST _IOWR('d', 60, bind_info_t) 406 - #define DS_GET_DEVICE_INFO _IOWR('d', 61, bind_info_t) 407 - #define DS_GET_NEXT_DEVICE _IOWR('d', 62, bind_info_t) 408 - #define DS_UNBIND_REQUEST _IOW ('d', 63, bind_info_t) 409 - #define DS_BIND_MTD _IOWR('d', 64, mtd_info_t) 410 - 411 - 412 - /* used in userspace only */ 413 - #define CS_IN_USE 0x1e 414 - 415 - #define INFO_MASTER_CLIENT 0x01 416 - #define INFO_IO_CLIENT 0x02 417 - #define INFO_MTD_CLIENT 0x04 418 - #define INFO_MEM_CLIENT 0x08 419 - #define MAX_NUM_CLIENTS 3 420 - 421 - #define INFO_CARD_SHARE 0x10 422 - #define INFO_CARD_EXCL 0x20 423 - 424 - 425 - #endif /* !defined(__KERNEL__) || defined(CONFIG_PCMCIA_IOCTL) */ 426 229 427 230 #endif /* _LINUX_DS_H */
+3 -22
include/pcmcia/ss.h
··· 19 19 #include <linux/sched.h> /* task_struct, completion */ 20 20 #include <linux/mutex.h> 21 21 22 - #include <pcmcia/cs_types.h> 23 22 #include <pcmcia/cs.h> 24 23 #ifdef CONFIG_CARDBUS 25 24 #include <linux/pci.h> ··· 161 162 u_int pci_irq; 162 163 struct pci_dev *cb_dev; 163 164 164 - 165 165 /* socket setup is done so resources should be able to be allocated. 166 166 * Only if set to 1, calls to find_{io,mem}_region are handled, and 167 167 * insertio events are actually managed by the PCMCIA layer.*/ 168 - u8 resource_setup_done:1; 169 - 170 - /* It's old if resource setup is done using adjust_resource_info() */ 171 - u8 resource_setup_old:1; 172 - u8 resource_setup_new:1; 173 - 174 - u8 reserved:5; 168 + u8 resource_setup_done; 175 169 176 170 /* socket operations */ 177 171 struct pccard_operations *ops; ··· 210 218 * incorrectness and change */ 211 219 u8 device_count; 212 220 213 - /* 16-bit state: */ 214 - struct { 215 - /* "master" ioctl is used */ 216 - u8 busy:1; 217 - /* the PCMCIA card consists of two pseudo devices */ 218 - u8 has_pfc:1; 219 - 220 - u8 reserved:6; 221 - } pcmcia_state; 221 + /* does the PCMCIA card consist of two pseudo devices? */ 222 + u8 pcmcia_pfc; 222 223 223 224 /* non-zero if PCMCIA card is present */ 224 225 atomic_t present; ··· 219 234 /* IRQ to be used by PCMCIA devices. May not be IRQ 0. */ 220 235 unsigned int pcmcia_irq; 221 236 222 - #ifdef CONFIG_PCMCIA_IOCTL 223 - struct user_info_t *user; 224 - wait_queue_head_t queue; 225 - #endif /* CONFIG_PCMCIA_IOCTL */ 226 237 #endif /* CONFIG_PCMCIA */ 227 238 228 239 /* socket device */
+5 -4
sound/pcmcia/pdaudiocf/pdaudiocf.c
··· 139 139 pdacf->p_dev = link; 140 140 link->priv = pdacf; 141 141 142 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 143 - link->io.NumPorts1 = 16; 142 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 143 + link->resource[0]->end = 16; 144 144 145 145 link->conf.Attributes = CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; 146 146 link->conf.IntType = INT_MEMORY_AND_IO; ··· 219 219 snd_printdd(KERN_DEBUG "pdacf_config called\n"); 220 220 link->conf.ConfigIndex = 0x5; 221 221 222 - ret = pcmcia_request_io(link, &link->io); 222 + ret = pcmcia_request_io(link); 223 223 if (ret) 224 224 goto failed; 225 225 ··· 231 231 if (ret) 232 232 goto failed; 233 233 234 - if (snd_pdacf_assign_resources(pdacf, link->io.BasePort1, link->irq) < 0) 234 + if (snd_pdacf_assign_resources(pdacf, link->resource[0]->start, 235 + link->irq) < 0) 235 236 goto failed; 236 237 237 238 return 0;
-1
sound/pcmcia/pdaudiocf/pdaudiocf.h
··· 24 24 #include <sound/pcm.h> 25 25 #include <asm/io.h> 26 26 #include <linux/interrupt.h> 27 - #include <pcmcia/cs_types.h> 28 27 #include <pcmcia/cs.h> 29 28 #include <pcmcia/cistpl.h> 30 29 #include <pcmcia/ds.h>
+5 -4
sound/pcmcia/vx/vxpocket.c
··· 159 159 vxp->p_dev = link; 160 160 link->priv = chip; 161 161 162 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 163 - link->io.NumPorts1 = 16; 162 + link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 163 + link->resource[0]->end = 16; 164 164 165 165 link->conf.Attributes = CONF_ENABLE_IRQ; 166 166 link->conf.IntType = INT_MEMORY_AND_IO; ··· 226 226 strcpy(chip->card->driver, vxp440_hw.name); 227 227 } 228 228 229 - ret = pcmcia_request_io(link, &link->io); 229 + ret = pcmcia_request_io(link); 230 230 if (ret) 231 231 goto failed; 232 232 ··· 241 241 chip->dev = &link->dev; 242 242 snd_card_set_dev(chip->card, chip->dev); 243 243 244 - if (snd_vxpocket_assign_resources(chip, link->io.BasePort1, link->irq) < 0) 244 + if (snd_vxpocket_assign_resources(chip, link->resource[0]->start, 245 + link->irq) < 0) 245 246 goto failed; 246 247 247 248 return 0;
-1
sound/pcmcia/vx/vxpocket.h
··· 23 23 24 24 #include <sound/vx_core.h> 25 25 26 - #include <pcmcia/cs_types.h> 27 26 #include <pcmcia/cs.h> 28 27 #include <pcmcia/cistpl.h> 29 28 #include <pcmcia/ds.h>