linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: PnP BIOS + 2.4.9-ac16 = no boot
@ 2001-10-02 23:17 Thomas Hood
  0 siblings, 0 replies; 18+ messages in thread
From: Thomas Hood @ 2001-10-02 23:17 UTC (permalink / raw)
  To: linux-kernel

> Well, the funny thing is, the same kernel doesn't boot on a Dell Inspiron 
> laptop either, if PNP is enabled -- and the oops is the same. So it's not 
> just Sony...
> 
> 2.4.9-ac10 has no such issues on the same laptop, btw.
> 
> Ion

Thanks for reporting this.  Please try 2.4.10-ac3.  If your
kernel won't boot, try booting with the "nobioscurrpnp" option.

-- 
Thomas Hood
(Don't reply to the From: address but to jdthood_AT_yahoo.co.uk)

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PnP BIOS + 2.4.9-ac16 = no boot
  2001-10-02 23:29 Thomas Hood
@ 2001-10-03 14:06 ` Ion Badulescu
  0 siblings, 0 replies; 18+ messages in thread
From: Ion Badulescu @ 2001-10-03 14:06 UTC (permalink / raw)
  To: Thomas Hood; +Cc: linux-kernel

On Tue, 2 Oct 2001 19:29:41 -0400 (EDT), Thomas Hood <jdthood@home.dhs.org> wrote:
> I wrote:
>> Thanks for reporting this.  Please try 2.4.10-ac3.  If your
>> kernel won't boot, try booting with the "nobioscurrpnp" option.
> 
> Better yet, try 2.4.10-ac4  :)

Yup, -ac4 fixed the problem.

Ion

-- 
  It is better to keep your mouth shut and be thought a fool,
            than to open it and remove all doubt.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PnP BIOS + 2.4.9-ac16 = no boot
  2001-10-02 22:11   ` Ion Badulescu
@ 2001-10-03  9:28     ` Stelian Pop
  0 siblings, 0 replies; 18+ messages in thread
From: Stelian Pop @ 2001-10-03  9:28 UTC (permalink / raw)
  To: Ion Badulescu; +Cc: linux-kernel, alan

On Tue, Oct 02, 2001 at 06:11:58PM -0400, Ion Badulescu wrote:

> > What about making a conditional on 'is_sony_vaio_laptop' here ?
> > (but you need to extends the conditionnal export of this variable 
> > from dmi_scan.c / i386_ksyms.c).
> 
> Well, the funny thing is, the same kernel doesn't boot on a Dell Inspiron 
> laptop either, if PNP is enabled -- and the oops is the same. So it's not 
> just Sony...

Maybe we'll need to test against something like 'pnp_broken' 
variable instead of is_sony_vaio_laptop in PnP drivers, and
add the callbacks in dmi_scan to initialize pnp_broken...

Stelian.
-- 
Stelian Pop <stelian.pop@fr.alcove.com>
|---------------- Free Software Engineer -----------------|
| Alcôve - http://www.alcove.com - Tel: +33 1 49 22 68 00 |
|------------- Alcôve, liberating software ---------------|

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PnP BIOS + 2.4.9-ac16 = no boot
@ 2001-10-02 23:29 Thomas Hood
  2001-10-03 14:06 ` Ion Badulescu
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Hood @ 2001-10-02 23:29 UTC (permalink / raw)
  To: linux-kernel

I wrote:
> Thanks for reporting this.  Please try 2.4.10-ac3.  If your
> kernel won't boot, try booting with the "nobioscurrpnp" option.

Better yet, try 2.4.10-ac4  :)

