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 _SYS_ACPIDEV_IMPL_H 27b72d5b75SMichael Corcoran #define _SYS_ACPIDEV_IMPL_H 28b72d5b75SMichael Corcoran #include <sys/types.h> 29b72d5b75SMichael Corcoran #include <sys/cmn_err.h> 30*a3114836SGerry Liu #include <sys/bitmap.h> 31*a3114836SGerry Liu #include <sys/synch.h> 32b72d5b75SMichael Corcoran #include <sys/sunddi.h> 33b72d5b75SMichael Corcoran #include <sys/acpi/acpi.h> 34b72d5b75SMichael Corcoran #include <sys/acpica.h> 35b72d5b75SMichael Corcoran #include <sys/acpidev.h> 36*a3114836SGerry Liu #include <sys/acpidev_dr.h> 37b72d5b75SMichael Corcoran 38b72d5b75SMichael Corcoran #ifdef __cplusplus 39b72d5b75SMichael Corcoran extern "C" { 40b72d5b75SMichael Corcoran #endif 41b72d5b75SMichael Corcoran 42b72d5b75SMichael Corcoran #ifdef _KERNEL 43b72d5b75SMichael Corcoran 44b72d5b75SMichael Corcoran #define ACPIDEV_ARRAY_PARAM(a) (a), (sizeof (a) / sizeof ((a)[0])) 45b72d5b75SMichael Corcoran 46b72d5b75SMichael Corcoran /* Debug support facilities. */ 47b72d5b75SMichael Corcoran extern int acpidev_debug; 48b72d5b75SMichael Corcoran #define ACPIDEV_DEBUG(lvl, ...) if (acpidev_debug) cmn_err((lvl), __VA_ARGS__) 49b72d5b75SMichael Corcoran 50b72d5b75SMichael Corcoran /* Data attached to an ACPI object to maintain device status information. */ 51b72d5b75SMichael Corcoran struct acpidev_data_impl { 52b72d5b75SMichael Corcoran uint32_t aod_eflag; /* External flags */ 53b72d5b75SMichael Corcoran uint32_t aod_iflag; /* Internal flags */ 54b72d5b75SMichael Corcoran uint32_t aod_level; 55b72d5b75SMichael Corcoran int aod_status; /* Cached _STA value */ 56b72d5b75SMichael Corcoran ACPI_HANDLE *aod_hdl; 57b72d5b75SMichael Corcoran dev_info_t *aod_dip; 58b72d5b75SMichael Corcoran acpidev_class_t *aod_class; 59b72d5b75SMichael Corcoran acpidev_class_list_t **aod_class_list; 60*a3114836SGerry Liu acpidev_board_type_t aod_bdtype; /* Type of board. */ 61*a3114836SGerry Liu uint32_t aod_bdnum; /* Board # for DR. */ 62*a3114836SGerry Liu uint32_t aod_portid; /* Port id for DR. */ 63*a3114836SGerry Liu uint32_t aod_bdidx; /* Index # of AP */ 64*a3114836SGerry Liu volatile uint32_t aod_chidx; /* Index # of child */ 65*a3114836SGerry Liu uint32_t aod_memidx; /* Index # of memory */ 66*a3114836SGerry Liu acpidev_class_id_t aod_class_id; /* Dev type for DR. */ 67b72d5b75SMichael Corcoran }; 68b72d5b75SMichael Corcoran 69b72d5b75SMichael Corcoran #define ACPIDEV_ODF_STATUS_VALID 0x1 70b72d5b75SMichael Corcoran #define ACPIDEV_ODF_DEVINFO_CREATED 0x2 71b72d5b75SMichael Corcoran #define ACPIDEV_ODF_DEVINFO_TAGGED 0x4 72*a3114836SGerry Liu #define ACPIDEV_ODF_HOTPLUG_CAPABLE 0x100 73*a3114836SGerry Liu #define ACPIDEV_ODF_HOTPLUG_READY 0x200 74*a3114836SGerry Liu #define ACPIDEV_ODF_HOTPLUG_FAILED 0x400 75*a3114836SGerry Liu 76*a3114836SGerry Liu #define ACPIDEV_DR_IS_BOARD(hdl) \ 77*a3114836SGerry Liu ((hdl)->aod_iflag & ACPIDEV_ODF_HOTPLUG_CAPABLE) 78*a3114836SGerry Liu 79*a3114836SGerry Liu #define ACPIDEV_DR_SET_BOARD(hdl) \ 80*a3114836SGerry Liu (hdl)->aod_iflag |= ACPIDEV_ODF_HOTPLUG_CAPABLE 81*a3114836SGerry Liu 82*a3114836SGerry Liu #define ACPIDEV_DR_IS_READY(hdl) \ 83*a3114836SGerry Liu ((hdl)->aod_iflag & ACPIDEV_ODF_HOTPLUG_READY) 84*a3114836SGerry Liu 85*a3114836SGerry Liu #define ACPIDEV_DR_SET_READY(hdl) \ 86*a3114836SGerry Liu (hdl)->aod_iflag |= ACPIDEV_ODF_HOTPLUG_READY 87*a3114836SGerry Liu 88*a3114836SGerry Liu #define ACPIDEV_DR_IS_FAILED(hdl) \ 89*a3114836SGerry Liu ((hdl)->aod_iflag & ACPIDEV_ODF_HOTPLUG_FAILED) 90*a3114836SGerry Liu 91*a3114836SGerry Liu #define ACPIDEV_DR_SET_FAILED(hdl) \ 92*a3114836SGerry Liu (hdl)->aod_iflag |= ACPIDEV_ODF_HOTPLUG_FAILED 93*a3114836SGerry Liu 94*a3114836SGerry Liu #define ACPIDEV_DR_IS_WORKING(hdl) \ 95*a3114836SGerry Liu (((hdl)->aod_iflag & (ACPIDEV_ODF_HOTPLUG_READY | \ 96*a3114836SGerry Liu ACPIDEV_ODF_HOTPLUG_FAILED)) == ACPIDEV_ODF_HOTPLUG_READY) 97*a3114836SGerry Liu 98*a3114836SGerry Liu #define ACPIDEV_DR_IS_PROCESSED(hdl) \ 99*a3114836SGerry Liu ((hdl)->aod_iflag & (ACPIDEV_ODF_HOTPLUG_READY | \ 100*a3114836SGerry Liu ACPIDEV_ODF_HOTPLUG_FAILED | ACPIDEV_ODF_HOTPLUG_CAPABLE)) 101*a3114836SGerry Liu 102*a3114836SGerry Liu #define ACPIDEV_DR_BOARD_READY(hdl) \ 103*a3114836SGerry Liu (((hdl)->aod_iflag & \ 104*a3114836SGerry Liu (ACPIDEV_ODF_HOTPLUG_READY | ACPIDEV_ODF_HOTPLUG_CAPABLE)) == \ 105*a3114836SGerry Liu (ACPIDEV_ODF_HOTPLUG_READY | ACPIDEV_ODF_HOTPLUG_CAPABLE)) 106b72d5b75SMichael Corcoran 107b72d5b75SMichael Corcoran /* 108b72d5b75SMichael Corcoran * List of registered device class drivers. 109b72d5b75SMichael Corcoran * Class drivers on the same list will be called from head to tail in turn. 110b72d5b75SMichael Corcoran */ 111b72d5b75SMichael Corcoran struct acpidev_class_list { 112b72d5b75SMichael Corcoran acpidev_class_list_t *acl_next; 113b72d5b75SMichael Corcoran acpidev_class_t *acl_class; 114b72d5b75SMichael Corcoran }; 115b72d5b75SMichael Corcoran 116b72d5b75SMichael Corcoran typedef struct acpidev_pseudo_uid { 117b72d5b75SMichael Corcoran struct acpidev_pseudo_uid *apu_next; 118b72d5b75SMichael Corcoran char *apu_uid; 119b72d5b75SMichael Corcoran acpidev_class_id_t apu_cid; 120b72d5b75SMichael Corcoran uint_t apu_nid; 121b72d5b75SMichael Corcoran } acpidev_pseudo_uid_t; 122b72d5b75SMichael Corcoran 123b72d5b75SMichael Corcoran typedef struct acpidev_pseudo_uid_head { 124b72d5b75SMichael Corcoran kmutex_t apuh_lock; 125b72d5b75SMichael Corcoran uint32_t apuh_id; 126b72d5b75SMichael Corcoran acpidev_pseudo_uid_t *apuh_first; 127b72d5b75SMichael Corcoran } acpidev_pseudo_uid_head_t; 128b72d5b75SMichael Corcoran 129*a3114836SGerry Liu typedef struct acpidev_dr_capacity { 130*a3114836SGerry Liu uint_t cpu_vendor; 131*a3114836SGerry Liu uint_t cpu_family; 132*a3114836SGerry Liu uint_t cpu_model_min; 133*a3114836SGerry Liu uint_t cpu_model_max; 134*a3114836SGerry Liu uint_t cpu_step_min; 135*a3114836SGerry Liu uint_t cpu_step_max; 136*a3114836SGerry Liu boolean_t hotplug_supported; 137*a3114836SGerry Liu uint64_t memory_alignment; 138*a3114836SGerry Liu } acpidev_dr_capacity_t; 139*a3114836SGerry Liu 140*a3114836SGerry Liu extern int acpidev_dr_enable; 141*a3114836SGerry Liu extern krwlock_t acpidev_class_lock; 142*a3114836SGerry Liu extern ulong_t acpidev_object_type_mask[BT_BITOUL(ACPI_TYPE_NS_NODE_MAX + 1)]; 143*a3114836SGerry Liu extern ACPI_TABLE_SRAT *acpidev_srat_tbl_ptr; 144*a3114836SGerry Liu extern ACPI_TABLE_SLIT *acpidev_slit_tbl_ptr; 145*a3114836SGerry Liu 146b72d5b75SMichael Corcoran #endif /* _KERNEL */ 147b72d5b75SMichael Corcoran 148b72d5b75SMichael Corcoran #ifdef __cplusplus 149b72d5b75SMichael Corcoran } 150b72d5b75SMichael Corcoran #endif 151b72d5b75SMichael Corcoran 152b72d5b75SMichael Corcoran #endif /* _SYS_ACPIDEV_IMPL_H */ 153