diff options
| -rw-r--r-- | drivers/Makefile | 2 | ||||
| -rw-r--r-- | drivers/pcmcia/Kconfig | 90 | ||||
| -rw-r--r-- | drivers/pcmcia/Makefile | 14 | ||||
| -rw-r--r-- | drivers/pcmcia/bulkmem.c | 534 | ||||
| -rw-r--r-- | drivers/pcmcia/cistpl.c | 78 | ||||
| -rw-r--r-- | drivers/pcmcia/cs.c | 156 | ||||
| -rw-r--r-- | drivers/pcmcia/cs_internal.h | 38 | ||||
| -rw-r--r-- | drivers/pcmcia/ds.c | 58 | ||||
| -rw-r--r-- | drivers/pcmcia/pcmcia_compat.c | 145 | ||||
| -rw-r--r-- | drivers/pcmcia/rsrc_mgr.c | 8 | ||||
| -rw-r--r-- | include/pcmcia/bulkmem.h | 148 | ||||
| -rw-r--r-- | include/pcmcia/cistpl.h | 10 | ||||
| -rw-r--r-- | include/pcmcia/cs.h | 15 | ||||
| -rw-r--r-- | include/pcmcia/cs_types.h | 3 | ||||
| -rw-r--r-- | include/pcmcia/ftl.h | 73 | ||||
| -rw-r--r-- | include/pcmcia/memory.h | 41 | ||||
| -rw-r--r-- | include/pcmcia/ss.h | 8 |
17 files changed, 414 insertions, 1007 deletions
diff --git a/drivers/Makefile b/drivers/Makefile index dfaafd02f1f7..88aec9768d2b 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -36,7 +36,7 @@ obj-$(CONFIG_FUSION) += message/ obj-$(CONFIG_IEEE1394) += ieee1394/ obj-y += cdrom/ obj-$(CONFIG_MTD) += mtd/ -obj-$(CONFIG_PCMCIA) += pcmcia/ +obj-$(CONFIG_PCCARD) += pcmcia/ obj-$(CONFIG_DIO) += dio/ obj-$(CONFIG_SBUS) += sbus/ obj-$(CONFIG_ZORRO) += zorro/ diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig index a265a67412b7..63e5190e5025 100644 --- a/drivers/pcmcia/Kconfig +++ b/drivers/pcmcia/Kconfig @@ -5,30 +5,24 @@ # by the integrated kernel driver. # -menu "PCMCIA/CardBus support" +menu "PCCARD (PCMCIA/CardBus) support" depends on HOTPLUG -config PCMCIA - tristate "PCMCIA/CardBus support" +config PCCARD + tristate "PCCard (PCMCIA/CardBus) support" ---help--- Say Y here if you want to attach PCMCIA- or PC-cards to your Linux computer. These are credit-card size devices such as network cards, modems or hard drives often used with laptops computers. There are actually two varieties of these cards: the older 16 bit PCMCIA cards - and the newer 32 bit CardBus cards. If you want to use CardBus - cards, you need to say Y here and also to "CardBus support" below. - - To use your PC-cards, you will need supporting software from David - Hinds' pcmcia-cs package (see the file <file:Documentation/Changes> - for location). Please also read the PCMCIA-HOWTO, available from - <http://www.tldp.org/docs.html#howto>. + and the newer 32 bit CardBus cards. To compile this driver as modules, choose M here: the - modules will be called pcmcia_core and ds. + module will be called pcmcia_core. config PCMCIA_DEBUG - bool "Enable PCMCIA debugging" - depends on PCMCIA != n + bool "Enable PCCARD debugging" + depends on PCCARD != n help Say Y here to enable PCMCIA subsystem debugging. You will need to choose the debugging level either via the @@ -45,29 +39,69 @@ config PCMCIA_DEBUG In all the above examples, N is the debugging verbosity level. -config YENTA - tristate "CardBus yenta-compatible bridge support" - depends on PCMCIA && PCI +config PCMCIA_OBSOLETE + bool "Enable obsolete PCCARD code" + depends on PCCARD != n + help + Say Y here to enable some code found in the PCCARD subsystem + which has no in-kernel usage, but might be needed for certain + external PCMCIA drivers. If you do need to say Y here so that + one such driver compiles and/or works correctly, please report + this to linux-pcmcia <at> lists.infradead.org + + If unsure, say N + +config PCMCIA + tristate "16-bit PCMCIA support" + depends on PCCARD + default y + ---help--- + This option enables support for 16-bit PCMCIA cards. Most older + PC-cards are such 16-bit PCMCIA cards, so unless you know you're + only using 32-bit CardBus cards, say Y or M here. + + To use 16-bit PCMCIA cards, you will need supporting software from + David Hinds' pcmcia-cs package (see the file <file:Documentation/Changes> + for location). Please also read the PCMCIA-HOWTO, available from + <http://www.tldp.org/docs.html#howto>. + + To compile this driver as modules, choose M here: the + module will be called pcmcia. + + If unsure, say Y. + +config CARDBUS + bool "32-bit CardBus support" + depends on PCCARD && PCI + default y ---help--- CardBus is a bus mastering architecture for PC-cards, which allows for 32 bit PC-cards (the original PCMCIA standard specifies only a 16 bit wide bus). Many newer PC-cards are actually CardBus cards. - This option enables support for CardBus PC Cards, as well as support - for CardBus host bridges. Virtually all modern PCMCIA bridges are - CardBus compatible. A "bridge" is the hardware inside your computer - that PCMCIA cards are plugged into. - - To use your PC-cards, you will need supporting software from David - Hinds' pcmcia-cs package (see the file <file:Documentation/Changes> - for location). + To use 32 bit PC-cards, you also need a CardBus compatible host + bridge. Virtually all modern PCMCIA bridges do this, and most of + them are "yenta-compatible", so say Y or M there, too. If unsure, say Y. -config CARDBUS - bool - depends on YENTA - default y if YENTA +comment "PC-card bridges" + +config YENTA + tristate "CardBus yenta-compatible bridge support" + depends on PCCARD && PCI +#fixme: remove dependendcy on CARDBUS + depends on CARDBUS + ---help--- + This option enables support for CardBus host bridges. Virtually + all modern PCMCIA bridges are CardBus compatible. A "bridge" is + the hardware inside your computer that PCMCIA cards are plugged + into. + + To compile this driver as modules, choose M here: the + module will be called yenta_socket. + + If unsure, say Y. config PD6729 tristate "Cirrus PD6729 compatible bridge support" diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index 450d524a9679..1ddf0c08c6bb 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile @@ -6,7 +6,16 @@ ifeq ($(CONFIG_PCMCIA_DEBUG),y) EXTRA_CFLAGS += -DDEBUG endif -obj-$(CONFIG_PCMCIA) += pcmcia_core.o ds.o +pcmcia_core-y += cs.o cistpl.o rsrc_mgr.o socket_sysfs.o +pcmcia_core-$(CONFIG_CARDBUS) += cardbus.o +obj-$(CONFIG_PCCARD) += pcmcia_core.o + +pcmcia-y += ds.o bulkmem.o pcmcia_compat.o +obj-$(CONFIG_PCMCIA) += pcmcia.o + + +# socket drivers + obj-$(CONFIG_YENTA) += yenta_socket.o obj-$(CONFIG_PD6729) += pd6729.o @@ -20,9 +29,6 @@ obj-$(CONFIG_PCMCIA_PXA2XX) += pxa2xx_core.o pxa2xx_cs.o obj-$(CONFIG_M32R_PCC) += m32r_pcc.o obj-$(CONFIG_M32R_CFC) += m32r_cfc.o -pcmcia_core-y += cistpl.o rsrc_mgr.o bulkmem.o cs.o socket_sysfs.o -pcmcia_core-$(CONFIG_CARDBUS) += cardbus.o - sa11xx_core-y += soc_common.o sa11xx_base.o pxa2xx_core-y += soc_common.o pxa2xx_base.o diff --git a/drivers/pcmcia/bulkmem.c b/drivers/pcmcia/bulkmem.c index 3298828e2890..c3fe894b54ac 100644 --- a/drivers/pcmcia/bulkmem.c +++ b/drivers/pcmcia/bulkmem.c @@ -48,276 +48,18 @@ #include <pcmcia/cistpl.h> #include "cs_internal.h" -static void retry_erase_list(erase_busy_t *list, u_int cause); - -/*====================================================================== - - This function handles submitting an MTD request, and retrying - requests when an MTD is busy. - - An MTD request should never block. - -======================================================================*/ - -static int do_mtd_request(memory_handle_t handle, mtd_request_t *req, - caddr_t buf) -{ - int ret, tries; - client_t *mtd; - struct pcmcia_socket *s; - - mtd = handle->mtd; - if (mtd == NULL) - return CS_GENERAL_FAILURE; - s = SOCKET(mtd); - for (ret = tries = 0; tries < 100; tries++) { - mtd->event_callback_args.mtdrequest = req; - mtd->event_callback_args.buffer = buf; - ret = EVENT(mtd, CS_EVENT_MTD_REQUEST, CS_EVENT_PRI_LOW); - if (ret != CS_BUSY) - break; - switch (req->Status) { - case MTD_WAITREQ: - /* Not that we should ever need this... */ - interruptible_sleep_on_timeout(&mtd->mtd_req, HZ); - break; - case MTD_WAITTIMER: - case MTD_WAITRDY: - interruptible_sleep_on_timeout(&mtd->mtd_req, req->Timeout*HZ/1000); - req->Function |= MTD_REQ_TIMEOUT; - break; - case MTD_WAITPOWER: - interruptible_sleep_on(&mtd->mtd_req); - break; - } - if (signal_pending(current)) - printk(KERN_NOTICE "cs: do_mtd_request interrupted!\n"); - } - if (tries == 20) { - printk(KERN_NOTICE "cs: MTD request timed out!\n"); - ret = CS_GENERAL_FAILURE; - } - wake_up_interruptible(&mtd->mtd_req); - retry_erase_list(&mtd->erase_busy, 0); - return ret; -} /* do_mtd_request */ - -/*====================================================================== - - This stuff is all for handling asynchronous erase requests. It - is complicated because all the retry stuff has to be dealt with - in timer interrupts or in the card status event handler. - -======================================================================*/ - -static void insert_queue(struct pcmcia_socket *s, erase_busy_t *head, erase_busy_t *entry) -{ - cs_dbg(s, 2, "adding 0x%p to queue 0x%p\n", entry, head); - entry->next = head; - entry->prev = head->prev; - head->prev->next = entry; - head->prev = entry; -} - -static void remove_queue(struct pcmcia_socket *s, erase_busy_t *entry) -{ - cs_dbg(s, 2, "unqueueing 0x%p\n", entry); - entry->next->prev = entry->prev; - entry->prev->next = entry->next; -} - -static void retry_erase(erase_busy_t *busy, u_int cause) -{ - eraseq_entry_t *erase = busy->erase; - mtd_request_t req; - client_t *mtd; - struct pcmcia_socket *s; - int ret; - - mtd = erase->Handle->mtd; - s = SOCKET(mtd); - - cs_dbg(s, 2, "trying erase request 0x%p...\n", busy); - if (busy->next) - remove_queue(s, busy); - req.Function = MTD_REQ_ERASE | cause; - req.TransferLength = erase->Size; - req.DestCardOffset = erase->Offset + erase->Handle->info.CardOffset; - req.MediaID = erase->Handle->MediaID; - mtd->event_callback_args.mtdrequest = &req; - ret = EVENT(mtd, CS_EVENT_MTD_REQUEST, CS_EVENT_PRI_LOW); - if (ret == CS_BUSY) { - cs_dbg(s, 2, " Status = %d, requeueing.\n", req.Status); - switch (req.Status) { - case MTD_WAITREQ: - case MTD_WAITPOWER: - insert_queue(s, &mtd->erase_busy, busy); - break; - case MTD_WAITTIMER: - case MTD_WAITRDY: - if (req.Status == MTD_WAITRDY) - insert_queue(s, &s->erase_busy, busy); - mod_timer(&busy->timeout, jiffies + req.Timeout*HZ/1000); - break; - } - } else { - /* update erase queue status */ - cs_dbg(s, 2, " Ret = %d\n", ret); - switch (ret) { - case CS_SUCCESS: - erase->State = ERASE_PASSED; break; - case CS_WRITE_PROTECTED: - erase->State = ERASE_MEDIA_WRPROT; break; - case CS_BAD_OFFSET: - erase->State = ERASE_BAD_OFFSET; break; - case CS_BAD_SIZE: - erase->State = ERASE_BAD_SIZE; break; - case CS_NO_CARD: - erase->State = ERASE_BAD_SOCKET; break; - default: - erase->State = ERASE_FAILED; break; - } - busy->client->event_callback_args.info = erase; - EVENT(busy->client, CS_EVENT_ERASE_COMPLETE, CS_EVENT_PRI_LOW); - kfree(busy); - /* Resubmit anything waiting for a request to finish */ - wake_up_interruptible(&mtd->mtd_req); - retry_erase_list(&mtd->erase_busy, 0); - } -} /* retry_erase */ - -static void retry_erase_list(erase_busy_t *list, u_int cause) -{ - erase_busy_t tmp = *list; - - cs_dbg(SOCKET(list->client), 2, "rescanning erase queue list 0x%p\n", list); - if (list->next == list) - return; - /* First, truncate the original list */ - list->prev->next = &tmp; - list->next->prev = &tmp; - list->prev = list->next = list; - tmp.prev->next = &tmp; - tmp.next->prev = &tmp; - - /* Now, retry each request, in order. */ - while (tmp.next != &tmp) - retry_erase(tmp.next, cause); -} /* retry_erase_list */ - -static void handle_erase_timeout(u_long arg) -{ - erase_busy_t *busy = (erase_busy_t *)arg; - cs_dbg(SOCKET(busy->client), 0, "erase timeout for entry 0x%lx\n", arg); - retry_erase(busy, MTD_REQ_TIMEOUT); -} - -static void setup_erase_request(client_handle_t handle, eraseq_entry_t *erase) -{ - erase_busy_t *busy; - region_info_t *info; - - if (CHECK_REGION(erase->Handle)) - erase->State = ERASE_BAD_SOCKET; - else { - info = &erase->Handle->info; - if ((erase->Offset >= info->RegionSize) || - (erase->Offset & (info->BlockSize-1))) - erase->State = ERASE_BAD_OFFSET; - else if ((erase->Offset+erase->Size > info->RegionSize) || - (erase->Size & (info->BlockSize-1))) - erase->State = ERASE_BAD_SIZE; - else { - erase->State = 1; - busy = kmalloc(sizeof(erase_busy_t), GFP_KERNEL); - if (!busy) { - erase->State = ERASE_FAILED; - return; - } - busy->erase = erase; - busy->client = handle; - init_timer(&busy->timeout); - busy->timeout.data = (u_long)busy; - busy->timeout.function = &handle_erase_timeout; - busy->prev = busy->next = NULL; - retry_erase(busy, 0); - } - } -} /* setup_erase_request */ - -/*====================================================================== - - MTD helper functions - -======================================================================*/ - -static int mtd_modify_window(window_handle_t win, mtd_mod_win_t *req) -{ - if ((win == NULL) || (win->magic != WINDOW_MAGIC)) - return CS_BAD_HANDLE; - win->ctl.flags = MAP_16BIT | MAP_ACTIVE; - if (req->Attributes & WIN_USE_WAIT) - win->ctl.flags |= MAP_USE_WAIT; - if (req->Attributes & WIN_MEMORY_TYPE) - win->ctl.flags |= MAP_ATTRIB; - win->ctl.speed = req->AccessSpeed; - win->ctl.card_start = req->CardOffset; - win->sock->ops->set_mem_map(win->sock, &win->ctl); - return CS_SUCCESS; -} - -static int mtd_set_vpp(client_handle_t handle, mtd_vpp_req_t *req) -{ - struct pcmcia_socket *s; - if (CHECK_HANDLE(handle)) - return CS_BAD_HANDLE; - if (req->Vpp1 != req->Vpp2) - return CS_BAD_VPP; - s = SOCKET(handle); - s->socket.Vpp = req->Vpp1; - if (s->ops->set_socket(s, &s->socket)) - return CS_BAD_VPP; - return CS_SUCCESS; -} - -static int mtd_rdy_mask(client_handle_t handle, mtd_rdy_req_t *req) -{ - struct pcmcia_socket *s; - if (CHECK_HANDLE(handle)) - return CS_BAD_HANDLE; - s = SOCKET(handle); - if (req->Mask & CS_EVENT_READY_CHANGE) - s->socket.csc_mask |= SS_READY; - else - s->socket.csc_mask &= ~SS_READY; - if (s->ops->set_socket(s, &s->socket)) - return CS_GENERAL_FAILURE; - return CS_SUCCESS; -} - -int MTDHelperEntry(int func, void *a1, void *a2) -{ - switch (func) { - case MTDRequestWindow: - { - window_handle_t w; - int ret = pcmcia_request_window(a1, a2, &w); - a1 = w; - return ret; - } - break; - case MTDReleaseWindow: - return pcmcia_release_window(a1); - case MTDModifyWindow: - return mtd_modify_window(a1, a2); break; - case MTDSetVpp: - return mtd_set_vpp(a1, a2); break; - case MTDRDYMask: - return mtd_rdy_mask(a1, a2); break; - default: - return CS_UNSUPPORTED_FUNCTION; break; - } -} /* MTDHelperEntry */ +#ifdef DEBUG +extern int pc_debug; +#define cs_socket_name(skt) ((skt)->dev.class_id) + +#define ds_dbg(skt, lvl, fmt, arg...) do { \ + if (pc_debug >= lvl) \ + printk(KERN_DEBUG "ds: %s: " fmt, \ + cs_socket_name(skt) , ## arg); \ +} while (0) +#else +#define ds_dbg(lvl, fmt, arg...) do { } while (0) +#endif /*====================================================================== @@ -327,8 +69,8 @@ int MTDHelperEntry(int func, void *a1, void *a2) ======================================================================*/ -static void setup_regions(client_handle_t handle, int attr, - memory_handle_t *list) +static void setup_regions(struct pcmcia_socket *s, unsigned int function, + int attr, memory_handle_t *list) { int i, code, has_jedec, has_geo; u_int offset; @@ -337,22 +79,22 @@ static void setup_regions(client_handle_t handle, int attr, cistpl_device_geo_t geo; memory_handle_t r; - cs_dbg(SOCKET(handle), 1, "setup_regions(0x%p, %d, 0x%p)\n", - handle, attr, list); + ds_dbg(s, 1, "setup_regions(0x%d, %d, 0x%p)\n", + function, attr, list); code = (attr) ? CISTPL_DEVICE_A : CISTPL_DEVICE; - if (read_tuple(handle, code, &device) != CS_SUCCESS) + if (pccard_read_tuple(s, function, code, &device) != CS_SUCCESS) return; code = (attr) ? CISTPL_JEDEC_A : CISTPL_JEDEC_C; - has_jedec = (read_tuple(handle, code, &jedec) == CS_SUCCESS); + has_jedec = (pccard_read_tuple(s, function, code, &jedec) == CS_SUCCESS); if (has_jedec && (device.ndev != jedec.nid)) { - cs_dbg(SOCKET(handle), 0, "Device info does not match JEDEC info.\n"); + ds_dbg(s, 0, "Device info does not match JEDEC info.\n"); has_jedec = 0; } code = (attr) ? CISTPL_DEVICE_GEO_A : CISTPL_DEVICE_GEO; - has_geo = (read_tuple(handle, code, &geo) == CS_SUCCESS); + has_geo = (pccard_read_tuple(s, function, code, &geo) == CS_SUCCESS); if (has_geo && (device.ndev != geo.ngeo)) { - cs_dbg(SOCKET(handle), 0, "Device info does not match geometry tuple.\n"); + ds_dbg(s, 0, "Device info does not match geometry tuple.\n"); has_geo = 0; } @@ -400,6 +142,37 @@ static void setup_regions(client_handle_t handle, int attr, ======================================================================*/ +static int pccard_match_region(memory_handle_t list, region_info_t *match) +{ + if (list) { + *match = list->info; + return CS_SUCCESS; + } + return CS_NO_MORE_ITEMS; +} /* match_region */ + +int pccard_get_first_region(struct pcmcia_socket *s, region_info_t *rgn) +{ + if (!(s->state & SOCKET_REGION_INFO)) { + setup_regions(s, BIND_FN_ALL, 0, &s->c_region); + setup_regions(s, BIND_FN_ALL, 1, &s->a_region); + s->state |= SOCKET_REGION_INFO; + } + + if (rgn->Attributes & REGION_TYPE_AM) + return pccard_match_region(s->a_region, rgn); + else + return pccard_match_region(s->c_region, rgn); +} /* get_first_region */ + +int pccard_get_next_region(struct pcmcia_socket *s, region_info_t *rgn) +{ + return pccard_match_region(rgn->next, rgn); +} /* get_next_region */ + + +#ifdef CONFIG_PCMCIA_OBSOLETE + static int match_region(client_handle_t handle, memory_handle_t list, region_info_t *match) { @@ -422,8 +195,8 @@ int pcmcia_get_first_region(client_handle_t handle, region_info_t *rgn) if ((handle->Attributes & INFO_MASTER_CLIENT) && (!(s->state & SOCKET_REGION_INFO))) { - setup_regions(handle, 0, &s->c_region); - setup_regions(handle, 1, &s->a_region); + setup_regions(s, handle->Function, 0, &s->c_region); + setup_regions(s, handle->Function, 1, &s->a_region); s->state |= SOCKET_REGION_INFO; } @@ -432,6 +205,7 @@ int pcmcia_get_first_region(client_handle_t handle, region_info_t *rgn) else return match_region(handle, s->c_region, rgn); } /* get_first_region */ +EXPORT_SYMBOL(pcmcia_get_first_region); int pcmcia_get_next_region(client_handle_t handle, region_info_t *rgn) { @@ -439,200 +213,6 @@ int pcmcia_get_next_region(client_handle_t handle, region_info_t *rgn) return CS_BAD_HANDLE; return match_region(handle, rgn->next, rgn); } /* get_next_region */ +EXPORT_SYMBOL(pcmcia_get_next_region); -/*====================================================================== - - Connect an MTD with a memory region. - -======================================================================*/ - -int pcmcia_register_mtd(client_handle_t handle, mtd_reg_t *reg) -{ - memory_handle_t list; - struct pcmcia_socket *s; - - if (CHECK_HANDLE(handle)) - return CS_BAD_HANDLE; - s = SOCKET(handle); - if (reg->Attributes & REGION_TYPE_AM) - list = s->a_region; - else - list = s->c_region; - cs_dbg(s, 1, "register_mtd(0x%p, '%s', 0x%x)\n", - handle, handle->dev_info, reg->Offset); - while (list) { - if (list->info.CardOffset == reg->Offset) break; - list = list->info.next; - } - if (list && (list->mtd == NULL) && - (strcmp(handle->dev_info, list->dev_info) == 0)) { - list->info.Attributes = reg->Attributes; - list->MediaID = reg->MediaID; - list->mtd = handle; - handle->mtd_count++; - return CS_SUCCESS; - } else - return CS_BAD_OFFSET; -} /* register_mtd */ - -/*====================================================================== - - Erase queue management functions - -======================================================================*/ - -int pcmcia_register_erase_queue(client_handle_t *handle, eraseq_hdr_t *header, - eraseq_handle_t *e) -{ - eraseq_t *queue; - - if ((handle == NULL) || CHECK_HANDLE(*handle)) - return CS_BAD_HANDLE; - queue = kmalloc(sizeof(*queue), GFP_KERNEL); - if (!queue) return CS_OUT_OF_RESOURCE; - queue->eraseq_magic = ERASEQ_MAGIC; - queue->handle = *handle; - queue->count = header->QueueEntryCnt; - queue->entry = header->QueueEntryArray; - *e = queue; - return CS_SUCCESS; -} /* register_erase_queue */ - -int pcmcia_deregister_erase_queue(eraseq_handle_t eraseq) -{ - int i; - if (CHECK_ERASEQ(eraseq)) - return CS_BAD_HANDLE; - for (i = 0; i < eraseq->count; i++) - if (ERASE_IN_PROGRESS(eraseq->entry[i].State)) break; - if (i < eraseq->count) - return CS_BUSY; - eraseq->eraseq_magic = 0; - kfree(eraseq); - return CS_SUCCESS; -} /* deregister_erase_queue */ - -int pcmcia_check_erase_queue(eraseq_handle_t eraseq) -{ - int i; - if (CHECK_ERASEQ(eraseq)) - return CS_BAD_HANDLE; - for (i = 0; i < eraseq->count; i++) - if (eraseq->entry[i].State == ERASE_QUEUED) - setup_erase_request(eraseq->handle, &eraseq->entry[i]); - return CS_SUCCESS; -} /* check_erase_queue */ - -/*====================================================================== - - Look up the memory region matching the request, and return a - memory handle. - -======================================================================*/ - -int pcmcia_open_memory(client_handle_t *handle, open_mem_t *open, memory_handle_t *mh) -{ - struct pcmcia_socket *s; - memory_handle_t region; - - if ((handle == NULL) || CHECK_HANDLE(*handle)) - return CS_BAD_HANDLE; - s = (*handle)->Socket; - if (open->Attributes & MEMORY_TYPE_AM) - region = s->a_region; - else - region = s->c_region; - while (region) { - if (region->info.CardOffset == open->Offset) break; - region = region->info.next; - } - if (region && region->mtd) { - *mh = region; - cs_dbg(s, 1, "open_memory(0x%p, 0x%x) = 0x%p\n", - handle, open->Offset, region); - return CS_SUCCESS; - } else - return CS_BAD_OFFSET; -} /* open_memory */ - -/*====================================================================== - - Close a memory handle from an earlier call to OpenMemory. - - For the moment, I don't think this needs to do anything. - -======================================================================*/ - -int pcmcia_close_memory(memory_handle_t handle) -{ - cs_dbg(SOCKET(handle->mtd), 1, "cs: close_memory(0x%p)\n", handle); - if (CHECK_REGION(handle)) - return CS_BAD_HANDLE; - return CS_SUCCESS; -} /* close_memory */ - -/*====================================================================== - - Read from a memory device, using a handle previously returned - by a call to OpenMemory. - -======================================================================*/ - -int pcmcia_read_memory(memory_handle_t handle, mem_op_t *req, caddr_t buf) -{ - mtd_request_t mtd; - if (CHECK_REGION(handle)) - return CS_BAD_HANDLE; - if (req->Offset >= handle->info.RegionSize) - return CS_BAD_OFFSET; - if (req->Offset+req->Count > handle->info.RegionSize) - return CS_BAD_SIZE; - - mtd.SrcCardOffset = req->Offset + handle->info.CardOffset; - mtd.TransferLength = req->Count; - mtd.MediaID = handle->MediaID; - mtd.Function = MTD_REQ_READ; - if (req->Attributes & MEM_OP_BUFFER_KERNEL) - mtd.Function |= MTD_REQ_KERNEL; - return do_mtd_request(handle, &mtd, buf); -} /* read_memory */ - -/*====================================================================== - - Write to a memory device, using a handle previously returned by - a call to OpenMemory. - -======================================================================*/ - -int pcmcia_write_memory(memory_handle_t handle, mem_op_t *req, caddr_t buf) -{ - mtd_request_t mtd; - if (CHECK_REGION(handle)) - return CS_BAD_HANDLE; - if (req->Offset >= handle->info.RegionSize) - return CS_BAD_OFFSET; - if (req->Offset+req->Count > handle->info.RegionSize) - return CS_BAD_SIZE; - - mtd.DestCardOffset = req->Offset + handle->info.CardOffset; - mtd.TransferLength = req->Count; - mtd.MediaID = handle->MediaID; - mtd.Function = MTD_REQ_WRITE; - if (req->Attributes & MEM_OP_BUFFER_KERNEL) - mtd.Function |= MTD_REQ_KERNEL; - return do_mtd_request(handle, &mtd, buf); -} /* write_memory */ - -/*====================================================================== - - This isn't needed for anything I could think of. - -======================================================================*/ - -int pcmcia_copy_memory(memory_handle_t handle, copy_op_t *req) -{ - if (CHECK_REGION(handle)) - return CS_BAD_HANDLE; - return CS_UNSUPPORTED_FUNCTION; -} - +#endif diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 317ca50a3db3..0cedf0c7d5da 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c @@ -376,12 +376,8 @@ int verify_cis_cache(struct pcmcia_socket *s) ======================================================================*/ -int pcmcia_replace_cis(client_handle_t handle, cisdump_t *cis) +int pcmcia_replace_cis(struct pcmcia_socket *s, cisdump_t *cis) { - struct pcmcia_socket *s; - if (CHECK_HANDLE(handle)) - return CS_BAD_HANDLE; - s = SOCKET(handle); if (s->fake_cis != NULL) { kfree(s->fake_cis); s->fake_cis = NULL; @@ -414,14 +410,12 @@ typedef struct tuple_flags { #define MFC_FN(f) (((tuple_flags *)(&(f)))->mfc_fn) #define SPACE(f) (((tuple_flags *)(&(f)))->space) -int pcmcia_get_next_tuple(client_handle_t handle, tuple_t *tuple); +int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int func, tuple_t *tuple); -int pcmcia_get_first_tuple(client_handle_t handle, tuple_t *tuple) +int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, tuple_t *tuple) { - struct pcmcia_socket *s; - if (CHECK_HANDLE(handle)) + if (!s) return CS_BAD_HANDLE; - s = SOCKET(handle); if (!(s->state & SOCKET_PRESENT)) return CS_NO_CARD; tuple->TupleLink = tuple->Flags = 0; @@ -443,16 +437,17 @@ int pcmcia_get_first_tuple(client_handle_t handle, tuple_t *tuple) !(tuple->Attributes & TUPLE_RETURN_COMMON)) { cisdata_t req = tuple->DesiredTuple; tuple->DesiredTuple = CISTPL_LONGLINK_MFC; - if (pcmcia_get_next_tuple(handle, tuple) == CS_SUCCESS) { + if (pccard_get_next_tuple(s, function, tuple) == CS_SUCCESS) { tuple->DesiredTuple = CISTPL_LINKTARGET; - if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS) + if (pccard_get_next_tuple(s, function, tuple) != CS_SUCCESS) return CS_NO_MORE_ITEMS; } else tuple->CISOffset = tuple->TupleLink = 0; tuple->DesiredTuple = req; } - return pcmcia_get_next_tuple(handle, tuple); + return pccard_get_next_tuple(s, function, tuple); } +EXPORT_SYMBOL(pccard_get_first_tuple); static int follow_link(struct pcmcia_socket *s, tuple_t *tuple) { @@ -494,15 +489,13 @@ static int follow_link(struct pcmcia_socket *s, tuple_t *tuple) return -1; } -int pcmcia_get_next_tuple(client_handle_t handle, tuple_t *tuple) +int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_t *tuple) { - struct pcmcia_socket *s; u_char link[2], tmp; int ofs, i, attr; - - if (CHECK_HANDLE(handle)) + + if (!s) return CS_BAD_HANDLE; - s = SOCKET(handle); if (!(s->state & SOCKET_PRESENT)) return CS_NO_CARD; @@ -554,14 +547,14 @@ int pcmcia_get_next_tuple(client_handle_t handle, tuple_t *tuple) case CISTPL_LONGLINK_MFC: tuple->LinkOffset = ofs + 3; LINK_SPACE(tuple->Flags) = attr; - if (handle->Function == BIND_FN_ALL) { + if (function == BIND_FN_ALL) { /* Follow all the MFC links */ read_cis_cache(s, attr, ofs+2, 1, &tmp); MFC_FN(tuple->Flags) = tmp; } else { /* Follow exactly one of the links */ MFC_FN(tuple->Flags) = 1; - tuple->LinkOffset += handle->Function * 5; + tuple->LinkOffset += function * 5; } break; case CISTPL_NO_LINK: @@ -589,20 +582,18 @@ int pcmcia_get_next_tuple(client_handle_t handle, tuple_t *tuple) tuple->CISOffset = ofs + 2; return CS_SUCCESS; } +EXPORT_SYMBOL(pccard_get_next_tuple); /*====================================================================*/ #define _MIN(a, b) (((a) < (b)) ? (a) : (b)) -int pcmcia_get_tuple_data(client_handle_t handle, tuple_t *tuple) +int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple) { - struct pcmcia_socket *s; u_int len; - - if (CHECK_HANDLE(handle)) - return CS_BAD_HANDLE; - s = SOCKET(handle); + if (!s) + return CS_BAD_HANDLE; if (tuple->TupleLink < tuple->TupleOffset) return CS_NO_MORE_ITEMS; @@ -615,6 +606,8 @@ int pcmcia_get_tuple_data(client_handle_t handle, tuple_t *tuple) _MIN(len, tuple->TupleDataMax), tuple->TupleData); return CS_SUCCESS; } +EXPORT_SYMBOL(pccard_get_tuple_data); + /*====================================================================== @@ -1320,7 +1313,7 @@ static int parse_format(tuple_t *tuple, cistpl_format_t *fmt) /*====================================================================*/ -int pcmcia_parse_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) +int pccard_parse_tuple(tuple_t *tuple, cisparse_t *parse) { int ret = CS_SUCCESS; @@ -1401,6 +1394,7 @@ int pcmcia_parse_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse } return ret; } +EXPORT_SYMBOL(pccard_parse_tuple); /*====================================================================== @@ -1408,7 +1402,7 @@ int pcmcia_parse_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse ======================================================================*/ -int read_tuple(client_handle_t handle, cisdata_t code, void *parse) +int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t code, void *parse) { tuple_t tuple; cisdata_t *buf; @@ -1419,18 +1413,19 @@ int read_tuple(client_handle_t handle, cisdata_t code, void *parse) return CS_OUT_OF_RESOURCE; tuple.DesiredTuple = code; tuple.Attributes = TUPLE_RETURN_COMMON; - ret = pcmcia_get_first_tuple(handle, &tuple); + ret = pccard_get_first_tuple(s, function, &tuple); if (ret != CS_SUCCESS) goto done; tuple.TupleData = buf; tuple.TupleOffset = 0; tuple.TupleDataMax = 255; - ret = pcmcia_get_tuple_data(handle, &tuple); + ret = pccard_get_tuple_data(s, &tuple); if (ret != CS_SUCCESS) goto done; - ret = pcmcia_parse_tuple(handle, &tuple, parse); + ret = pccard_parse_tuple(&tuple, parse); done: kfree(buf); return ret; } +EXPORT_SYMBOL(pccard_read_tuple); /*====================================================================== @@ -1442,14 +1437,15 @@ done: ======================================================================*/ -int pcmcia_validate_cis(client_handle_t handle, cisinfo_t *info) +int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, cisinfo_t *info) { tuple_t *tuple; cisparse_t *p; int ret, reserved, dev_ok = 0, ident_ok = 0; - if (CHECK_HANDLE(handle)) + if (!s) return CS_BAD_HANDLE; + tuple = kmalloc(sizeof(*tuple), GFP_KERNEL); if (tuple == NULL) return CS_OUT_OF_RESOURCE; @@ -1462,30 +1458,30 @@ int pcmcia_validate_cis(client_handle_t handle, cisinfo_t *info) info->Chains = reserved = 0; tuple->DesiredTuple = RETURN_FIRST_TUPLE; tuple->Attributes = TUPLE_RETURN_COMMON; - ret = pcmcia_get_first_tuple(handle, tuple); + ret = pccard_get_first_tuple(s, function, tuple); if (ret != CS_SUCCESS) goto done; /* First tuple should be DEVICE; we should really have either that or a CFTABLE_ENTRY of some sort */ if ((tuple->TupleCode == CISTPL_DEVICE) || - (read_tuple(handle, CISTPL_CFTABLE_ENTRY, p) == CS_SUCCESS) || - (read_tuple(handle, CISTPL_CFTABLE_ENTRY_CB, p) == CS_SUCCESS)) + (pccard_read_tuple(s, function, CISTPL_CFTABLE_ENTRY, p) == CS_SUCCESS) || + (pccard_read_tuple(s, function, CISTPL_CFTABLE_ENTRY_CB, p) == CS_SUCCESS)) dev_ok++; /* All cards should have a MANFID tuple, and/or a VERS_1 or VERS_2 tuple, for card identification. Certain old D-Link and Linksys cards have only a broken VERS_2 tuple; hence the bogus test. */ - if ((read_tuple(handle, CISTPL_MANFID, p) == CS_SUCCESS) || - (read_tuple(handle, CISTPL_VERS_1, p) == CS_SUCCESS) || - (read_tuple(handle, CISTPL_VERS_2, p) != CS_NO_MORE_ITEMS)) + if ((pccard_read_tuple(s, function, CISTPL_MANFID, p) == CS_SUCCESS) || + (pccard_read_tuple(s, function, CISTPL_VERS_1, p) == CS_SUCCESS) || + (pccard_read_tuple(s, function, CISTPL_VERS_2, p) != CS_NO_MORE_ITEMS)) ident_ok++; if (!dev_ok && !ident_ok) goto done; for (info->Chains = 1; info->Chains < MAX_TUPLES; info->Chains++) { - ret = pcmcia_get_next_tuple(handle, tuple); + ret = pccard_get_next_tuple(s, function, tuple); if (ret != CS_SUCCESS) break; if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) || ((tuple->TupleCode > 0x47) && (tuple->TupleCode < 0x80)) || @@ -1501,4 +1497,4 @@ done: kfree(p); return CS_SUCCESS; } - +EXPORT_SYMBOL(pccard_validate_cis); diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index c33ac27567dc..842a0cfbe556 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -249,7 +249,7 @@ int pcmcia_register_socket(struct pcmcia_socket *socket) /* base address = 0, map = 0 */ socket->cis_mem.flags = 0; socket->cis_mem.speed = cis_speed; - socket->erase_busy.next = socket->erase_busy.prev = &socket->erase_busy; + INIT_LIST_HEAD(&socket->cis_cache); spin_lock_init(&socket->lock); @@ -846,23 +846,18 @@ static void release_io_space(struct pcmcia_socket *s, ioaddr_t base, ======================================================================*/ -int pcmcia_access_configuration_register(client_handle_t handle, +int pccard_access_configuration_register(struct pcmcia_socket *s, + unsigned int function, conf_reg_t *reg) { - struct pcmcia_socket *s; config_t *c; int addr; u_char val; - - if (CHECK_HANDLE(handle)) - return CS_BAD_HANDLE; - s = SOCKET(handle); - if (handle->Function == BIND_FN_ALL) { - if (reg->Function >= s->functions) - return CS_BAD_ARGS; - c = &s->config[reg->Function]; - } else - c = CONFIG(handle); + + if (!s || !s->config) + return CS_NO_CARD; + + c = &s->config[function]; if (c == NULL) return CS_NO_CARD; @@ -887,7 +882,7 @@ int pcmcia_access_configuration_register(client_handle_t handle, } return CS_SUCCESS; } /* access_configuration_register */ - +EXPORT_SYMBOL(pccard_access_configuration_register); /*====================================================================*/ @@ -895,7 +890,6 @@ int pcmcia_deregister_client(client_handle_t handle) { client_t **client; struct pcmcia_socket *s; - memory_handle_t region; u_long flags; int i; @@ -912,14 +906,6 @@ int pcmcia_deregister_client(client_handle_t handle) if (handle->state & CLIENT_WIN_REQ(i)) return CS_IN_USE; - /* Disconnect all MTD links */ - if (handle->mtd_count) { - for (region = s->a_region; region; region = region->info.next) - if (region->mtd == handle) region->mtd = NULL; - for (region = s->c_region; region; region = region->info.next) - if (region->mtd == handle) region->mtd = NULL; - } - if ((handle->state & CLIENT_STALE) || (handle->Attributes & INFO_MASTER_CLIENT)) { spin_lock_irqsave(&s->lock, flags); @@ -936,7 +922,6 @@ int pcmcia_deregister_client(client_handle_t handle) spin_unlock_irqrestore(&s->lock, flags); } else { handle->state = CLIENT_UNBOUND; - handle->mtd_count = 0; handle->event_handler = NULL; } @@ -945,29 +930,20 @@ int pcmcia_deregister_client(client_handle_t handle) /*====================================================================*/ -int pcmcia_get_configuration_info(client_handle_t handle, +int pccard_get_configuration_info(struct pcmcia_socket *s, + unsigned int function, config_info_t *config) { - struct pcmcia_socket *s; config_t *c; - if (CHECK_HANDLE(handle)) - return CS_BAD_HANDLE; - s = SOCKET(handle); if (!(s->state & SOCKET_PRESENT)) return CS_NO_CARD; - if (handle->Function == BIND_FN_ALL) { - if (config->Function && (config->Function >= s->functions)) - return CS_BAD_ARGS; - } else - config->Function = handle->Function; - + config->Function = function; + #ifdef CONFIG_CARDBUS if (s->state & SOCKET_CARDBUS) { - u_char fn = config->Function; memset(config, 0, sizeof(config_info_t)); - config->Function = fn; config->Vcc = s->socket.Vcc; config->Vpp1 = config->Vpp2 = s->socket.Vpp; config->Option = s->cb_dev->subordinate->number; @@ -984,7 +960,7 @@ int pcmcia_get_configuration_info(client_handle_t handle, } #endif - c = (s->config != NULL) ? &s->config[config->Function] : NULL; + c = (s->config != NULL) ? &s->config[function] : NULL; if ((c == NULL) || !(c->state & CONFIG_LOCKED)) { config->Attributes = 0; @@ -1009,6 +985,7 @@ int pcmcia_get_configuration_info(client_handle_t handle, return CS_SUCCESS; } /* get_configuration_info */ +EXPORT_SYMBOL(pccard_get_configuration_info); /*====================================================================== @@ -1033,6 +1010,8 @@ int pcmcia_get_card_services_info(servinfo_t *info) return CS_SUCCESS; } /* get_card_services_info */ +#ifdef CONFIG_PCMCIA_OBSOLETE + /*====================================================================== Note that get_first_client() *does* recognize the Socket field @@ -1056,6 +1035,7 @@ int pcmcia_get_first_client(client_handle_t *handle, client_req_t *req) *handle = socket->clients; return CS_SUCCESS; } /* get_first_client */ +EXPORT_SYMBOL(pcmcia_get_first_client); /*====================================================================*/ @@ -1075,20 +1055,17 @@ int pcmcia_get_next_client(client_handle_t *handle, client_req_t *req) *handle = (*handle)->next; return CS_SUCCESS; } /* get_next_client */ +EXPORT_SYMBOL(pcmcia_get_next_client); +#endif /* CONFIG_PCMCIA_OBSOLETE */ /*====================================================================*/ -int pcmcia_get_window(window_handle_t *handle, int idx, win_req_t *req) +int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, int idx, win_req_t *req) { - struct pcmcia_socket *s; window_t *win; int w; - if (idx == 0) - s = ((client_handle_t)*handle)->Socket; - else - s = (*handle)->sock; - if (!(s->state & SOCKET_PRESENT)) + if (!s || !(s->state & SOCKET_PRESENT)) return CS_NO_CARD; for (w = idx; w < MAX_WIN; w++) if (s->state & SOCKET_WIN_REQ(w)) break; @@ -1110,20 +1087,7 @@ int pcmcia_get_window(window_handle_t *handle, int idx, win_req_t *req) *handle = win; return CS_SUCCESS; } /* get_window */ - -int pcmcia_get_first_window(window_handle_t *win, win_req_t *req) -{ - if ((win == NULL) || ((*win)->magic != WINDOW_MAGIC)) - return CS_BAD_HANDLE; - return pcmcia_get_window(win, 0, req); -} - -int pcmcia_get_next_window(window_handle_t *win, win_req_t *req) -{ - if ((win == NULL) || ((*win)->magic != WINDOW_MAGIC)) - return CS_BAD_HANDLE; - return pcmcia_get_window(win, (*win)->index+1, req); -} +EXPORT_SYMBOL(pcmcia_get_window); /*===================================================================== @@ -1133,14 +1097,9 @@ int pcmcia_get_next_window(window_handle_t *win, win_req_t *req) #ifdef CONFIG_CARDBUS -struct pci_bus *pcmcia_lookup_bus(client_handle_t handle) +struct pci_bus *pcmcia_lookup_bus(struct pcmcia_socket *s) { - struct pcmcia_socket *s; - - if (CHECK_HANDLE(handle)) - return NULL; - s = SOCKET(handle); - if (!(s->state & SOCKET_CARDBUS)) + if (!s || !(s->state & SOCKET_CARDBUS)) return NULL; return s->cb_dev->subordinate; @@ -1157,15 +1116,11 @@ EXPORT_SYMBOL(pcmcia_lookup_bus); ======================================================================*/ -int pcmcia_get_status(client_handle_t handle, cs_status_t *status) +int pccard_get_status(struct pcmcia_socket *s, unsigned int function, cs_status_t *status) { - struct pcmcia_socket *s; config_t *c; int val; - if (CHECK_HANDLE(handle)) - return CS_BAD_HANDLE; - s = SOCKET(handle); s->ops->get_status(s, &val); status->CardState = status->SocketState = 0; status->CardState |= (val & SS_DETECT) ? CS_EVENT_CARD_DETECT : 0; @@ -1177,13 +1132,7 @@ int pcmcia_get_status(client_handle_t handle, cs_status_t *status) if (!(s->state & SOCKET_PRESENT)) return CS_NO_CARD; - /* Get info from the PRR, if necessary */ - if (handle->Function == BIND_FN_ALL) { - if (status->Function && (status->Function >= s->functions)) - return CS_BAD_ARGS; - c = (s->config != NULL) ? &s->config[status->Function] : NULL; - } else - c = CONFIG(handle); + c = (s->config != NULL) ? &s->config[function] : NULL; if ((c != NULL) && (c->state & CONFIG_LOCKED) && (c->IntType & (INT_MEMORY_AND_IO | INT_ZOOMED_VIDEO))) { u_char reg; @@ -1218,6 +1167,7 @@ int pcmcia_get_status(client_handle_t handle, cs_status_t *status) (val & SS_READY) ? CS_EVENT_READY_CHANGE : 0; return CS_SUCCESS; } /* get_status */ +EXPORT_SYMBOL(pccard_get_status); /*====================================================================== @@ -1297,6 +1247,8 @@ int pcmcia_modify_configuration(client_handle_t handle, return CS_SUCCESS; } /* modify_configuration */ +#ifdef CONFIG_PCMCIA_OBSOLETE + /*====================================================================== Modify the attributes of a window returned by RequestWindow. @@ -1322,6 +1274,10 @@ int pcmcia_modify_window(window_handle_t win, modwin_t *req) return CS_SUCCESS; } /* modify_window */ +EXPORT_SYMBOL(pcmcia_modify_window); + +#endif /* CONFIG_PCMCIA_OBSOLETE */ + /*====================================================================== @@ -1371,7 +1327,7 @@ int pcmcia_register_client(client_handle_t *handle, client_reg_t *req) if ((!(s->state & SOCKET_CARDBUS)) && (s->functions == 0) && (client->Function != BIND_FN_ALL)) { cistpl_longlink_mfc_t mfc; - if (read_tuple(client, CISTPL_LONGLINK_MFC, &mfc) + if (pccard_read_tuple(s, client->Function, CISTPL_LONGLINK_MFC, &mfc) == CS_SUCCESS) s->functions = mfc.nfn; else @@ -1915,14 +1871,10 @@ int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle ======================================================================*/ -int pcmcia_reset_card(client_handle_t handle, client_req_t *req) +int pccard_reset_card(struct pcmcia_socket *skt) { - struct pcmcia_socket *skt; int ret; - if (CHECK_HANDLE(handle)) - return CS_BAD_HANDLE; - skt = SOCKET(handle); cs_dbg(skt, 1, "resetting socket\n"); down(&skt->skt_sem); @@ -1947,15 +1899,13 @@ int pcmcia_reset_card(client_handle_t handle, client_req_t *req) send_event(skt, CS_EVENT_CARD_RESET, CS_EVENT_PRI_LOW); } - handle->event_callback_args.info = (void *)(u_long)ret; - EVENT(handle, CS_EVENT_RESET_COMPLETE, CS_EVENT_PRI_LOW); - ret = CS_SUCCESS; } while (0); up(&skt->skt_sem); return ret; } /* reset_card */ +EXPORT_SYMBOL(pccard_reset_card); /*====================================================================== @@ -2073,6 +2023,7 @@ int pcmcia_insert_card(struct pcmcia_socket *skt) ======================================================================*/ +#ifdef CONFIG_PCMCIA_OBSOLETE int pcmcia_set_event_mask(client_handle_t handle, eventmask_t *mask) { u_int events, bit; @@ -2090,6 +2041,9 @@ int pcmcia_set_event_mask(client_handle_t handle, eventmask_t *mask) } return CS_SUCCESS; } /* set_event_mask */ +EXPORT_SYMBOL(pcmcia_set_event_mask); + +#endif /* CONFIG_PCMCIA_OBSOLETE */ /*====================================================================== @@ -2097,37 +2051,14 @@ int pcmcia_set_event_mask(client_handle_t handle, eventmask_t *mask) ======================================================================*/ /* in alpha order */ -EXPORT_SYMBOL(pcmcia_access_configuration_register); -EXPORT_SYMBOL(pcmcia_adjust_resource_info); -EXPORT_SYMBOL(pcmcia_check_erase_queue); -EXPORT_SYMBOL(pcmcia_close_memory); -EXPORT_SYMBOL(pcmcia_copy_memory); EXPORT_SYMBOL(pcmcia_deregister_client); -EXPORT_SYMBOL(pcmcia_deregister_erase_queue); EXPORT_SYMBOL(pcmcia_eject_card); -EXPORT_SYMBOL(pcmcia_get_first_client); EXPORT_SYMBOL(pcmcia_get_card_services_info); -EXPORT_SYMBOL(pcmcia_get_configuration_info); EXPORT_SYMBOL(pcmcia_get_mem_page); -EXPORT_SYMBOL(pcmcia_get_next_client); -EXPORT_SYMBOL(pcmcia_get_first_region); -EXPORT_SYMBOL(pcmcia_get_first_tuple); -EXPORT_SYMBOL(pcmcia_get_first_window); -EXPORT_SYMBOL(pcmcia_get_next_region); -EXPORT_SYMBOL(pcmcia_get_next_tuple); -EXPORT_SYMBOL(pcmcia_get_next_window); -EXPORT_SYMBOL(pcmcia_get_status); -EXPORT_SYMBOL(pcmcia_get_tuple_data); EXPORT_SYMBOL(pcmcia_insert_card); EXPORT_SYMBOL(pcmcia_map_mem_page); EXPORT_SYMBOL(pcmcia_modify_configuration); -EXPORT_SYMBOL(pcmcia_modify_window); -EXPORT_SYMBOL(pcmcia_open_memory); -EXPORT_SYMBOL(pcmcia_parse_tuple); -EXPORT_SYMBOL(pcmcia_read_memory); EXPORT_SYMBOL(pcmcia_register_client); -EXPORT_SYMBOL(pcmcia_register_erase_queue); -EXPORT_SYMBOL(pcmcia_register_mtd); EXPORT_SYMBOL(pcmcia_release_configuration); EXPORT_SYMBOL(pcmcia_release_io); EXPORT_SYMBOL(pcmcia_release_irq); @@ -2137,15 +2068,10 @@ EXPORT_SYMBOL(pcmcia_request_configuration); EXPORT_SYMBOL(pcmcia_request_io); EXPORT_SYMBOL(pcmcia_request_irq); EXPORT_SYMBOL(pcmcia_request_window); -EXPORT_SYMBOL(pcmcia_reset_card); EXPORT_SYMBOL(pcmcia_resume_card); -EXPORT_SYMBOL(pcmcia_set_event_mask); EXPORT_SYMBOL(pcmcia_suspend_card); -EXPORT_SYMBOL(pcmcia_validate_cis); -EXPORT_SYMBOL(pcmcia_write_memory); EXPORT_SYMBOL(dead_socket); -EXPORT_SYMBOL(MTDHelperEntry); EXPORT_SYMBOL(pcmcia_parse_events); struct class pcmcia_socket_class = { diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index e148fb96746a..fbce6b67988b 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h @@ -21,14 +21,6 @@ #include <linux/config.h> -#define ERASEQ_MAGIC 0xFA67 -typedef struct eraseq_t { - u_short eraseq_magic; - client_handle_t handle; - int count; - eraseq_entry_t *entry; -} eraseq_t; - #define CLIENT_MAGIC 0x51E6 typedef struct client_t { u_short client_magic; @@ -42,9 +34,6 @@ typedef struct client_t { event_callback_args_t *); event_callback_args_t event_callback_args; struct client_t *next; - u_int mtd_count; - wait_queue_head_t mtd_req; - erase_busy_t erase_busy; } client_t; /* Flags in client state */ @@ -157,27 +146,7 @@ void write_cis_mem(struct pcmcia_socket *s, int attr, void release_cis_mem(struct pcmcia_socket *s); void destroy_cis_cache(struct pcmcia_socket *s); int verify_cis_cache(struct pcmcia_socket *s); -void preload_cis_cache(struct pcmcia_socket *s); -int get_first_tuple(client_handle_t handle, tuple_t *tuple); -int get_next_tuple(client_handle_t handle, tuple_t *tuple); -int get_tuple_data(client_handle_t handle, tuple_t *tuple); -int parse_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse); -int validate_cis(client_handle_t handle, cisinfo_t *info); -int replace_cis(client_handle_t handle, cisdump_t *cis); -int read_tuple(client_handle_t handle, cisdata_t code, void *parse); - -/* In bulkmem.c */ -int get_first_region(client_handle_t handle, region_info_t *rgn); -int get_next_region(client_handle_t handle, region_info_t *rgn); -int register_mtd(client_handle_t handle, mtd_reg_t *reg); -int register_erase_queue(client_handle_t *handle, eraseq_hdr_t *header); -int deregister_erase_queue(eraseq_handle_t eraseq); -int check_erase_queue(eraseq_handle_t eraseq); -int open_memory(client_handle_t *handle, open_mem_t *open); -int close_memory(memory_handle_t handle); -int read_memory(memory_handle_t handle, mem_op_t *req, caddr_t buf); -int write_memory(memory_handle_t handle, mem_op_t *req, caddr_t buf); -int copy_memory(memory_handle_t handle, copy_op_t *req); +int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t code, void *parse); /* In rsrc_mgr */ void pcmcia_validate_mem(struct pcmcia_socket *s); @@ -198,6 +167,11 @@ extern struct class_interface pccard_sysfs_interface; /* In cs.c */ extern struct rw_semaphore pcmcia_socket_list_rwsem; extern struct list_head pcmcia_socket_list; +int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, int idx, win_req_t *req); +int pccard_get_configuration_info(struct pcmcia_socket *s, unsigned int function, config_info_t *config); +int pccard_reset_card(struct pcmcia_socket *skt); +int pccard_get_status(struct pcmcia_socket *s, unsigned int function, cs_status_t *status); +int pccard_access_configuration_register(struct pcmcia_socket *s, unsigned int function, conf_reg_t *reg); #define cs_socket_name(skt) ((skt)->dev.class_id) diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index b4f741a12cce..41163a17ec03 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -75,7 +75,7 @@ MODULE_DESCRIPTION("PCMCIA Driver Services"); MODULE_LICENSE("Dual MPL/GPL"); #ifdef DEBUG -static int pc_debug; +int pc_debug; module_param(pc_debug, int, 0644); @@ -167,9 +167,6 @@ static int pcmcia_bind_device(bind_req_t *req) client->Socket = s; client->Function = req->Function; client->state = CLIENT_UNBOUND; - client->erase_busy.next = &client->erase_busy; - client->erase_busy.prev = &client->erase_busy; - init_waitqueue_head(&client->mtd_req); client->next = s->clients; s->clients = client; ds_dbg(1, "%s: bind_device(): client 0x%p, dev %s\n", @@ -630,6 +627,8 @@ static int bind_request(struct pcmcia_bus_socket *s, bind_info_t *bind_info) /*====================================================================*/ +extern struct pci_bus *pcmcia_lookup_bus(struct pcmcia_socket *s); + static int get_device_info(struct pcmcia_bus_socket *s, bind_info_t *bind_info, int first) { socket_bind_t *b; @@ -643,7 +642,7 @@ static int get_device_info(struct pcmcia_bus_socket *s, bind_info_t *bind_info, { struct pci_bus *bus; - bus = pcmcia_lookup_bus(s->handle); + bus = pcmcia_lookup_bus(s->parent); if (bus) { struct list_head *list; struct pci_dev *dev = NULL; @@ -885,6 +884,10 @@ static u_int ds_poll(struct file *file, poll_table *wait) /*====================================================================*/ +extern int pcmcia_adjust_resource_info(adjust_t *adj); +extern int pccard_get_next_region(struct pcmcia_socket *s, region_info_t *rgn); +extern int pccard_get_first_region(struct pcmcia_socket *s, region_info_t *rgn); + static int ds_ioctl(struct inode * inode, struct file * file, u_int cmd, u_long arg) { @@ -933,39 +936,47 @@ static int ds_ioctl(struct inode * inode, struct file * file, switch (cmd) { case DS_ADJUST_RESOURCE_INFO: - ret = pcmcia_adjust_resource_info(s->handle, &buf.adjust); + ret = pcmcia_adjust_resource_info(&buf.adjust); break; case DS_GET_CARD_SERVICES_INFO: ret = pcmcia_get_card_services_info(&buf.servinfo); break; case DS_GET_CONFIGURATION_INFO: - ret = pcmcia_get_configuration_info(s->handle, &buf.config); + if (buf.config.Function && + (buf.config.Function >= s->parent->functions)) + ret = CS_BAD_ARGS; + else + ret = pccard_get_configuration_info(s->parent, buf.config.Function, &buf.config); break; case DS_GET_FIRST_TUPLE: pcmcia_validate_mem(s->parent); - ret = pcmcia_get_first_tuple(s->handle, &buf.tuple); + ret = pccard_get_first_tuple(s->parent, BIND_FN_ALL, &buf.tuple); break; case DS_GET_NEXT_TUPLE: - ret = pcmcia_get_next_tuple(s->handle, &buf.tuple); + ret = pccard_get_next_tuple(s->parent, BIND_FN_ALL, &buf.tuple); break; case DS_GET_TUPLE_DATA: buf.tuple.TupleData = buf.tuple_parse.data; buf.tuple.TupleDataMax = sizeof(buf.tuple_parse.data); - ret = pcmcia_get_tuple_data(s->handle, &buf.tuple); + ret = pccard_get_tuple_data(s->parent, &buf.tuple); break; case DS_PARSE_TUPLE: buf.tuple.TupleData = buf.tuple_parse.data; - ret = pcmcia_parse_tuple(s->handle, &buf.tuple, &buf.tuple_parse.parse); + ret = pccard_parse_tuple(&buf.tuple, &buf.tuple_parse.parse); break; case DS_RESET_CARD: - ret = pcmcia_reset_card(s->handle, NULL); + ret = pccard_reset_card(s->parent); break; case DS_GET_STATUS: - ret = pcmcia_get_status(s->handle, &buf.status); + if (buf.status.Function && + (buf.status.Function >= s->parent->functions)) + ret = CS_BAD_ARGS; + else + ret = pccard_get_status(s->parent, buf.status.Function, &buf.status); break; case DS_VALIDATE_CIS: pcmcia_validate_mem(s->parent); - ret = pcmcia_validate_cis(s->handle, &buf.cisinfo); + ret = pccard_validate_cis(s->parent, BIND_FN_ALL, &buf.cisinfo); break; case DS_SUSPEND_CARD: ret = pcmcia_suspend_card(s->parent); @@ -982,27 +993,30 @@ static int ds_ioctl(struct inode * inode, struct file * file, case DS_ACCESS_CONFIGURATION_REGISTER: if ((buf.conf_reg.Action == CS_WRITE) && !capable(CAP_SYS_ADMIN)) return -EPERM; - ret = pcmcia_access_configuration_register(s->handle, &buf.conf_reg); + if (buf.conf_reg.Function && + (buf.conf_reg.Function >= s->parent->functions)) + ret = CS_BAD_ARGS; + else + ret = pccard_access_configuration_register(s->parent, buf.conf_reg.Function, &buf.conf_reg); break; case DS_GET_FIRST_REGION: - ret = pcmcia_get_first_region(s->handle, &buf.region); + ret = pccard_get_first_region(s->parent, &buf.region); break; case DS_GET_NEXT_REGION: - ret = pcmcia_get_next_region(s->handle, &buf.region); + ret = pccard_get_next_region(s->parent, &buf.region); break; case DS_GET_FIRST_WINDOW: - buf.win_info.handle = (window_handle_t)s->handle; - ret = pcmcia_get_first_window(&buf.win_info.handle, &buf.win_info.window); + ret = pcmcia_get_window(s->parent, &buf.win_info.handle, 0, &buf.win_info.window); break; case DS_GET_NEXT_WINDOW: - ret = pcmcia_get_next_window(&buf.win_info.handle, &buf.win_info.window); + ret = pcmcia_get_window(s->parent, &buf.win_info.handle, buf.win_info.handle->index + 1, &buf.win_info.window); break; case DS_GET_MEM_PAGE: ret = pcmcia_get_mem_page(buf.win_info.handle, &buf.win_info.map); break; case DS_REPLACE_CIS: - ret = pcmcia_replace_cis(s->handle, &buf.cisdump); + ret = pcmcia_replace_cis(s->parent, &buf.cisdump); break; case DS_BIND_REQUEST: if (!capable(CAP_SYS_ADMIN)) return -EPERM; @@ -1244,3 +1258,5 @@ static struct pcmcia_driver * get_pcmcia_driver (dev_info_t *dev_info) return cmp.drv; return NULL; } + +MODULE_ALIAS("ds"); diff --git a/drivers/pcmcia/pcmcia_compat.c b/drivers/pcmcia/pcmcia_compat.c new file mode 100644 index 000000000000..673d34576d3b --- /dev/null +++ b/drivers/pcmcia/pcmcia_compat.c @@ -0,0 +1,145 @@ +/* + * PCMCIA 16-bit compatibility functions + * + * The initial developer of the original code is David A. Hinds + * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. + * + * Copyright (C) 2004 Dominik Brodowski + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#include <linux/config.h> +#include <linux/module.h> +#include <linux/init.h> + +#define IN_CARD_SERVICES +#include <pcmcia/version.h> +#include <pcmcia/cs_types.h> +#include <pcmcia/cs.h> +#include <pcmcia/bulkmem.h> +#include <pcmcia/cistpl.h> +#include <pcmcia/ds.h> +#include <pcmcia/ss.h> + +#include "cs_internal.h" + +int pcmcia_get_first_tuple(client_handle_t handle, tuple_t *tuple) +{ + struct pcmcia_socket *s; + if (CHECK_HANDLE(handle)) + return CS_BAD_HANDLE; + s = SOCKET(handle); + return pccard_get_first_tuple(s, handle->Function, tuple); +} +EXPORT_SYMBOL(pcmcia_get_first_tuple); + +int pcmcia_get_next_tuple(client_handle_t handle, tuple_t *tuple) +{ + struct pcmcia_socket *s; + if (CHECK_HANDLE(handle)) + return CS_BAD_HANDLE; + s = SOCKET(handle); + return pccard_get_next_tuple(s, handle->Function, tuple); +} +EXPORT_SYMBOL(pcmcia_get_next_tuple); + +int pcmcia_get_tuple_data(client_handle_t handle, tuple_t *tuple) +{ + struct pcmcia_socket *s; + if (CHECK_HANDLE(handle)) + return CS_BAD_HANDLE; + s = SOCKET(handle); + return pccard_get_tuple_data(s, tuple); +} +EXPORT_SYMBOL(pcmcia_get_tuple_data); + +int pcmcia_parse_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) +{ + return pccard_parse_tuple(tuple, parse); +} +EXPORT_SYMBOL(pcmcia_parse_tuple); + +int pcmcia_validate_cis(client_handle_t handle, cisinfo_t *info) +{ + struct pcmcia_socket *s; + if (CHECK_HANDLE(handle)) + return CS_BAD_HANDLE; + s = SOCKET(handle); + return pccard_validate_cis(s, handle->Function, info); +} +EXPORT_SYMBOL(pcmcia_validate_cis); + +int pcmcia_get_configuration_info(client_handle_t handle, + config_info_t *config) +{ + struct pcmcia_socket *s; + + if ((CHECK_HANDLE(handle)) || !config) + return CS_BAD_HANDLE; + s = SOCKET(handle); + if (!s) + return CS_BAD_HANDLE; + return pccard_get_configuration_info(s, handle->Function, config); +} +EXPORT_SYMBOL(pcmcia_get_configuration_info); + +int pcmcia_reset_card(client_handle_t handle, client_req_t *req) +{ + struct pcmcia_socket *skt; + + if (CHECK_HANDLE(handle)) + return CS_BAD_HANDLE; + skt = SOCKET(handle); + if (!skt) + return CS_BAD_HANDLE; + + return pccard_reset_card(skt); +} +EXPORT_SYMBOL(pcmcia_reset_card); + +int pcmcia_get_status(client_handle_t handle, cs_status_t *status) +{ + struct pcmcia_socket *s; + if (CHECK_HANDLE(handle)) + return CS_BAD_HANDLE; + s = SOCKET(handle); + return pccard_get_status(s, handle->Function, status); +} +EXPORT_SYMBOL(pcmcia_get_status); + +int pcmcia_access_configuration_register(client_handle_t handle, + conf_reg_t *reg) +{ + struct pcmcia_socket *s; + if (CHECK_HANDLE(handle)) + return CS_BAD_HANDLE; + s = SOCKET(handle); + return pccard_access_configuration_register(s, handle->Function, reg); +} +EXPORT_SYMBOL(pcmcia_access_configuration_register); + +#ifdef CONFIG_PCMCIA_OBSOLETE + +int pcmcia_get_first_window(window_handle_t *win, win_req_t *req) +{ + if ((win == NULL) || ((*win)->magic != WINDOW_MAGIC)) + return CS_BAD_HANDLE; + + return pcmcia_get_window(((client_handle_t)*win)->Socket, win, 0, req); +} +EXPORT_SYMBOL(pcmcia_get_first_window); + +int pcmcia_get_next_window(window_handle_t *win, win_req_t *req) +{ + if ((win == NULL) || ((*win)->magic != WINDOW_MAGIC)) + return CS_BAD_HANDLE; + return pcmcia_get_window((*win)->sock, win, (*win)->index+1, req); +} +EXPORT_SYMBOL(pcmcia_get_next_window); + +#endif diff --git a/drivers/pcmcia/rsrc_mgr.c b/drivers/pcmcia/rsrc_mgr.c index 620b20f7e040..4e0ca166dade 100644 --- a/drivers/pcmcia/rsrc_mgr.c +++ b/drivers/pcmcia/rsrc_mgr.c @@ -307,7 +307,7 @@ static int readable(struct pcmcia_socket *s, struct resource *res, cisinfo_t *in s->cis_mem.res = res; s->cis_virt = ioremap(res->start, s->map_size); if (s->cis_virt) { - ret = pcmcia_validate_cis(s->clients, info); + ret = pccard_validate_cis(s, BIND_FN_ALL, info); /* invalidate mapping and CIS cache */ iounmap(s->cis_virt); s->cis_virt = NULL; @@ -973,11 +973,8 @@ static int adjust_irq(adjust_t *adj) /*====================================================================*/ -int pcmcia_adjust_resource_info(client_handle_t handle, adjust_t *adj) +int pcmcia_adjust_resource_info(adjust_t *adj) { - if (CHECK_HANDLE(handle)) - return CS_BAD_HANDLE; - switch (adj->Resource) { case RES_MEMORY_RANGE: return adjust_memory(adj); @@ -991,6 +988,7 @@ int pcmcia_adjust_resource_info(client_handle_t handle, adjust_t *adj) } return CS_UNSUPPORTED_FUNCTION; } +EXPORT_SYMBOL(pcmcia_adjust_resource_info); /*====================================================================*/ diff --git a/include/pcmcia/bulkmem.h b/include/pcmcia/bulkmem.h index c21d64d62b60..f6954220f419 100644 --- a/include/pcmcia/bulkmem.h +++ b/include/pcmcia/bulkmem.h @@ -53,155 +53,7 @@ typedef struct region_info_t { #define REGION_BAR_MASK 0xe000 #define REGION_BAR_SHIFT 13 -/* For OpenMemory */ -typedef struct open_mem_t { - u_int Attributes; - u_int Offset; -} open_mem_t; - -/* Attributes for OpenMemory */ -#define MEMORY_TYPE 0x0001 -#define MEMORY_TYPE_CM 0x0000 -#define MEMORY_TYPE_AM 0x0001 -#define MEMORY_EXCLUSIVE 0x0002 -#define MEMORY_PREFETCH 0x0008 -#define MEMORY_CACHEABLE 0x0010 -#define MEMORY_BAR_MASK 0xe000 -#define MEMORY_BAR_SHIFT 13 - -typedef struct eraseq_entry_t { - memory_handle_t Handle; - u_char State; - u_int Size; - u_int Offset; - void *Optional; -} eraseq_entry_t; - -typedef struct eraseq_hdr_t { - int QueueEntryCnt; - eraseq_entry_t *QueueEntryArray; -} eraseq_hdr_t; - -#define ERASE_QUEUED 0x00 -#define ERASE_IN_PROGRESS(n) (((n) > 0) && ((n) < 0x80)) -#define ERASE_IDLE 0xff -#define ERASE_PASSED 0xe0 -#define ERASE_FAILED 0xe1 - -#define ERASE_MISSING 0x80 -#define ERASE_MEDIA_WRPROT 0x84 -#define ERASE_NOT_ERASABLE 0x85 -#define ERASE_BAD_OFFSET 0xc1 -#define ERASE_BAD_TECH 0xc2 -#define ERASE_BAD_SOCKET 0xc3 -#define ERASE_BAD_VCC 0xc4 -#define ERASE_BAD_VPP 0xc5 -#define ERASE_BAD_SIZE 0xc6 - -/* For CopyMemory */ -typedef struct copy_op_t { - u_int Attributes; - u_int SourceOffset; - u_int DestOffset; - u_int Count; -} copy_op_t; - -/* For ReadMemory and WriteMemory */ -typedef struct mem_op_t { - u_int Attributes; - u_int Offset; - u_int Count; -} mem_op_t; - -#define MEM_OP_BUFFER 0x01 -#define MEM_OP_BUFFER_USER 0x00 -#define MEM_OP_BUFFER_KERNEL 0x01 -#define MEM_OP_DISABLE_ERASE 0x02 -#define MEM_OP_VERIFY 0x04 - -/* For RegisterMTD */ -typedef struct mtd_reg_t { - u_int Attributes; - u_int Offset; - u_long MediaID; -} mtd_reg_t; - -/* - * Definitions for MTD requests - */ - -typedef struct mtd_request_t { - u_int SrcCardOffset; - u_int DestCardOffset; - u_int TransferLength; - u_int Function; - u_long MediaID; - u_int Status; - u_int Timeout; -} mtd_request_t; - -/* Fields in MTD Function */ -#define MTD_REQ_ACTION 0x003 -#define MTD_REQ_ERASE 0x000 -#define MTD_REQ_READ 0x001 -#define MTD_REQ_WRITE 0x002 -#define MTD_REQ_COPY 0x003 -#define MTD_REQ_NOERASE 0x004 -#define MTD_REQ_VERIFY 0x008 -#define MTD_REQ_READY 0x010 -#define MTD_REQ_TIMEOUT 0x020 -#define MTD_REQ_LAST 0x040 -#define MTD_REQ_FIRST 0x080 -#define MTD_REQ_KERNEL 0x100 - -/* Status codes */ -#define MTD_WAITREQ 0x00 -#define MTD_WAITTIMER 0x01 -#define MTD_WAITRDY 0x02 -#define MTD_WAITPOWER 0x03 - -/* - * Definitions for MTD helper functions - */ - -/* For MTDModifyWindow */ -typedef struct mtd_mod_win_t { - u_int Attributes; - u_int AccessSpeed; - u_int CardOffset; -} mtd_mod_win_t; - -/* For MTDSetVpp */ -typedef struct mtd_vpp_req_t { - u_char Vpp1, Vpp2; -} mtd_vpp_req_t; - -/* For MTDRDYMask */ -typedef struct mtd_rdy_req_t { - u_int Mask; -} mtd_rdy_req_t; - -enum mtd_helper { - MTDRequestWindow, MTDModifyWindow, MTDReleaseWindow, - MTDSetVpp, MTDRDYMask -}; - -#ifdef IN_CARD_SERVICES -extern int MTDHelperEntry(int func, void *a1, void *a2); -#else -extern int MTDHelperEntry(int func, ...); -#endif - int pcmcia_get_first_region(client_handle_t handle, region_info_t *rgn); int pcmcia_get_next_region(client_handle_t handle, region_info_t *rgn); -int pcmcia_register_mtd(client_handle_t handle, mtd_reg_t *reg); -int pcmcia_register_erase_queue(client_handle_t *handle, eraseq_hdr_t *header, eraseq_handle_t *e); -int pcmcia_deregister_erase_queue(eraseq_handle_t eraseq); -int pcmcia_check_erase_queue(eraseq_handle_t eraseq); -int pcmcia_open_memory(client_handle_t *handle, open_mem_t *open, memory_handle_t *m); -int pcmcia_close_memory(memory_handle_t handle); -int pcmcia_read_memory(memory_handle_t handle, mem_op_t *req, caddr_t buf); -int pcmcia_write_memory(memory_handle_t handle, mem_op_t *req, caddr_t buf); -int pcmcia_copy_memory(memory_handle_t handle, copy_op_t *req); #endif /* _LINUX_BULKMEM_H */ diff --git a/include/pcmcia/cistpl.h b/include/pcmcia/cistpl.h index a14f0b91335d..499f748c0028 100644 --- a/include/pcmcia/cistpl.h +++ b/include/pcmcia/cistpl.h @@ -607,6 +607,14 @@ int pcmcia_get_tuple_data(client_handle_t handle, tuple_t *tuple); int pcmcia_parse_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse); int pcmcia_validate_cis(client_handle_t handle, cisinfo_t *info); -int pcmcia_replace_cis(client_handle_t handle, cisdump_t *cis); +int pcmcia_replace_cis(struct pcmcia_socket *s, cisdump_t *cis); + +/* don't use outside of PCMCIA core yet */ +int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int func, tuple_t *tuple); +int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, tuple_t *tuple); +int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple); +int pccard_parse_tuple(tuple_t *tuple, cisparse_t *parse); + +int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, cisinfo_t *info); #endif /* LINUX_CISTPL_H */ diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 871d8f1d9ac8..48eddee1e554 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -348,7 +348,6 @@ typedef struct mtd_bind_t { #define CS_EVENT_RESET_PHYSICAL 0x000200 #define CS_EVENT_CARD_RESET 0x000400 #define CS_EVENT_REGISTRATION_COMPLETE 0x000800 -#define CS_EVENT_RESET_COMPLETE 0x001000 #define CS_EVENT_PM_SUSPEND 0x002000 #define CS_EVENT_PM_RESUME 0x004000 #define CS_EVENT_INSERTION_REQUEST 0x008000 @@ -425,16 +424,12 @@ int pcmcia_access_configuration_register(client_handle_t handle, conf_reg_t *reg int pcmcia_deregister_client(client_handle_t handle); int pcmcia_get_configuration_info(client_handle_t handle, config_info_t *config); int pcmcia_get_card_services_info(servinfo_t *info); -int pcmcia_get_first_client(client_handle_t *handle, client_req_t *req); -int pcmcia_get_next_client(client_handle_t *handle, client_req_t *req); -int pcmcia_get_window(window_handle_t *handle, int idx, win_req_t *req); int pcmcia_get_first_window(window_handle_t *win, win_req_t *req); int pcmcia_get_next_window(window_handle_t *win, win_req_t *req); int pcmcia_get_status(client_handle_t handle, cs_status_t *status); int pcmcia_get_mem_page(window_handle_t win, memreq_t *req); int pcmcia_map_mem_page(window_handle_t win, memreq_t *req); int pcmcia_modify_configuration(client_handle_t handle, modconf_t *mod); -int pcmcia_modify_window(window_handle_t win, modwin_t *req); int pcmcia_register_client(client_handle_t *handle, client_reg_t *req); int pcmcia_release_configuration(client_handle_t handle); int pcmcia_release_io(client_handle_t handle, io_req_t *req); @@ -449,12 +444,14 @@ int pcmcia_suspend_card(struct pcmcia_socket *skt); int pcmcia_resume_card(struct pcmcia_socket *skt); int pcmcia_eject_card(struct pcmcia_socket *skt); int pcmcia_insert_card(struct pcmcia_socket *skt); -int pcmcia_set_event_mask(client_handle_t handle, eventmask_t *mask); int pcmcia_report_error(client_handle_t handle, error_info_t *err); -struct pci_bus *pcmcia_lookup_bus(client_handle_t handle); -/* rsrc_mgr.c */ -int pcmcia_adjust_resource_info(client_handle_t handle, adjust_t *adj); +#ifdef CONFIG_PCMCIA_OBSOLETE +int pcmcia_get_first_client(client_handle_t *handle, client_req_t *req); +int pcmcia_get_next_client(client_handle_t *handle, client_req_t *req); +int pcmcia_modify_window(window_handle_t win, modwin_t *req); +int pcmcia_set_event_mask(client_handle_t handle, eventmask_t *mask); +#endif #endif /* __KERNEL__ */ diff --git a/include/pcmcia/cs_types.h b/include/pcmcia/cs_types.h index abc32897e390..3a4aec08549e 100644 --- a/include/pcmcia/cs_types.h +++ b/include/pcmcia/cs_types.h @@ -56,9 +56,6 @@ typedef struct window_t *window_handle_t; struct region_t; typedef struct region_t *memory_handle_t; -struct eraseq_t; -typedef struct eraseq_t *eraseq_handle_t; - #ifndef DEV_NAME_LEN #define DEV_NAME_LEN 32 #endif diff --git a/include/pcmcia/ftl.h b/include/pcmcia/ftl.h deleted file mode 100644 index 62a8071f2f7f..000000000000 --- a/include/pcmcia/ftl.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * ftl.h 1.8 2000/06/12 21:55:40 - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License - * at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and - * limitations under the License. - * - * The initial developer of the original code is David A. Hinds - * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds - * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. - * - * Alternatively, the contents of this file may be used under the - * terms of the GNU General Public License version 2 (the "GPL"), in which - * case the provisions of the GPL are applicable instead of the - * above. If you wish to allow the use of your version of this file - * only under the terms of the GPL and not to allow others to use - * your version of this file under the MPL, indicate your decision by - * deleting the provisions above and replace them with the notice and - * other provisions required by the GPL. If you do not delete the - * provisions above, a recipient may use your version of this file - * under either the MPL or the GPL. - */ - -#ifndef _LINUX_FTL_H -#define _LINUX_FTL_H - -typedef struct erase_unit_header_t { - u_char LinkTargetTuple[5]; - u_char DataOrgTuple[10]; - u_char NumTransferUnits; - u_int EraseCount; - u_short LogicalEUN; - u_char BlockSize; - u_char EraseUnitSize; - u_short FirstPhysicalEUN; - u_short NumEraseUnits; - u_int FormattedSize; - u_int FirstVMAddress; - u_short NumVMPages; - u_char Flags; - u_char Code; - u_int SerialNumber; - u_int AltEUHOffset; - u_int BAMOffset; - u_char Reserved[12]; - u_char EndTuple[2]; -} erase_unit_header_t; - -/* Flags in erase_unit_header_t */ -#define HIDDEN_AREA 0x01 -#define REVERSE_POLARITY 0x02 -#define DOUBLE_BAI 0x04 - -/* Definitions for block allocation information */ - -#define BLOCK_FREE(b) ((b) == 0xffffffff) -#define BLOCK_DELETED(b) (((b) == 0) || ((b) == 0xfffffffe)) - -#define BLOCK_TYPE(b) ((b) & 0x7f) -#define BLOCK_ADDRESS(b) ((b) & ~0x7f) -#define BLOCK_NUMBER(b) ((b) >> 9) -#define BLOCK_CONTROL 0x30 -#define BLOCK_DATA 0x40 -#define BLOCK_REPLACEMENT 0x60 -#define BLOCK_BAD 0x70 - -#endif /* _LINUX_FTL_H */ diff --git a/include/pcmcia/memory.h b/include/pcmcia/memory.h deleted file mode 100644 index ef87944dd4b3..000000000000 --- a/include/pcmcia/memory.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * memory.h 1.7 2000/06/12 21:55:40 - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License - * at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and - * limitations under the License. - * - * The initial developer of the original code is David A. Hinds - * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds - * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. - * - * Alternatively, the contents of this file may be used under the - * terms of the GNU General Public License version 2 (the "GPL"), in which - * case the provisions of the GPL are applicable instead of the - * above. If you wish to allow the use of your version of this file - * only under the terms of the GPL and not to allow others to use - * your version of this file under the MPL, indicate your decision by - * deleting the provisions above and replace them with the notice and - * other provisions required by the GPL. If you do not delete the - * provisions above, a recipient may use your version of this file - * under either the MPL or the GPL. - */ - -#ifndef _LINUX_MEMORY_H -#define _LINUX_MEMORY_H - -typedef struct erase_info_t { - u_long Offset; - u_long Size; -} erase_info_t; - -#define MEMGETINFO _IOR('M', 1, region_info_t) -#define MEMERASE _IOW('M', 2, erase_info_t) - -#endif /* _LINUX_MEMORY_H */ diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h index 7883d79b9055..1958cda29889 100644 --- a/include/pcmcia/ss.h +++ b/include/pcmcia/ss.h @@ -135,13 +135,6 @@ struct pccard_operations { */ struct pcmcia_socket; -typedef struct erase_busy_t { - eraseq_entry_t *erase; - client_handle_t client; - struct timer_list timeout; - struct erase_busy_t *prev, *next; -} erase_busy_t; - typedef struct io_window_t { u_int Attributes; ioaddr_t BasePort, NumPorts; @@ -185,7 +178,6 @@ struct pcmcia_socket { io_window_t io[MAX_IO_WIN]; window_t win[MAX_WIN]; struct region_t *c_region, *a_region; - erase_busy_t erase_busy; struct list_head cis_cache; u_int fake_cis_len; char *fake_cis; |
