From owner-svn-src-head@FreeBSD.ORG Wed May 8 12:53:22 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 96AA1ED2; Wed, 8 May 2013 12:53:22 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 78843D6B; Wed, 8 May 2013 12:53:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r48CrM2n006980; Wed, 8 May 2013 12:53:22 GMT (envelope-from takawata@svn.freebsd.org) Received: (from takawata@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r48CrMGX006978; Wed, 8 May 2013 12:53:22 GMT (envelope-from takawata@svn.freebsd.org) Message-Id: <201305081253.r48CrMGX006978@svn.freebsd.org> From: Takanori Watanabe Date: Wed, 8 May 2013 12:53:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r250363 - in head/sys: dev/acpi_support modules/acpi/acpi_rapidstart X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 May 2013 12:53:22 -0000 Author: takawata Date: Wed May 8 12:53:21 2013 New Revision: 250363 URL: http://svnweb.freebsd.org/changeset/base/250363 Log: A driver for Intel Rapid Start Technology ACPI device. Note that it is just for 'Advanced' configuration for Rapid start technology. Added: head/sys/dev/acpi_support/acpi_rapidstart.c (contents, props changed) head/sys/modules/acpi/acpi_rapidstart/ head/sys/modules/acpi/acpi_rapidstart/Makefile (contents, props changed) Added: head/sys/dev/acpi_support/acpi_rapidstart.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/acpi_support/acpi_rapidstart.c Wed May 8 12:53:21 2013 (r250363) @@ -0,0 +1,133 @@ +/*- + * Copyright (c) 2013 Takanori Watanabe + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_acpi.h" +#include +#include +#include + +#include + +#include "acpi_if.h" +#include +#include +#include +static int sysctl_acpi_rapidstart_gen_handler(SYSCTL_HANDLER_ARGS); + + +static struct acpi_rapidstart_name_list +{ + char *nodename; + char *getmethod; + char *setmethod; + char *comment; +} acpi_rapidstart_oids[] ={ + {"ffs","GFFS","SFFS","Flash Fast Store Flag"}, + {"ftv","GFTV","SFTV","Time value"}, + {NULL, NULL, NULL, NULL} +}; + +struct acpi_rapidstart_softc { + struct sysctl_ctx_list *sysctl_ctx; + struct sysctl_oid *sysctl_tree; + +}; +static char *rapidstart_ids[] = {"INT3392", NULL}; +static int +acpi_rapidstart_probe(device_t dev) +{ + if (acpi_disabled("rapidstart") || + ACPI_ID_PROBE(device_get_parent(dev), dev, rapidstart_ids) == NULL || + device_get_unit(dev) != 0) + return (ENXIO); + + device_set_desc(dev, "Intel Rapid Start ACPI device"); + + return (0); + +} + +static int +acpi_rapidstart_attach(device_t dev) +{ + struct acpi_rapidstart_softc *sc; + int i; + + sc = device_get_softc(dev); + + sc->sysctl_ctx = device_get_sysctl_ctx(dev); + sc->sysctl_tree = device_get_sysctl_tree(dev); + for (i = 0 ; acpi_rapidstart_oids[i].nodename != NULL; i++){ + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + i, acpi_rapidstart_oids[i].nodename , CTLTYPE_INT | + ((acpi_rapidstart_oids[i].setmethod)? CTLFLAG_RW: CTLFLAG_RD), + dev, i, sysctl_acpi_rapidstart_gen_handler, "I", + acpi_rapidstart_oids[i].comment); + } + return (0); +} + +static int +sysctl_acpi_rapidstart_gen_handler(SYSCTL_HANDLER_ARGS) +{ + device_t dev = arg1; + int function = oidp->oid_arg2; + int error = 0, val; + + acpi_GetInteger(acpi_get_handle(dev), + acpi_rapidstart_oids[function].getmethod, &val); + error = sysctl_handle_int(oidp, &val, 0, req); + if (error || !req->newptr || !acpi_rapidstart_oids[function].setmethod) + return (error); + acpi_SetInteger(acpi_get_handle(dev), + acpi_rapidstart_oids[function].setmethod, val); + return (0); +} + +static device_method_t acpi_rapidstart_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, acpi_rapidstart_probe), + DEVMETHOD(device_attach, acpi_rapidstart_attach), + + DEVMETHOD_END +}; + +static driver_t acpi_rapidstart_driver = { + "acpi_rapidstart", + acpi_rapidstart_methods, + sizeof(struct acpi_rapidstart_softc), +}; + +static devclass_t acpi_rapidstart_devclass; + +DRIVER_MODULE(acpi_rapidstart, acpi, acpi_rapidstart_driver, acpi_rapidstart_devclass, + 0, 0); +MODULE_DEPEND(acpi_rapidstart, acpi, 1, 1, 1); + Added: head/sys/modules/acpi/acpi_rapidstart/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/acpi/acpi_rapidstart/Makefile Wed May 8 12:53:21 2013 (r250363) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../../dev/acpi_support + +KMOD= acpi_rapidstart +SRCS= acpi_rapidstart.c opt_acpi.h device_if.h bus_if.h acpi_if.h + +.include