Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Aug 2000 00:30:52 +0900
From:      Mitsuru IWASAKI <iwasaki@jp.FreeBSD.org>
To:        freebsd-current@FreeBSD.org
Cc:        freebsd-hackers@FreeBSD.org, acpi-jp@jp.FreeBSD.org
Subject:   ACPI project progress report (final?)
Message-ID:  <20000810003052A.iwasaki@jp.FreeBSD.org>

next in thread | raw e-mail | index | archive | help
Hi, here is the latest (and maybe final?) report on our ACPI project's
progress.

We are ready now to merge our work on ACPI into main source tree!

Our prototype development is going to finish.  AML interpreter
development is almost completed, region access facility (SystemMemory,
SystemIO and PCI_Config) is almost completed, device major number is
officialy assigned, source code cleanup is finished.  Also some of us
are committers of freefall to work on it.
Of cause we still have a lot of things should be done to complete this
project, but we think it's good enough as a prototype and want to work
together with you, many people who are interested in ACPI
implementation.  Folks, there are a lot of exciting and cool things,
like Processor and Device Power State Control, Thermal Management,
Replacement PnP system, OS initiated hibernation and many :-)
I think now is the time to start open and development, not only in Japan,
for FreeBSD ACPI support!

At USENIX 2000, I luckily had a discussion with Mike Smith, John Baldwin, 
Doug Rabson, Peter Wemm and some people.  I very much appreciate very useful
suggestions from them (especially Mike, thanks a lot).

Once merge happened, we will stop maintaining our ACPI CVS repository
except for DSDT/ASL data collection.  Discussions in Japanese
mailing-list will be continued but it will be just for some people who
want to get information in Japanese.  Most of Japanese ACPI developers
will work based on CURRENT.

Recently we imported CURRENT sys tree as of 2000/8/4 into our ACPI
repository and prepared diffs against CURREN at;
http://people.FreeBSD.org/~iwasaki/acpi/acpi-sys-20000804.diff.gz

and snapshot of userland tools is available at;
http://people.FreeBSD.org/~iwasaki/acpi/acpi-usr.sbin-20000804.tar.gz

Please get and taste them, we are going to merge them into CURRENT
sometime around end of this month.

How to use:
 # cd /usr/src
 # gzip -dc < /somewhere/acpi-sys-20000804.diff.gz | patch
 # tar xzpvf /somewhere/acpi-usr.sbin-20000804.tar.gz
 # cp sys/sys/acpi.h /usr/include/sys/
 # cd /usr/src/usr.sbin/acpi
 # make obj depend all install
 # mknod /dev/acpi c 152 0
 # cd /usr/src/sys/i386/conf
 # echo 'device acpi' >> MYKERNEL
 # echo 'options ACPI_DEBUG' >> MYKERNEL
 # echo 'options AML_DEBUG' >> MYKERNEL
 # config -r MYKERNEL
 # cd ../../compile/MYKERNEL
 # make depend; make all install
 # shutdown -r now
 (reboot...)
 # acpiconf -s 5
 (sleeping state 5, shutdown & power off)
 or press Power button to shutdown if supported.