-- 
Thomas Hood
(Don't reply to the From: address but to jdthood_AT_yahoo.co.uk)

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PnP BIOS + 2.4.9-ac16 = no boot
  2001-09-28 14:02 ` Stelian Pop
  2001-09-28 14:41   ` Thomas Hood
  2001-09-28 14:58   ` Thomas Hood
@ 2001-10-02 22:11   ` Ion Badulescu
  2001-10-03  9:28     ` Stelian Pop
  2 siblings, 1 reply; 18+ messages in thread
From: Ion Badulescu @ 2001-10-02 22:11 UTC (permalink / raw)
  To: Stelian Pop; +Cc: linux-kernel, alan

On Fri, 28 Sep 2001 16:02:52 +0200, Stelian Pop <stelian.pop@fr.alcove.com> wrote:

> What about making a conditional on 'is_sony_vaio_laptop' here ?
> (but you need to extends the conditionnal export of this variable 
> from dmi_scan.c / i386_ksyms.c).

Well, the funny thing is, the same kernel doesn't boot on a Dell Inspiron 
laptop either, if PNP is enabled -- and the oops is the same. So it's not 
just Sony...

2.4.9-ac10 has no such issues on the same laptop, btw.

Ion

-- 
  It is better to keep your mouth shut and be thought a fool,
            than to open it and remove all doubt.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PnP BIOS + 2.4.9-ac16 = no boot
  2001-09-28 15:20   ` Thomas Hood
@ 2001-09-28 15:28     ` Alan Cox
  0 siblings, 0 replies; 18+ messages in thread
From: Alan Cox @ 2001-09-28 15:28 UTC (permalink / raw)
  To: Thomas Hood; +Cc: linux-kernel

> > The only remaining problem is that the DMI scan routines are
> > called _after_ the PnP BIOS scan, so the is_sony_vaio_laptop
> > variable will be always evaluated to 0 in your patch (causing
> > the same hang again).
> 
> This is unfortunate.  :(

We need to move the DMI scan earlier anyway to handle 440GX boards

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PnP BIOS + 2.4.9-ac16 = no boot
  2001-09-28 14:51 ` Stelian Pop
@ 2001-09-28 15:20   ` Thomas Hood
  2001-09-28 15:28     ` Alan Cox
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Hood @ 2001-09-28 15:20 UTC (permalink / raw)
  To: linux-kernel

Stelian Pop wrote:
> It works, kind of.
> 
> The only remaining problem is that the DMI scan routines are
> called _after_ the PnP BIOS scan, so the is_sony_vaio_laptop
> variable will be always evaluated to 0 in your patch (causing
> the same hang again).

This is unfortunate.  :(

Alan:  Does this mean that we will have to use a new CONFIG_
macro instead of testing is_sony_vaio_laptop?  If so then
I will submit a new patch with "#ifdef CONFIG_SONY_PNPBIOS"s
in it and I'll let you futz with the kernel configuration
files required to set this up.

> After manually changing is_sony_vaio_laptop to 1 the
> patched kernel boots ok, entries in /proc/bus/pnp are present
> (not sure how to test if their contents are corect though).

There should be no numerically named entries in /proc/bus/pnp;
you should see only the "devices" file and the "boot" directory.
You should see numerically named entries in /proc/bus/pnp/boot
for each device.

--
Thomas

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PnP BIOS + 2.4.9-ac16 = no boot
  2001-09-28 14:02 ` Stelian Pop
  2001-09-28 14:41   ` Thomas Hood
@ 2001-09-28 14:58   ` Thomas Hood
  2001-10-02 22:11   ` Ion Badulescu
  2 siblings, 0 replies; 18+ messages in thread
From: Thomas Hood @ 2001-09-28 14:58 UTC (permalink / raw)
  To: Stelian Pop; +Cc: linux-kernel

I said:
> In addition to applying the patch I just sent
> (thood-pnpbiosvaio-patch-20010928-3), you will have
> to move the definition of is_sony_vaio_laptop outside
> the #ifdefs in arch/i386/kernel/dmi_scan.c and i386_ksyms.c

... along with the functions that initialize it.  The easiest
thing to do is remove the #ifdef's and #endif's around the
sony_vaio_laptop stuff in those two files.  Is that the
ultimately correct thing to do?

--
Thomas

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PnP BIOS + 2.4.9-ac16 = no boot
  2001-09-28 14:41   ` Thomas Hood
  2001-09-28 14:54     ` Stelian Pop
@ 2001-09-28 14:58     ` Alan Cox
  1 sibling, 0 replies; 18+ messages in thread
From: Alan Cox @ 2001-09-28 14:58 UTC (permalink / raw)
  To: Thomas Hood; +Cc: Stelian Pop, linux-kernel

> In addition to applying the patch I just sent
> (thood-pnpbiosvaio-patch-20010928-3), you will have
> to move the definition of is_sony_vaio_laptop outside
> the #ifdefs in arch/i386/kernel/dmi_scan.c and i386_ksyms.c
> 
> You or Alan:  For the cleaned up patch, do we export this
> variable unconditionally?

I think so

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PnP BIOS + 2.4.9-ac16 = no boot
  2001-09-28 14:41   ` Thomas Hood
@ 2001-09-28 14:54     ` Stelian Pop
  2001-09-28 14:58     ` Alan Cox
  1 sibling, 0 replies; 18+ messages in thread
From: Stelian Pop @ 2001-09-28 14:54 UTC (permalink / raw)
  To: Thomas Hood; +Cc: linux-kernel

On Fri, Sep 28, 2001 at 10:41:45AM -0400, Thomas Hood wrote:

> Stelian Pop wrote:
> > What about making a conditional on 'is_sony_vaio_laptop' here ?
> > (but you need to extends the conditionnal export of this variable
> > from dmi_scan.c / i386_ksyms.c).
> 
> In addition to applying the patch I just sent
> (thood-pnpbiosvaio-patch-20010928-3), you will have
> to move the definition of is_sony_vaio_laptop outside
> the #ifdefs in arch/i386/kernel/dmi_scan.c and i386_ksyms.c

No need for me since I have CONFIG_SONYPI on.

> You or Alan:  For the cleaned up patch, do we export this
> variable unconditionally?

I'd vote for unconditionnally define one int instead of having
something like:
	#if defined(CONFIG_SONYPI) || defined(CONFIG_SONYPI_MODULE) || ( defined(CONFIG_PNP) && defined(CONFIG_PROC) )
(and maybe other defines in the future... :( ).

Stelian.
-- 
Stelian Pop <stelian.pop@fr.alcove.com>
|---------------- Free Software Engineer -----------------|
| Alcôve - http://www.alcove.com - Tel: +33 1 49 22 68 00 |
|------------- Alcôve, liberating software ---------------|

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PnP BIOS + 2.4.9-ac16 = no boot
  2001-09-28 14:33 Thomas Hood
@ 2001-09-28 14:51 ` Stelian Pop
  2001-09-28 15:20   ` Thomas Hood
  0 siblings, 1 reply; 18+ messages in thread
From: Stelian Pop @ 2001-09-28 14:51 UTC (permalink / raw)
  To: Thomas Hood; +Cc: linux-kernel

On Fri, Sep 28, 2001 at 10:33:24AM -0400, Thomas Hood wrote:

> Hi Stelian.
> 
> Try this patch.  It is a modification of the latest
> pnpbios driver patch to 2.4.9-ac16 which includes
> hacks to work on a Vaio laptop.  If this works then
> I'll clean it up a bit and submit to Alan.

It works, kind of.

The only remaining problem is that the DMI scan routines are
called _after_ the PnP BIOS scan, so the is_sony_vaio_laptop
variable will be always evaluated to 0 in your patch (causing
the same hang again).

After manually changing is_sony_vaio_laptop to 1 the
patched kernel boots ok, entries in /proc/bus/pnp are present
(not sure how to test if their contents are corect though).

Stelian.
-- 
Stelian Pop <stelian.pop@fr.alcove.com>
|---------------- Free Software Engineer -----------------|
| Alcôve - http://www.alcove.com - Tel: +33 1 49 22 68 00 |
|------------- Alcôve, liberating software ---------------|

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PnP BIOS + 2.4.9-ac16 = no boot
  2001-09-28 14:02 ` Stelian Pop
@ 2001-09-28 14:41   ` Thomas Hood
  2001-09-28 14:54     ` Stelian Pop
  2001-09-28 14:58     ` Alan Cox
  2001-09-28 14:58   ` Thomas Hood
  2001-10-02 22:11   ` Ion Badulescu
  2 siblings, 2 replies; 18+ messages in thread
From: Thomas Hood @ 2001-09-28 14:41 UTC (permalink / raw)
  To: Stelian Pop; +Cc: linux-kernel

Stelian Pop wrote:
> What about making a conditional on 'is_sony_vaio_laptop' here ?
> (but you need to extends the conditionnal export of this variable
> from dmi_scan.c / i386_ksyms.c).

In addition to applying the patch I just sent
(thood-pnpbiosvaio-patch-20010928-3), you will have
to move the definition of is_sony_vaio_laptop outside
the #ifdefs in arch/i386/kernel/dmi_scan.c and i386_ksyms.c

You or Alan:  For the cleaned up patch, do we export this
variable unconditionally?

--
Thomas

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PnP BIOS + 2.4.9-ac16 = no boot
@ 2001-09-28 14:33 Thomas Hood
  2001-09-28 14:51 ` Stelian Pop
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Hood @ 2001-09-28 14:33 UTC (permalink / raw)
  To: Stelian Pop; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 220 bytes --]

Hi Stelian.

Try this patch.  It is a modification of the latest
pnpbios driver patch to 2.4.9-ac16 which includes
hacks to work on a Vaio laptop.  If this works then
I'll clean it up a bit and submit to Alan.

--
Thomas

[-- Attachment #2: thood-pnpbiosvaio-patch-20010928-3 --]
[-- Type: text/plain, Size: 13821 bytes --]

diff -Naur -5 pnp_ORIG/pnp_bios.c pnp/pnp_bios.c
--- pnp_ORIG/pnp_bios.c	Thu Sep 27 15:21:46 2001
+++ pnp/pnp_bios.c	Fri Sep 28 10:25:38 2001
@@ -484,11 +484,11 @@
 	envp [i++] = scratch;
 	scratch += sprintf (scratch, "ACTION=%s", dock?"add":"remove") + 1;
 
 	/* Report the ident for the dock */
 	envp [i++] = scratch;
-	scratch += sprintf (scratch, "DOCK=%x/%x/%x",
+	scratch += sprintf (scratch, "DOCK=0x%x/0x%x/0x%x",
 		info->location_id, info->serial, info->capabilities);
 	envp[i] = 0;
 	
 	value = call_usermodehelper (argv [0], argv, envp);
 	kfree (buf);
@@ -552,14 +552,13 @@
 	complete_and_exit(&unload_sem, 0);
 }
 
 #endif
 
-/* 
- * Searches the defined area (0xf0000-0xffff0) for a valid PnP BIOS
- * structure and, if found one, sets up the selectors and entry points
- */
+extern int is_sony_vaio_laptop;
+int pnp_bios_dont_use_current;
+EXPORT_SYMBOL(pnp_bios_dont_use_current);
 
 static int pnp_bios_disabled;
 
 static int disable_pnp_bios(char *str)
 {
@@ -567,10 +566,15 @@
 	return 0;
 }
 
 __setup("nobiospnp", disable_pnp_bios);
 
+/* 
+ * Searches the defined area (0xf0000-0xffff0) for a valid PnP BIOS
+ * structure and, if found one, sets up the selectors and entry points
+ */
+
 void pnp_bios_init(void)
 {
 	union pnpbios *check;
 	u8 sum;
 	int i, length;
@@ -580,10 +584,16 @@
 	if(pnp_bios_disabled)
 	{
 		printk(KERN_INFO "PNP BIOS services disabled.\n");
 		return;
 	}
+
+	if ( is_sony_vaio_laptop )
+		pnp_bios_dont_use_current = 1;
+	else
+		pnp_bios_dont_use_current = 0;
+
 	for (check = (union pnpbios *) __va(0xf0000);
 	     check < (union pnpbios *) __va(0xffff0);
 	     ((void *) (check)) += 16) {
 		if (check->fields.signature != PNP_SIGNATURE)
 			continue;
@@ -593,18 +603,18 @@
 		for (sum = 0, i = 0; i < length; i++)
 			sum += check->chars[i];
 		if (sum)
 			continue;
 		if (check->fields.version < 0x10) {
-			printk(KERN_WARNING "PnP: unsupported version %d.%d",
+			printk(KERN_WARNING "PnPBIOS: unsupported version %d.%d",
 			       check->fields.version >> 4,
 			       check->fields.version & 15);
 			continue;
 		}
-		printk(KERN_INFO "PnP: PNP BIOS installation structure at 0x%p\n",
+		printk(KERN_INFO "PnPBIOS: PnP BIOS installation structure at 0x%p\n",
 		       check);
-		printk(KERN_INFO "PnP: PNP BIOS version %d.%d, entry at %x:%x, dseg at %x\n",
+		printk(KERN_INFO "PnPBIOS: PnP BIOS version %d.%d, entry at 0x%x:0x%x, dseg at 0x%x\n",
                        check->fields.version >> 4, check->fields.version & 15,
 		       check->fields.pm16cseg, check->fields.pm16offset,
 		       check->fields.pm16dseg);
 		Q2_SET_SEL(PNP_CS32, &pnp_bios_callfunc, 64 * 1024);
 		Q_SET_SEL(PNP_CS16, check->fields.pm16cseg, 64 * 1024);
@@ -644,33 +654,49 @@
 EXPORT_SYMBOL(pnp_bios_present);
 EXPORT_SYMBOL(pnp_bios_dev_node_info);
 
 static void inline pnpbios_add_irqresource(struct pci_dev *dev, int irq)
 {
+	// Permit irq==-1 which signifies "disabled"
 	int i = 0;
-	while (dev->irq_resource[i].start && i < DEVICE_COUNT_IRQ) i++;
-	if (i < DEVICE_COUNT_IRQ)
+	while (!(dev->irq_resource[i].flags & IORESOURCE_UNSET) && i < DEVICE_COUNT_IRQ) i++;
+	if (i < DEVICE_COUNT_IRQ) {
 		dev->irq_resource[i].start = irq;
+		dev->irq_resource[i].flags = IORESOURCE_IRQ;  // Also clears _UNSET flag
+	}
 }
 
 static void inline pnpbios_add_dmaresource(struct pci_dev *dev, int dma)
 {
+	// Permit dma==-1 which signifies "disabled"
 	int i = 0;
-	while (dev->dma_resource[i].start && i < DEVICE_COUNT_DMA) i++;
-	if (i < DEVICE_COUNT_DMA)
+	while (!(dev->dma_resource[i].flags & IORESOURCE_UNSET) && i < DEVICE_COUNT_DMA) i++;
+	if (i < DEVICE_COUNT_DMA) {
 		dev->dma_resource[i].start = dma;
+		dev->dma_resource[i].flags = IORESOURCE_DMA;  // Also clears _UNSET flag
+	}
 }
 
-static void __init pnpbios_add_ioresource(struct pci_dev *dev, int io, 
-					  int len, int flags)
+static void __init pnpbios_add_ioresource(struct pci_dev *dev, int io, int len)
 {
 	int i = 0;
-	while (dev->resource[i].start && i < DEVICE_COUNT_RESOURCE) i++;
+	while (!(dev->resource[i].flags & IORESOURCE_UNSET) && i < DEVICE_COUNT_RESOURCE) i++;
 	if (i < DEVICE_COUNT_RESOURCE) {
 		dev->resource[i].start = io;
 		dev->resource[i].end = io + len;
-		dev->resource[i].flags = flags;
+		dev->resource[i].flags = IORESOURCE_IO;  // Also clears _UNSET flag
+	}
+}
+
+static void __init pnpbios_add_memresource(struct pci_dev *dev, int io, int len)
+{
+	int i = 0;
+	while (!(dev->resource[i].flags & IORESOURCE_UNSET) && i < DEVICE_COUNT_RESOURCE) i++;
+	if (i < DEVICE_COUNT_RESOURCE) {
+		dev->resource[i].start = io;
+		dev->resource[i].end = io + len;
+		dev->resource[i].flags = IORESOURCE_MEM;  // Also clears _UNSET flag
 	}
 }
 
 static char * __init pnpid32_to_pnpid(u32 id);
 
@@ -678,22 +704,22 @@
  * request I/O ports which are used according to the PnP BIOS
  * to avoid I/O conflicts.
  */
 static void mboard_request(char *pnpid, int io, int len)
 {
-    struct ressource *res;
+    struct resource *res;
     
     if (0 != strcmp(pnpid,"PNP0c01") &&  /* memory controller */
 	0 != strcmp(pnpid,"PNP0c02"))    /* system peripheral: other */
 	return;
 
     if (io < 0x100) {
 	/*
 	 * below 0x100 is only standard PC hardware
 	 * (pics, kbd, timer, dma, ...)
 	 *
-	 * We should not get ressource conflicts there,
+	 * We should not get resource conflicts there,
 	 * and the kernel reserves these anyway
 	 * (see arch/i386/kernel/setup.c).
 	 */
 	return;
     }
@@ -714,75 +740,91 @@
 
 /* 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,len,dma;
 
-	memset(pci_dev, 0, sizeof(struct pci_dev));
         while ( (char *)p < ((char *)node->data + node->size )) {
         	if(p==lastp) break;
 
                 if( p[0] & 0x80 ) {// large item
 			switch (p[0] & 0x7f) {
 			case 0x01: // memory
-				io = *(short *) &p[4];
-				len = *(short *) &p[10];
-				pnpbios_add_ioresource(pci_dev, io, len, IORESOURCE_MEM);
+			{
+				int io = *(short *) &p[4];
+				int len = *(short *) &p[10];
+				pnpbios_add_memresource(pci_dev, io, len);
 				break;
+			}
 			case 0x02: // device name
-				len = *(short *) &p[1];
+			{
+				int len = *(short *) &p[1];
 				memcpy(pci_dev->name, p + 3, len >= 80 ? 79 : len);
 				break;
+			}
 			case 0x05: // 32-bit memory
-				io = *(int *) &p[4];
-				len = *(int *) &p[16];
-				pnpbios_add_ioresource(pci_dev, io, len, IORESOURCE_MEM);
+			{
+				int io = *(int *) &p[4];
+				int len = *(int *) &p[16];
+				pnpbios_add_memresource(pci_dev, io, len);
 				break;
+			}
 			case 0x06: // fixed location 32-bit memory
-				io = *(int *) &p[4];
-				len = *(int *) &p[8];
-				pnpbios_add_ioresource(pci_dev, io, len, IORESOURCE_MEM);
+			{
+				int io = *(int *) &p[4];
+				int len = *(int *) &p[8];
+				pnpbios_add_memresource(pci_dev, io, len);
 				break;
 			}
+			} /* switch */
                         lastp = p+3;
                         p = p + p[1] + p[2]*256 + 3;
                         continue;
                 }
                 if ((p[0]>>3) == 0x0f) // end tag
                         break;
                 switch (p[0]>>3) {
                 case 0x04: // irq
-                        irq = -1;
+                {
+                        int i, mask, irq = -1; // "disabled"
                         mask= p[1] + p[2]*256;
                         for (i=0;i<16;i++, mask=mask>>1)
-                                if(mask &0x01) irq=i;
+                                if(mask & 0x01) irq=i;
 			pnpbios_add_irqresource(pci_dev, irq);
                         break;
+                }
                 case 0x05: // dma
-                        dma = -1;
+                {
+                        int i, mask, dma = -1; // "disabled"
                         mask = p[1];
                         for (i=0;i<8;i++, mask = mask>>1)
-                                if(mask&0x01) dma=i;
+                                if(mask & 0x01) dma=i;
 			pnpbios_add_dmaresource(pci_dev, dma);
                         break;
+                }
                 case 0x08: // io
-			io= p[2] + p[3] *256;
-			len = p[7];
-			pnpbios_add_ioresource(pci_dev, io, len, IORESOURCE_IO);
+                {
+			int io= p[2] + p[3] *256;
+			int len = p[7];
+			pnpbios_add_ioresource(pci_dev, io, len);
 			mboard_request(pnpid32_to_pnpid(node->eisa_id),io,len);
                         break;
+                }
 		case 0x09: // fixed location io
-			io = p[1] + p[2] * 256;
-			len = p[3];
-			pnpbios_add_ioresource(pci_dev, io, len, IORESOURCE_IO);
+		{
+			int io = p[1] + p[2] * 256;
+			int len = p[3];
+			pnpbios_add_ioresource(pci_dev, io, len);
 			break;
-                }
+		}
+                } /* switch */
                 lastp=p+1;
                 p = p + (p[0] & 0x07) + 1;
 
-        }
+        } /* while */
+
+        return;
 }
 
 #define HEX(id,a) hex[((id)>>a) & 15]
 #define CHAR(id,a) (0x40 + (((id)>>a) & 31))
 
@@ -816,21 +858,49 @@
 	/* FIXME: Need to check for re-add of existing node */
 	list_add_tail(&dev->global_list, &pnpbios_devices);
 	return 0;
 }
 
+static struct pci_dev * __init pnpbios_kmalloc_pci_dev( void )
+{
+	struct pci_dev *dev;
+	int i;
+
+	dev =  kmalloc( sizeof(struct pci_dev), GFP_KERNEL );
+	if (!dev)
+		return NULL;
+
+	memset(dev,0,sizeof(struct pci_dev));
+
+	for (i=0;i<DEVICE_COUNT_RESOURCE;i++) {
+	/*	dev->resource[i].start = 0; */
+		dev->resource[i].flags = IORESOURCE_UNSET;
+	}
+	for (i=0;i<DEVICE_COUNT_IRQ;i++) {
+		dev->irq_resource[i].start = (unsigned long)-1;  // "disabled"
+		dev->irq_resource[i].flags = IORESOURCE_UNSET;
+	}
+	for (i=0;i<DEVICE_COUNT_DMA;i++) {
+		dev->dma_resource[i].start = (unsigned long)-1;  // "disabled"
+		dev->dma_resource[i].flags = IORESOURCE_UNSET;
+	}
+
+	return dev;
+}
+
 /*
  *	Build the list of pci_dev objects from the PnP table
  */
  
 static void __init pnpbios_build_devlist(void)
 {
-	int i, devs = 0;
+	int i;
+	int nodes_got = 0;
 	struct pnp_bios_node *node;
         struct pnp_dev_node_info node_info;
 	struct pci_dev *dev;
-	int num;
+	int nodenum;
 	char *pnpid;
 
 	
         if (!pnp_bios_present ())
                 return;
@@ -840,33 +910,33 @@
 
         node = kmalloc(node_info.max_node_size, GFP_KERNEL);
         if (!node)
                 return;
 
-	for(i=0;i<0xff;i++) {
-		dev =  kmalloc(sizeof (struct pci_dev), GFP_KERNEL);
+	for(i=0,nodenum=0;i<0xff && nodenum!=0xff;i++) {
+		int thisnodenum = nodenum;
+                if (pnp_bios_get_dev_node(
+                	(u8 *)&nodenum,
+                	pnp_bios_dont_use_current ? (char) 1 : (char ) 0,
+                	node)
+                )
+			continue;
+		nodes_got++;
+		dev = pnpbios_kmalloc_pci_dev();
 		if (!dev)
 			break;
-			
-                if (pnp_bios_get_dev_node((u8 *)&num, (char )0 , node))
-			continue;
-
-		devs++;
 		pnpbios_rawdata_2_pci_dev(node,dev);
-		dev->devfn=num;
+		dev->devfn=thisnodenum;
 		pnpid = pnpid32_to_pnpid(node->eisa_id);
 		memcpy(dev->name,"PNPBIOS",8);
 		memcpy(dev->slot_name,pnpid,8);
 		if(pnpbios_insert_device(dev)<0)
 			kfree(dev);
 	}
 	kfree(node);
 
-	if (devs)
-		printk(KERN_INFO "PnP: %i device%s detected total\n", devs, devs > 1 ? "s" : "");
-	else
-		printk(KERN_INFO "PnP: No devices found\n");
+	printk(KERN_INFO "PnPBIOS: %i node%s reported by PnP BIOS\n", nodes_got, nodes_got != 1 ? "s" : "");
 }
 
 
 /*
  *	The public interface to PnP BIOS enumeration
diff -Naur -5 pnp_ORIG/pnp_proc.c pnp/pnp_proc.c
--- pnp_ORIG/pnp_proc.c	Thu Sep 27 15:21:46 2001
+++ pnp/pnp_proc.c	Fri Sep 28 10:28:31 2001
@@ -13,10 +13,11 @@
 #include <linux/slab.h>
 #include <linux/types.h>
 #include <linux/proc_fs.h>
 #include <linux/pnp_bios.h>
 
+extern int pnp_bios_dont_use_current;
 static struct proc_dir_entry *proc_pnp = NULL;
 static struct proc_dir_entry *proc_pnp_boot = NULL;
 static struct pnp_dev_node_info node_info;
 
 static int proc_read_devices(char *buf, char **start, off_t pos,
@@ -31,11 +32,11 @@
 	    return 0;
 	}
 	node = kmalloc(node_info.max_node_size, GFP_KERNEL);
 	if (!node) return -ENOMEM;
 	for (num = 0; num != 0xff; ) {
-		pnp_bios_get_dev_node(&num, 0, node);
+		pnp_bios_get_dev_node(&num, 1, node);
 		p += sprintf(p, "%02x\t%08x\t%02x:%02x:%02x\t%04x\n",
 			     node->handle, node->eisa_id,
 			     node->type_code[0], node->type_code[1],
 			     node->type_code[2], node->flags);
 	}
@@ -103,18 +104,20 @@
 	
 	node = kmalloc(node_info.max_node_size, GFP_KERNEL);
 	if (!node) return;
 	for (num = 0; num != 0xff; ) {
 		//sprintf(name, "%02x", num);
-		if (pnp_bios_get_dev_node(&num, 0, node) != 0)
+		if (pnp_bios_get_dev_node(&num, 1, node) != 0)
 			break;
 		sprintf(name, "%02x", node->handle);
-		ent = create_proc_entry(name, 0, proc_pnp);
-		if (ent) {
-			ent->read_proc = proc_read_node;
-			ent->write_proc = proc_write_node;
-			ent->data = (void *)(long)(node->handle);
+		if ( !pnp_bios_dont_use_current ) {
+			ent = create_proc_entry(name, 0, proc_pnp);
+			if (ent) {
+				ent->read_proc = proc_read_node;
+				ent->write_proc = proc_write_node;
+				ent->data = (void *)(long)(node->handle);
+			}
 		}
 		ent = create_proc_entry(name, 0, proc_pnp_boot);
 		if (ent) {
 			ent->read_proc = proc_read_node;
 			ent->write_proc = proc_write_node;
@@ -130,11 +133,13 @@
 	char name[3];
 	
 	if (!proc_pnp) return;
 	for (num = 0; num != 0xff; num++) {
 		sprintf(name, "%02x", num);
-		remove_proc_entry(name, proc_pnp);
+		if ( !pnp_bios_dont_use_current ) {
+			remove_proc_entry(name, proc_pnp);
+		}
 		remove_proc_entry(name, proc_pnp_boot);
 	}
 	remove_proc_entry("boot", proc_pnp);
 	remove_proc_entry("devices", proc_pnp);
 	remove_proc_entry("pnp", proc_bus);

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PnP BIOS + 2.4.9-ac16 = no boot
  2001-09-28 13:47 Thomas Hood
@ 2001-09-28 14:02 ` Stelian Pop
  2001-09-28 14:41   ` Thomas Hood
                     ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Stelian Pop @ 2001-09-28 14:02 UTC (permalink / raw)
  To: Thomas Hood; +Cc: linux-kernel

On Fri, Sep 28, 2001 at 09:47:43AM -0400, Thomas Hood wrote:

[ Some detailed PnP BIOS driver explication snipped]
> I attach a revised patch which cuts out proc support.  Hopefully
> this will allow your kernel to boot.  This is just a hack; I'll
> submit a proper fix to Alan later.

I confirm that the revised patch makes a bootable kernel for me.

> Stelian: Your report made me go back and look at something Alan
> told me earlier about Vaio laptops.  At the time I didn't fully 
> understand what he meant when he said:
> > If you query the current device status on a Vaio and some other boxes
> > using the 32bit API your computer dies horribly shortly afterwards.
> I didn't realize that he meant the "current" configuration as
> opposed to the "boot" configuration.  Stupid of me.
[...]
> -	pnp_proc_init();
> +	// pnp_proc_init();

What about making a conditional on 'is_sony_vaio_laptop' here ?
(but you need to extends the conditionnal export of this variable 
from dmi_scan.c / i386_ksyms.c).

Stelian.
-- 
Stelian Pop <stelian.pop@fr.alcove.com>
|---------------- Free Software Engineer -----------------|
| Alcôve - http://www.alcove.com - Tel: +33 1 49 22 68 00 |
|------------- Alcôve, liberating software ---------------|

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PnP BIOS + 2.4.9-ac16 = no boot
@ 2001-09-28 13:47 Thomas Hood
  2001-09-28 14:02 ` Stelian Pop
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Hood @ 2001-09-28 13:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Stelian Pop

[-- Attachment #1: Type: text/plain, Size: 1777 bytes --]

Stelian:

In -ac15 the PnP BIOS driver was changed so that the proc interface
got the "current" and "boot" configurations the right way 'round.
As a side effect the change made the initialization routine
build its device list from the "current" configuration as opposed
to the "boot" configuration (... which seemed like the right thing
to do at the time, heh heh ... hmmmmm).

You wrote:
> With the patch a third line is printed before the oops:
> 	PnP: PNP BIOS 13 devices detected (or something like that).

The patch I sent you reverted the build_devlist function to looking
at the "boot" configuration.  Your output shows that the devlist
got built this time, which is good.  However you still got an oops,
which is bad.  My guess is that the oops now occurs in pnp_proc_init().
I attach a revised patch which cuts out proc support.  Hopefully
this will allow your kernel to boot.  This is just a hack; I'll
submit a proper fix to Alan later.

Alan (if you're listening): The patches I have already sent you are
still okay to go since they don't affect this issue.  What I need
to do is submit a patch that, for Sony laptops, (1) causes pnpbios
to build its devlist from the "boot" configuration, and (2) omits
the "current" configuration from /proc/bus/pnp.  I'll work on this
tonight.

Stelian: Your report made me go back and look at something Alan
told me earlier about Vaio laptops.  At the time I didn't fully 
understand what he meant when he said:
> If you query the current device status on a Vaio and some other boxes
> using the 32bit API your computer dies horribly shortly afterwards.
I didn't realize that he meant the "current" configuration as
opposed to the "boot" configuration.  Stupid of me.

--
Thomas
P.S. The attached patch is only a temporary hack!

[-- Attachment #2: thood-pnpbiosvaio-patch-20010928-2 --]
[-- Type: text/plain, Size: 781 bytes --]

--- pnp_bios.c_ORIG	Thu Sep 27 15:21:46 2001
+++ pnp_bios.c_vaiofix	Fri Sep 28 09:38:16 2001
@@ -614,11 +614,11 @@
 		pnp_bios_inst_struc = check;
 		break;
 	}
 	pnpbios_build_devlist();
 #ifdef CONFIG_PROC_FS
-	pnp_proc_init();
+	// pnp_proc_init();
 #endif
 #ifdef CONFIG_HOTPLUG	
 	init_completion(&unload_sem);
 	if(kernel_thread(pnp_dock_thread, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGNAL)>0)
 		unloading = 0;
@@ -845,11 +845,11 @@
 	for(i=0;i<0xff;i++) {
 		dev =  kmalloc(sizeof (struct pci_dev), GFP_KERNEL);
 		if (!dev)
 			break;
 			
-                if (pnp_bios_get_dev_node((u8 *)&num, (char )0 , node))
+                if (pnp_bios_get_dev_node((u8 *)&num, (char )1 , node))
 			continue;
 
 		devs++;
 		pnpbios_rawdata_2_pci_dev(node,dev);
 		dev->devfn=num;

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PnP BIOS + 2.4.9-ac16 = no boot
       [not found] <3BB46DCD.91576F70@mail.com>
@ 2001-09-28 13:12 ` Stelian Pop
  0 siblings, 0 replies; 18+ messages in thread
From: Stelian Pop @ 2001-09-28 13:12 UTC (permalink / raw)
  To: Thomas Hood; +Cc: Linux Kernel Mailing List

On Fri, Sep 28, 2001 at 08:32:13AM -0400, Thomas Hood wrote:

> Please try this patch to drivers/pnp/pnp_bios.c (attached) and get
> back to me.

It doesn't change much: without the patch it hangs after:
	PnP: PNP BIOS installation structure at 0xc00f8120
	PnP: PNP BIOS version 1.0, entry ay f0000:b25f, dseg at 400
With the patch a third line is printed before the oops:
	PnP: PNP BIOS 13 devices detected (or something like that).

The oops symptoms seems to be identical in both cases.

> It would be helpful too if you could track down (using printks)
> where the fault occurs.

What about this manually copied oops decode (not sure why the
warnings are present...) (NOTE: this oops is without your patch):

ksymoops 2.4.1 on i586 2.4.9-ac16.  Options used
     -V (default)
     -k /proc/ksyms (default)
     -l /proc/modules (default)
     -o /lib/modules/2.4.9-ac16/ (default)
     -m /boot/System.map-2.4.9-ac16 (default)

Warning: You did not tell me where to find symbol information.  I will
assume that the log matches the kernel and modules that are running
right now and I'll use the default options above for symbol resolution.
If the current kernel and/or modules do not match the log, you can get
more accurate output by telling me the kernel version and where to find
map, modules, ksyms etc.  ksymoops -h explains the options.

Warning (compare_maps): mismatch on symbol us_list  , usb-storage says c80729b0, /lib/modules/2.4.9-ac16/kernel/drivers/usb/storage/usb-storage.o says c8071c80.  Ignoring /lib/modules/2.4.9-ac16/kernel/drivers/usb/storage/usb-storage.o entry
Warning (compare_maps): mismatch on symbol us_list_semaphore  , usb-storage says c80729b4, /lib/modules/2.4.9-ac16/kernel/drivers/usb/storage/usb-storage.o says c8071c84.  Ignoring /lib/modules/2.4.9-ac16/kernel/drivers/usb/storage/usb-storage.o entry
Warning (compare_maps): mismatch on symbol proc_scsi  , scsi_mod says c806c778, /lib/modules/2.4.9-ac16/kernel/drivers/scsi/scsi_mod.o says c806afd0.  Ignoring /lib/modules/2.4.9-ac16/kernel/drivers/scsi/scsi_mod.o entry
Warning (compare_maps): mismatch on symbol scsi_devicelist  , scsi_mod says c806c7a4, /lib/modules/2.4.9-ac16/kernel/drivers/scsi/scsi_mod.o says c806affc.  Ignoring /lib/modules/2.4.9-ac16/kernel/drivers/scsi/scsi_mod.o entry
Warning (compare_maps): mismatch on symbol scsi_hostlist  , scsi_mod says c806c7a0, /lib/modules/2.4.9-ac16/kernel/drivers/scsi/scsi_mod.o says c806aff8.  Ignoring /lib/modules/2.4.9-ac16/kernel/drivers/scsi/scsi_mod.o entry
Warning (compare_maps): mismatch on symbol scsi_hosts  , scsi_mod says c806c7a8, /lib/modules/2.4.9-ac16/kernel/drivers/scsi/scsi_mod.o says c806b000.  Ignoring /lib/modules/2.4.9-ac16/kernel/drivers/scsi/scsi_mod.o entry
Warning (compare_maps): mismatch on symbol scsi_logging_level  , scsi_mod says c806c774, /lib/modules/2.4.9-ac16/kernel/drivers/scsi/scsi_mod.o says c806afcc.  Ignoring /lib/modules/2.4.9-ac16/kernel/drivers/scsi/scsi_mod.o entry
Warning (compare_maps): mismatch on symbol usb_devfs_handle  , usbcore says c8050580, /lib/modules/2.4.9-ac16/kernel/drivers/usb/usbcore.o says c80500a0.  Ignoring /lib/modules/2.4.9-ac16/kernel/drivers/usb/usbcore.o entry
CPU:    0
EIP:    0068:[<0000a67e>]  Not tainted
Using defaults from ksymoops -t elf32-i386 -a i386
EFLAGS: 00010046
eax: 00000001 ebx: 0000a8ce ecx: 00150000 edx: 00000005
esi: 0000c569 edi: 00000000 ebp: c11ede80 esp: c11ede28
ds: 0040 es:0080 ss: 0018
Process swapper (pid: 1, stackpage=c11ed000)
Stack: c5ae0070 a8ce0005 c5883032 c54c0003 0a110011 0018c50f c4fca8c8 0000c4e8
       c4d3a8c7 0000c4c1 00030000 de800000 de6ec11e a8afc11e 00000000 00180000
       00010015 ca5d0000 02f8c039 c1cac0b4 c17f0000 cac2c1a7 20000000 00000000
Call trace: [<c011a3cc>] [<c018bf28>] [<c0105000>] [<c018c4bb>] [<c01051fd>] 
   [<c0105000>] [<c010562f>] [<c01051f4>]
Code: Bad EIP value

>>EIP; 0000a67e Before first symbol   <=====
Trace; c011a3cc <update_process_times+20/7f>
Trace; c018bf28 <pnp_bios_get_dev_node+de/123>
Trace; c0105000 <_stext+0/0>
Trace; c018c4bb <pnp_bios_init+169/1b6>
Trace; c01051fd <init+9/134>
Trace; c0105000 <_stext+0/0>
Trace; c010562f <kernel_thread+26/30>
Trace; c01051f4 <init+0/134>

  Kernel panic: Attempted to kill init!

9 warnings issued.  Results may not be reliable.

-- 
Stelian Pop <stelian.pop@fr.alcove.com>
|---------------- Free Software Engineer -----------------|
| Alcôve - http://www.alcove.com - Tel: +33 1 49 22 68 00 |
|------------- Alcôve, liberating software ---------------|

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PnP BIOS + 2.4.9-ac16 = no boot
@ 2001-09-28 12:29 Thomas Hood
  0 siblings, 0 replies; 18+ messages in thread
From: Thomas Hood @ 2001-09-28 12:29 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1120 bytes --]

Stelian Pop wrote:
> When booting a 2.4.9-ac16 kernel on my Sony Vaio C1VE laptop
> the boot process hangs with something like:
> 	PnP: PNP BIOS installation structure at 0xc00f8120
> 	PnP: PNP BIOS version 1.0, entry ay f0000:b25f, dseg at 400
> 	general protection fault: 0000
> 	...
> 	Code: Bad EIP value
> 
> Adding nobiospnp to the kernel boot line solves the problem. The last
> -ac kernel I tried (2.4.9-ac10) does not need exhibit this problem.

Between 2.4.9-ac10 and 2.4.9-ac16 two small changes were made to
the PnP BIOS code.  One of them must be the cause of your troubles.

> Since this machine's BIOS is crap anyway (almost entirely ACPI - 
> APM suspend doesn't work etc), is it worth investigating this issue
> or should I blame the BIOS structures once again ?

Initial suspicion may fall on your BIOS.  However, if the
PnP BIOS driver worked before then that means that we ought
to be able to work around any bugs in it.

Please try this patch to drivers/pnp/pnp_bios.c (attached) and get
back to me.

It would be helpful too if you could track down (using printks)
where the fault occurs.

--
Thomas

[-- Attachment #2: thood-pnpbiosvaio-patch-20010928-1 --]
[-- Type: text/plain, Size: 457 bytes --]

--- pnp_bios.c_ORIG	Thu Sep 27 15:21:46 2001
+++ pnp_bios.c_vaiofix	Fri Sep 28 08:24:39 2001
@@ -845,11 +845,11 @@
 	for(i=0;i<0xff;i++) {
 		dev =  kmalloc(sizeof (struct pci_dev), GFP_KERNEL);
 		if (!dev)
 			break;
 			
-                if (pnp_bios_get_dev_node((u8 *)&num, (char )0 , node))
+                if (pnp_bios_get_dev_node((u8 *)&num, (char )1 , node))
 			continue;
 
 		devs++;
 		pnpbios_rawdata_2_pci_dev(node,dev);
 		dev->devfn=num;


^ permalink raw reply	[flat|nested] 18+ messages in thread

* PnP BIOS + 2.4.9-ac16 = no boot
@ 2001-09-28 10:46 Stelian Pop
  0 siblings, 0 replies; 18+ messages in thread
From: Stelian Pop @ 2001-09-28 10:46 UTC (permalink / raw)
  To: Linux Kernel Mailing List

Hi,

When booting a 2.4.9-ac16 kernel on my Sony Vaio C1VE laptop
the boot process hangs with something like:
	PnP: PNP BIOS installation structure at 0xc00f8120
	PnP: PNP BIOS version 1.0, entry ay f0000:b25f, dseg at 400
	general protection fault: 0000
	...
	Code: Bad EIP value

Adding nobiospnp to the kernel boot line solves the problem. The last
-ac kernel I tried (2.4.9-ac10) does not need exhibit this problem.

Since this machine's BIOS is crap anyway (almost entirely ACPI - 
APM suspend doesn't work etc), is it worth investigating this issue
or should I blame the BIOS structures once again ?

Thanks,

Stelian.
-- 
Stelian Pop <stelian.pop@fr.alcove.com>
|---------------- Free Software Engineer -----------------|
| Alcôve - http://www.alcove.com - Tel: +33 1 49 22 68 00 |
|------------- Alcôve, liberating software ---------------|

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2001-10-03 14:06 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-02 23:17 PnP BIOS + 2.4.9-ac16 = no boot Thomas Hood
  -- strict thread matches above, loose matches on Subject: below --
2001-10-02 23:29 Thomas Hood
2001-10-03 14:06 ` Ion Badulescu
2001-09-28 14:33 Thomas Hood
2001-09-28 14:51 ` Stelian Pop
2001-09-28 15:20   ` Thomas Hood
2001-09-28 15:28     ` Alan Cox
2001-09-28 13:47 Thomas Hood
2001-09-28 14:02 ` Stelian Pop
2001-09-28 14:41   ` Thomas Hood
2001-09-28 14:54     ` Stelian Pop
2001-09-28 14:58     ` Alan Cox
2001-09-28 14:58   ` Thomas Hood
2001-10-02 22:11   ` Ion Badulescu
2001-10-03  9:28     ` Stelian Pop
     [not found] <3BB46DCD.91576F70@mail.com>
2001-09-28 13:12 ` Stelian Pop
2001-09-28 12:29 Thomas Hood
2001-09-28 10:46 Stelian Pop

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).