Subject: Re: PC card adapter PCI board not work
To: None <okazaki@hitachi-to.co.jp>
From: Masanori Kanaoka <kanaoka@ann.hi-ho.ne.jp>
List: tech-kern
Date: 09/09/2002 22:27:47
----Next_Part(Mon_Sep__9_22:27:47_2002_616)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

       From: Tsukasa Okazaki <okazaki@hitachi-to.co.jp>
    Subject: Re: PC card adapter PCI board not work
      Date : Mon, 09 Sep 2002 21:03:11 +0900
 Message-ID: <20020909210311M.okazaki@hitachi-to.co.jp>

$ Possbile irq
$ NumberOfInterrupts: 11
$ 	3 4 5 6 7 9 10 11 12 14 15 

How about next patch?
I guss that all the device will be assigned to irq 9.

Regards
---
 Masanori Kanaoka	kanaoka@ann.hi-ho.ne.jp


----Next_Part(Mon_Sep__9_22:27:47_2002_616)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="acpi.diff2"

Index: acpi.c
===================================================================
RCS file: /ftp/cvs/syssrc/sys/dev/acpi/acpi.c,v
retrieving revision 1.15
diff -u -r1.15 acpi.c
--- acpi.c	2002/07/29 03:26:20	1.15
+++ acpi.c	2002/09/09 13:16:10
@@ -909,6 +909,9 @@
 	ACPI_RESOURCE *res;
 	ACPI_RESOURCE_IRQ *irq;
 	uint intr;
+#ifdef ACPI_DEBUG
+	int i;
+#endif /* ACPI_DEBUG */
 
 	intr = -1;
 	rv = acpi_get(handle, &ret, AcpiGetCurrentResources);
@@ -918,12 +921,23 @@
 	     res = ACPI_NEXT_RESOURCE(res)) {
 		if (res->Id == ACPI_RSTYPE_IRQ) {
 			irq = (ACPI_RESOURCE_IRQ *)&res->Data;
+#ifdef ACPI_DEBUG
+			printf("NumberOfInterrupts %d\n\t", 
+			    irq->NumberOfInterrupts);
+			for (i = 0;i < irq->NumberOfInterrupts; i++)
+				printf(" %d", irq->Interrupts[i]);
+			printf("\n");
+#endif /* ACPI_DEBUG */
 			if (irq->NumberOfInterrupts == 1)
 				intr = irq->Interrupts[0];
 			break;
 		}
 	}
 	free(ret.Pointer, M_DEVBUF);
+
+#ifdef ACPI_DEBUG
+	printf("acpi_get_intr: return %d\n", intr);
+#endif /* ACPI_DEBUG */
 	return (intr);
 }
 
@@ -1014,7 +1028,7 @@
 		if (link == NULL)
 			continue;
 		line = acpi_get_intr(link);
-		if (line == -1) {
+		if (line == -1 || line == 0) {
 #ifdef ACPI_DEBUG
 			printf("%s: fixing up link %s\n", sc->sc_dev.dv_xname,
 			    PrtElement->Source);
@@ -1026,7 +1040,7 @@
 				continue;
 			}
 			line = acpi_get_intr(link);
-			if (line == -1) {
+			if (line == -1 || line == 0) {
 				printf("%s: get intr failed %s\n",
 				    sc->sc_dev.dv_xname, PrtElement->Source);
 				continue;
@@ -1054,6 +1068,10 @@
 	ACPI_RESOURCE_IRQ *irq;
 	ACPI_STATUS rv;
 	uint delta;
+#ifdef ACPI_DEBUG
+	ACPI_RESOURCE_IRQ *irqp;
+	int i;
+#endif /* ACPI_DEBUG */
 
 	rv = acpi_get(handle, &bufp, AcpiGetPossibleResources);
 	if (ACPI_FAILURE(rv))
@@ -1080,9 +1098,18 @@
 			memcpy(&resn->Data, &resp->Data,
 			       sizeof(ACPI_RESOURCE_IRQ));
 			irq = (ACPI_RESOURCE_IRQ *)&resn->Data;
+#ifdef ACPI_DEBUG
+			printf("Possbile irq\n");
+			irqp = (ACPI_RESOURCE_IRQ *)&resp->Data;
+			printf("NumberOfInterrupts: %d\n\t", irqp->NumberOfInterrupts);
+			for (i = 0; i < irqp->NumberOfInterrupts;i++) {
+				printf("%d ", irqp->Interrupts[i]);
+			}
+			printf("\n");
+#endif /* ACPI_DEBUG */
 			irq->Interrupts[0] =
 			    ((ACPI_RESOURCE_IRQ *)&resp->Data)->
-			        Interrupts[irq->NumberOfInterrupts-1];
+			        Interrupts[(irq->NumberOfInterrupts >> 1)];
 			irq->NumberOfInterrupts = 1;
 			resn->Length = ACPI_SIZEOF_RESOURCE(ACPI_RESOURCE_IRQ);
 			break;

----Next_Part(Mon_Sep__9_22:27:47_2002_616)----