Directory tour:
 - kernel space side
	src/sys/i386/i386/machdep.c
		getmemsize() try to get ACPI related memory range from SMAP.

	src/sys/i386/i386/bios.c
		bios32_init() try to find RSD PTR signature (probe ACPI BIOS).

	src/sys/sys/acpi.h
		The acpi related structs and function declaration.  This need
		to be installed in /usr/include/sys/ to compile acpi userland
		tools.

	src/sys/dev/acpi/acpi.c
		acpi device driver.

	src/sys/dev/acpi/aml/
		AML interpreter code.
		aml_parse.c was originally developed based on dfr's AML
		disassembler program.  These files can be compiled and work in
		both of kernel/userland side.

	src/sys/i386/conf/NOTES
		sample configration and possible options for acpi driver.

	src/sys/i386/i386/acpi_machdep.c
		i386 dependent implementations to be added here.

	src/sys/i386/include/acpica_osd.h
		ACPICA interface implementation (part of OS-dependent code).

	src/sys/conf/{files|options}
	src/sys/conf/files.i386
		file and option configuration for ACPI.

 - userland side
	src/usr.sbin/acpi/acpiconf
		enabler/disabler and sleeping state transition ioctl
		requests generator.

	src/usr.sbin/acpi/acpidump
		ASL and AML dump tool (modified dfr's tool a bit).
	src/usr.sbin/acpi/amldb
		The debugger for AML interpreter.

 - device file
	/dev/acpi
		major/minor should be 152, 0 (officially assigned).
		You need to create this file like
		# mknod /dev/acpi c 152 0
		to use userland tools.

ACPI device driver:
This driver has
 - ACPI memory range management
 - The pmap stuff for ACPI
 - ACPI registers manipulation stuff
 - ACPI tables handlers *
 - System sleeping state stuff
 - AML interpreter callers for special control methods; _PTS and _WAK *
 - Event handler (power/sleep button for now)
 - Interrupt handler (for general purpose events maybe incomplete)
 - Event enabler (PM1 only, GPE not yet)
 - Device file manipulation stuff
 - The new-bus dependent code

*: acpi_handle_dsdt() and acpi_execute_{pts|wak}() invoke AML interpreter.

AML interpreter source files:
 - aml_amlmem.c		memory manager instance for AML interpreter
 - aml_amlmem.h		memory manager instance for AML interpreter
 - aml_common.c		common functions for some component
 - aml_common.h		common function declarations and macros for
			kernel/userland portability
 - aml_env.h		AML execution environment
 - aml_evalobj.c	evaluation of named objects
 - aml_evalobj.h	evaluation of named objects
 - aml_memman.c		generic memory manager
 - aml_memman.h		generic memory manager
 - aml_name.c		named object and tree manipulation
 - aml_name.h		named object and tree manipulation
 - aml_obj.c		ACPI object manipulation
 - aml_obj.h		ACPI object manipulation and structure declaration
 - aml_parse.c		AML parser
 - aml_parse.h		AML parser
 - aml_region.c		region I/O routines for system resources *
 - aml_region.h		region I/O routines for system resources
 - aml_status.h		interpreter and debugger execution status declaration
 - aml_store.c		Store operation implementation
 - aml_store.h		Store operation implementation

*: SystemMemory and SystemIO I/O routines are supported, PCI_Config is almost
   completed but we need to combine ACPI namespace and new-bus device
   tree together in order to finish work.  EmbeddedController and SMBus are not
   supported for now.

ACPI userland tools:
 - acpiconf
	acpiconf [-e] [-d]	write enable/disable value to SMI command port
				(specified in FACP).
	acpiconf -s [0-5]	set sleeping state (only 1 and 5 are implemented)

 - acpidump
	acpidump		print ASL code from DSDT via /dev/mem.
	acpidump -o dsdt_file	print ASL and dump DSDT data block to the file.
	acpidump -f dsdt_file	print ASL code from given dsdt data file.

 - amldb
	amldb dsdt_files...	interpret and execute AML from given dsdt files.
				This has I/O simulator (tiny virtual machine?)
				in order to execute ACPI control methods in
				userland.  Values from/to the I/O simulator can
				be changed by prompt before actual accessing
				occurred.
				Initial content file for simulator is region.ini.
				If -d option was given, file region.dmp will be
				generated (final status of simulator contents).

	debugger commands are;

s       Single step
n       Step program
c       Continue program being debugged
q       Quit method execution
t       Show local name space tree and variables
i       Toggle region input prompt
o       Toggle region output prompt
m       Show memory management statistics
r       Run specified method
f       Find named objects from namespace.
h       Show this messsage

	example;
% amldb 3110CT.dsdt.dat
Loading 3110CT.dsdt.dat...done
AML>f _PS2
\_SB_.PCI0.VGA_._PS2.
AML>r \_SB_.PCI0.VGA_._PS2
Method: Arg 8 From 0x280603a6 To 0x2806043f
==== Running \_SB_.PCI0.VGA_._PS2. ====
AML>s
[\_SB_.PCI0.VGA_._PS2. START]
Store(0x1, \_SB_.MEM_.IESI)
[aml_region_write(0, 0, 0x1, 0x100b0000, 0x34080, 0x20)]
amldb: region.ini: No such file or directory
        [0:0x00@0x100b6810]->[0:0x01@0x100b6810]
        [0:0x00@0x100b6811]->[0:0x00@0x100b6811]
        [0:0x00@0x100b6812]->[0:0x00@0x100b6812]
        [0:0x00@0x100b6813]->[0:0x00@0x100b6813]
[write(0, 0x1, 0x100b6810)]
[aml_region_read(0, 0, 0x100b0000, 0x34080, 0x20)]
        [0:0x01@0x100b6810]
        [0:0x00@0x100b6811]
        [0:0x00@0x100b6812]
        [0:0x00@0x100b6813]
DEBUG[read(0, 0x100b6813)&mask:0x1](default: 0x1 / 1) >>
[read(0, 0x100b6810)->0x1]
AML>

	amldb -d		dump contents of I/O simulator when exiting.

	amldb -s		print memory statistics when exiting.
				AML interpreter has own memory management system
				to reduce malloc/free calling overhead and
				memory leak possibilities.  Initial memory blocks
				was pre-allocated for each defined-structures
				during compile-time.  If initial memory block is
				consumed completely, then this will try to obtain
				many blocks at once by malloc().  Also normal 
				malloc/free() like interfaces are supported (with 
				statistics) for flexible size memory allocations 
				which can't be determined until the interpreter
				is executed at runtime.

	amldb -t		print namespace tree when starting.

Additional files for amldb:
 - amldb.c			main funcion
 - debug.c			debugger
 - region.c			userland version of region I/O routines
				using I/O simulator

Data files for testing:
http://www.jp.freebsd.org/cgi/cvsweb.cgi/ACPI/util/takawata/acpi/?cvsroot=freebsd-jp
and
http://www.jp.freebsd.org/cgi/cvsweb.cgi/ACPI/util/dfr/acpitest/?cvsroot=freebsd-jp
DSDT data block files (AML) and ASL code files respectively.

Other 3rd vendor tools:
 - ASL compiler			http://www.teleport.com/~acpi/samples.htm
   example)
