patch-2.3.27 linux/drivers/pcmcia/cs.c

Next file: linux/drivers/pcmcia/cs_internal.h
Previous file: linux/drivers/pcmcia/cistpl.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.26/linux/drivers/pcmcia/cs.c linux/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 @@
 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 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 @@
 /*====================================================================*/
 
 #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 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 @@
 	/* 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 @@
 	/* 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 @@
 	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 @@
     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(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)
 {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)