18e56767dSsmall /* 28e56767dSsmall * CDDL HEADER START 38e56767dSsmall * 48e56767dSsmall * The contents of this file are subject to the terms of the 530082d0cSmyers * Common Development and Distribution License (the "License"). 630082d0cSmyers * You may not use this file except in compliance with the License. 78e56767dSsmall * 88e56767dSsmall * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 98e56767dSsmall * or http://www.opensolaris.org/os/licensing. 108e56767dSsmall * See the License for the specific language governing permissions 118e56767dSsmall * and limitations under the License. 128e56767dSsmall * 138e56767dSsmall * When distributing Covered Code, include this CDDL HEADER in each 148e56767dSsmall * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 158e56767dSsmall * If applicable, add the following below this CDDL HEADER, with the 168e56767dSsmall * fields enclosed by brackets "[]" replaced with your own identifying 178e56767dSsmall * information: Portions Copyright [yyyy] [name of copyright owner] 188e56767dSsmall * 198e56767dSsmall * CDDL HEADER END 208e56767dSsmall */ 217c478bd9Sstevel@tonic-gate /* 22*35786f68SRobert Mustacchi * Copyright 2018 Joyent, Inc. 2326f3cdf0SGordon Ross * Copyright 2011 Nexenta Systems, Inc. All rights reserved. 24aa2aa9a6SDana Myers * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 257c478bd9Sstevel@tonic-gate * Use is subject to license terms. 267c478bd9Sstevel@tonic-gate */ 277c478bd9Sstevel@tonic-gate 288e56767dSsmall #ifndef _ACSOLARIS_H_ 298e56767dSsmall #define _ACSOLARIS_H_ 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #ifdef __cplusplus 327c478bd9Sstevel@tonic-gate extern "C" { 337c478bd9Sstevel@tonic-gate #endif 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #include <sys/types.h> 367c478bd9Sstevel@tonic-gate #include <sys/sunddi.h> 377c478bd9Sstevel@tonic-gate #include <sys/varargs.h> 387c478bd9Sstevel@tonic-gate #include <sys/cpu.h> 39aa2aa9a6SDana Myers #include <sys/thread.h> 407c478bd9Sstevel@tonic-gate 417b1019a6SJerry Jelinek #ifdef _KERNEL 427b1019a6SJerry Jelinek #include <sys/ctype.h> 437b1019a6SJerry Jelinek #else 447b1019a6SJerry Jelinek #include <ctype.h> 457b1019a6SJerry Jelinek #include <strings.h> 467b1019a6SJerry Jelinek #include <stdlib.h> 47*35786f68SRobert Mustacchi #include <stdio.h> 48*35786f68SRobert Mustacchi #include <fcntl.h> 49*35786f68SRobert Mustacchi #include <sys/types.h> 50*35786f68SRobert Mustacchi #include <sys/stat.h> 51*35786f68SRobert Mustacchi #include <errno.h> 527b1019a6SJerry Jelinek #endif 537b1019a6SJerry Jelinek 5426f3cdf0SGordon Ross /* Function name used for debug output. */ 5526f3cdf0SGordon Ross #define ACPI_GET_FUNCTION_NAME __func__ 567c478bd9Sstevel@tonic-gate 57db2bae30SDana Myers uint32_t __acpi_acquire_global_lock(void *); 58db2bae30SDana Myers uint32_t __acpi_release_global_lock(void *); 597c478bd9Sstevel@tonic-gate void __acpi_wbinvd(void); 607b1019a6SJerry Jelinek uint32_t acpi_strtoul(const char *, char **, int); 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate #ifdef _ILP32 637c478bd9Sstevel@tonic-gate #define ACPI_MACHINE_WIDTH 32 647c478bd9Sstevel@tonic-gate #elif defined(_LP64) 657c478bd9Sstevel@tonic-gate #define ACPI_MACHINE_WIDTH 64 667c478bd9Sstevel@tonic-gate #endif 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate #define COMPILER_DEPENDENT_INT64 int64_t 697c478bd9Sstevel@tonic-gate #define COMPILER_DEPENDENT_UINT64 uint64_t 707c478bd9Sstevel@tonic-gate 7126f3cdf0SGordon Ross #define ACPI_CAST_PTHREAD_T(pthread) ((ACPI_THREAD_ID) (pthread)) 7227f7c583Smyers 737c478bd9Sstevel@tonic-gate #define ACPI_USE_NATIVE_DIVIDE 747c478bd9Sstevel@tonic-gate #define ACPI_FLUSH_CPU_CACHE() (__acpi_wbinvd()) 757c478bd9Sstevel@tonic-gate 76bc36eafdSMike Gerdts #ifndef ACPI_DISASSEMBLER 7730082d0cSmyers #define ACPI_DISASSEMBLER 78bc36eafdSMike Gerdts #endif 7927f7c583Smyers #define ACPI_PACKED_POINTERS_NOT_SUPPORTED 8030082d0cSmyers 817c478bd9Sstevel@tonic-gate /* 827c478bd9Sstevel@tonic-gate * Calling conventions: 837c478bd9Sstevel@tonic-gate * 847c478bd9Sstevel@tonic-gate * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) 857c478bd9Sstevel@tonic-gate * ACPI_EXTERNAL_XFACE - External ACPI interfaces 867c478bd9Sstevel@tonic-gate * ACPI_INTERNAL_XFACE - Internal ACPI interfaces 877c478bd9Sstevel@tonic-gate * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces 887c478bd9Sstevel@tonic-gate */ 897c478bd9Sstevel@tonic-gate #define ACPI_SYSTEM_XFACE 907c478bd9Sstevel@tonic-gate #define ACPI_EXTERNAL_XFACE 917c478bd9Sstevel@tonic-gate #define ACPI_INTERNAL_XFACE 927c478bd9Sstevel@tonic-gate #define ACPI_INTERNAL_VAR_XFACE 937c478bd9Sstevel@tonic-gate 947b1019a6SJerry Jelinek /* 957b1019a6SJerry Jelinek * The ACPI headers shipped from Intel defines a bunch of functions which are 967b1019a6SJerry Jelinek * already provided by the kernel. The variable below prevents those from 977b1019a6SJerry Jelinek * being loaded as part of accommon.h. 987b1019a6SJerry Jelinek */ 997b1019a6SJerry Jelinek #define ACPI_USE_SYSTEM_CLIBRARY 100*35786f68SRobert Mustacchi 101*35786f68SRobert Mustacchi #ifdef _KERNEL 102*35786f68SRobert Mustacchi #define strtoul(s, r, b) acpi_strtoul(s, r, b) 103*35786f68SRobert Mustacchi #define toupper(x) (islower(x) ? (x) - 'a' + 'A' : (x)) 104*35786f68SRobert Mustacchi #define tolower(x) (isupper(x) ? (x) - 'A' + 'a' : (x)) 1057b1019a6SJerry Jelinek #endif 1067b1019a6SJerry Jelinek 1077c478bd9Sstevel@tonic-gate #define ACPI_ASM_MACROS 1087c478bd9Sstevel@tonic-gate #define BREAKPOINT3 1097c478bd9Sstevel@tonic-gate #define ACPI_DISABLE_IRQS() cli() 1107c478bd9Sstevel@tonic-gate #define ACPI_ENABLE_IRQS() sti() 111db2bae30SDana Myers #define ACPI_ACQUIRE_GLOBAL_LOCK(Facs, Acq) \ 112db2bae30SDana Myers ((Acq) = __acpi_acquire_global_lock(Facs)) 1137c478bd9Sstevel@tonic-gate 114db2bae30SDana Myers #define ACPI_RELEASE_GLOBAL_LOCK(Facs, Acq) \ 115db2bae30SDana Myers ((Acq) = __acpi_release_global_lock(Facs)) 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1187c478bd9Sstevel@tonic-gate } 1197c478bd9Sstevel@tonic-gate #endif 1207c478bd9Sstevel@tonic-gate 1218e56767dSsmall #endif /* _ACSOLARIS_H_ */ 122