% wine 'asl.exe Trajan.asl'
ACPI Source Language Assembler Version 1.0.11 [Jan 18 1999, 17:50:22]
Copyright (c) 1996,1999 Microsoft Corporation
Compliant with ACPI 1.0 specification

Trajan.asl:
lm75.asl:
px4smb.asl:
NS338.asl:
338_uar1.asl:
338_uar2.asl:
338_prt.asl:
338_fdc.asl:
mb_dev.asl:
dock.asl:
asl(trajan.aml): Image Size=9204, Image Checksum=0x1a

 - ACPI Spec 2.0
	http://www.teleport.com/%7Eacpi/2spec.htm
 - ACPICA (ACPI Component Archtecture) source code and document
	This is yet another AML interpreter implementaion.  Linux take
	this one in thier kernel.
	http://developer.intel.com/technology/iapc/tech.htm

ASL code and DSDT data collection:
  We are gathering them for further implementation and testing.
  % acpidump -o foo.dsdt > foo.asl

and finally send them to takawata@shidahara1.planet.sci.kobe-u.ac.jp.
Submitted data will be stored in ACPI CVS repository.


The following is updates from our last report issued June.  New/Changed items
are marked as *.

TODO:
 - combine sys/isa/pnpparse.c with interpreter.
 - support S2, S3, S4 (hibernation) sleeping transition.  S4 sleep
   require some hack in boot loader.... needs help.
 - implement serialization and synchronization mechanism.
 - migrate to Intel ACPICA? (but that's too large to understand.  I'm
   not sure whether this has licencing issue or welcome to import it into
   FreeBSD repository in terms of licencing policy... ours?  Yes, it's BSD
   Licence. No problem at all :-)
   * I've attached Licence term of ACPICA for your reference in this mail.
 * writing manpages.  I take this one for userland tools first :-)
 * support Dock.
 * support General-Purpose Event (GPE) and Notity() implementatioin.
 * implement the rest of AML interpreter.
 * implement ACPI event thread to handle events of devices which is 
   waiting for interrupts such as buttons or Embedded Controller.
 * design/implement Policy Management daemon program.
 - and many.

Current status:
* The aml interpreter development is almost finished and also we've
ported it to kernel.  Now that we can build ACPI namespace and search
any named objects from there in kernel space.
  The aml interpreter code can be compiled and executed in both
userland (using I/O simulator) and kernel space so that we can
continue development even after we ported the code in kernel.
* Implementation of the accessing facility for SystemMemory, SystemIO
was completed.  PCI_Config is almost finished with some limitations.  And 
now simple method (eg _PTS with 1 or 5 and _WAK) is nicely executed already.
* Thus, we've achieved our goal of prototype development!

