acpi.c (277796) | acpi.c (278320) |
---|---|
1/*- 2 * Copyright (c) 2000 Takanori Watanabe <takawata@jp.freebsd.org> 3 * Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@jp.freebsd.org> 4 * Copyright (c) 2000, 2001 Michael Smith 5 * Copyright (c) 2000 BSDi 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2000 Takanori Watanabe <takawata@jp.freebsd.org> 3 * Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@jp.freebsd.org> 4 * Copyright (c) 2000, 2001 Michael Smith 5 * Copyright (c) 2000 BSDi 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi.c 277796 2015-01-27 17:33:18Z avg $"); | 31__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi.c 278320 2015-02-06 16:09:01Z jhb $"); |
32 33#include "opt_acpi.h" 34#include <sys/param.h> 35#include <sys/kernel.h> 36#include <sys/proc.h> 37#include <sys/fcntl.h> 38#include <sys/malloc.h> 39#include <sys/module.h> --- 56 unchanged lines hidden (view full) --- 96struct callout acpi_sleep_timer; 97 98/* Bitmap of device quirks. */ 99int acpi_quirks; 100 101/* Supported sleep states. */ 102static BOOLEAN acpi_sleep_states[ACPI_S_STATE_COUNT]; 103 | 32 33#include "opt_acpi.h" 34#include <sys/param.h> 35#include <sys/kernel.h> 36#include <sys/proc.h> 37#include <sys/fcntl.h> 38#include <sys/malloc.h> 39#include <sys/module.h> --- 56 unchanged lines hidden (view full) --- 96struct callout acpi_sleep_timer; 97 98/* Bitmap of device quirks. */ 99int acpi_quirks; 100 101/* Supported sleep states. */ 102static BOOLEAN acpi_sleep_states[ACPI_S_STATE_COUNT]; 103 |
104static void acpi_lookup(void *arg, const char *name, device_t *dev); |
|
104static int acpi_modevent(struct module *mod, int event, void *junk); 105static int acpi_probe(device_t dev); 106static int acpi_attach(device_t dev); 107static int acpi_suspend(device_t dev); 108static int acpi_resume(device_t dev); 109static int acpi_shutdown(device_t dev); 110static device_t acpi_add_child(device_t bus, u_int order, const char *name, 111 int unit); --- 554 unchanged lines hidden (view full) --- 666 sc->acpi_dev_t->si_drv1 = sc; 667 668 if ((error = acpi_machdep_init(dev))) 669 goto out; 670 671 /* Register ACPI again to pass the correct argument of pm_func. */ 672 power_pm_register(POWER_PM_TYPE_ACPI, acpi_pm_func, sc); 673 | 105static int acpi_modevent(struct module *mod, int event, void *junk); 106static int acpi_probe(device_t dev); 107static int acpi_attach(device_t dev); 108static int acpi_suspend(device_t dev); 109static int acpi_resume(device_t dev); 110static int acpi_shutdown(device_t dev); 111static device_t acpi_add_child(device_t bus, u_int order, const char *name, 112 int unit); --- 554 unchanged lines hidden (view full) --- 667 sc->acpi_dev_t->si_drv1 = sc; 668 669 if ((error = acpi_machdep_init(dev))) 670 goto out; 671 672 /* Register ACPI again to pass the correct argument of pm_func. */ 673 power_pm_register(POWER_PM_TYPE_ACPI, acpi_pm_func, sc); 674 |
674 if (!acpi_disabled("bus")) | 675 if (!acpi_disabled("bus")) { 676 EVENTHANDLER_REGISTER(dev_lookup, acpi_lookup, NULL, 1000); |
675 acpi_probe_children(dev); | 677 acpi_probe_children(dev); |
678 } |
|
676 677 /* Update all GPEs and enable runtime GPEs. */ 678 status = AcpiUpdateAllGpes(); 679 if (ACPI_FAILURE(status)) 680 device_printf(dev, "Could not update all GPEs: %s\n", 681 AcpiFormatException(status)); 682 683 /* Allow sleep request after a while. */ --- 2712 unchanged lines hidden (view full) --- 3396 } 3397 cp += len; 3398 } 3399 freeenv(env); 3400 3401 return (0); 3402} 3403 | 679 680 /* Update all GPEs and enable runtime GPEs. */ 681 status = AcpiUpdateAllGpes(); 682 if (ACPI_FAILURE(status)) 683 device_printf(dev, "Could not update all GPEs: %s\n", 684 AcpiFormatException(status)); 685 686 /* Allow sleep request after a while. */ --- 2712 unchanged lines hidden (view full) --- 3399 } 3400 cp += len; 3401 } 3402 freeenv(env); 3403 3404 return (0); 3405} 3406 |
3407static void 3408acpi_lookup(void *arg, const char *name, device_t *dev) 3409{ 3410 ACPI_HANDLE handle; 3411 3412 if (*dev != NULL) 3413 return; 3414 3415 /* 3416 * Allow any handle name that is specified as an absolute path and 3417 * starts with '\'. We could restrict this to \_SB and friends, 3418 * but see acpi_probe_children() for notes on why we scan the entire 3419 * namespace for devices. 3420 * 3421 * XXX: The pathname argument to AcpiGetHandle() should be fixed to 3422 * be const. 3423 */ 3424 if (name[0] != '\\') 3425 return; 3426 if (ACPI_FAILURE(AcpiGetHandle(ACPI_ROOT_OBJECT, __DECONST(char *, name), 3427 &handle))) 3428 return; 3429 *dev = acpi_get_device(handle); 3430} 3431 |
|
3404/* 3405 * Control interface. 3406 * 3407 * We multiplex ioctls for all participating ACPI devices here. Individual 3408 * drivers wanting to be accessible via /dev/acpi should use the 3409 * register/deregister interface to make their handlers visible. 3410 */ 3411struct acpi_ioctl_hook --- 588 unchanged lines hidden --- | 3432/* 3433 * Control interface. 3434 * 3435 * We multiplex ioctls for all participating ACPI devices here. Individual 3436 * drivers wanting to be accessible via /dev/acpi should use the 3437 * register/deregister interface to make their handlers visible. 3438 */ 3439struct acpi_ioctl_hook --- 588 unchanged lines hidden --- |