diff options
-rw-r--r-- | sys/arch/amd64/conf/GENERIC | 4 | ||||
-rw-r--r-- | sys/arch/i386/conf/GENERIC | 4 | ||||
-rw-r--r-- | sys/dev/acpi/acpi.c | 12 | ||||
-rw-r--r-- | sys/dev/acpi/acpivar.h | 17 | ||||
-rw-r--r-- | sys/dev/acpi/acpivideo.c | 131 | ||||
-rw-r--r-- | sys/dev/acpi/acpivout.c | 353 | ||||
-rw-r--r-- | sys/dev/acpi/files.acpi | 8 | ||||
-rw-r--r-- | sys/dev/pci/vga_pci.c | 20 |
8 files changed, 518 insertions, 31 deletions
diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC index a4fe0629105..6de9641a778 100644 --- a/sys/arch/amd64/conf/GENERIC +++ b/sys/arch/amd64/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.265 2009/06/03 00:11:13 jordan Exp $ +# $OpenBSD: GENERIC,v 1.266 2009/06/03 00:36:59 pirofti Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -51,6 +51,8 @@ acpiprt* at acpi? acpitz* at acpi? acpimadt0 at acpi? acpithinkpad* at acpi? +acpivideo* at acpi? +acpivout* at acpivideo? mpbios0 at bios0 diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC index 907c6343c58..7b864efac1e 100644 --- a/sys/arch/i386/conf/GENERIC +++ b/sys/arch/i386/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.660 2009/06/02 23:57:21 jordan Exp $ +# $OpenBSD: GENERIC,v 1.661 2009/06/03 00:36:59 pirofti Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -63,6 +63,8 @@ acpiprt* at acpi? acpitz* at acpi? acpiasus* at acpi? acpithinkpad* at acpi? +acpivideo* at acpi? +acpivout* at acpivideo? option PCIVERBOSE option EISAVERBOSE diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index e67c3539195..d67f471f3ef 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.138 2009/06/03 00:13:35 jordan Exp $ */ +/* $OpenBSD: acpi.c,v 1.139 2009/06/03 00:36:59 pirofti Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> @@ -54,6 +54,7 @@ int acpi_debug = 16; int acpi_enabled; int acpi_poll_enabled; int acpi_hasprocfvs; +int acpi_thinkpad_enabled; #define ACPIEN_RETRIES 15 @@ -720,8 +721,9 @@ acpi_attach(struct device *parent, struct device *self, void *aux) /* attach docks */ aml_find_node(&aml_root, "_DCK", acpi_founddock, sc); - /* attach video */ - aml_find_node(&aml_root, "_DOS", acpi_foundvideo, sc); + /* attach video only if this is not a stinkpad */ + if (!acpi_thinkpad_enabled) + aml_find_node(&aml_root, "_DOS", acpi_foundvideo, sc); /* create list of devices we want to query when APM come in */ SLIST_INIT(&sc->sc_ac); @@ -2236,8 +2238,10 @@ acpi_foundhid(struct aml_node *node, void *arg) aaa.aaa_name = "acpibtn"; else if (!strcmp(dev, ACPI_DEV_ASUS)) aaa.aaa_name = "acpiasus"; - else if (!strcmp(dev, ACPI_DEV_THINKPAD)) + else if (!strcmp(dev, ACPI_DEV_THINKPAD)) { aaa.aaa_name = "acpithinkpad"; + acpi_thinkpad_enabled = 1; + } if (aaa.aaa_name) config_found(self, &aaa, acpi_print); diff --git a/sys/dev/acpi/acpivar.h b/sys/dev/acpi/acpivar.h index c2875818b19..53913740ab4 100644 --- a/sys/dev/acpi/acpivar.h +++ b/sys/dev/acpi/acpivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: acpivar.h,v 1.47 2009/04/17 13:20:20 pirofti Exp $ */ +/* $OpenBSD: acpivar.h,v 1.48 2009/06/03 00:36:59 pirofti Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * @@ -46,6 +46,16 @@ extern u_int8_t acpi_lapic_flags[LAPIC_MAP_SIZE]; struct klist; struct acpiec_softc; +struct acpivideo_softc { + struct device sc_dev; + + struct acpi_softc *sc_acpi; + struct aml_node *sc_devnode; + + int *sc_dod; + size_t sc_dod_len; +}; + struct acpi_attach_args { char *aaa_name; bus_space_tag_t aaa_iot; @@ -55,6 +65,11 @@ struct acpi_attach_args { const char *aaa_dev; }; +struct acpivideo_attach_args { + struct acpi_attach_args aaa; + int dod; +}; + struct acpi_mem_map { vaddr_t baseva; u_int8_t *va; diff --git a/sys/dev/acpi/acpivideo.c b/sys/dev/acpi/acpivideo.c index 1689de48d57..a1728a08737 100644 --- a/sys/dev/acpi/acpivideo.c +++ b/sys/dev/acpi/acpivideo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpivideo.c,v 1.2 2008/07/02 04:23:22 fgsch Exp $ */ +/* $OpenBSD: acpivideo.c,v 1.3 2009/06/03 00:36:59 pirofti Exp $ */ /* * Copyright (c) 2008 Federico G. Schwindt <fgsch@openbsd.org> * @@ -18,6 +18,7 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/device.h> +#include <sys/malloc.h> #include <machine/bus.h> @@ -47,22 +48,14 @@ #define NOTIFY_OUTPUT_NEXT_KEY 0x83 #define NOTIFY_OUTPUT_PREV_KEY 0x84 -/* Notifications for Output Devices */ -#define NOTIFY_BRIGHTNESS_CYCLE 0x85 -#define NOTIFY_BRIGHTNESS_UP 0x86 -#define NOTIFY_BRIGHTNESS_DOWN 0x87 -#define NOTIFY_BRIGHTNESS_ZERO 0x88 -#define NOTIFY_DISPLAY_OFF 0x89 - -struct acpivideo_softc { - struct device sc_dev; - - struct acpi_softc *sc_acpi; - struct aml_node *sc_devnode; -}; - int acpivideo_match(struct device *, void *, void *); void acpivideo_attach(struct device *, struct device *, void *); +int acpivideo_notify(struct aml_node *, int, void *); + +void acpivideo_set_policy(struct acpivideo_softc *, int); +void acpivideo_get_dod(struct acpivideo_softc *); +int acpi_foundvout(struct aml_node *, void *); +int acpivideo_print(void *, const char *); struct cfattach acpivideo_ca = { sizeof(struct acpivideo_softc), acpivideo_match, acpivideo_attach @@ -72,9 +65,6 @@ struct cfdriver acpivideo_cd = { NULL, "acpivideo", DV_DULL }; -int acpivideo_notify(struct aml_node *, int, void *); -void acpivideo_set_policy(struct acpivideo_softc *, int); - int acpivideo_match(struct device *parent, void *match, void *aux) { @@ -92,18 +82,21 @@ void acpivideo_attach(struct device *parent, struct device *self, void *aux) { struct acpivideo_softc *sc = (struct acpivideo_softc *)self; - struct acpi_attach_args *aa = aux; + struct acpi_attach_args *aaa = aux; sc->sc_acpi = (struct acpi_softc *)parent; - sc->sc_devnode = aa->aaa_node; + sc->sc_devnode = aaa->aaa_node; printf(": %s\n", sc->sc_devnode->name); - aml_register_notify(sc->sc_devnode, aa->aaa_dev, + aml_register_notify(sc->sc_devnode, aaa->aaa_dev, acpivideo_notify, sc, ACPIDEV_NOPOLL); acpivideo_set_policy(sc, DOS_SWITCH_BY_OSPM | DOS_BRIGHTNESS_BY_OSPM); + + acpivideo_get_dod(sc); + aml_find_node(aaa->aaa_node, "_DCS", acpi_foundvout, sc); } int @@ -114,9 +107,11 @@ acpivideo_notify(struct aml_node *node, int notify, void *arg) switch (notify) { case NOTIFY_OUTPUT_SWITCHED: case NOTIFY_OUTPUT_CHANGED: + case NOTIFY_OUTPUT_CYCLE_KEY: + case NOTIFY_OUTPUT_NEXT_KEY: + case NOTIFY_OUTPUT_PREV_KEY: DPRINTF(("%s: event 0x%02x\n", DEVNAME(sc), notify)); break; - default: printf("%s: unknown event 0x%02x\n", DEVNAME(sc), notify); break; @@ -133,6 +128,98 @@ acpivideo_set_policy(struct acpivideo_softc *sc, int policy) memset(&args, 0, sizeof(args)); args.v_integer = policy; args.type = AML_OBJTYPE_INTEGER; + aml_evalname(sc->sc_acpi, sc->sc_devnode, "_DOS", 1, &args, &res); + DPRINTF(("%s: set policy to %d", DEVNAME(sc), aml_val2int(&res))); + + aml_freevalue(&res); +} + +int +acpi_foundvout(struct aml_node *node, void *arg) +{ + struct aml_value res; + int i, addr; + char fattach = 0; + + struct acpivideo_softc *sc = (struct acpivideo_softc *)arg; + struct device *self = (struct device *)arg; + struct acpivideo_attach_args av; + + if (sc->sc_dod == NULL) + return (0); + DPRINTF(("Inside acpi_foundvout()")); + if (aml_evalname(sc->sc_acpi, node->parent, "_ADR", 0, NULL, &res)) { + DPRINTF(("%s: no _ADR\n", DEVNAME(sc))); + return (0); + } + addr = aml_val2int(&res); + DPRINTF(("_ADR: %X\n", addr)); + aml_freevalue(&res); + + for (i = 0; i < sc->sc_dod_len; i++) + if (addr == (sc->sc_dod[i]&0xffff)) { + DPRINTF(("Matched: %X\n", sc->sc_dod[i])); + fattach = 1; + break; + } + if (fattach) { + memset(&av, 0, sizeof(av)); + av.aaa.aaa_iot = sc->sc_acpi->sc_iot; + av.aaa.aaa_memt = sc->sc_acpi->sc_memt; + av.aaa.aaa_node = node->parent; + av.aaa.aaa_name = "acpivout"; + av.dod = sc->sc_dod[i]; + + config_found(self, &av, acpivideo_print); + } + + return (0); +} + +int +acpivideo_print(void *aux, const char *pnp) +{ + struct acpi_attach_args *aa = aux; + + if (pnp) { + if (aa->aaa_name) + printf("%s at %s", aa->aaa_name, pnp); + else + return (QUIET); + } + + return (UNCONF); +} + +void +acpivideo_get_dod(struct acpivideo_softc * sc) +{ + struct aml_value res; + int i; + + if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_DOD", 0, NULL, &res)) { + DPRINTF(("%s: no _DOD\n", DEVNAME(sc))); + return; + } + sc->sc_dod_len = res.length; + if (sc->sc_dod_len == 0) { + sc->sc_dod = NULL; + aml_freevalue(&res); + return; + } + sc->sc_dod = malloc(sc->sc_dod_len * sizeof(int), M_DEVBUF, + M_WAITOK|M_ZERO); + if (sc->sc_dod == NULL) { + aml_freevalue(&res); + return; + } + + for (i = 0; i < sc->sc_dod_len; i++) { + sc->sc_dod[i] = aml_val2int(res.v_package[i]); + DPRINTF(("DOD: %X ", sc->sc_dod[i])); + } + DPRINTF(("\n")); + aml_freevalue(&res); } diff --git a/sys/dev/acpi/acpivout.c b/sys/dev/acpi/acpivout.c new file mode 100644 index 00000000000..d6776719562 --- /dev/null +++ b/sys/dev/acpi/acpivout.c @@ -0,0 +1,353 @@ +/* $OpenBSD: acpivout.c,v 1.1 2009/06/03 00:36:59 pirofti Exp $ */ +/* + * Copyright (c) 2009 Paul Irofti <pirofti@openbsd.org> + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/device.h> +#include <sys/malloc.h> + +#include <machine/bus.h> + +#include <dev/acpi/acpireg.h> +#include <dev/acpi/acpivar.h> +#include <dev/acpi/acpidev.h> +#include <dev/acpi/amltypes.h> +#include <dev/acpi/dsdt.h> + +#include <dev/wscons/wsconsio.h> + +int acpivout_match(struct device *, void *, void *); +void acpivout_attach(struct device *, struct device *, void *); +int acpivout_notify(struct aml_node *, int, void *); + +#ifdef ACPIVIDEO_DEBUG +#define DPRINTF(x) printf x +#else +#define DPRINTF(x) +#endif + +/* Notifications for Output Devices */ +#define NOTIFY_BRIGHTNESS_CYCLE 0x85 +#define NOTIFY_BRIGHTNESS_UP 0x86 +#define NOTIFY_BRIGHTNESS_DOWN 0x87 +#define NOTIFY_BRIGHTNESS_ZERO 0x88 +#define NOTIFY_DISPLAY_OFF 0x89 + +struct acpivout_softc { + struct device sc_dev; + + bus_space_tag_t sc_iot; + bus_space_handle_t sc_ioh; + + struct acpi_softc *sc_acpi; + struct aml_node *sc_devnode; + + int *sc_bcl; + size_t sc_bcl_len; + + int sc_dod; + int sc_vout_type; +#define ACPIVOUT_OTHER 0 +#define ACPIVOUT_VGA 1 +#define ACPIVOUT_TV 2 +#define ACPIVOUT_DVI 3 +#define ACPIVOUT_LCD 4 + +#define ACPIVOUT_TYPE_MASK 0x0f00 +}; +void acpivout_brightness_cycle(struct acpivout_softc *); +void acpivout_brightness_up(struct acpivout_softc *); +void acpivout_brightness_down(struct acpivout_softc *); +void acpivout_brightness_zero(struct acpivout_softc *); +int acpivout_get_brightness(struct acpivout_softc *); +void acpivout_set_brightness(struct acpivout_softc *, int); +void acpivout_get_bcl(struct acpivout_softc *); + +/* wconsole hook functions */ +int acpivout_get_param(struct wsdisplay_param *); +int acpivout_set_param(struct wsdisplay_param *); + +extern int (*ws_get_param)(struct wsdisplay_param *); +extern int (*ws_set_param)(struct wsdisplay_param *); + +struct cfattach acpivout_ca = { + sizeof(struct acpivout_softc), acpivout_match, acpivout_attach +}; + +struct cfdriver acpivout_cd = { + NULL, "acpivout", DV_DULL +}; + +int +acpivout_match(struct device *parent, void *match, void *aux) +{ + struct acpivideo_attach_args *av = aux; + struct cfdata *cf = match; + + if (av->aaa.aaa_name == NULL || + strcmp(av->aaa.aaa_name, cf->cf_driver->cd_name) != 0 || + av->aaa.aaa_table != NULL) + return (0); + + return (1); +} + +void +acpivout_attach(struct device *parent, struct device *self, void *aux) +{ + struct acpivout_softc *sc = (struct acpivout_softc *)self; + struct acpivideo_attach_args *av = aux; + + sc->sc_acpi = ((struct acpivideo_softc *)parent)->sc_acpi; + sc->sc_devnode = av->aaa.aaa_node; + + sc->sc_vout_type = (av->dod&ACPIVOUT_TYPE_MASK)>>8; + + printf(": %s\n", sc->sc_devnode->name); + + aml_register_notify(sc->sc_devnode, av->aaa.aaa_dev, + acpivout_notify, sc, ACPIDEV_NOPOLL); + + ws_get_param = acpivout_get_param; + ws_set_param = acpivout_set_param; + + if (sc->sc_vout_type == ACPIVOUT_LCD || + sc->sc_vout_type == ACPIVOUT_VGA) + acpivout_get_bcl(sc); +} + +int +acpivout_notify(struct aml_node *node, int notify, void *arg) +{ + struct acpivout_softc *sc = arg; + + switch (notify) { + case NOTIFY_BRIGHTNESS_CYCLE: + acpivout_brightness_cycle(sc); + break; + case NOTIFY_BRIGHTNESS_UP: + acpivout_brightness_up(sc); + break; + case NOTIFY_BRIGHTNESS_DOWN: + acpivout_brightness_down(sc); + break; + case NOTIFY_BRIGHTNESS_ZERO: + acpivout_brightness_zero(sc); + break; + case NOTIFY_DISPLAY_OFF: + /* TODO: D3 state change */ + break; + default: + printf("%s: unknown event 0x%02x\n", DEVNAME(sc), notify); + break; + } + + return (0); +} + +void +acpivout_brightness_cycle(struct acpivout_softc *sc) +{ + int cur_level; + + if (sc->sc_bcl_len == 0) + return; + if (cur_level == sc->sc_bcl[sc->sc_bcl_len - 1]) + acpivout_brightness_zero(sc); + else + acpivout_brightness_up(sc); +} + +void +acpivout_brightness_up(struct acpivout_softc *sc) +{ + int i, cur_level; + + if (sc->sc_bcl_len == 0) + return; + cur_level = acpivout_get_brightness(sc); + if (cur_level == -1) + return; + + /* check for max brightness level */ + if (cur_level == sc->sc_bcl[sc->sc_bcl_len - 1]) + return; + + for (i = 0; i < sc->sc_bcl_len && cur_level != sc->sc_bcl[i]; i++); + acpivout_set_brightness(sc, sc->sc_bcl[i + 1]); +} + +void +acpivout_brightness_down(struct acpivout_softc *sc) +{ + int i, cur_level; + + if (sc->sc_bcl_len == 0) + return; + cur_level = acpivout_get_brightness(sc); + if (cur_level == -1) + return; + + /* check for min brightness level */ + if (cur_level == sc->sc_bcl[0]) + return; + + for (i = 0; i < sc->sc_bcl_len && cur_level != sc->sc_bcl[i]; i++); + acpivout_set_brightness(sc, sc->sc_bcl[i - 1]); +} + +void +acpivout_brightness_zero(struct acpivout_softc *sc) { + if (sc->sc_bcl_len == 0) + return; + acpivout_set_brightness(sc, sc->sc_bcl[0]); +} + +int +acpivout_get_brightness(struct acpivout_softc *sc) +{ + struct aml_value res; + int level; + + aml_evalname(sc->sc_acpi, sc->sc_devnode, "_BQC", 0, NULL, &res); + level = aml_val2int(&res); + aml_freevalue(&res); + + if (level < sc->sc_bcl[0] || level > sc->sc_bcl[sc->sc_bcl_len -1]) + level = -1; + return (level); +} + +void +acpivout_set_brightness(struct acpivout_softc *sc, int level) +{ + struct aml_value args, res; + + memset(&args, 0, sizeof(args)); + args.v_integer = level; + args.type = AML_OBJTYPE_INTEGER; + + aml_evalname(sc->sc_acpi, sc->sc_devnode, "_BCM", 1, &args, &res); + + aml_freevalue(&res); +} + +void +acpivout_get_bcl(struct acpivout_softc *sc) +{ + int i, j, value; + struct aml_value res; + + DPRINTF(("Getting _BCL!")); + aml_evalname(sc->sc_acpi, sc->sc_devnode, "_BCL", 0, NULL, &res); + if (res.type != AML_OBJTYPE_PACKAGE) { + sc->sc_bcl_len = 0; + goto err; + } + /* + * Per the ACPI spec section B.6.2 the _BCL method returns a package. + * The first integer in the package is the brightness level + * when the computer has full power, and the second is the + * brightness level when the computer is on batteries. + * All other levels may be used by OSPM. + * So we skip the first two integers in the package. + */ + if (res.length <= 2) { + sc->sc_bcl_len = 0; + goto err; + } + sc->sc_bcl_len = res.length - 2; + + sc->sc_bcl = malloc(sc->sc_bcl_len * sizeof(int), M_DEVBUF, + M_WAITOK|M_ZERO); + if (sc->sc_bcl == NULL) { + sc->sc_bcl_len = 0; + goto err; + } + + for (i = 0; i < sc->sc_bcl_len; i++) { + /* Sort darkest to brightest */ + value = aml_val2int(res.v_package[i + 2]); + for (j = i; j > 0 && sc->sc_bcl[j - 1] > value; j--) + sc->sc_bcl[j] = sc->sc_bcl[j - 1]; + sc->sc_bcl[j] = value; + } + +err: + aml_freevalue(&res); +} + + +int +acpivout_get_param(struct wsdisplay_param *dp) +{ + struct acpivout_softc *sc = NULL; + int i; + + switch (dp->param) { + case WSDISPLAYIO_PARAM_BRIGHTNESS: + if (acpivout_cd.cd_ndevs != 0) + for (i = 0; i < acpivout_cd.cd_ndevs; i++) { + if (acpivout_cd.cd_devs[i] == NULL) + continue; + sc = (struct acpivout_softc *)acpivout_cd.cd_devs[i]; + /* + * Ignore device if not connected. + */ + if (sc->sc_bcl_len != 0) + break; + } + if (sc != NULL && sc->sc_bcl_len != 0) { + dp->min = sc->sc_bcl[0]; + dp->max = sc->sc_bcl[sc->sc_bcl_len - 1]; + dp->curval = acpivout_get_brightness(sc); + return 0; + } + return -1; + default: + return -1; + } +} + +int +acpivout_set_param(struct wsdisplay_param *dp) +{ + struct acpivout_softc *sc = NULL; + int i; + + switch (dp->param) { + case WSDISPLAYIO_PARAM_BRIGHTNESS: + if (acpivout_cd.cd_ndevs != 0) + for (i = 0; i < acpivout_cd.cd_ndevs; i++) { + if (acpivout_cd.cd_devs[i] == NULL) + continue; + sc = (struct acpivout_softc *)acpivout_cd.cd_devs[i]; + /* + * Ignore device if not connected. + */ + if (sc->sc_bcl_len != 0) + break; + } + if (sc != NULL && sc->sc_bcl_len != 0) { + acpivout_set_brightness(sc, dp->curval); + return 0; + } + return -1; + default: + return -1; + } +} diff --git a/sys/dev/acpi/files.acpi b/sys/dev/acpi/files.acpi index f40ba2b9888..f3d4daf926d 100644 --- a/sys/dev/acpi/files.acpi +++ b/sys/dev/acpi/files.acpi @@ -1,4 +1,4 @@ -# $OpenBSD: files.acpi,v 1.20 2008/07/02 03:14:54 fgsch Exp $ +# $OpenBSD: files.acpi,v 1.21 2009/06/03 00:36:59 pirofti Exp $ # # Config file and device description for machine-independent ACPI code. # Included by ports that need it. @@ -77,6 +77,12 @@ attach acpithinkpad at acpi file dev/acpi/acpithinkpad.c acpithinkpad # ACPI video +define acpivideo {} device acpivideo attach acpivideo at acpi file dev/acpi/acpivideo.c acpivideo + +# ACPI vout +device acpivout +attach acpivout at acpivideo +file dev/acpi/acpivout.c acpivout diff --git a/sys/dev/pci/vga_pci.c b/sys/dev/pci/vga_pci.c index b41b668e1d1..e6688252ace 100644 --- a/sys/dev/pci/vga_pci.c +++ b/sys/dev/pci/vga_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vga_pci.c,v 1.40 2009/06/02 11:22:45 deraadt Exp $ */ +/* $OpenBSD: vga_pci.c,v 1.41 2009/06/03 00:36:59 pirofti Exp $ */ /* $NetBSD: vga_pci.c,v 1.3 1998/06/08 06:55:58 thorpej Exp $ */ /* @@ -117,6 +117,16 @@ int vesafb_putcmap(struct vga_pci_softc *, struct wsdisplay_cmap *); int vesafb_getcmap(struct vga_pci_softc *, struct wsdisplay_cmap *); #endif + +/* + * Function pointers for wsconsctl parameter handling. + * XXX These should be per-softc, but right now we only attach + * XXX a single vga@pci instance, so this will do. + */ +int (*ws_get_param)(struct wsdisplay_param *); +int (*ws_set_param)(struct wsdisplay_param *); + + struct cfattach vga_pci_ca = { sizeof(struct vga_pci_softc), vga_pci_match, vga_pci_attach, }; @@ -335,6 +345,14 @@ vga_pci_ioctl(void *v, u_long cmd, caddr_t addr, int flag, struct proc *pb) break; #endif + case WSDISPLAYIO_GETPARAM: + if(ws_get_param != NULL) + return (*ws_get_param)((struct wsdisplay_param *)addr); + break; + case WSDISPLAYIO_SETPARAM: + if(ws_set_param != NULL) + return (*ws_set_param)((struct wsdisplay_param *)addr); + break; default: error = ENOTTY; } |