Obtaining latest source code:
* Note that this repository will be obsolete soon after merge to CURRENT.
To get ACPI project repository, please try CVSup with;
---------------------------------------
*default host=cvsup.jp.FreeBSD.org
*default base=/usr
*default prefix=/home/cvs
*default release=cvs 
*default delete use-rel-suffix
jp-acpi
---------------------------------------
cvsweb is also available at;
<URL:http://www.jp.freebsd.org/cgi/cvsweb.cgi/ACPI/?cvsroot=freebsd-jp>.


Thanks!

Appendix:  Licence terms of ACPICA
/******************************************************************************
 *
 * 1. Copyright Notice
 *
 * Some or all of this work - Copyright (c) 1999, Intel Corp.  All rights
 * reserved.
 *
 * 2. License
 *
 * 2.1. This is your license from Intel Corp. under its intellectual property
 * rights.  You may have additional license terms from the party that provided
 * you this software, covering your right to use that party's intellectual
 * property rights.
 *
 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
 * copy of the source code appearing in this file ("Covered Code") an
 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
 * base code distributed originally by Intel ("Original Intel Code") to copy,
 * make derivatives, distribute, use and display any portion of the Covered
 * Code in any form, with the right to sublicense such rights; and
 *
 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
 * license (with the right to sublicense), under only those claims of Intel
 * patents that are infringed by the Original Intel Code, to make, use, sell,
 * offer to sell, and import the Covered Code and derivative works thereof
 * solely to the minimum extent necessary to exercise the above copyright
 * license, and in no event shall the patent license extend to any additions
 * to or modifications of the Original Intel Code.  No other license or right
 * is granted directly or by implication, estoppel or otherwise;
 *
 * The above copyright and patent license is granted only if the following
 * conditions are met:
 *
 * 3. Conditions 
 *
 * 3.1. Redistribution of Source with Rights to Further Distribute Source.  
 * Redistribution of source code of any substantial portion of the Covered
 * Code or modification with rights to further distribute source must include
 * the above Copyright Notice, the above License, this list of Conditions,
 * and the following Disclaimer and Export Compliance provision.  In addition,
 * Licensee must cause all Covered Code to which Licensee contributes to
 * contain a file documenting the changes Licensee made to create that Covered
 * Code and the date of any change.  Licensee must include in that file the
 * documentation of any changes made by any predecessor Licensee.  Licensee 
 * must include a prominent statement that the modification is derived,
 * directly or indirectly, from Original Intel Code.
 *
 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.  
 * Redistribution of source code of any substantial portion of the Covered
 * Code or modification without rights to further distribute source must
 * include the following Disclaimer and Export Compliance provision in the
 * documentation and/or other materials provided with distribution.  In
 * addition, Licensee may not authorize further sublicense of source of any
 * portion of the Covered Code, and must include terms to the effect that the
 * license from Licensee to its licensee is limited to the intellectual
 * property embodied in the software Licensee provides to its licensee, and
 * not to intellectual property embodied in modifications its licensee may
 * make.
 *
 * 3.3. Redistribution of Executable. Redistribution in executable form of any
 * substantial portion of the Covered Code or modification must reproduce the
 * above Copyright Notice, and the following Disclaimer and Export Compliance
 * provision in the documentation and/or other materials provided with the
 * distribution.
 *
 * 3.4. Intel retains all right, title, and interest in and to the Original
 * Intel Code.
 *
 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
 * Intel shall be used in advertising or otherwise to promote the sale, use or
 * other dealings in products derived from or relating to the Covered Code
 * without prior written authorization from Intel.
 *
 * 4. Disclaimer and Export Compliance
 *
 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
 * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
 * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
 * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
 * PARTICULAR PURPOSE. 
 *
 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
 * LIMITED REMEDY.
 *
 * 4.3. Licensee shall not export, either directly or indirectly, any of this
 * software or system incorporating such software without first obtaining any
 * required license or other approval from the U. S. Department of Commerce or
 * any other agency or department of the United States Government.  In the
 * event Licensee exports any such software from the United States or
 * re-exports any such software from a foreign destination, Licensee shall
 * ensure that the distribution and export/re-export of the software is in
 * compliance with all laws, regulations, orders, or other restrictions of the
 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
 * any of its subsidiaries will export/re-export any technical data, process,
 * software, or service, directly or indirectly, to any country for which the
 * United States government or any agency thereof requires an export license,
 * other governmental approval, or letter of assurance, without first obtaining
 * such license, approval or letter.
 *
 *****************************************************************************/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000810003052A.iwasaki>