1b72d5b75SMichael Corcoran /* 2b72d5b75SMichael Corcoran * CDDL HEADER START 3b72d5b75SMichael Corcoran * 4b72d5b75SMichael Corcoran * The contents of this file are subject to the terms of the 5b72d5b75SMichael Corcoran * Common Development and Distribution License (the "License"). 6b72d5b75SMichael Corcoran * You may not use this file except in compliance with the License. 7b72d5b75SMichael Corcoran * 8b72d5b75SMichael Corcoran * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9b72d5b75SMichael Corcoran * or http://www.opensolaris.org/os/licensing. 10b72d5b75SMichael Corcoran * See the License for the specific language governing permissions 11b72d5b75SMichael Corcoran * and limitations under the License. 12b72d5b75SMichael Corcoran * 13b72d5b75SMichael Corcoran * When distributing Covered Code, include this CDDL HEADER in each 14b72d5b75SMichael Corcoran * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15b72d5b75SMichael Corcoran * If applicable, add the following below this CDDL HEADER, with the 16b72d5b75SMichael Corcoran * fields enclosed by brackets "[]" replaced with your own identifying 17b72d5b75SMichael Corcoran * information: Portions Copyright [yyyy] [name of copyright owner] 18b72d5b75SMichael Corcoran * 19b72d5b75SMichael Corcoran * CDDL HEADER END 20b72d5b75SMichael Corcoran */ 21b72d5b75SMichael Corcoran /* 22*a3114836SGerry Liu * Copyright (c) 2009-2010, Intel Corporation. 23b72d5b75SMichael Corcoran * All rights reserved. 24b72d5b75SMichael Corcoran */ 25b72d5b75SMichael Corcoran 26b72d5b75SMichael Corcoran #ifndef _ACPI_NEXUS_H 27b72d5b75SMichael Corcoran #define _ACPI_NEXUS_H 28b72d5b75SMichael Corcoran #include <sys/types.h> 29b72d5b75SMichael Corcoran #include <sys/dditypes.h> /* needed for definition of dev_info_t */ 30b72d5b75SMichael Corcoran #include <sys/mutex.h> 31b72d5b75SMichael Corcoran 32b72d5b75SMichael Corcoran #ifdef __cplusplus 33b72d5b75SMichael Corcoran extern "C" { 34b72d5b75SMichael Corcoran #endif 35b72d5b75SMichael Corcoran 36b72d5b75SMichael Corcoran #ifdef _KERNEL 37b72d5b75SMichael Corcoran 38b72d5b75SMichael Corcoran #define ACPINEX_INSTANCE_MAX (1 << 10) 39b72d5b75SMichael Corcoran #define ACPINEX_INSTANCE_MASK (ACPINEX_INSTANCE_MAX - 1) 40b72d5b75SMichael Corcoran #define ACPINEX_INSTANCE_SHIFT 8 41b72d5b75SMichael Corcoran #define ACPINEX_MINOR_TYPE_MASK ((1 << ACPINEX_INSTANCE_SHIFT) - 1) 42b72d5b75SMichael Corcoran #define ACPINEX_DEVCTL_MINOR ((1 << ACPINEX_INSTANCE_SHIFT) - 1) 43b72d5b75SMichael Corcoran 44b72d5b75SMichael Corcoran #define ACPINEX_MAKE_DEVCTL_MINOR(instance) \ 45b72d5b75SMichael Corcoran (((instance) << ACPINEX_INSTANCE_SHIFT) | ACPINEX_DEVCTL_MINOR) 46b72d5b75SMichael Corcoran #define ACPINEX_IS_DEVCTL(minor) \ 47b72d5b75SMichael Corcoran (((minor) & ACPINEX_MINOR_TYPE_MASK) == ACPINEX_DEVCTL_MINOR) 48b72d5b75SMichael Corcoran 49b72d5b75SMichael Corcoran #define ACPINEX_GET_INSTANCE(minor) ((minor) >> ACPINEX_INSTANCE_SHIFT) 50b72d5b75SMichael Corcoran 51b72d5b75SMichael Corcoran extern int acpinex_debug; 52b72d5b75SMichael Corcoran #define ACPINEX_DEBUG(lvl, ...) \ 53b72d5b75SMichael Corcoran if (acpinex_debug) cmn_err((lvl), __VA_ARGS__) 54b72d5b75SMichael Corcoran 55b72d5b75SMichael Corcoran /* Softstate structure for acpinex instance. */ 56b72d5b75SMichael Corcoran typedef struct { 57b72d5b75SMichael Corcoran dev_info_t *ans_dip; 58b72d5b75SMichael Corcoran ACPI_HANDLE ans_hdl; 59b72d5b75SMichael Corcoran int ans_fm_cap; 60b72d5b75SMichael Corcoran ddi_iblock_cookie_t ans_fm_ibc; 61b72d5b75SMichael Corcoran kmutex_t ans_lock; 62b72d5b75SMichael Corcoran char ans_path[MAXPATHLEN]; 63b72d5b75SMichael Corcoran } acpinex_softstate_t; 64b72d5b75SMichael Corcoran 65*a3114836SGerry Liu extern void acpinex_event_init(void); 66*a3114836SGerry Liu extern void acpinex_event_fini(void); 67*a3114836SGerry Liu extern int acpinex_event_scan(acpinex_softstate_t *, boolean_t); 68*a3114836SGerry Liu 69b72d5b75SMichael Corcoran #endif /* _KERNEL */ 70b72d5b75SMichael Corcoran 71b72d5b75SMichael Corcoran #ifdef __cplusplus 72b72d5b75SMichael Corcoran } 73b72d5b75SMichael Corcoran #endif 74b72d5b75SMichael Corcoran 75b72d5b75SMichael Corcoran #endif /* _ACPI_NEXUS_H */ 76