diff -ruN poldhu/README poldhu_r1/README --- poldhu/README 2003-12-21 23:45:03.000000000 +0100 +++ poldhu_r1/README 2004-02-21 21:17:01.242412464 +0100 @@ -1,6 +1,6 @@ No Wires Needed Poldhu driver -version 0.3.1 -Mon Dec 21 12:00:00 CET 2003 +version 0.3.1-r1 +Sat Feb 21 12:00:00 CET 2004 Introduction diff -ruN poldhu/clients/poldhu.c poldhu_r1/clients/poldhu.c --- poldhu/clients/poldhu.c 2003-12-21 23:29:35.000000000 +0100 +++ poldhu_r1/clients/poldhu.c 2004-02-21 21:17:01.244412160 +0100 @@ -4,9 +4,11 @@ Copyright (C) 2002 Bas Vermeulen -- bvermeul@blackstar.nl - poldhu.c 0.3.1 2002/08/04 + Adapted for 2.6.x kernels by David Anes -- danes@inf.upv.es - Version 0.3.1 is designed to work with kernel version 2.6.0+, + poldhu.c 0.3.1-r1 2004/02/21 + + Version 0.3.1-r1 is designed to work with kernel version 2.6.x, where the PCMCIA code has been integrated into the kernel. This software may be used and distributed according to the @@ -173,7 +175,7 @@ unsigned long state; }; -static char *version = "No Wires Needed Poldhu driver v0.3.1"; +static char *version = "No Wires Needed Poldhu driver v0.3.1-r1"; #ifdef CONFIG_PCMCIA_POLDHU_DEBUG static int poldhu_debug = CONFIG_PCMCIA_POLDHU_DEBUG; @@ -656,7 +658,8 @@ client_reg.Version = 0x0210; client_reg.event_callback_args.client_data = link; - ret = CardServices(RegisterClient, &link->handle, &client_reg); +// KRPATCH +++ ret = CardServices(RegisterClient, &link->handle, &client_reg); + ret = pcmcia_register_client(&link->handle, &client_reg); if (ret != 0) { cs_error(link->handle, RegisterClient, ret); poldhu_pcmcia_detach(link); @@ -706,7 +709,8 @@ } if (link->handle) - CardServices(DeregisterClient, link->handle); +// KRPATCH *** CardServices(DeregisterClient, link->handle); + pcmcia_deregister_client(link->handle); /* Unlink device structure, free bits */ *linkp = link->next; @@ -739,11 +743,14 @@ ========================================================================*/ -#define CS_CHECK(fn, args...) \ -while ((last_ret = CardServices(last_fn=(fn), args)) != 0) goto cs_failed +/* KRPATCH - These 2 macros have been expanded on the code + #define CS_CHECK(fn, args...) \ + while ((last_ret = CardServices(last_fn=(fn), args)) != 0) goto cs_failed + -#define CFG_CHECK(fn, args...) \ -if (CardServices(fn, args) != 0) goto next_entry + #define CFG_CHECK(fn, args...) \ + if (CardServices(fn, args) != 0) goto next_entry +*/ static void poldhu_pcmcia_config(dev_link_t * link) { @@ -770,20 +777,32 @@ */ tuple.Attributes = 0; tuple.DesiredTuple = CISTPL_CONFIG; - CS_CHECK(GetFirstTuple, handle, &tuple); + +// KRPATCH *** CS_CHECK(GetFirstTuple, handle, &tuple); + last_fn = (GetFirstTuple); + while ((last_ret = pcmcia_get_first_tuple(handle, &tuple)) != 0) goto cs_failed; + tuple.TupleData = (cisdata_t *) buf; tuple.TupleDataMax = sizeof(buf); tuple.TupleOffset = 0; - CS_CHECK(GetTupleData, handle, &tuple); - CS_CHECK(ParseTuple, handle, &tuple, &parse); +// KRPATCH *** CS_CHECK(GetTupleData, handle, &tuple); + last_fn = (GetTupleData); + while ((last_ret = pcmcia_get_tuple_data(handle, &tuple)) != 0) goto cs_failed; + +// KRPATCH *** CS_CHECK(ParseTuple, handle, &tuple, &parse); + last_fn = (ParseTuple); + while ((last_ret = pcmcia_parse_tuple(handle, &tuple, &parse)) != 0) goto cs_failed; + link->conf.ConfigBase = parse.config.base; link->conf.Present = parse.config.rmask[0]; /* Is this a 3Com XJack card? */ tuple.DesiredTuple = CISTPL_MANFID; tuple.Attributes = TUPLE_RETURN_COMMON; - if ((CardServices(GetFirstTuple, handle, &tuple) == CS_SUCCESS) && - (CardServices(GetTupleData, handle, &tuple) == CS_SUCCESS)) +// KRPATCH *** if ((CardServices(GetFirstTuple, handle, &tuple) == CS_SUCCESS) && +// KRPATCH *** (CardServices(GetTupleData, handle, &tuple) == CS_SUCCESS)) + if ((pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) && + (pcmcia_get_tuple_data(handle, &tuple) == CS_SUCCESS)) { if ((buf[0] == 0x01) && (buf[1] == 0x01) && (buf[2] == 0x92) && (buf[3] == 0x20)) @@ -807,12 +826,20 @@ any Poldhu card, since that has an accurate CIS. */ tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; - CS_CHECK(GetFirstTuple, handle, &tuple); + +// KRPATCH *** CS_CHECK(GetFirstTuple, handle, &tuple); + last_fn = (GetFirstTuple); + while ((last_ret = pcmcia_get_first_tuple(handle, &tuple)) != 0) goto cs_failed; + while (1) { cistpl_cftable_entry_t dflt = { 0 }; cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); - CFG_CHECK(GetTupleData, handle, &tuple); - CFG_CHECK(ParseTuple, handle, &tuple, &parse); + +// KRPATCH *** CFG_CHECK(GetTupleData, handle, &tuple); + if (pcmcia_get_tuple_data(handle, &tuple) != 0) goto next_entry; + +// KRPATCH *** CFG_CHECK(ParseTuple, handle, &tuple, &parse); + if (pcmcia_parse_tuple(handle, &tuple, &parse) != 0) goto next_entry; if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; @@ -869,7 +896,9 @@ } /* This reserves IO space but doesn't actually enable it */ - CFG_CHECK(RequestIO, link->handle, &link->io); + +// KRPATCH *** CFG_CHECK(RequestIO, link->handle, &link->io); + if (pcmcia_request_io(link->handle, &link->io) != 0) goto next_entry; /* Now set up a common memory window, if needed. There is room @@ -891,28 +920,45 @@ req.Size = mem->win[0].len; req.AccessSpeed = 0; link->win = (window_handle_t) link->handle; - CFG_CHECK(RequestWindow, &link->win, &req); + +// KRPATCH *** CFG_CHECK(RequestWindow, &link->win, &req); + if (pcmcia_request_window(&link->handle, &req, &link->win) != 0) goto next_entry; + map.Page = 0; map.CardOffset = mem->win[0].card_addr; - CFG_CHECK(MapMemPage, link->win, &map); + +// KRPATCH *** CFG_CHECK(MapMemPage, link->win, &map); + if (pcmcia_map_mem_page(link->win, &map) != 0) goto next_entry; + } /* If we got this far, we're cool! */ break; next_entry: - CS_CHECK(GetNextTuple, handle, &tuple); +// KRPATCH *** CS_CHECK(GetNextTuple, handle, &tuple); + last_fn = (GetNextTuple); + while ((last_ret = pcmcia_get_next_tuple(handle, &tuple)) != 0) goto cs_failed; + } /* Allocate an interrupt line. */ if (link->conf.Attributes & CONF_ENABLE_IRQ) - CS_CHECK(RequestIRQ, link->handle, &link->irq); +// KRPATCH *** CS_CHECK(RequestIRQ, link->handle, &link->irq); + { + last_fn = (RequestIRQ); + while ((last_ret = pcmcia_request_irq(link->handle, &link->irq)) != 0) goto cs_failed; + } /* This actually configures the PCMCIA socket -- setting up the I/O windows and the interrupt mapping, and putting the card and host interface into "Memory and IO" mode. */ - CS_CHECK(RequestConfiguration, link->handle, &link->conf); + +// KRPATCH *** CS_CHECK(RequestConfiguration, link->handle, &link->conf); + last_fn = (RequestConfiguration); + while ((last_ret = pcmcia_request_configuration(link->handle, &link->conf)) != 0) goto cs_failed; + /* Report what we've done so far */ printk(KERN_INFO "poldhu_cs: index 0x%02x: Vcc %d.%d", @@ -1069,9 +1115,12 @@ /* Remove proc file */ remove_proc_entry(link->dev->dev_name, poldhu_proc_dir); - CardServices(ReleaseConfiguration, link->handle); - CardServices(ReleaseIO, link->handle, &link->io); - CardServices(ReleaseIRQ, link->handle, &link->irq); +// KRPATCH *** CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_configuration(link->handle); +// KRPATCH *** CardServices(ReleaseIO, link->handle, &link->io); + pcmcia_release_io(link->handle, &link->io); +// KRPATCH ** CardServices(ReleaseIRQ, link->handle, &link->irq); + pcmcia_release_irq(link->handle, &link->irq); link->state &= ~(DEV_CONFIG | DEV_RELEASE_PENDING); } @@ -1111,7 +1160,8 @@ if (link->open) { netif_device_detach(dev); } - CardServices(ReleaseConfiguration, link->handle); +// KRPATCH *** CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_configuration(link->handle); } break; case CS_EVENT_PM_RESUME: @@ -1119,8 +1169,8 @@ /* Fall through */ case CS_EVENT_CARD_RESET: if (link->state & DEV_CONFIG) { - CardServices(RequestConfiguration, - link->handle, &link->conf); +// KRPATCH *** CardServices(RequestConfiguration, link->handle, &link->conf); + pcmcia_request_configuration(link->handle, &link->conf); if (link->open) { /* Enable interrupts if needed */ if (!(INB(Comms7(dev->base_addr)) & INT_STATUS)) {