Bug : Can't read CIS (2.6.0-test4)

Jean Tourrilhes jt at bougret.hpl.hp.com
Mon Sep 8 17:51:28 BST 2003


On Mon, Sep 08, 2003 at 07:13:38PM +0100, Russell King wrote:
> On Mon, Sep 08, 2003 at 10:40:54AM -0700, Jean Tourrilhes wrote:
> > 	On a side note, I'm disapointed that you pushed into the
> > kernel only half of the DEBUG patch. This means that the debug code is
> > still not functional (won't compile in cistpl.c). This also means that
> > random users still can't send you detailed bug report by just toggling
> > a kernel option.
> > 	I would just like to ask you to push the other half of my
> > patch into the kernel.
> 
> I don't want the debug level to depend on a config option - I'd rather
> just have a "PCMCIA debug" option which enables/disables the code, and
> then have a parameter to set the level.

	That's the only issue with my patch ? Ok, here is a new
version for 2.6.0-test5 that doesn't set the debug level via Kconfig
and make the debug code work properly.
	By the way, as it's not possible to rmmod i82365 (and
therefore not possible to rmmod pcmcia_core), it might be even better
to make pc_debug a sysctl or something setable via sysfs. That would
also take care of people doing non-modular builds of Pcmcia. But
that's probably for later.

> I have patches to do that, but its a matter of sorting them out and
> applying them to the tree.

	The patch is below is tested and current (2.6.0-test5), so you
can forward it directly and forget about it.

	Have fun...

	Jean

---------------------------------------------------------

diff -u -p linux/include/pcmcia/cs.r1.h linux/include/pcmcia/cs.h
--- linux/include/pcmcia/cs.r1.h	Mon Sep  8 14:55:11 2003
+++ linux/include/pcmcia/cs.h	Mon Sep  8 14:56:53 2003
@@ -463,6 +463,11 @@ struct pci_bus *pcmcia_lookup_bus(client
 /* rsrc_mgr.c */
 int pcmcia_adjust_resource_info(client_handle_t handle, adjust_t *adj);
 
+/* Debugging stuff (need to adjust level via pc_debug) */
+#ifdef CONFIG_PCMCIA_DEBUG_ENABLE
+#define PCMCIA_DEBUG 0
+#endif
+
 #endif /* __KERNEL__ */
 
 #endif /* _LINUX_CS_H */
diff -u -p linux/drivers/pcmcia.r1/Kconfig linux/drivers/pcmcia/Kconfig
--- linux/drivers/pcmcia.r1/Kconfig	Mon Sep  8 14:39:01 2003
+++ linux/drivers/pcmcia/Kconfig	Mon Sep  8 14:58:00 2003
@@ -104,6 +104,15 @@ config PCMCIA_SA1111
 
 	  This driver is also available as a module called sa1111_cs.
 
+config PCMCIA_DEBUG_ENABLE
+	bool "Enable PCMCIA debug code"
+	depends on PCMCIA
+	help
+	  Enable PCMCIA debugging code.
+	  You must select the level at run time for each pcmcia module
+	  via the module parameter "pc_debug". By default, the level
+	  is 0 (i.e. no debugging output).
+
 config PCMCIA_PROBE
 	bool
 	default y if ISA && !ARCH_SA1100 && !ARCH_CLPS711X
diff -u -p linux/drivers/pcmcia.r1/cistpl.c linux/drivers/pcmcia/cistpl.c
--- linux/drivers/pcmcia.r1/cistpl.c	Mon Sep  8 14:42:37 2003
+++ linux/drivers/pcmcia/cistpl.c	Mon Sep  8 14:56:28 2003
@@ -572,7 +572,7 @@ int pcmcia_get_next_tuple(client_handle_
 	ofs += link[1] + 2;
     }
     if (i == MAX_TUPLES) {
-	DEBUG(1, "cs: overrun in pcmcia_get_next_tuple for socket %d\n",
+	DEBUG(1, "cs: overrun in pcmcia_get_next_tuple for socket 0x%p\n",
 	      handle->Socket);
 	return CS_NO_MORE_ITEMS;
     }
diff -u -p linux/drivers/pcmcia.r1/cs.c linux/drivers/pcmcia/cs.c
--- linux/drivers/pcmcia.r1/cs.c	Mon Sep  8 14:42:37 2003
+++ linux/drivers/pcmcia/cs.c	Mon Sep  8 15:00:36 2003
@@ -112,7 +112,8 @@ INT_MODULE_PARM(cis_speed,	300);		/* ns 
 INT_MODULE_PARM(io_speed,	0);		/* ns */
 
 #ifdef PCMCIA_DEBUG
-INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
+int pc_debug = PCMCIA_DEBUG;	/* Can't be static !!! */
+MODULE_PARM(pc_debug, "i");
 static const char *version =
 "cs.c 1.279 2001/10/13 00:08:28 (David Hinds)";
 #endif
@@ -1018,7 +1019,7 @@ int pcmcia_bind_device(bind_req_t *req)
     init_waitqueue_head(&client->mtd_req);
     client->next = s->clients;
     s->clients = client;
-    DEBUG(1, "cs: bind_device(): client 0x%p, sock %p, dev %s\n",
+    DEBUG(1, "cs: bind_device(): client 0x%p, sock 0x%p, dev %s\n",
 	  client, client->Socket, client->dev_info);
     return CS_SUCCESS;
 } /* bind_device */
@@ -1551,7 +1552,7 @@ int pcmcia_register_client(client_handle
 	memset(s->config, 0, sizeof(config_t) * s->functions);
     }
     
-    DEBUG(1, "cs: register_client(): client 0x%p, sock %p, dev %s\n",
+    DEBUG(1, "cs: register_client(): client 0x%p, sock 0x%p, dev %s\n",
 	  client, client->Socket, client->dev_info);
     if (client->EventMask & CS_EVENT_REGISTRATION_COMPLETE)
 	EVENT(client, CS_EVENT_REGISTRATION_COMPLETE, CS_EVENT_PRI_LOW);
@@ -2087,7 +2088,7 @@ int pcmcia_reset_card(client_handle_t ha
     
 	if (CHECK_HANDLE(handle))
 		return CS_BAD_HANDLE;
-	DEBUG(1, "cs: resetting socket %p\n", handle->Socket);
+	DEBUG(1, "cs: resetting socket 0x%p\n", handle->Socket);
 	skt = SOCKET(handle);
 
 	down(&skt->skt_sem);
@@ -2136,7 +2137,7 @@ int pcmcia_suspend_card(client_handle_t 
     
 	if (CHECK_HANDLE(handle))
 		return CS_BAD_HANDLE;
-	DEBUG(1, "cs: suspending socket %p\n", handle->Socket);
+	DEBUG(1, "cs: suspending socket 0x%p\n", handle->Socket);
 	skt = SOCKET(handle);
 
 	down(&skt->skt_sem);
@@ -2163,7 +2164,7 @@ int pcmcia_resume_card(client_handle_t h
     
 	if (CHECK_HANDLE(handle))
 		return CS_BAD_HANDLE;
-	DEBUG(1, "cs: waking up socket %p\n", handle->Socket);
+	DEBUG(1, "cs: waking up socket 0x%p\n", handle->Socket);
 	skt = SOCKET(handle);
 
 	down(&skt->skt_sem);
@@ -2196,7 +2197,7 @@ int pcmcia_eject_card(client_handle_t ha
     
 	if (CHECK_HANDLE(handle))
 		return CS_BAD_HANDLE;
-	DEBUG(1, "cs: user eject request on socket %p\n", handle->Socket);
+	DEBUG(1, "cs: user eject request on socket 0x%p\n", handle->Socket);
 	skt = SOCKET(handle);
 
 	down(&skt->skt_sem);
@@ -2225,7 +2226,7 @@ int pcmcia_insert_card(client_handle_t h
 
 	if (CHECK_HANDLE(handle))
 		return CS_BAD_HANDLE;
-	DEBUG(1, "cs: user insert request on socket %p\n", handle->Socket);
+	DEBUG(1, "cs: user insert request on socket 0x%p\n", handle->Socket);
 	skt = SOCKET(handle);
 
 	down(&skt->skt_sem);
diff -u -p linux/drivers/pcmcia.r1/tcic.c linux/drivers/pcmcia/tcic.c
--- linux/drivers/pcmcia.r1/tcic.c	Mon Sep  8 14:41:34 2003
+++ linux/drivers/pcmcia/tcic.c	Mon Sep  8 14:56:28 2003
@@ -627,7 +627,7 @@ static int tcic_get_status(struct pcmcia
     reg = tcic_getb(TCIC_PWR);
     if (reg & (TCIC_PWR_VCC(psock)|TCIC_PWR_VPP(psock)))
 	*value |= SS_POWERON;
-    DEBUG(1, "tcic: GetStatus(%d) = %#2.2x\n", lsock, *value);
+    DEBUG(1, "tcic: GetStatus(0x%p) = %#2.2x\n", sock, *value);
     return 0;
 } /* tcic_get_status */
   
@@ -678,8 +678,8 @@ static int tcic_get_socket(struct pcmcia
 	state->csc_mask |= (scf2 & TCIC_SCF2_MRDY) ? 0 : SS_READY;
     }
 
-    DEBUG(1, "tcic: GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, "
-	  "io_irq %d, csc_mask %#2.2x\n", lsock, state->flags,
+    DEBUG(1, "tcic: GetSocket(0x%p) = flags %#3.3x, Vcc %d, Vpp %d, "
+	  "io_irq %d, csc_mask %#2.2x\n", sock, state->flags,
 	  state->Vcc, state->Vpp, state->io_irq, state->csc_mask);
     return 0;
 } /* tcic_get_socket */
@@ -692,8 +692,8 @@ static int tcic_set_socket(struct pcmcia
     u_char reg;
     u_short scf1, scf2;
 
-    DEBUG(1, "tcic: SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, "
-	  "io_irq %d, csc_mask %#2.2x)\n", lsock, state->flags,
+    DEBUG(1, "tcic: SetSocket(0x%p, flags %#3.3x, Vcc %d, Vpp %d, "
+	  "io_irq %d, csc_mask %#2.2x)\n", sock, state->flags,
 	  state->Vcc, state->Vpp, state->io_irq, state->csc_mask);
     tcic_setw(TCIC_ADDR+2, (psock << TCIC_SS_SHFT) | TCIC_ADR2_INDREG);
 
@@ -767,8 +767,8 @@ static int tcic_set_io_map(struct pcmcia
     u_int addr;
     u_short base, len, ioctl;
     
-    DEBUG(1, "tcic: SetIOMap(%d, %d, %#2.2x, %d ns, "
-	  "%#4.4x-%#4.4x)\n", lsock, io->map, io->flags,
+    DEBUG(1, "tcic: SetIOMap(0x%p, %d, %#2.2x, %d ns, "
+	  "%#4.4x-%#4.4x)\n", sock, io->map, io->flags,
 	  io->speed, io->start, io->stop);
     if ((io->map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) ||
 	(io->stop < io->start)) return -EINVAL;
@@ -804,8 +804,8 @@ static int tcic_set_mem_map(struct pcmci
     u_short addr, ctl;
     u_long base, len, mmap;
 
-    DEBUG(1, "tcic: SetMemMap(%d, %d, %#2.2x, %d ns, "
-	  "%#5.5lx-%#5.5lx, %#5.5x)\n", lsock, mem->map, mem->flags,
+    DEBUG(1, "tcic: SetMemMap(0x%p, %d, %#2.2x, %d ns, "
+	  "%#5.5lx-%#5.5lx, %#5.5x)\n", sock, mem->map, mem->flags,
 	  mem->speed, mem->sys_start, mem->sys_stop, mem->card_start);
     if ((mem->map > 3) || (mem->card_start > 0x3ffffff) ||
 	(mem->sys_start > 0xffffff) || (mem->sys_stop > 0xffffff) ||



More information about the linux-pcmcia mailing list