Subject: Re: MPACPI fix (for those who had trouble with it, urgent!)
To: None <port-i386@netbsd.org>
From: Miles Nordin <carton@Ivy.NET>
List: port-i386
Date: 05/07/2004 22:03:48
>>>>> "adc" == Alicia da Conceicao <alicia@engine.ca> writes:

   adc> When I disable MPACPI/MPBIOS and enable all PCIBIOS_* and
   adc> ACPI_PCI_FIXUP options including PCIBIOS_ADDR_FIXUP, then
   adc> NetBSD has a kernel panic during boot

I had a problem with PCI_INTR_FIXUP causing a kernel panic on a
Panasonic Toughbook CF-25 MKII.  Importing the following patch from
OpenBSD stopped the kernel panic, but I never got the machine fully
working.  I don't know if it will help your much newer machine.

Index: pcibios.c
===================================================================
RCS file: /scratch/cvsroot/netbsd/src/sys/arch/i386/pci/pcibios.c,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 pcibios.c
--- pcibios.c	12 Dec 2003 11:33:05 -0000	1.1.1.5
+++ pcibios.c	3 Feb 2004 23:05:41 -0000
@@ -347,12 +378,28 @@
 	u_int32_t edx;
 	int rv;
 
+#if 0
 	__asm __volatile("lcall *(%%edi)				; \
 			jc 1f						; \
 			xor %%ah, %%ah					; \
 		1:"
 		: "=a" (ax), "=b" (bx), "=c" (cx), "=d" (edx)
 		: "0" (0xb101), "D" (&pcibios_entry));
+#else
+	__asm __volatile("pushl	%%es\n\t"
+			 "pushl	%%ds\n\t"
+			 "movw	4(%%edi), %%cx\n\t"
+			 "movl	%%ecx, %%ds\n\t"
+			 "lcall	%%cs:*(%%edi)\n\t"
+			 "pop	%%ds\n\t"
+			 "pop	%%es\n\t"
+			 "jc	1f\n\t"
+			 "xor	%%ah, %%ah\n"
+		    "1:"
+		: "=a" (ax), "=b" (bx), "=c" (cx), "=d" (edx)
+		: "0" (0xb101), "D" (&pcibios_entry)
+		: "cc", "memory");
+#endif
 
 	rv = pcibios_return_code(ax, "pcibios_get_status");
 	if (rv != PCIBIOS_SUCCESS)
@@ -395,6 +442,7 @@
 
 	memset(table, 0, args.size);
 
+#if 0
 	__asm __volatile("lcall *(%%esi)				; \
 			jc 1f						; \
 			xor %%ah, %%ah					; \
@@ -403,6 +451,21 @@
 		: "=a" (ax), "=b" (bx)
 		: "r" GSEL(GDATA_SEL, SEL_KPL), "0" (0xb10e), "1" (0),
 		  "D" (&args), "S" (&pcibios_entry));
+#else
+	__asm __volatile("pushl	%%es\n\t"
+			 "pushl	%%ds\n\t"
+			 "movw	4(%%esi), %%cx\n\t"
+			 "movl	%%ecx, %%ds\n\t"
+			 "lcall	%%cs:*(%%esi)\n\t"
+			 "popl	%%ds\n\t"
+			 "popl	%%es\n\t"
+			 "jc	1f\n\t"
+			 "xor	%%ah, %%ah\n"
+		    "1:\n"
+		: "=a" (ax), "=b" (bx)
+		: "0" (0xb10e), "1" (0), "D" (&args), "S" (&pcibios_entry)
+		: "%ecx", "%edx", "cc", "memory");
+#endif
 
 	rv = pcibios_return_code(ax, "pcibios_get_intr_routing");
 	if (rv != PCIBIOS_SUCCESS)