summaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/cs.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-01-29 01:41:54 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-01-29 01:41:54 +0000
commitf969d69ba9f952e5bdd38278e25e26a3e4a61a70 (patch)
treeb3530d803df59d726afaabebc6626987dee1ca05 /drivers/pcmcia/cs.c
parenta10ce7ef2066b455d69187643ddf2073bfc4db24 (diff)
Merge with 2.3.27.
Diffstat (limited to 'drivers/pcmcia/cs.c')
-rw-r--r--drivers/pcmcia/cs.c52
1 files changed, 36 insertions, 16 deletions
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index f7fda7d8d..0b3bbd77d 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -2,7 +2,7 @@
PCMCIA Card Services -- core services
- cs.c 1.232 1999/10/20 22:17:24
+ cs.c 1.235 1999/11/11 17:52:05
The contents of this file are subject to the Mozilla Public
License Version 1.1 (the "License"); you may not use this file
@@ -15,7 +15,7 @@
rights and limitations under the License.
The initial developer of the original code is David A. Hinds
- <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds
+ <dhinds@pcmcia.sourceforge.org>. 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
@@ -70,7 +70,7 @@ static int handle_apm_event(apm_event_t event);
int pc_debug = PCMCIA_DEBUG;
MODULE_PARM(pc_debug, "i");
static const char *version =
-"cs.c 1.232 1999/10/20 22:17:24 (David Hinds)";
+"cs.c 1.235 1999/11/11 17:52:05 (David Hinds)";
#endif
static const char *release = "Linux PCMCIA Card Services " CS_RELEASE;
@@ -100,7 +100,7 @@ static const char *options = "options: "
static int setup_delay = HZ/20; /* ticks */
static int resume_delay = HZ/5; /* ticks */
static int shutdown_delay = HZ/40; /* ticks */
-static int vcc_settle = HZ*3/10; /* ticks */
+static int vcc_settle = HZ*4/10; /* ticks */
static int reset_time = 10; /* usecs */
static int unreset_delay = HZ/10; /* ticks */
static int unreset_check = HZ/10; /* ticks */
@@ -268,8 +268,8 @@ static void init_socket(socket_info_t *s)
/*====================================================================*/
#if defined(CONFIG_PROC_FS) && defined(PCMCIA_DEBUG)
-int proc_read_clients(char *buf, char **start, off_t pos,
- int count, int *eof, void *data)
+static int proc_read_clients(char *buf, char **start, off_t pos,
+ int count, int *eof, void *data)
{
socket_info_t *s = data;
client_handle_t c;
@@ -708,14 +708,28 @@ static int handle_apm_event(apm_event_t event)
======================================================================*/
static int alloc_io_space(socket_info_t *s, u_int attr, ioaddr_t *base,
- ioaddr_t num, char *name)
+ ioaddr_t num, u_int lines, char *name)
{
int i;
- ioaddr_t try;
-
+ ioaddr_t try, align;
+
+ align = (*base) ? (1<<lines) : 1;
+ if (align && (align < num)) {
+ printk(KERN_INFO "odd IO request: num %04x align %04x\n",
+ num, align);
+ if (*base)
+ align = 0;
+ else
+ while (align && (align < num)) align <<= 1;
+ }
+ if (*base & ~(align-1)) {
+ printk(KERN_INFO "odd IO request: base %04x align %04x\n",
+ *base, align);
+ align = 0;
+ }
for (i = 0; i < MAX_IO_WIN; i++) {
if (s->io[i].NumPorts == 0) {
- if (find_io_region(base, num, name) == 0) {
+ if (find_io_region(base, num, align, name) == 0) {
s->io[i].Attributes = attr;
s->io[i].BasePort = *base;
s->io[i].NumPorts = s->io[i].InUse = num;
@@ -727,7 +741,7 @@ static int alloc_io_space(socket_info_t *s, u_int attr, ioaddr_t *base,
/* Try to extend top of window */
try = s->io[i].BasePort + s->io[i].NumPorts;
if ((*base == 0) || (*base == try))
- if (find_io_region(&try, num, name) == 0) {
+ if (find_io_region(&try, num, 0, name) == 0) {
*base = try;
s->io[i].NumPorts += num;
s->io[i].InUse += num;
@@ -736,7 +750,7 @@ static int alloc_io_space(socket_info_t *s, u_int attr, ioaddr_t *base,
/* Try to extend bottom of window */
try = s->io[i].BasePort - num;
if ((*base == 0) || (*base == try))
- if (find_io_region(&try, num, name) == 0) {
+ if (find_io_region(&try, num, 0, name) == 0) {
s->io[i].BasePort = *base = try;
s->io[i].NumPorts += num;
s->io[i].InUse += num;
@@ -1699,12 +1713,14 @@ static int request_io(client_handle_t handle, io_req_t *req)
return CS_BAD_ATTRIBUTE;
if (alloc_io_space(s, req->Attributes1, &req->BasePort1,
- req->NumPorts1, handle->dev_info))
+ req->NumPorts1, req->IOAddrLines,
+ handle->dev_info))
return CS_IN_USE;
if (req->NumPorts2) {
if (alloc_io_space(s, req->Attributes2, &req->BasePort2,
- req->NumPorts2, handle->dev_info)) {
+ req->NumPorts2, req->IOAddrLines,
+ handle->dev_info)) {
release_io_space(s, req->BasePort1, req->NumPorts1);
return CS_IN_USE;
}
@@ -1836,10 +1852,11 @@ static int request_window(client_handle_t *handle, win_req_t *req)
win->size = req->Size;
align = ((s->cap.features & SS_CAP_MEM_ALIGN) ||
(req->Attributes & WIN_STRICT_ALIGN));
- if (find_mem_region(&win->base, win->size, (*handle)->dev_info,
+ if (find_mem_region(&win->base, win->size,
(align ? req->Size : s->cap.map_size),
(req->Attributes & WIN_MAP_BELOW_1MB) ||
- !(s->cap.features & SS_CAP_PAGE_REGS)))
+ !(s->cap.features & SS_CAP_PAGE_REGS),
+ (*handle)->dev_info))
return CS_IN_USE;
req->Base = win->base;
(*handle)->state |= CLIENT_WIN_REQ(w);
@@ -2202,6 +2219,9 @@ EXPORT_SYMBOL(register_ss_entry);
EXPORT_SYMBOL(unregister_ss_entry);
EXPORT_SYMBOL(CardServices);
EXPORT_SYMBOL(MTDHelperEntry);
+#ifdef CONFIG_PROC_FS
+EXPORT_SYMBOL(proc_pccard);
+#endif
static int __init init_pcmcia_cs(void)
{