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

pcmcia: do not use win_req_t when calling pcmcia_request_window()

Instead of win_req_t, drivers are now requested to fill out
struct pcmcia_device *p_dev->resource[2,3,4,5] for up to four iomem
ranges. After a call to pcmcia_request_window(), the windows found there
are reserved and may be used until pcmcia_release_window() is called.

CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-mtd@lists.infradead.org
CC: Jiri Kosina <jkosina@suse.cz>
CC: linux-scsi@vger.kernel.org
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>

+241 -277
+7
Documentation/pcmcia/driver-changes.txt
··· 1 1 This file details changes in 2.6 which affect PCMCIA card driver authors: 2 + * pcmcia_request_window changes (as of 2.6.36) 3 + Instead of win_req_t, drivers are now requested to fill out 4 + struct pcmcia_device *p_dev->resource[2,3,4,5] for up to four ioport 5 + ranges. After a call to pcmcia_request_window(), the regions found there 6 + are reserved and may be used immediately -- until pcmcia_release_window() 7 + is called. 8 + 2 9 * pcmcia_request_io changes (as of 2.6.36) 3 10 Instead of io_req_t, drivers are now requested to fill out 4 11 struct pcmcia_device *p_dev->resource[0,1] for up to two ioport
+37 -50
drivers/char/pcmcia/ipwireless/main.c
··· 105 105 if (cfg->mem.nwin == 0) 106 106 return 0; 107 107 108 - ipw->request_common_memory.Attributes = 108 + p_dev->resource[2]->flags |= 109 109 WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE; 110 - ipw->request_common_memory.Base = cfg->mem.win[0].host_addr; 111 - ipw->request_common_memory.Size = cfg->mem.win[0].len; 112 - if (ipw->request_common_memory.Size < 0x1000) 113 - ipw->request_common_memory.Size = 0x1000; 114 - ipw->request_common_memory.AccessSpeed = 0; 110 + p_dev->resource[2]->start = cfg->mem.win[0].host_addr; 111 + p_dev->resource[2]->end = cfg->mem.win[0].len; 112 + if (p_dev->resource[2]->end < 0x1000) 113 + p_dev->resource[2]->end = 0x1000; 115 114 116 - ret = pcmcia_request_window(p_dev, &ipw->request_common_memory, 117 - &ipw->handle_common_memory); 118 - 115 + ret = pcmcia_request_window(p_dev, p_dev->resource[2], 0); 119 116 if (ret != 0) 120 117 goto exit1; 121 118 122 - ret = pcmcia_map_mem_page(p_dev, ipw->handle_common_memory, 119 + ret = pcmcia_map_mem_page(p_dev, p_dev->resource[2], 123 120 cfg->mem.win[0].card_addr); 124 - 125 121 if (ret != 0) 126 122 goto exit2; 127 123 128 124 ipw->is_v2_card = cfg->mem.win[0].len == 0x100; 129 125 130 - ipw->common_memory = ioremap(ipw->request_common_memory.Base, 131 - ipw->request_common_memory.Size); 132 - request_mem_region(ipw->request_common_memory.Base, 133 - ipw->request_common_memory.Size, 126 + ipw->attr_memory = ioremap(p_dev->resource[2]->start, 127 + resource_size(p_dev->resource[2])); 128 + request_mem_region(p_dev->resource[2]->start, 129 + resource_size(p_dev->resource[2]), 134 130 IPWIRELESS_PCCARD_NAME); 135 131 136 - ipw->request_attr_memory.Attributes = 137 - WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM | WIN_ENABLE; 138 - ipw->request_attr_memory.Base = 0; 139 - ipw->request_attr_memory.Size = 0; /* this used to be 0x1000 */ 140 - ipw->request_attr_memory.AccessSpeed = 0; 141 - 142 - ret = pcmcia_request_window(p_dev, &ipw->request_attr_memory, 143 - &ipw->handle_attr_memory); 144 - 132 + p_dev->resource[3]->flags |= WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM | 133 + WIN_ENABLE; 134 + p_dev->resource[3]->end = 0; /* this used to be 0x1000 */ 135 + ret = pcmcia_request_window(p_dev, p_dev->resource[3], 0); 145 136 if (ret != 0) 146 137 goto exit2; 147 138 148 - ret = pcmcia_map_mem_page(p_dev, ipw->handle_attr_memory, 0); 139 + ret = pcmcia_map_mem_page(p_dev, p_dev->resource[3], 0); 149 140 if (ret != 0) 150 141 goto exit3; 151 142 152 - ipw->attr_memory = ioremap(ipw->request_attr_memory.Base, 153 - ipw->request_attr_memory.Size); 154 - request_mem_region(ipw->request_attr_memory.Base, 155 - ipw->request_attr_memory.Size, IPWIRELESS_PCCARD_NAME); 143 + ipw->attr_memory = ioremap(p_dev->resource[3]->start, 144 + resource_size(p_dev->resource[3])); 145 + request_mem_region(p_dev->resource[3]->start, 146 + resource_size(p_dev->resource[3]), 147 + IPWIRELESS_PCCARD_NAME); 156 148 157 149 return 0; 158 150 159 151 exit3: 160 152 exit2: 161 153 if (ipw->common_memory) { 162 - release_mem_region(ipw->request_common_memory.Base, 163 - ipw->request_common_memory.Size); 154 + release_mem_region(p_dev->resource[2]->start, 155 + resource_size(p_dev->resource[2])); 164 156 iounmap(ipw->common_memory); 165 157 } 166 158 exit1: ··· 193 201 (unsigned int) link->irq); 194 202 if (ipw->attr_memory && ipw->common_memory) 195 203 printk(KERN_INFO IPWIRELESS_PCCARD_NAME 196 - ": attr memory 0x%08lx-0x%08lx, common memory 0x%08lx-0x%08lx\n", 197 - ipw->request_attr_memory.Base, 198 - ipw->request_attr_memory.Base 199 - + ipw->request_attr_memory.Size - 1, 200 - ipw->request_common_memory.Base, 201 - ipw->request_common_memory.Base 202 - + ipw->request_common_memory.Size - 1); 204 + ": attr memory %pR, common memory %pR\n", 205 + link->resource[3], 206 + link->resource[2]); 203 207 204 208 ipw->network = ipwireless_network_create(ipw->hardware); 205 209 if (!ipw->network) ··· 219 231 return 0; 220 232 221 233 exit: 222 - if (ipw->attr_memory) { 223 - release_mem_region(ipw->request_attr_memory.Base, 224 - ipw->request_attr_memory.Size); 225 - iounmap(ipw->attr_memory); 226 - 227 - } 228 234 if (ipw->common_memory) { 229 - release_mem_region(ipw->request_common_memory.Base, 230 - ipw->request_common_memory.Size); 235 + release_mem_region(link->resource[2]->start, 236 + resource_size(link->resource[2])); 231 237 iounmap(ipw->common_memory); 238 + } 239 + if (ipw->attr_memory) { 240 + release_mem_region(link->resource[3]->start, 241 + resource_size(link->resource[3])); 242 + iounmap(ipw->attr_memory); 232 243 } 233 244 pcmcia_disable_device(link); 234 245 return -1; ··· 236 249 static void release_ipwireless(struct ipw_dev *ipw) 237 250 { 238 251 if (ipw->common_memory) { 239 - release_mem_region(ipw->request_common_memory.Base, 240 - ipw->request_common_memory.Size); 252 + release_mem_region(ipw->link->resource[2]->start, 253 + resource_size(ipw->link->resource[2])); 241 254 iounmap(ipw->common_memory); 242 255 } 243 256 if (ipw->attr_memory) { 244 - release_mem_region(ipw->request_attr_memory.Base, 245 - ipw->request_attr_memory.Size); 257 + release_mem_region(ipw->link->resource[3]->start, 258 + resource_size(ipw->link->resource[3])); 246 259 iounmap(ipw->attr_memory); 247 260 } 248 261 pcmcia_disable_device(ipw->link);
-4
drivers/char/pcmcia/ipwireless/main.h
··· 45 45 struct pcmcia_device *link; 46 46 int is_v2_card; 47 47 48 - window_handle_t handle_attr_memory; 49 48 void __iomem *attr_memory; 50 - win_req_t request_attr_memory; 51 49 52 - window_handle_t handle_common_memory; 53 50 void __iomem *common_memory; 54 - win_req_t request_common_memory; 55 51 56 52 /* Reference to attribute memory, containing CIS data */ 57 53 void *attribute_memory;
+29 -24
drivers/mtd/maps/pcmciamtd.c
··· 101 101 static caddr_t remap_window(struct map_info *map, unsigned long to) 102 102 { 103 103 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; 104 - window_handle_t win = (window_handle_t)map->map_priv_2; 104 + struct resource *win = (struct resource *) map->map_priv_2; 105 105 unsigned int offset; 106 106 int ret; 107 107 ··· 339 339 340 340 DEBUG(3, "link = 0x%p", link); 341 341 342 - if (link->win) { 342 + if (link->resource[2]->end) { 343 343 if(dev->win_base) { 344 344 iounmap(dev->win_base); 345 345 dev->win_base = NULL; ··· 491 491 { 492 492 struct pcmciamtd_dev *dev = link->priv; 493 493 struct mtd_info *mtd = NULL; 494 - win_req_t req; 495 494 int ret; 496 - int i; 495 + int i, j = 0; 497 496 static char *probes[] = { "jedec_probe", "cfi_probe" }; 498 497 int new_name = 0; 499 498 ··· 519 520 * smaller windows until we succeed 520 521 */ 521 522 522 - req.Attributes = WIN_MEMORY_TYPE_CM | WIN_ENABLE; 523 - req.Attributes |= (dev->pcmcia_map.bankwidth == 1) ? WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16; 524 - req.Base = 0; 525 - req.AccessSpeed = mem_speed; 526 - link->win = (window_handle_t)link; 527 - req.Size = (force_size) ? force_size << 20 : MAX_PCMCIA_ADDR; 523 + link->resource[2]->flags |= WIN_MEMORY_TYPE_CM | WIN_ENABLE; 524 + link->resource[2]->flags |= (dev->pcmcia_map.bankwidth == 1) ? 525 + WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16; 526 + link->resource[2]->start = 0; 527 + link->resource[2]->end = (force_size) ? force_size << 20 : 528 + MAX_PCMCIA_ADDR; 528 529 dev->win_size = 0; 529 530 530 531 do { 531 532 int ret; 532 - DEBUG(2, "requesting window with size = %dKiB memspeed = %d", 533 - req.Size >> 10, req.AccessSpeed); 534 - ret = pcmcia_request_window(link, &req, &link->win); 533 + DEBUG(2, "requesting window with size = %luKiB memspeed = %d", 534 + (unsigned long) resource_size(link->resource[2]) >> 10, 535 + mem_speed); 536 + ret = pcmcia_request_window(link, link->resource[2], mem_speed); 535 537 DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size); 536 538 if(ret) { 537 - req.Size >>= 1; 539 + j++; 540 + link->resource[2]->start = 0; 541 + link->resource[2]->end = (force_size) ? 542 + force_size << 20 : MAX_PCMCIA_ADDR; 543 + link->resource[2]->end >>= j; 538 544 } else { 539 - DEBUG(2, "Got window of size %dKiB", req.Size >> 10); 540 - dev->win_size = req.Size; 545 + DEBUG(2, "Got window of size %luKiB", (unsigned long) 546 + resource_size(link->resource[2]) >> 10); 547 + dev->win_size = resource_size(link->resource[2]); 541 548 break; 542 549 } 543 - } while(req.Size >= 0x1000); 550 + } while (link->resource[2]->end >= 0x1000); 544 551 545 552 DEBUG(2, "dev->win_size = %d", dev->win_size); 546 553 ··· 558 553 DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); 559 554 560 555 /* Get write protect status */ 561 - DEBUG(2, "window handle = 0x%8.8lx", (unsigned long)link->win); 562 - dev->win_base = ioremap(req.Base, req.Size); 556 + dev->win_base = ioremap(link->resource[2]->start, 557 + resource_size(link->resource[2])); 563 558 if(!dev->win_base) { 564 - dev_err(&dev->p_dev->dev, "ioremap(%lu, %u) failed\n", 565 - req.Base, req.Size); 559 + dev_err(&dev->p_dev->dev, "ioremap(%pR) failed\n", 560 + link->resource[2]); 566 561 pcmciamtd_release(link); 567 562 return -ENODEV; 568 563 } 569 - DEBUG(1, "mapped window dev = %p req.base = 0x%lx base = %p size = 0x%x", 570 - dev, req.Base, dev->win_base, req.Size); 564 + DEBUG(1, "mapped window dev = %p @ %pR, base = %p", 565 + dev, link->resource[2], dev->win_base); 571 566 572 567 dev->offset = 0; 573 568 dev->pcmcia_map.map_priv_1 = (unsigned long)dev; 574 - dev->pcmcia_map.map_priv_2 = (unsigned long)link->win; 569 + dev->pcmcia_map.map_priv_2 = (unsigned long)link->resource[2]; 575 570 576 571 dev->vpp = (vpp) ? vpp : link->socket->socket.Vpp; 577 572 link->conf.Attributes = 0;
+12 -17
drivers/net/pcmcia/fmvj18x_cs.c
··· 544 544 545 545 static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) 546 546 { 547 - win_req_t req; 548 547 u_char __iomem *base; 549 548 int i, j; 550 549 551 550 /* Allocate a small memory window */ 552 - req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 553 - req.Base = 0; req.Size = 0; 554 - req.AccessSpeed = 0; 555 - i = pcmcia_request_window(link, &req, &link->win); 551 + link->resource[2]->flags |= WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 552 + link->resource[2]->start = 0; link->resource[2]->end = 0; 553 + i = pcmcia_request_window(link, link->resource[2], 0); 556 554 if (i != 0) 557 555 return -1; 558 556 559 - base = ioremap(req.Base, req.Size); 560 - pcmcia_map_mem_page(link, link->win, 0); 557 + base = ioremap(link->resource[2]->start, resource_size(link->resource[2])); 558 + pcmcia_map_mem_page(link, link->resource[2], 0); 561 559 562 560 /* 563 561 * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format ··· 580 582 } 581 583 582 584 iounmap(base); 583 - j = pcmcia_release_window(link, link->win); 585 + j = pcmcia_release_window(link, link->resource[2]); 584 586 return (i != 0x200) ? 0 : -1; 585 587 586 588 } /* fmvj18x_get_hwinfo */ ··· 588 590 589 591 static int fmvj18x_setup_mfc(struct pcmcia_device *link) 590 592 { 591 - win_req_t req; 592 593 int i; 593 594 struct net_device *dev = link->priv; 594 595 unsigned int ioaddr; 595 596 local_info_t *lp = netdev_priv(dev); 596 597 597 598 /* Allocate a small memory window */ 598 - req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 599 - req.Base = 0; req.Size = 0; 600 - req.AccessSpeed = 0; 601 - i = pcmcia_request_window(link, &req, &link->win); 599 + link->resource[3]->flags = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 600 + link->resource[3]->start = link->resource[3]->end = 0; 601 + i = pcmcia_request_window(link, link->resource[3], 0); 602 602 if (i != 0) 603 603 return -1; 604 604 605 - lp->base = ioremap(req.Base, req.Size); 605 + lp->base = ioremap(link->resource[3]->start, 606 + resource_size(link->resource[3])); 606 607 if (lp->base == NULL) { 607 608 printk(KERN_NOTICE "fmvj18x_cs: ioremap failed\n"); 608 609 return -1; 609 610 } 610 611 611 - i = pcmcia_map_mem_page(link, link->win, 0); 612 + i = pcmcia_map_mem_page(link, link->resource[3], 0); 612 613 if (i != 0) { 613 614 iounmap(lp->base); 614 615 lp->base = NULL; ··· 635 638 struct net_device *dev = link->priv; 636 639 local_info_t *lp = netdev_priv(dev); 637 640 u_char __iomem *tmp; 638 - int j; 639 641 640 642 dev_dbg(&link->dev, "fmvj18x_release\n"); 641 643 ··· 642 646 tmp = lp->base; 643 647 lp->base = NULL; /* set NULL before iounmap */ 644 648 iounmap(tmp); 645 - j = pcmcia_release_window(link, link->win); 646 649 } 647 650 648 651 pcmcia_disable_device(link);
+20 -22
drivers/net/pcmcia/ibmtr_cs.c
··· 102 102 103 103 typedef struct ibmtr_dev_t { 104 104 struct pcmcia_device *p_dev; 105 - struct net_device *dev; 106 - window_handle_t sram_win_handle; 107 - struct tok_info *ti; 105 + struct net_device *dev; 106 + struct tok_info *ti; 108 107 } ibmtr_dev_t; 109 108 110 109 static void netdev_get_drvinfo(struct net_device *dev, ··· 209 210 ibmtr_dev_t *info = link->priv; 210 211 struct net_device *dev = info->dev; 211 212 struct tok_info *ti = netdev_priv(dev); 212 - win_req_t req; 213 213 int i, ret; 214 214 215 215 dev_dbg(&link->dev, "ibmtr_config\n"); ··· 238 240 ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq); 239 241 240 242 /* Allocate the MMIO memory window */ 241 - req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 242 - req.Attributes |= WIN_USE_WAIT; 243 - req.Base = 0; 244 - req.Size = 0x2000; 245 - req.AccessSpeed = 250; 246 - ret = pcmcia_request_window(link, &req, &link->win); 243 + link->resource[2]->flags |= WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 244 + link->resource[2]->flags |= WIN_USE_WAIT; 245 + link->resource[2]->start = 0; 246 + link->resource[2]->end = 0x2000; 247 + ret = pcmcia_request_window(link, link->resource[2], 250); 247 248 if (ret) 248 249 goto failed; 249 250 250 - ret = pcmcia_map_mem_page(link, link->win, mmiobase); 251 + ret = pcmcia_map_mem_page(link, link->resource[2], mmiobase); 251 252 if (ret) 252 253 goto failed; 253 - ti->mmio = ioremap(req.Base, req.Size); 254 + ti->mmio = ioremap(link->resource[2]->start, 255 + resource_size(link->resource[2])); 254 256 255 257 /* Allocate the SRAM memory window */ 256 - req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 257 - req.Attributes |= WIN_USE_WAIT; 258 - req.Base = 0; 259 - req.Size = sramsize * 1024; 260 - req.AccessSpeed = 250; 261 - ret = pcmcia_request_window(link, &req, &info->sram_win_handle); 258 + link->resource[3]->flags = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 259 + link->resource[3]->flags |= WIN_USE_WAIT; 260 + link->resource[3]->start = 0; 261 + link->resource[3]->end = sramsize * 1024; 262 + ret = pcmcia_request_window(link, link->resource[3], 250); 262 263 if (ret) 263 264 goto failed; 264 265 265 - ret = pcmcia_map_mem_page(link, info->sram_win_handle, srambase); 266 + ret = pcmcia_map_mem_page(link, link->resource[3], srambase); 266 267 if (ret) 267 268 goto failed; 268 269 269 270 ti->sram_base = srambase >> 12; 270 - ti->sram_virt = ioremap(req.Base, req.Size); 271 - ti->sram_phys = req.Base; 271 + ti->sram_virt = ioremap(link->resource[3]->start, 272 + resource_size(link->resource[3])); 273 + ti->sram_phys = link->resource[3]->start; 272 274 273 275 ret = pcmcia_request_configuration(link, &link->conf); 274 276 if (ret) ··· 314 316 315 317 dev_dbg(&link->dev, "ibmtr_release\n"); 316 318 317 - if (link->win) { 319 + if (link->resource[2]->end) { 318 320 struct tok_info *ti = netdev_priv(dev); 319 321 iounmap(ti->mmio); 320 322 }
+22 -22
drivers/net/pcmcia/pcnet_cs.c
··· 300 300 static hw_info_t *get_hwinfo(struct pcmcia_device *link) 301 301 { 302 302 struct net_device *dev = link->priv; 303 - win_req_t req; 304 303 u_char __iomem *base, *virt; 305 304 int i, j; 306 305 307 306 /* Allocate a small memory window */ 308 - req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 309 - req.Base = 0; req.Size = 0; 310 - req.AccessSpeed = 0; 311 - i = pcmcia_request_window(link, &req, &link->win); 307 + link->resource[2]->flags |= WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 308 + link->resource[2]->start = 0; link->resource[2]->end = 0; 309 + i = pcmcia_request_window(link, link->resource[2], 0); 312 310 if (i != 0) 313 311 return NULL; 314 312 315 - virt = ioremap(req.Base, req.Size); 313 + virt = ioremap(link->resource[2]->start, 314 + resource_size(link->resource[2])); 316 315 for (i = 0; i < NR_INFO; i++) { 317 - pcmcia_map_mem_page(link, link->win, hw_info[i].offset & ~(req.Size-1)); 318 - base = &virt[hw_info[i].offset & (req.Size-1)]; 316 + pcmcia_map_mem_page(link, link->resource[2], 317 + hw_info[i].offset & ~(resource_size(link->resource[2])-1)); 318 + base = &virt[hw_info[i].offset & (resource_size(link->resource[2])-1)]; 319 319 if ((readb(base+0) == hw_info[i].a0) && 320 320 (readb(base+2) == hw_info[i].a1) && 321 321 (readb(base+4) == hw_info[i].a2)) { ··· 326 326 } 327 327 328 328 iounmap(virt); 329 - j = pcmcia_release_window(link, link->win); 329 + j = pcmcia_release_window(link, link->resource[2]); 330 330 return (i < NR_INFO) ? hw_info+i : NULL; 331 331 } /* get_hwinfo */ 332 332 ··· 1486 1486 { 1487 1487 struct net_device *dev = link->priv; 1488 1488 pcnet_dev_t *info = PRIV(dev); 1489 - win_req_t req; 1490 1489 int i, window_size, offset, ret; 1491 1490 1492 1491 window_size = (stop_pg - start_pg) << 8; ··· 1496 1497 window_size = roundup_pow_of_two(window_size); 1497 1498 1498 1499 /* Allocate a memory window */ 1499 - req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 1500 - req.Attributes |= WIN_USE_WAIT; 1501 - req.Base = 0; req.Size = window_size; 1502 - req.AccessSpeed = mem_speed; 1503 - ret = pcmcia_request_window(link, &req, &link->win); 1500 + link->resource[3]->flags |= WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 1501 + link->resource[3]->flags |= WIN_USE_WAIT; 1502 + link->resource[3]->start = 0; link->resource[3]->end = window_size; 1503 + ret = pcmcia_request_window(link, link->resource[3], mem_speed); 1504 1504 if (ret) 1505 1505 goto failed; 1506 1506 1507 1507 offset = (start_pg << 8) + cm_offset; 1508 1508 offset -= offset % window_size; 1509 - ret = pcmcia_map_mem_page(link, link->win, offset); 1509 + ret = pcmcia_map_mem_page(link, link->resource[3], offset); 1510 1510 if (ret) 1511 1511 goto failed; 1512 1512 1513 1513 /* Try scribbling on the buffer */ 1514 - info->base = ioremap(req.Base, window_size); 1514 + info->base = ioremap(link->resource[3]->start, 1515 + resource_size(link->resource[3])); 1515 1516 for (i = 0; i < (TX_PAGES<<8); i += 2) 1516 1517 __raw_writew((i>>1), info->base+offset+i); 1517 1518 udelay(100); ··· 1520 1521 pcnet_reset_8390(dev); 1521 1522 if (i != (TX_PAGES<<8)) { 1522 1523 iounmap(info->base); 1523 - pcmcia_release_window(link, link->win); 1524 - info->base = NULL; link->win = 0; 1524 + pcmcia_release_window(link, link->resource[3]); 1525 + info->base = NULL; 1525 1526 goto failed; 1526 1527 } 1527 1528 1528 1529 ei_status.mem = info->base + offset; 1529 - ei_status.priv = req.Size; 1530 + ei_status.priv = resource_size(link->resource[3]); 1530 1531 dev->mem_start = (u_long)ei_status.mem; 1531 - dev->mem_end = dev->mem_start + req.Size; 1532 + dev->mem_end = dev->mem_start + resource_size(link->resource[3]); 1532 1533 1533 1534 ei_status.tx_start_page = start_pg; 1534 1535 ei_status.rx_start_page = start_pg + TX_PAGES; 1535 - ei_status.stop_page = start_pg + ((req.Size - offset) >> 8); 1536 + ei_status.stop_page = start_pg + ( 1537 + (resource_size(link->resource[3]) - offset) >> 8); 1536 1538 1537 1539 /* set up block i/o functions */ 1538 1540 ei_status.get_8390_hdr = &shmem_get_8390_hdr;
+7 -8
drivers/net/pcmcia/smc91c92_cs.c
··· 442 442 { 443 443 struct net_device *dev = link->priv; 444 444 struct smc_private *smc = netdev_priv(dev); 445 - win_req_t req; 446 445 unsigned int offset; 447 446 int i; 448 447 ··· 458 459 dev->base_addr = link->resource[0]->start; 459 460 460 461 /* Allocate a memory window, for accessing the ISR */ 461 - req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 462 - req.Base = req.Size = 0; 463 - req.AccessSpeed = 0; 464 - i = pcmcia_request_window(link, &req, &link->win); 462 + link->resource[2]->flags = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 463 + link->resource[2]->start = link->resource[2]->end = 0; 464 + i = pcmcia_request_window(link, link->resource[2], 0); 465 465 if (i != 0) 466 466 return -ENODEV; 467 467 468 - smc->base = ioremap(req.Base, req.Size); 468 + smc->base = ioremap(link->resource[2]->start, 469 + resource_size(link->resource[2])); 469 470 offset = (smc->manfid == MANFID_MOTOROLA) ? link->conf.ConfigBase : 0; 470 - i = pcmcia_map_mem_page(link, link->win, offset); 471 + i = pcmcia_map_mem_page(link, link->resource[2], offset); 471 472 if ((i == 0) && 472 473 (smc->manfid == MANFID_MEGAHERTZ) && 473 474 (smc->cardid == PRODID_MEGAHERTZ_EM3288)) ··· 998 999 static void smc91c92_release(struct pcmcia_device *link) 999 1000 { 1000 1001 dev_dbg(&link->dev, "smc91c92_release\n"); 1001 - if (link->win) { 1002 + if (link->resource[2]->end) { 1002 1003 struct net_device *dev = link->priv; 1003 1004 struct smc_private *smc = netdev_priv(dev); 1004 1005 iounmap(smc->base);
+7 -9
drivers/net/pcmcia/xirc2ps_cs.c
··· 869 869 goto config_error; 870 870 871 871 if (local->dingo) { 872 - win_req_t req; 873 - 874 872 /* Reset the modem's BAR to the correct value 875 873 * This is necessary because in the RequestConfiguration call, 876 874 * the base address of the ethernet port (BasePort1) is written ··· 888 890 * is at 0x0800. So we allocate a window into the attribute 889 891 * memory and write direct to the CIS registers 890 892 */ 891 - req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 892 - req.Base = req.Size = 0; 893 - req.AccessSpeed = 0; 894 - if ((err = pcmcia_request_window(link, &req, &link->win))) 893 + link->resource[2]->flags = WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | 894 + WIN_ENABLE; 895 + link->resource[2]->start = link->resource[2]->end = 0; 896 + if ((err = pcmcia_request_window(link, link->resource[2], 0))) 895 897 goto config_error; 896 898 897 - local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800; 898 - if ((err = pcmcia_map_mem_page(link, link->win, 0))) 899 + local->dingo_ccr = ioremap(link->resource[2]->start, 0x1000) + 0x0800; 900 + if ((err = pcmcia_map_mem_page(link, link->resource[2], 0))) 899 901 goto config_error; 900 902 901 903 /* Setup the CCRs; there are no infos in the CIS about the Ethernet ··· 986 988 { 987 989 dev_dbg(&link->dev, "release\n"); 988 990 989 - if (link->win) { 991 + if (link->resource[2]->end) { 990 992 struct net_device *dev = link->priv; 991 993 local_info_t *local = netdev_priv(dev); 992 994 if (local->dingo)
+6 -8
drivers/net/wireless/b43/pcmcia.c
··· 63 63 static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) 64 64 { 65 65 struct ssb_bus *ssb; 66 - win_req_t win; 67 66 int err = -ENOMEM; 68 67 int res = 0; 69 68 ··· 75 76 dev->conf.Attributes = CONF_ENABLE_IRQ; 76 77 dev->conf.IntType = INT_MEMORY_AND_IO; 77 78 78 - win.Attributes = WIN_ENABLE | WIN_DATA_WIDTH_16 | 79 + dev->resource[2]->flags |= WIN_ENABLE | WIN_DATA_WIDTH_16 | 79 80 WIN_USE_WAIT; 80 - win.Base = 0; 81 - win.Size = SSB_CORE_SIZE; 82 - win.AccessSpeed = 250; 83 - res = pcmcia_request_window(dev, &win, &dev->win); 81 + dev->resource[2]->start = 0; 82 + dev->resource[2]->end = SSB_CORE_SIZE; 83 + res = pcmcia_request_window(dev, dev->resource[2], 250); 84 84 if (res != 0) 85 85 goto err_kfree_ssb; 86 86 87 - res = pcmcia_map_mem_page(dev, dev->win, 0); 87 + res = pcmcia_map_mem_page(dev, dev->resource[2], 0); 88 88 if (res != 0) 89 89 goto err_disable; 90 90 ··· 94 96 if (res != 0) 95 97 goto err_disable; 96 98 97 - err = ssb_bus_pcmciabus_register(ssb, dev, win.Base); 99 + err = ssb_bus_pcmciabus_register(ssb, dev, dev->resource[2]->start); 98 100 if (err) 99 101 goto err_disable; 100 102 dev->priv = ssb;
+21 -23
drivers/net/wireless/ray_cs.c
··· 391 391 { 392 392 int ret = 0; 393 393 int i; 394 - win_req_t req; 395 394 struct net_device *dev = (struct net_device *)link->priv; 396 395 ray_dev_t *local = netdev_priv(dev); 397 396 ··· 419 420 goto failed; 420 421 421 422 /*** Set up 32k window for shared memory (transmit and control) ************/ 422 - req.Attributes = 423 - WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; 424 - req.Base = 0; 425 - req.Size = 0x8000; 426 - req.AccessSpeed = ray_mem_speed; 427 - ret = pcmcia_request_window(link, &req, &link->win); 423 + link->resource[2]->flags |= WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; 424 + link->resource[2]->start = 0; 425 + link->resource[2]->end = 0x8000; 426 + ret = pcmcia_request_window(link, link->resource[2], ray_mem_speed); 428 427 if (ret) 429 428 goto failed; 430 - ret = pcmcia_map_mem_page(link, link->win, 0); 429 + ret = pcmcia_map_mem_page(link, link->resource[2], 0); 431 430 if (ret) 432 431 goto failed; 433 - local->sram = ioremap(req.Base, req.Size); 432 + local->sram = ioremap(link->resource[2]->start, 433 + resource_size(link->resource[2])); 434 434 435 435 /*** Set up 16k window for shared memory (receive buffer) ***************/ 436 - req.Attributes = 436 + link->resource[3]->flags |= 437 437 WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; 438 - req.Base = 0; 439 - req.Size = 0x4000; 440 - req.AccessSpeed = ray_mem_speed; 441 - ret = pcmcia_request_window(link, &req, &local->rmem_handle); 438 + link->resource[3]->start = 0; 439 + link->resource[3]->end = 0x4000; 440 + ret = pcmcia_request_window(link, link->resource[3], ray_mem_speed); 442 441 if (ret) 443 442 goto failed; 444 - ret = pcmcia_map_mem_page(link, local->rmem_handle, 0x8000); 443 + ret = pcmcia_map_mem_page(link, link->resource[3], 0x8000); 445 444 if (ret) 446 445 goto failed; 447 - local->rmem = ioremap(req.Base, req.Size); 446 + local->rmem = ioremap(link->resource[3]->start, 447 + resource_size(link->resource[3])); 448 448 449 449 /*** Set up window for attribute memory ***********************************/ 450 - req.Attributes = 450 + link->resource[4]->flags |= 451 451 WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | WIN_ENABLE | WIN_USE_WAIT; 452 - req.Base = 0; 453 - req.Size = 0x1000; 454 - req.AccessSpeed = ray_mem_speed; 455 - ret = pcmcia_request_window(link, &req, &local->amem_handle); 452 + link->resource[4]->start = 0; 453 + link->resource[4]->end = 0x1000; 454 + ret = pcmcia_request_window(link, link->resource[4], ray_mem_speed); 456 455 if (ret) 457 456 goto failed; 458 - ret = pcmcia_map_mem_page(link, local->amem_handle, 0); 457 + ret = pcmcia_map_mem_page(link, link->resource[4], 0); 459 458 if (ret) 460 459 goto failed; 461 - local->amem = ioremap(req.Base, req.Size); 460 + local->amem = ioremap(link->resource[4]->start, 461 + resource_size(link->resource[4])); 462 462 463 463 dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram); 464 464 dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem);
-2
drivers/net/wireless/ray_cs.h
··· 25 25 typedef struct ray_dev_t { 26 26 int card_status; 27 27 int authentication_state; 28 - window_handle_t amem_handle; /* handle to window for attribute memory */ 29 - window_handle_t rmem_handle; /* handle to window for rx buffer on card */ 30 28 void __iomem *sram; /* pointer to beginning of shared RAM */ 31 29 void __iomem *amem; /* pointer to attribute mem window */ 32 30 void __iomem *rmem; /* pointer to receive buffer window */
+33 -27
drivers/pcmcia/pcmcia_resource.c
··· 204 204 EXPORT_SYMBOL(pcmcia_write_config_byte); 205 205 206 206 207 - int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh, 207 + int pcmcia_map_mem_page(struct pcmcia_device *p_dev, struct resource *res, 208 208 unsigned int offset) 209 209 { 210 210 struct pcmcia_socket *s = p_dev->socket; 211 - struct resource *res = wh; 212 211 unsigned int w; 213 212 int ret; 214 213 ··· 385 386 return ret; 386 387 } /* pcmcia_release_io */ 387 388 388 - 389 + /** 390 + * pcmcia_release_window() - release reserved iomem for PCMCIA devices 391 + * 392 + * pcmcia_release_window() releases struct resource *res which was 393 + * previously reserved by calling pcmcia_request_window(). 394 + */ 389 395 int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res) 390 396 { 391 397 struct pcmcia_socket *s = p_dev->socket; ··· 424 420 kfree(win->res); 425 421 win->res = NULL; 426 422 } 423 + res->start = res->end = 0; 424 + res->flags = IORESOURCE_MEM; 427 425 p_dev->_win &= ~CLIENT_WIN_REQ(w); 428 426 mutex_unlock(&s->ops_mutex); 429 427 ··· 801 795 } 802 796 803 797 804 - /** pcmcia_request_window 798 + /** 799 + * pcmcia_request_window() - attempt to reserve iomem for PCMCIA devices 805 800 * 806 - * Request_window() establishes a mapping between card memory space 807 - * and system memory space. 801 + * pcmcia_request_window() attepts to reserve an iomem ranges specified in 802 + * struct resource *res pointing to one of the entries in 803 + * struct pcmcia_device *p_dev->resource[2..5]. The "start" value is the 804 + * requested start of the IO mem resource; "end" reflects the size 805 + * requested. 808 806 */ 809 - int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_handle_t *wh) 807 + int pcmcia_request_window(struct pcmcia_device *p_dev, struct resource *res, 808 + unsigned int speed) 810 809 { 811 810 struct pcmcia_socket *s = p_dev->socket; 812 811 pccard_mem_map *win; 813 812 u_long align; 814 - struct resource *res; 815 813 int w; 816 814 817 815 if (!(s->state & SOCKET_PRESENT)) { ··· 824 814 } 825 815 826 816 /* Window size defaults to smallest available */ 827 - if (req->Size == 0) 828 - req->Size = s->map_size; 829 - align = (s->features & SS_CAP_MEM_ALIGN) ? req->Size : s->map_size; 830 - if (req->Size & (s->map_size-1)) { 817 + if (res->end == 0) 818 + res->end = s->map_size; 819 + align = (s->features & SS_CAP_MEM_ALIGN) ? res->end : s->map_size; 820 + if (res->end & (s->map_size-1)) { 831 821 dev_dbg(&p_dev->dev, "invalid map size\n"); 832 822 return -EINVAL; 833 823 } 834 - if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) || 835 - (req->Base & (align-1))) { 824 + if ((res->start && (s->features & SS_CAP_STATIC_MAP)) || 825 + (res->start & (align-1))) { 836 826 dev_dbg(&p_dev->dev, "invalid base address\n"); 837 827 return -EINVAL; 838 828 } 839 - if (req->Base) 829 + if (res->start) 840 830 align = 0; 841 831 842 832 /* Allocate system memory window */ ··· 853 843 win = &s->win[w]; 854 844 855 845 if (!(s->features & SS_CAP_STATIC_MAP)) { 856 - win->res = pcmcia_find_mem_region(req->Base, req->Size, align, 846 + win->res = pcmcia_find_mem_region(res->start, res->end, align, 857 847 0, s); 858 848 if (!win->res) { 859 849 dev_dbg(&p_dev->dev, "allocating mem region failed\n"); ··· 865 855 866 856 /* Configure the socket controller */ 867 857 win->map = w+1; 868 - win->flags = req->Attributes; 869 - win->speed = req->AccessSpeed; 858 + win->flags = res->flags & WIN_FLAGS_MAP; 859 + win->speed = speed; 870 860 win->card_start = 0; 871 861 872 862 if (s->ops->set_mem_map(s, win) != 0) { ··· 878 868 879 869 /* Return window handle */ 880 870 if (s->features & SS_CAP_STATIC_MAP) 881 - req->Base = win->static_start; 871 + res->start = win->static_start; 882 872 else 883 - req->Base = win->res->start; 873 + res->start = win->res->start; 884 874 885 875 /* convert to new-style resources */ 886 - res = p_dev->resource[w + MAX_IO_WIN]; 887 - res->start = req->Base; 888 - res->end = req->Base + req->Size - 1; 889 - res->flags &= ~IORESOURCE_BITS; 890 - res->flags |= (req->Attributes & WIN_FLAGS_MAP) | (win->map << 2); 891 - res->flags |= IORESOURCE_MEM; 876 + res->end += res->start - 1; 877 + res->flags &= ~WIN_FLAGS_REQ; 878 + res->flags |= (win->map << 2) | IORESOURCE_MEM; 892 879 res->parent = win->res; 893 880 if (win->res) 894 881 request_resource(&iomem_resource, res); ··· 893 886 dev_dbg(&p_dev->dev, "request_window results in %pR\n", res); 894 887 895 888 mutex_unlock(&s->ops_mutex); 896 - *wh = res; 897 889 898 890 return 0; 899 891 } /* pcmcia_request_window */
+19 -30
drivers/scsi/pcmcia/nsp_cs.c
··· 1596 1596 ethernet device available to the system. 1597 1597 ======================================================================*/ 1598 1598 1599 - struct nsp_cs_configdata { 1600 - nsp_hw_data *data; 1601 - win_req_t req; 1602 - }; 1603 - 1604 1599 static int nsp_cs_config_check(struct pcmcia_device *p_dev, 1605 1600 cistpl_cftable_entry_t *cfg, 1606 1601 cistpl_cftable_entry_t *dflt, 1607 1602 unsigned int vcc, 1608 1603 void *priv_data) 1609 1604 { 1610 - struct nsp_cs_configdata *cfg_mem = priv_data; 1605 + nsp_hw_data *data = priv_data; 1611 1606 1612 1607 if (cfg->index == 0) 1613 1608 return -ENODEV; ··· 1658 1663 if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { 1659 1664 cistpl_mem_t *mem = 1660 1665 (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; 1661 - cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; 1662 - cfg_mem->req.Attributes |= WIN_ENABLE; 1663 - cfg_mem->req.Base = mem->win[0].host_addr; 1664 - cfg_mem->req.Size = mem->win[0].len; 1665 - if (cfg_mem->req.Size < 0x1000) 1666 - cfg_mem->req.Size = 0x1000; 1667 - cfg_mem->req.AccessSpeed = 0; 1668 - if (pcmcia_request_window(p_dev, &cfg_mem->req, &p_dev->win) != 0) 1666 + p_dev->resource[2]->flags |= (WIN_DATA_WIDTH_16 | 1667 + WIN_MEMORY_TYPE_CM | 1668 + WIN_ENABLE); 1669 + p_dev->resource[2]->start = mem->win[0].host_addr; 1670 + p_dev->resource[2]->end = mem->win[0].len; 1671 + if (p_dev->resource[2]->end < 0x1000) 1672 + p_dev->resource[2]->end = 0x1000; 1673 + if (pcmcia_request_window(p_dev, p_dev->resource[2], 1674 + 0) != 0) 1669 1675 goto next_entry; 1670 - if (pcmcia_map_mem_page(p_dev, p_dev->win, 1676 + if (pcmcia_map_mem_page(p_dev, p_dev->resource[2], 1671 1677 mem->win[0].card_addr) != 0) 1672 1678 goto next_entry; 1673 1679 1674 - cfg_mem->data->MmioAddress = (unsigned long) ioremap_nocache(cfg_mem->req.Base, cfg_mem->req.Size); 1675 - cfg_mem->data->MmioLength = cfg_mem->req.Size; 1680 + data->MmioAddress = (unsigned long) 1681 + ioremap_nocache(p_dev->resource[2]->start, 1682 + resource_size(p_dev->resource[2])); 1683 + data->MmioLength = resource_size(p_dev->resource[2]); 1676 1684 } 1677 1685 /* If we got this far, we're cool! */ 1678 1686 return 0; ··· 1691 1693 { 1692 1694 int ret; 1693 1695 scsi_info_t *info = link->priv; 1694 - struct nsp_cs_configdata *cfg_mem; 1695 1696 struct Scsi_Host *host; 1696 1697 nsp_hw_data *data = &nsp_data_base; 1697 1698 1698 1699 nsp_dbg(NSP_DEBUG_INIT, "in"); 1699 1700 1700 - cfg_mem = kzalloc(sizeof(*cfg_mem), GFP_KERNEL); 1701 - if (!cfg_mem) 1702 - return -ENOMEM; 1703 - cfg_mem->data = data; 1704 - 1705 - ret = pcmcia_loop_config(link, nsp_cs_config_check, cfg_mem); 1701 + ret = pcmcia_loop_config(link, nsp_cs_config_check, data); 1706 1702 if (ret) 1707 1703 goto cs_failed; 1708 1704 ··· 1759 1767 printk(", io %pR", link->resource[0]); 1760 1768 if (link->resource[1]) 1761 1769 printk(" & %pR", link->resource[1]); 1762 - if (link->win) 1763 - printk(", mem 0x%06lx-0x%06lx", cfg_mem->req.Base, 1764 - cfg_mem->req.Base+cfg_mem->req.Size-1); 1770 + if (link->resource[2]) 1771 + printk(", mem %pR", link->resource[2]); 1765 1772 printk("\n"); 1766 1773 1767 - kfree(cfg_mem); 1768 1774 return 0; 1769 1775 1770 1776 cs_failed: 1771 1777 nsp_dbg(NSP_DEBUG_INIT, "config fail"); 1772 1778 nsp_cs_release(link); 1773 - kfree(cfg_mem); 1774 1779 1775 1780 return -ENODEV; 1776 1781 } /* nsp_cs_config */ ··· 1796 1807 scsi_remove_host(info->host); 1797 1808 } 1798 1809 1799 - if (link->win) { 1810 + if (resource_size(link->resource[2])) { 1800 1811 if (data != NULL) { 1801 1812 iounmap((void *)(data->MmioAddress)); 1802 1813 }
-24
include/pcmcia/cs.h
··· 68 68 #define PRESENT_IOBASE_3 0x100 69 69 #define PRESENT_IOSIZE 0x200 70 70 71 - /* For RequestWindow */ 72 - typedef struct win_req_t { 73 - u_int Attributes; 74 - u_long Base; 75 - u_int Size; 76 - u_int AccessSpeed; 77 - } win_req_t; 78 - 79 - /* Attributes for RequestWindow */ 80 - #define WIN_MEMORY_TYPE_CM 0x00 /* default */ 81 - #define WIN_MEMORY_TYPE_AM 0x20 /* MAP_ATTRIB */ 82 - #define WIN_DATA_WIDTH_8 0x00 /* default */ 83 - #define WIN_DATA_WIDTH_16 0x02 /* MAP_16BIT */ 84 - #define WIN_ENABLE 0x01 /* MAP_ACTIVE */ 85 - #define WIN_USE_WAIT 0x40 /* MAP_USE_WAIT */ 86 - 87 - #define WIN_FLAGS_MAP 0x63 /* MAP_ATTRIB | MAP_16BIT | MAP_ACTIVE | 88 - MAP_USE_WAIT */ 89 - #define WIN_FLAGS_REQ 0x1c /* mapping to socket->win[i]: 90 - 0x04 -> 0 91 - 0x08 -> 1 92 - 0x0c -> 2 93 - 0x10 -> 3 */ 94 - 95 71 #endif /* _LINUX_CS_H */
+21 -7
include/pcmcia/ds.h
··· 36 36 struct config_t; 37 37 struct net_device; 38 38 39 - typedef struct resource *window_handle_t; 40 - 41 39 /* dynamic device IDs for PCMCIA device drivers. See 42 40 * Documentation/pcmcia/driver.txt for details. 43 41 */ ··· 90 92 91 93 /* deprecated, will be cleaned up soon */ 92 94 config_req_t conf; 93 - window_handle_t win; 94 95 95 96 /* device setup */ 96 97 unsigned int irq; ··· 206 209 int pcmcia_request_configuration(struct pcmcia_device *p_dev, 207 210 config_req_t *req); 208 211 209 - int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, 210 - window_handle_t *wh); 211 - int pcmcia_release_window(struct pcmcia_device *p_dev, window_handle_t win); 212 - int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t win, 212 + int pcmcia_request_window(struct pcmcia_device *p_dev, struct resource *res, 213 + unsigned int speed); 214 + int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res); 215 + int pcmcia_map_mem_page(struct pcmcia_device *p_dev, struct resource *res, 213 216 unsigned int offset); 214 217 215 218 int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); ··· 230 233 return IO_DATA_PATH_WIDTH_8; 231 234 return IO_DATA_PATH_WIDTH_AUTO; 232 235 } 236 + 237 + /* IO memory */ 238 + #define WIN_MEMORY_TYPE_CM 0x00 /* default */ 239 + #define WIN_MEMORY_TYPE_AM 0x20 /* MAP_ATTRIB */ 240 + #define WIN_DATA_WIDTH_8 0x00 /* default */ 241 + #define WIN_DATA_WIDTH_16 0x02 /* MAP_16BIT */ 242 + #define WIN_ENABLE 0x01 /* MAP_ACTIVE */ 243 + #define WIN_USE_WAIT 0x40 /* MAP_USE_WAIT */ 244 + 245 + #define WIN_FLAGS_MAP 0x63 /* MAP_ATTRIB | MAP_16BIT | MAP_ACTIVE | 246 + MAP_USE_WAIT */ 247 + #define WIN_FLAGS_REQ 0x1c /* mapping to socket->win[i]: 248 + 0x04 -> 0 249 + 0x08 -> 1 250 + 0x0c -> 2 251 + 0x10 -> 3 */ 252 + 233 253 234 254 #endif /* __KERNEL__ */ 235 255