From owner-acpi-jp@jp.freebsd.org  Sat Oct  7 01:25:44 2000
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id BAA55037;
	Sat, 7 Oct 2000 01:25:44 +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 BAA55032
	for <acpi-jp@jp.freebsd.org>; Sat, 7 Oct 2000 01:25:44 +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 BAA51525
	for <acpi-jp@jp.freebsd.org>; Sat, 7 Oct 2000 01:24:01 +0900 (JST)
	(envelope-from takawata@shidahara1.planet.sci.kobe-u.ac.jp)
Message-Id: <200010061624.BAA51525@shidahara1.planet.sci.kobe-u.ac.jp>
To: acpi-jp@jp.freebsd.org
In-reply-to: Your message of "Fri, 06 Oct 2000 16:34:55 JST."
             <200010060734.QAA48418@shidahara1.planet.sci.kobe-u.ac.jp>
Date: Sat, 07 Oct 2000 01:24:01 +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 806
Subject: [acpi-jp 806] Re: Device Enumlation idea. 
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

I revised the propose I made before.

0.BASIC PRINCIPAL.
MAKE EXISTING CODE MODIFICATION MINIMAL.IT IS BEST IF ALL YOU NEED TO
ACPI BUS ENUMULATION FUNCTIONALLY IS  SIMPLY ADD ACPI BINARY MODULE.
PRESERVE NAME SPACE STRUCTURE AS MUCH AS WE CAN.

1. Probe root name space in _PR_, _SB_,_TZ_ order.
 Devices under these name space is attached to acpi device 
directly.  Generally if a device is under non-attribute name object,
add device into child of the device that have grand parent name object.

2. Add bus bridge enumulator driver(only have device_identify bus method)
 for each device that can bedescendant of ACPI and appear as name space. 
In the method, add children to the bus and register acpi_name-device_t
table in acpi driver. Then call  _INI method if after checking by _STA.
Then install address space handler ...etc.

3. The manipulation to get ACPI_HANDLE etc... is not done via 
DEVMETHOD but direct function call. This may require module dependency
with acpi driver, but if the driver want to use ACPI_HANDLE, 
this driver must depend acpi. If device that is used other than ACPI,
the device may not use ACPI_HANDLE to get infomation,such as ISA-PNP
Logical ID. Use isa driver instead in this example.

4.Add acpi attachment for devices that can be attached to acpi 
directry. acpi-pcib driver is quite different implement than 
that of nexus-pcib.

5.Make ACPI driver interface(especially IVAR interface) compatible with 
PNP-ISA driver(static hint support is not needed,nothing to say).
This will make us less trouble if there were devices
such as sio that is attached to _SB_ directly,though
I don't think such machine as PCI(or something other than ISA)-les
s  ACPI machine.
So acpi_ivars structure is like this

struct acpi_ivars {
   ACPI_HANDLE *ad_handle;

   struct resource_list *ad_rl;
}

And include isavar.h .BUS_READ/WRITE_IVAR method can be quite 
different imprementation than actually isa one. This should be
good testbed for acpi_isa enumulation imprementation.

existing struct acpi_driver is used to device_t-ACPI_HANDLE 
list.

struct acpi_driver {
	ACPI_HANDLE *ad_handle;
	int ad_magic; /*Or this should be in acpi_ivars?*/

	device_t dev;
	LIST_ENTRY(,struct acpi_device) links;
};


Yes, Mike's 1005 version of code is slitely opposed to this direction yet.


Summery:

Needed stuff additionally.
 Enumlator.
  acpi_pci.c  PCI bus enumlator.Install address space handler,
  	      and enumulate device.
  acpi_isa.c  ISA bus enumlator.Just same role of pnp(4).

 Bus device.
  acpi_pcib.c  acpi attachment for host-pcib driver.

  acpi_ec.c  This is EC driver and can attach only ACPI specific driver.
  ec_smbus.c This is smbus interface that can attach smart battery.
	  (Though I have never looked smart battery defined by EC-SMBus device)
  acpi_smbus.c This is control method smbus code. Control method smbus 
	   spec proposal was(is) available from http://www.smbus.org/,
	    #Is this spec incorporated to ACPI-2.0?

 Need to be modified.
  acpi.c  Change IVAR imprementation.And include <isa/isavar.h> instead.
 	This is intended to emulate PNP-ISA bus. 
  acpi.h  Delete all IVAR interface. And acpi_device meaning and add acpi_add
	structure.
  pci/pci.c Add BUS_ADD_CHILD method so that identify method can use.
	(Alloc ivar)	and enable BUS_WRITE_IVAR interface 
	for SLOT and FUNCTION  check if same dev-function device exist.
	If exist, use the device is used to process normal pci conf space
	reading.

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 
