From owner-acpi-jp@jp.FreeBSD.org Fri Sep 19 01:31:27 2003
Received: (from daemon@localhost)
	by castle.jp.FreeBSD.org (8.11.6p2+3.4W/8.11.3) id h8IGVRD35395;
	Fri, 19 Sep 2003 01:31:27 +0900 (JST)
	(envelope-from owner-acpi-jp@jp.FreeBSD.org)
Received: from locore.org (ns01.locore.org [3ffe:505:2035:1:260:97ff:fe6a:9a8c])
	by castle.jp.FreeBSD.org (8.11.6p2+3.4W/8.11.3) with ESMTP/inet6 id h8IGVPJ35388
	for <acpi-jp@jp.FreeBSD.org>; Fri, 19 Sep 2003 01:31:25 +0900 (JST)
	(envelope-from iwasaki@jp.FreeBSD.org)
Received: from localhost (ns01.locore.org [218.45.21.227])
	by locore.org (8.12.9/8.12.9/iwasaki) with ESMTP/inet id h8IGUt4l089053;
	Fri, 19 Sep 2003 01:30:56 +0900 (JST)
	(envelope-from iwasaki@jp.FreeBSD.org)
Message-Id: <20030919.013121.43004805.iwasaki@jp.FreeBSD.org>
To: acpi-jp@jp.FreeBSD.org, aizu@navi.org
Cc: nate@root.org
From: Mitsuru IWASAKI <iwasaki@jp.FreeBSD.org>
In-Reply-To: <20030918231149.7e57383b.aizu@navi.org>
References: <20030914225148.2e1a21f7.aizu@navi.org>
	<20030916161328.Q10247@root.org>
	<20030918231149.7e57383b.aizu@navi.org>
X-Mailer: Mew version 2.2 on Emacs 20.7 / Mule 4.0 (HANANOEN)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Reply-To: acpi-jp@jp.FreeBSD.org
Precedence: list
Date: Fri, 19 Sep 2003 01:31:21 +0900
X-Sequence: acpi-jp 2678
Subject: [acpi-jp 2678] Re: TOSHIBA HCI driver on ACPI.
Sender: owner-acpi-jp@jp.FreeBSD.org
X-Originator: iwasaki@jp.FreeBSD.org
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+030902

> I revised acpi_toshiba.c again. And the code size reduced to half.

Cool!
I think this driver should be kernel loadable module only driver
for Toshiba laptop users.  Small patches and module Makefile attached.
Here is my rough idea for this driver.
Source file path:    sys/i386/acpi/acpi_toshiba.c
Module compile path: sys/modules/acpi/acpi_toshiba/

Adding to ports collecton (sysutils?) also would be possible.

Suggestions?

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	i386/acpica/acpi_toshiba.c.diff
#	modules/acpi/acpi_toshiba/Makefile
#
echo x - i386/acpica/acpi_toshiba.c.diff
sed 's/^X//' >i386/acpica/acpi_toshiba.c.diff << 'END-of-i386/acpica/acpi_toshiba.c.diff'
X--- acpi_toshiba.c-	Fri Sep 19 00:52:18 2003
X+++ acpi_toshiba.c	Fri Sep 19 01:13:50 2003
X@@ -121,6 +121,8 @@
X static void acpi_toshiba_button_notify_pressed_for_sleep(void *);
X static void acpi_toshiba_button_pressed_for_power_profile(void *);
X 
X+static int acpi_toshiba_modevent(struct module *, int, void *);
X+
X #define FN_NONE		0x0000
X #define FN_F1_PRESS	0x013B
X #define FN_F1_RELEASE	0x01BB
X@@ -341,7 +343,7 @@
X }
X 
X 
X-ACPI_STATUS
X+static ACPI_STATUS
X get_hci_fn_key(ACPI_HANDLE handle, UINT32 *key)
X {
X     struct hci_regs args, results;
X@@ -451,21 +453,21 @@
X     call_hci(handle, HCI_SET, ef->reg, arg, NULL);
X }
X 
X-void
X+static void
X power_profile_next(device_t dev, ACPI_HANDLE handle)
X {
X     AcpiOsQueueForExecution(OSD_PRIORITY_LO,
X                         acpi_toshiba_button_pressed_for_power_profile, dev);
X }
X 
X-void
X+static void
X fn_sleep_button(device_t dev, ACPI_HANDLE handle)
X {
X     AcpiOsQueueForExecution(OSD_PRIORITY_LO,
X                         acpi_toshiba_button_notify_pressed_for_sleep, dev);
X }
X 
X-void
X+static void
X system_event(device_t dev, ACPI_HANDLE h)
X {
X     int i, n;
X@@ -538,6 +540,25 @@
X                                 POWER_PROFILE_ECONOMY);
X }
X 
X+static int
X+acpi_toshiba_modevent(struct module *mod, int event, void *junk)
X+{   
X+    switch(event) {
X+    case MOD_LOAD:
X+        if (!cold) {
X+            printf("The ACPI Toshiba driver cannot be loaded after boot.\n");
X+            return (EPERM);
X+        }
X+        break;
X+    case MOD_UNLOAD:
X+        return (EBUSY);
X+        break;
X+    default:
X+        break;
X+    }
X+    return (0);
X+}
X+
X 
X static device_method_t acpi_toshiba_methods[] = {
X 	DEVMETHOD(device_probe,		acpi_toshiba_probe),
X@@ -552,5 +573,5 @@
X };
X 
X static devclass_t acpi_toshiba_devclass;
X-DRIVER_MODULE(acpi_toshiba, acpi, acpi_toshiba_driver, acpi_toshiba_devclass, 0, 0);
X+DRIVER_MODULE(acpi_toshiba, acpi, acpi_toshiba_driver, acpi_toshiba_devclass, acpi_toshiba_modevent, 0);
X MODULE_DEPEND(acpi_toshiba, acpi, 100, 100, 100);
END-of-i386/acpica/acpi_toshiba.c.diff
echo x - modules/acpi/acpi_toshiba/Makefile
sed 's/^X//' >modules/acpi/acpi_toshiba/Makefile << 'END-of-modules/acpi/acpi_toshiba/Makefile'
X# $FreeBSD$
X
X.PATH: ${.CURDIR}/../../../i386/acpica
X
XKMOD=	acpi_toshiba
X
XCFLAGS+=   -I${.CURDIR}/../../../contrib/dev/acpica
XSRCS+=	acpi_toshiba.c
XSRCS+=  opt_acpi.h bus_if.h device_if.h
X
X.include <bsd.kmod.mk>
END-of-modules/acpi/acpi_toshiba/Makefile
exit

