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 /* 227b1019a6SJerry Jelinek * Copyright 2016 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> 477b1019a6SJerry Jelinek #endif 487b1019a6SJerry Jelinek 4926f3cdf0SGordon Ross /* Function name used for debug output. */ 5026f3cdf0SGordon Ross #define ACPI_GET_FUNCTION_NAME __func__ 517c478bd9Sstevel@tonic-gate 52db2bae30SDana Myers uint32_t __acpi_acquire_global_lock(void *); 53db2bae30SDana Myers uint32_t __acpi_release_global_lock(void *); 547c478bd9Sstevel@tonic-gate void __acpi_wbinvd(void); 557b1019a6SJerry Jelinek uint32_t acpi_strtoul(const char *, char **, int); 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate #ifdef _ILP32 587c478bd9Sstevel@tonic-gate #define ACPI_MACHINE_WIDTH 32 597c478bd9Sstevel@tonic-gate #elif defined(_LP64) 607c478bd9Sstevel@tonic-gate #define ACPI_MACHINE_WIDTH 64 617c478bd9Sstevel@tonic-gate #endif 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate #define COMPILER_DEPENDENT_INT64 int64_t 647c478bd9Sstevel@tonic-gate #define COMPILER_DEPENDENT_UINT64 uint64_t 657c478bd9Sstevel@tonic-gate 6626f3cdf0SGordon Ross #define ACPI_CAST_PTHREAD_T(pthread) ((ACPI_THREAD_ID) (pthread)) 6727f7c583Smyers 68c8b558caSToomas Soome /* 69c8b558caSToomas Soome * We should use acgcc.h, but lint does not like it. Until lint is removed 70c8b558caSToomas Soome * we need to have private definitions here. 71c8b558caSToomas Soome */ 72c8b558caSToomas Soome #define ACPI_PRINTF_LIKE(c) __PRINTFLIKE(c) 73c8b558caSToomas Soome #define ACPI_UNUSED_VAR __unused 747c478bd9Sstevel@tonic-gate #define ACPI_USE_NATIVE_DIVIDE 757c478bd9Sstevel@tonic-gate #define ACPI_FLUSH_CPU_CACHE() (__acpi_wbinvd()) 767c478bd9Sstevel@tonic-gate 77*bc36eafdSMike Gerdts #ifndef ACPI_DISASSEMBLER 7830082d0cSmyers #define ACPI_DISASSEMBLER 79*bc36eafdSMike Gerdts #endif 8027f7c583Smyers #define ACPI_PACKED_POINTERS_NOT_SUPPORTED 8130082d0cSmyers 827c478bd9Sstevel@tonic-gate /* 837c478bd9Sstevel@tonic-gate * Calling conventions: 847c478bd9Sstevel@tonic-gate * 857c478bd9Sstevel@tonic-gate * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) 867c478bd9Sstevel@tonic-gate * ACPI_EXTERNAL_XFACE - External ACPI interfaces 877c478bd9Sstevel@tonic-gate * ACPI_INTERNAL_XFACE - Internal ACPI interfaces 887c478bd9Sstevel@tonic-gate * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces 897c478bd9Sstevel@tonic-gate */ 907c478bd9Sstevel@tonic-gate #define ACPI_SYSTEM_XFACE 917c478bd9Sstevel@tonic-gate #define ACPI_EXTERNAL_XFACE 927c478bd9Sstevel@tonic-gate #define ACPI_INTERNAL_XFACE 937c478bd9Sstevel@tonic-gate #define ACPI_INTERNAL_VAR_XFACE 947c478bd9Sstevel@tonic-gate 957b1019a6SJerry Jelinek #ifdef _KERNEL 967b1019a6SJerry Jelinek #define strtoul(s, r, b) acpi_strtoul(s, r, b) 977b1019a6SJerry Jelinek #define toupper(x) (islower(x) ? (x) - 'a' + 'A' : (x)) 987b1019a6SJerry Jelinek #define tolower(x) (isupper(x) ? (x) - 'A' + 'a' : (x)) 997b1019a6SJerry Jelinek 1007b1019a6SJerry Jelinek /* 1017b1019a6SJerry Jelinek * The ACPI headers shipped from Intel defines a bunch of functions which are 1027b1019a6SJerry Jelinek * already provided by the kernel. The variable below prevents those from 1037b1019a6SJerry Jelinek * being loaded as part of accommon.h. 1047b1019a6SJerry Jelinek */ 1057b1019a6SJerry Jelinek #define ACPI_USE_SYSTEM_CLIBRARY 1067b1019a6SJerry Jelinek #endif 1077b1019a6SJerry Jelinek 1087c478bd9Sstevel@tonic-gate #define ACPI_ASM_MACROS 1097c478bd9Sstevel@tonic-gate #define BREAKPOINT3 1107c478bd9Sstevel@tonic-gate #define ACPI_DISABLE_IRQS() cli() 1117c478bd9Sstevel@tonic-gate #define ACPI_ENABLE_IRQS() sti() 112db2bae30SDana Myers #define ACPI_ACQUIRE_GLOBAL_LOCK(Facs, Acq) \ 113db2bae30SDana Myers ((Acq) = __acpi_acquire_global_lock(Facs)) 1147c478bd9Sstevel@tonic-gate 115db2bae30SDana Myers #define ACPI_RELEASE_GLOBAL_LOCK(Facs, Acq) \ 116db2bae30SDana Myers ((Acq) = __acpi_release_global_lock(Facs)) 1177c478bd9Sstevel@tonic-gate 1187c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1197c478bd9Sstevel@tonic-gate } 1207c478bd9Sstevel@tonic-gate #endif 1217c478bd9Sstevel@tonic-gate 1228e56767dSsmall #endif /* _ACSOLARIS_H_ */ 123