2 * Copyright (c) 2020 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 * ARM64 specific definitions for hibernation platform abstraction layer.
32 #ifndef _ARM64_PAL_HIBERNATE_H
33 #define _ARM64_PAL_HIBERNATE_H
35 #include <IOKit/IOHibernatePrivate.h>
40 * @enum pal_hib_map_type_t
41 * @discussion Parameter to pal_hib_map used to signify which memory region to map.
55 * @discussion ARM64-specific PAL context; see pal_hib_ctx_t for details.
61 * @typedef pal_hib_globals_t
62 * @discussion ARM64-specific state preserved pre-hibernation and needed during hibernation resume.
64 * @field dockChannelRegBase Physical address of the dockchannel registers
65 * @field dockChannelWstatMask Mask to apply to dockchannel WSTAT register to compute available FIFO entries
66 * @field hibUartRegBase Physical address of the UART registers
67 * @field hmacRegBase Physical address of the hmac block registers
68 * @field kernelSlide Offset from physical address to virtual address in the kernel map
71 uint64_t dockChannelRegBase
;
72 uint64_t dockChannelWstatMask
;
73 uint64_t hibUartRegBase
;
77 extern pal_hib_globals_t gHibernateGlobals
;
80 * @function pal_hib_get_stack_pages
81 * @discussion Returns the stack base address and number of pages to use during hibernation resume.
83 * @param first_page Out parameter: the base address of the hibernation resume stack
84 * @param page_count Out parameter: the number of pages in the hibernation stack
86 void pal_hib_get_stack_pages(vm_offset_t
*first_page
, vm_offset_t
*page_count
);
89 * @function pal_hib_resume_tramp
90 * @discussion Platform-specific system setup before calling hibernate_kernel_entrypoint.
92 * @param headerPpnum The page number of the IOHibernateImageHeader
94 void pal_hib_resume_tramp(uint32_t headerPpnum
);
97 * @typedef pal_hib_tramp_result_t
98 * @discussion This type is used to store the result of pal_hib_resume_tramp.
100 * @field ttbr0 Physical address of the first level translation table (low mem)
101 * @field ttbr1 Physical address of the first level translation table (high mem)
102 * @field memSlide Offset from physical address to virtual address during hibernation resume
108 } pal_hib_tramp_result_t
;
110 #if HIBERNATE_TRAP_HANDLER
112 * @function hibernate_trap
113 * @discussion Platform-specific function for handling a trap during hibernation resume.
115 * @param context The context captured during the trap
116 * @param trap_addr The address of the low level trap handler that was invoked
118 void hibernate_trap(arm_context_t
*context
, uint64_t trap_addr
) __attribute__((noreturn
));
119 #endif /* HIBERNATE_TRAP_HANDLER */
123 #endif /* _ARM64_PAL_HIBERNATE_H */