/*
- * Copyright (c) 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2009-2012 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
- *
+ *
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
- *
+ *
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
- *
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
- *
+ *
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _I386_PAL_ROUTINES_H
* only the low-order half is loaded (if applicable)
*/
struct pal_efi_registers {
- uint64_t rcx;
- uint64_t rdx;
- uint64_t r8;
- uint64_t r9;
- uint64_t rax;
+ uint64_t rcx;
+ uint64_t rdx;
+ uint64_t r8;
+ uint64_t r9;
+ uint64_t rax;
};
/*
*/
kern_return_t
pal_efi_call_in_64bit_mode(uint64_t func,
- struct pal_efi_registers *efi_reg,
- void *stack_contents,
- size_t stack_contents_size, /* 16-byte multiple */
- uint64_t *efi_status);
+ struct pal_efi_registers *efi_reg,
+ void *stack_contents,
+ size_t stack_contents_size, /* 16-byte multiple */
+ uint64_t *efi_status);
kern_return_t
pal_efi_call_in_32bit_mode(uint32_t func,
- struct pal_efi_registers *efi_reg,
- void *stack_contents,
- size_t stack_contents_size, /* 16-byte multiple */
- uint32_t *efi_status);
+ struct pal_efi_registers *efi_reg,
+ void *stack_contents,
+ size_t stack_contents_size, /* 16-byte multiple */
+ uint32_t *efi_status);
/* Go into ACPI sleep */
-boolean_t pal_machine_sleep(uint8_t type_a,
- uint8_t type_b,
- uint32_t bit_position,
- uint32_t disable_mask,
- uint32_t enable_mask);
+boolean_t pal_machine_sleep(uint8_t type_a,
+ uint8_t type_b,
+ uint32_t bit_position,
+ uint32_t disable_mask,
+ uint32_t enable_mask);
/* xnu internal PAL routines */
#ifdef XNU_KERNEL_PRIVATE
/* Define any PAL-specific types for x86 */
-#ifdef __i386__
-typedef uint32_t pal_cr_t;
-#else
typedef uint64_t pal_cr_t;
-#endif
struct pal_cpu_data; /* Defined per-platform */
struct pal_pcb; /* Defined per-platform */
/* For use by APIC kext */
extern struct pal_apic_table *apic_table;
-
+
/* serial / debug output routines */
extern int pal_serial_init(void);
extern void pal_serial_putc(char);
+extern void pal_serial_putc_nocr(char);
extern int pal_serial_getc(void);
/* Generic I386 PAL functions go here */
extern void pal_set_signal_delivery(thread_t);
/* Get values for cr0..4 */
-extern void pal_get_control_registers( pal_cr_t *cr0, pal_cr_t *cr2,
- pal_cr_t *cr3, pal_cr_t *cr4 );
+extern void pal_get_control_registers( pal_cr_t *cr0, pal_cr_t *cr2,
+ pal_cr_t *cr3, pal_cr_t *cr4 );
/* Debug hook invoked in the page-fault path */
-extern void pal_dbg_page_fault( thread_t thread, user_addr_t vadddr,
- kern_return_t kr );
+extern void pal_dbg_page_fault( thread_t thread, user_addr_t vadddr,
+ kern_return_t kr );
/* Set a task's name in the platform kernel debugger */
extern void pal_dbg_set_task_name( task_t task );
void pal_ast_check(thread_t thread);
/* Called by sync_iss_to_iks */
-extern void pal_get_kern_regs( x86_saved_state_t *state );
-
-/* Called by load_machfile */
-void pal_switch_pmap(thread_t, pmap_t, boolean_t);
+extern void pal_get_kern_regs( x86_saved_state_t *state ) __dead2;
/*
* Platform-specific hlt/sti.
- */
+ */
extern void pal_hlt(void);
extern void pal_sti(void);
extern void pal_cli(void);
/* Catch code running on the except thread that shouldn't be */
void pal_preemption_assert(void);
-void hibernate_pal_prepare(void);
-void pal_efi_hibernate_prepare(void);
-
/* Include a PAL-specific header, too, for xnu-internal overrides */
#include <i386/pal_native.h>
+#define PAL_XCPM_PROPERTY_VALUE 3
+
+extern boolean_t virtualized;
+#define PAL_VIRTUALIZED_PROPERTY_VALUE 4
/* Allow for tricky IOKit property matching */
#define PAL_AICPM_PROPERTY_NAME "intel_cpupm_matching"
-static inline void
+static inline void
pal_get_resource_property(const char **property_name, int *property_value)
{
*property_name = PAL_AICPM_PROPERTY_NAME;
- *property_value = PAL_AICPM_PROPERTY_VALUE;
+ *property_value = PAL_XCPM_PROPERTY_VALUE;
+ if (virtualized) {
+ *property_value = PAL_VIRTUALIZED_PROPERTY_VALUE;
+ }
}
/* assembly function to update TSC / timebase info */
extern void _pal_rtc_nanotime_store(
- uint64_t tsc,
- uint64_t nsec,
- uint32_t scale,
- uint32_t shift,
- struct pal_rtc_nanotime *dst);
+ uint64_t tsc,
+ uint64_t nsec,
+ uint32_t scale,
+ uint32_t shift,
+ struct pal_rtc_nanotime *dst);
/* global nanotime info */
extern struct pal_rtc_nanotime pal_rtc_nanotime_info;