From owner-acpi-jp@jp.freebsd.org  Thu Aug 31 01:08:17 2000
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id BAA08802;
	Thu, 31 Aug 2000 01:08:17 +0900 (JST)
	(envelope-from owner-acpi-jp@jp.FreeBSD.org)
Received: from shidahara1.planet.sci.kobe-u.ac.jp (shidahara1.planet.sci.kobe-u.ac.jp [133.30.50.200])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id BAA08796;
	Thu, 31 Aug 2000 01:08:16 +0900 (JST)
	(envelope-from takawata@shidahara1.planet.sci.kobe-u.ac.jp)
Received: from shidahara1.planet.sci.kobe-u.ac.jp (localhost [127.0.0.1])
	by shidahara1.planet.sci.kobe-u.ac.jp (8.9.3/8.9.3) with ESMTP id BAA04705;
	Thu, 31 Aug 2000 01:07:31 +0900 (JST)
	(envelope-from takawata@shidahara1.planet.sci.kobe-u.ac.jp)
Message-Id: <200008301607.BAA04705@shidahara1.planet.sci.kobe-u.ac.jp>
To: dfr@freebsd.org, iwasaki@jp.freebsd.org
Cc: acpi-jp@jp.freebsd.org, takawata@shidahara1.planet.sci.kobe-u.ac.jp
In-reply-to: Your message of "Wed, 30 Aug 2000 09:41:44 +0100."
             <Pine.BSF.4.21.0008300938420.24553-100000@salmon.nlsystems.com>
Date: Thu, 31 Aug 2000 01:07:31 +0900
From: Takanori Watanabe <takawata@shidahara1.planet.sci.kobe-u.ac.jp>
Reply-To: acpi-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+000315
X-Sequence: acpi-jp 590
Subject: [acpi-jp 590] Re: PCI changes affect ACPI bus space access code.
Errors-To: owner-acpi-jp@jp.freebsd.org
Sender: owner-acpi-jp@jp.freebsd.org
X-Originator: takawata@shidahara1.planet.sci.kobe-u.ac.jp

In message <Pine.BSF.4.21.0008300938420.24553-100000@salmon.nlsystems.com>, Dou
g Rabson wrote:
>On Wed, 30 Aug 2000, Mitsuru IWASAKI wrote:
>> 
>> The urgent problem is that kernel compilation is failed with the files
>> which include sys/i386/include/acpica_osd.h.  The file has
>> 
>>         pcicfgregs      pcicfg;
>> 
>>         /*
>>          * XXX Hack for Alpha(tsunami) systems.
>>          * pcicfg.hose is set to -1 in the hope that,
>>          * tsunami_cfgreadX() will set it up right.
>>          * Other Alpha systems (and i386's) don't seem to use hose.
>>          */
>>         pcicfg.hose = -1;
>> 
>> Just for very short-term solution, is it enough to delete the lines
>> which access to pcicfgregs:hose in sys/i386/include/acpica_osd.h ?
>> It seems the problem had gone if I delete the lines, but I could be
>> wrong :-)

I don't think it work,because pcicfg{read/write} is replaced into
pcib_if.m method.How about this patch?

Index: i386/include/acpica_osd.h
===================================================================
RCS file: /home/ncvs/src/sys/i386/include/acpica_osd.h,v
retrieving revision 1.2
diff -u -r1.2 acpica_osd.h
--- i386/include/acpica_osd.h	2000/08/29 20:30:51	1.2
+++ i386/include/acpica_osd.h	2000/08/30 15:54:42
@@ -35,7 +35,7 @@
 #include <sys/acpi.h>
 #include <vm/vm.h>
 #include <vm/pmap.h>
-#include <pci/pcivar.h>
+#include <i386/isa/pcibus.h>
 
 #define ACPI_BUS_SPACE_IO	I386_BUS_SPACE_IO
 
