Commit 46535956 authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Russell King

[PCMCIA] 01-unused_bulkmem_code.diff

Most of drivers/pcmcia/bulkmem.c is unused by the Linux kernel
PCMCIA subsystem and/or in-kernel PCMCIA device drivers. Remove
this unused code as well as references to it.
parent 9b9407e8
...@@ -48,277 +48,6 @@ ...@@ -48,277 +48,6 @@
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include "cs_internal.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 */
/*====================================================================== /*======================================================================
This stuff is used by Card Services to initialize the table of This stuff is used by Card Services to initialize the table of
...@@ -440,199 +169,3 @@ int pcmcia_get_next_region(client_handle_t handle, region_info_t *rgn) ...@@ -440,199 +169,3 @@ int pcmcia_get_next_region(client_handle_t handle, region_info_t *rgn)
return match_region(handle, rgn->next, rgn); return match_region(handle, rgn->next, rgn);
} /* get_next_region */ } /* 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;
}
...@@ -249,7 +249,7 @@ int pcmcia_register_socket(struct pcmcia_socket *socket) ...@@ -249,7 +249,7 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)
/* base address = 0, map = 0 */ /* base address = 0, map = 0 */
socket->cis_mem.flags = 0; socket->cis_mem.flags = 0;
socket->cis_mem.speed = cis_speed; socket->cis_mem.speed = cis_speed;
socket->erase_busy.next = socket->erase_busy.prev = &socket->erase_busy;
INIT_LIST_HEAD(&socket->cis_cache); INIT_LIST_HEAD(&socket->cis_cache);
spin_lock_init(&socket->lock); spin_lock_init(&socket->lock);
...@@ -895,7 +895,6 @@ int pcmcia_deregister_client(client_handle_t handle) ...@@ -895,7 +895,6 @@ int pcmcia_deregister_client(client_handle_t handle)
{ {
client_t **client; client_t **client;
struct pcmcia_socket *s; struct pcmcia_socket *s;
memory_handle_t region;
u_long flags; u_long flags;
int i; int i;
...@@ -912,14 +911,6 @@ int pcmcia_deregister_client(client_handle_t handle) ...@@ -912,14 +911,6 @@ int pcmcia_deregister_client(client_handle_t handle)
if (handle->state & CLIENT_WIN_REQ(i)) if (handle->state & CLIENT_WIN_REQ(i))
return CS_IN_USE; 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) || if ((handle->state & CLIENT_STALE) ||
(handle->Attributes & INFO_MASTER_CLIENT)) { (handle->Attributes & INFO_MASTER_CLIENT)) {
spin_lock_irqsave(&s->lock, flags); spin_lock_irqsave(&s->lock, flags);
...@@ -936,7 +927,6 @@ int pcmcia_deregister_client(client_handle_t handle) ...@@ -936,7 +927,6 @@ int pcmcia_deregister_client(client_handle_t handle)
spin_unlock_irqrestore(&s->lock, flags); spin_unlock_irqrestore(&s->lock, flags);
} else { } else {
handle->state = CLIENT_UNBOUND; handle->state = CLIENT_UNBOUND;
handle->mtd_count = 0;
handle->event_handler = NULL; handle->event_handler = NULL;
} }
...@@ -2099,11 +2089,7 @@ int pcmcia_set_event_mask(client_handle_t handle, eventmask_t *mask) ...@@ -2099,11 +2089,7 @@ int pcmcia_set_event_mask(client_handle_t handle, eventmask_t *mask)
/* in alpha order */ /* in alpha order */
EXPORT_SYMBOL(pcmcia_access_configuration_register); EXPORT_SYMBOL(pcmcia_access_configuration_register);
EXPORT_SYMBOL(pcmcia_adjust_resource_info); 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_client);
EXPORT_SYMBOL(pcmcia_deregister_erase_queue);
EXPORT_SYMBOL(pcmcia_eject_card); EXPORT_SYMBOL(pcmcia_eject_card);
EXPORT_SYMBOL(pcmcia_get_first_client); EXPORT_SYMBOL(pcmcia_get_first_client);
EXPORT_SYMBOL(pcmcia_get_card_services_info); EXPORT_SYMBOL(pcmcia_get_card_services_info);
...@@ -2122,12 +2108,8 @@ EXPORT_SYMBOL(pcmcia_insert_card); ...@@ -2122,12 +2108,8 @@ EXPORT_SYMBOL(pcmcia_insert_card);
EXPORT_SYMBOL(pcmcia_map_mem_page); EXPORT_SYMBOL(pcmcia_map_mem_page);
EXPORT_SYMBOL(pcmcia_modify_configuration); EXPORT_SYMBOL(pcmcia_modify_configuration);
EXPORT_SYMBOL(pcmcia_modify_window); EXPORT_SYMBOL(pcmcia_modify_window);
EXPORT_SYMBOL(pcmcia_open_memory);
EXPORT_SYMBOL(pcmcia_parse_tuple); EXPORT_SYMBOL(pcmcia_parse_tuple);
EXPORT_SYMBOL(pcmcia_read_memory);
EXPORT_SYMBOL(pcmcia_register_client); 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_configuration);
EXPORT_SYMBOL(pcmcia_release_io); EXPORT_SYMBOL(pcmcia_release_io);
EXPORT_SYMBOL(pcmcia_release_irq); EXPORT_SYMBOL(pcmcia_release_irq);
...@@ -2142,10 +2124,8 @@ EXPORT_SYMBOL(pcmcia_resume_card); ...@@ -2142,10 +2124,8 @@ EXPORT_SYMBOL(pcmcia_resume_card);
EXPORT_SYMBOL(pcmcia_set_event_mask); EXPORT_SYMBOL(pcmcia_set_event_mask);
EXPORT_SYMBOL(pcmcia_suspend_card); EXPORT_SYMBOL(pcmcia_suspend_card);
EXPORT_SYMBOL(pcmcia_validate_cis); EXPORT_SYMBOL(pcmcia_validate_cis);
EXPORT_SYMBOL(pcmcia_write_memory);
EXPORT_SYMBOL(dead_socket); EXPORT_SYMBOL(dead_socket);
EXPORT_SYMBOL(MTDHelperEntry);
EXPORT_SYMBOL(pcmcia_parse_events); EXPORT_SYMBOL(pcmcia_parse_events);
struct class pcmcia_socket_class = { struct class pcmcia_socket_class = {
......
...@@ -21,14 +21,6 @@ ...@@ -21,14 +21,6 @@
#include <linux/config.h> #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 #define CLIENT_MAGIC 0x51E6
typedef struct client_t { typedef struct client_t {
u_short client_magic; u_short client_magic;
...@@ -42,9 +34,6 @@ typedef struct client_t { ...@@ -42,9 +34,6 @@ typedef struct client_t {
event_callback_args_t *); event_callback_args_t *);
event_callback_args_t event_callback_args; event_callback_args_t event_callback_args;
struct client_t *next; struct client_t *next;
u_int mtd_count;
wait_queue_head_t mtd_req;
erase_busy_t erase_busy;
} client_t; } client_t;
/* Flags in client state */ /* Flags in client state */
...@@ -167,17 +156,8 @@ int replace_cis(client_handle_t handle, cisdump_t *cis); ...@@ -167,17 +156,8 @@ int replace_cis(client_handle_t handle, cisdump_t *cis);
int read_tuple(client_handle_t handle, cisdata_t code, void *parse); int read_tuple(client_handle_t handle, cisdata_t code, void *parse);
/* In bulkmem.c */ /* In bulkmem.c */
int get_first_region(client_handle_t handle, region_info_t *rgn); int pcmcia_get_first_region(client_handle_t handle, region_info_t *rgn);
int get_next_region(client_handle_t handle, region_info_t *rgn); int pcmcia_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);
/* In rsrc_mgr */ /* In rsrc_mgr */
void pcmcia_validate_mem(struct pcmcia_socket *s); void pcmcia_validate_mem(struct pcmcia_socket *s);
......
...@@ -167,9 +167,6 @@ static int pcmcia_bind_device(bind_req_t *req) ...@@ -167,9 +167,6 @@ static int pcmcia_bind_device(bind_req_t *req)
client->Socket = s; client->Socket = s;
client->Function = req->Function; client->Function = req->Function;
client->state = CLIENT_UNBOUND; 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; client->next = s->clients;
s->clients = client; s->clients = client;
ds_dbg(1, "%s: bind_device(): client 0x%p, dev %s\n", ds_dbg(1, "%s: bind_device(): client 0x%p, dev %s\n",
......
...@@ -53,155 +53,7 @@ typedef struct region_info_t { ...@@ -53,155 +53,7 @@ typedef struct region_info_t {
#define REGION_BAR_MASK 0xe000 #define REGION_BAR_MASK 0xe000
#define REGION_BAR_SHIFT 13 #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_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_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 */ #endif /* _LINUX_BULKMEM_H */
...@@ -56,9 +56,6 @@ typedef struct window_t *window_handle_t; ...@@ -56,9 +56,6 @@ typedef struct window_t *window_handle_t;
struct region_t; struct region_t;
typedef struct region_t *memory_handle_t; typedef struct region_t *memory_handle_t;
struct eraseq_t;
typedef struct eraseq_t *eraseq_handle_t;
#ifndef DEV_NAME_LEN #ifndef DEV_NAME_LEN
#define DEV_NAME_LEN 32 #define DEV_NAME_LEN 32
#endif #endif
......
...@@ -135,13 +135,6 @@ struct pccard_operations { ...@@ -135,13 +135,6 @@ struct pccard_operations {
*/ */
struct pcmcia_socket; 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 { typedef struct io_window_t {
u_int Attributes; u_int Attributes;
ioaddr_t BasePort, NumPorts; ioaddr_t BasePort, NumPorts;
...@@ -185,7 +178,6 @@ struct pcmcia_socket { ...@@ -185,7 +178,6 @@ struct pcmcia_socket {
io_window_t io[MAX_IO_WIN]; io_window_t io[MAX_IO_WIN];
window_t win[MAX_WIN]; window_t win[MAX_WIN];
struct region_t *c_region, *a_region; struct region_t *c_region, *a_region;
erase_busy_t erase_busy;
struct list_head cis_cache; struct list_head cis_cache;
u_int fake_cis_len; u_int fake_cis_len;
char *fake_cis; char *fake_cis;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment