[ltp] PnP-BIOS-related patches

Thomas Hood linux-thinkpad@www.bm-soft.com
Sat, 22 Sep 2001 19:55:17 -0400


This is a multi-part message in MIME format.
--------------B46039D2ABF72E7AF32130C3
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Fabrice Bellet wrote:
> I'm interested in your patches to other problems BTW.

Okay, here are the patches (attached).

1) setpnp.c patch to 3.1.28  (submitted to pcmcia-cs bug tracking)
2) parport_pc.c patch to 2.4.9-ac13 (submitted to linux-kernel)
3,4) pnp_bios.c patch to 2.4.9-ac13 (submitted to linux-kernel)

FYI the mwave patch to 2.4.9-ac13 is available at my website
http://panopticon.csustan.edu/thood/tp600lnx.htm#secmodem
It would be nice if people would test it.

--
Thomas
--------------B46039D2ABF72E7AF32130C3
Content-Type: text/plain; charset=us-ascii;
 name="setpnp-patch-20010921-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="setpnp-patch-20010921-1"

--- setpnp.c_ORIG	Mon Jun 12 17:34:19 2000
+++ setpnp.c	Thu Sep 20 20:21:32 2001
@@ -134,13 +134,13 @@
 	    case PNP_RES_SMTAG_IRQ:
 		if (res->nr[R_IRQ] > nu[R_IRQ]) {
 		    base = res->base[R_IRQ][nu[R_IRQ]++];
-		    r->irq.mask = base ? flip16(1<<base) : 0;
+		    r->irq.mask = flip16(1<<base);
 		}
 		break;
 	    case PNP_RES_SMTAG_DMA:
 		if (res->nr[R_DMA] > nu[R_DMA]) {
 		    base = res->base[R_DMA][nu[R_DMA]++];
-		    r->dma.mask = base ? flip16(1<<base) : 0;
+		    r->dma.mask = flip16(1<<base);
 		}
 		break;
 	    case PNP_RES_SMTAG_IO:

--------------B46039D2ABF72E7AF32130C3
Content-Type: text/plain; charset=us-ascii;
 name="parport_pc-patch-20010922-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="parport_pc-patch-20010922-1"

--- linux-2.4.9-ac13-mwave/drivers/parport/parport_pc.c_ORIG	Fri Sep 21 15:23:19 2001
+++ linux-2.4.9-ac13-mwave/drivers/parport/parport_pc.c	Sat Sep 22 19:48:55 2001
@@ -2807,8 +2807,6 @@
 	irq=dev->irq_resource[0].start;
 	dma=dev->dma_resource[0].start;
 
-	if(dma==0) dma=-1;
-
 	printk(KERN_INFO "PnPBIOS: Parport found %s %s at io=%04x,%04x irq=%d dma=%d\n",
 		dev->name,dev->slot_name,io,iohi,irq,dma);
 	if (parport_pc_probe_port(io,iohi,irq,dma,NULL))

--------------B46039D2ABF72E7AF32130C3
Content-Type: text/plain; charset=us-ascii;
 name="pnpbios-patch-20010921-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="pnpbios-patch-20010921-1"

--- linux-2.4.9-ac13-mwave/drivers/pnp/pnp_bios.c_ORIG	Fri Sep 21 15:23:19 2001
+++ linux-2.4.9-ac13-mwave/drivers/pnp/pnp_bios.c	Fri Sep 21 16:15:44 2001
@@ -233,39 +233,39 @@
 	return status;
 }
 
 /* 
  * Call pnp bios with function 0x01, "get system device node"
- * Input:  *nodenum=desired node, 
- *         static=1: config (dynamic) config, else boot (static) config,
+ * Input: *nodenum = desired node, 
+ *        boot = whether to get static boot (!=0) or dynamic current (0) config
  * Output: *nodenum=next node or 0xff if no more nodes
  */
 
-int pnp_bios_get_dev_node(u8 *nodenum, char config, struct pnp_bios_node *data)
+int pnp_bios_get_dev_node(u8 *nodenum, char boot, struct pnp_bios_node *data)
 {
 	u16 status;
 	if (!pnp_bios_present ())
 		return PNP_FUNCTION_NOT_SUPPORTED;
 	Q2_SET_SEL(PNP_TS1, nodenum, sizeof(char));
 	Q2_SET_SEL(PNP_TS2, data, 64 * 1024);
-	status = call_pnp_bios(PNP_GET_SYS_DEV_NODE, 0, PNP_TS1, 0, PNP_TS2, config ? 1 : 2, PNP_DS, 0);
+	status = call_pnp_bios(PNP_GET_SYS_DEV_NODE, 0, PNP_TS1, 0, PNP_TS2, boot ? 2 : 1, PNP_DS, 0);
 	return status;
 }
 
 /*
  * Call pnp bios with function 0x02, "set system device node"
- * Input: nodenum=desired node, 
- *        static=1: config (dynamic) config, else boot (static) config,
+ * Input: *nodenum = desired node, 
+ *        boot = whether to set static boot (!=0) or dynamic current (0) config
  */
 
-int pnp_bios_set_dev_node(u8 nodenum, char config, struct pnp_bios_node *data)
+int pnp_bios_set_dev_node(u8 nodenum, char boot, struct pnp_bios_node *data)
 {
 	u16 status;
 	if (!pnp_bios_present ())
 		return PNP_FUNCTION_NOT_SUPPORTED;
 	Q2_SET_SEL(PNP_TS1, data, /* *((u16 *) data)*/ 65536);
-	status = call_pnp_bios(PNP_SET_SYS_DEV_NODE, nodenum, 0, PNP_TS1, config ? 1 : 2, PNP_DS, 0, 0);
+	status = call_pnp_bios(PNP_SET_SYS_DEV_NODE, nodenum, 0, PNP_TS1, boot ? 2 : 1, PNP_DS, 0, 0);
 	return status;
 }
 
 /*
  * Call pnp bios with function 0x03, "get event"
@@ -714,11 +714,11 @@
 
 /* parse PNPBIOS "Allocated Resources Block" and fill IO,IRQ,DMA into pci_dev */
 static void __init pnpbios_rawdata_2_pci_dev(struct pnp_bios_node *node, struct pci_dev *pci_dev)
 {
 	unsigned char *p = node->data, *lastp=NULL;
-        int mask,i,io,irq=-1,len,dma=-1;
+        int mask,i,io,irq,len,dma;
 
 	memset(pci_dev, 0, sizeof(struct pci_dev));
         while ( (char *)p < ((char *)node->data + node->size )) {
         	if(p==lastp) break;
 
@@ -750,16 +750,18 @@
                 }
                 if ((p[0]>>3) == 0x0f) // end tag
                         break;
                 switch (p[0]>>3) {
                 case 0x04: // irq
+                        irq = -1;
                         mask= p[1] + p[2]*256;
                         for (i=0;i<16;i++, mask=mask>>1)
                                 if(mask &0x01) irq=i;
 			pnpbios_add_irqresource(pci_dev, irq);
                         break;
                 case 0x05: // dma
+                        dma = -1;
                         mask = p[1];
                         for (i=0;i<8;i++, mask = mask>>1)
                                 if(mask&0x01) dma=i;
 			pnpbios_add_dmaresource(pci_dev, dma);
                         break;

--------------B46039D2ABF72E7AF32130C3--


----- The Linux ThinkPad mailing list -----
The linux-thinkpad mailing list home page is at:
http://www.bm-soft.com/~bm/tp_mailing.html