@@ -200,22 +200,9 @@
 static __inline ACPI_STATUS
 OsdReadPciCfg(UINT32 Bus, UINT32 DeviceFunction, UINT32 Register, UINT32 *Value, int bytes)
 {
-	pcicfgregs	pcicfg;
 
-	/*
-	 * XXX Hack for Alpha(tsunami) systems.
-	 * pcicfg.hose is set to -1 in the hope that,
-	 * tsunami_cfgreadX() will set it up right.
-	 * Other Alpha systems (and i386's) don't seem to use hose.
-	 */
-	pcicfg.hose = -1;
-
-	pcicfg.bus = Bus;
-	pcicfg.slot = (DeviceFunction >> 16) & 0xff;
-	pcicfg.func = DeviceFunction & 0xff;
-
-	*Value = pci_cfgread(&pcicfg, Register, bytes);
-
+	*Value = nexus_pcib_read_config(NULL,bus,(DeviceFunction >> 16) & 0xff,
+					DeviceFunction & 0xff,Register,bytes);
 	return (AE_OK);
 }
 
@@ -264,22 +251,9 @@
 static __inline ACPI_STATUS
 OsdWritePciCfg(UINT32 Bus, UINT32 DeviceFunction, UINT32 Register, UINT32 Value, int bytes)
 {
-	pcicfgregs	pcicfg;
-
-	/*
-	 * XXX Hack for Alpha(tsunami) systems.
-	 * pcicfg.hose is set to -1 in the hope that,
-	 * tsunami_cfgreadX() will set it up right.
-	 * Other Alpha systems (and i386's) don't seem to use hose.
-	 */
-	pcicfg.hose = -1;
-
-	pcicfg.bus = Bus;
-	pcicfg.slot = (DeviceFunction >> 16) & 0xff;
-	pcicfg.func = DeviceFunction & 0xff;
-
-	pci_cfgwrite(&pcicfg, Register, Value, bytes);
-
+	nexus_pcib_write_config(NULL,bus,(DeviceFunction >> 16) & 0xff,
+			       DeviceFunction & 0xff,Register
+			       Value,bytes);
 	return (AE_OK);
 }
 
Index: i386/isa/pcibus.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/isa/pcibus.c,v
retrieving revision 1.63
diff -u -r1.63 pcibus.c
--- i386/isa/pcibus.c	2000/08/28 21:48:12	1.63
+++ i386/isa/pcibus.c	2000/08/30 15:30:03
@@ -66,7 +66,10 @@
 	return 31;
 }
 
-static u_int32_t
+#ifdef MACHDEP_PCIFUNC_STATICIZE 
+static 
+#endif
+u_int32_t
 nexus_pcib_read_config(device_t dev, int bus, int slot, int func,
 		       int reg, int bytes)
 {
@@ -77,7 +80,10 @@
 
 /* write configuration space register */
 
-static void
+#ifdef MACHDEP_PCIFUNC_STATICIZE 
+static
+#endif
+void
 nexus_pcib_write_config(device_t dev, int bus, int slot, int func,
 			int reg, u_int32_t data, int bytes)
 {
Index: i386/isa/pcibus.h
===================================================================
RCS file: /home/ncvs/src/sys/i386/isa/pcibus.h,v
retrieving revision 1.2
diff -u -r1.2 pcibus.h
--- i386/isa/pcibus.h	1999/08/28 00:44:59	1.2
+++ i386/isa/pcibus.h	2000/08/30 15:53:26
@@ -46,3 +46,13 @@
 
 #define CONF2_ENABLE_CHK   0x0e
 #define CONF2_ENABLE_RES   0x0e
+
+/* 
+ *The first argument is completely ignored.
+ *At least these function should not be used in MI code.
+ */
+
+#ifndef MACHDEP_PCIFUNC_STATICIZE
+u_int32_t nexus_pcib_read_config(device_t,int,int,int,int,int);
+void nexus_pcib_write_config(device_t,int,int,int,int,int,int);
+#endif


>This is not sufficient. You probably need to do something like
>pci_ioctl() does to implement PCIOCREAD - i.e. find the right pcib
>instance and call the PCIB_READ_CONFIG method of that device.

You are right.
But when ACPI recognize new-bus device tree,I can access pci 
configuration space via pci_if interface,I think.

Takanori Watanabe
<a href="http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html">
Public Key</a>
Key fingerprint =  2C 51 E2 78 2C E1 C5 2D  0F F1 20 A3 11 3A 62 2A 


