OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
AppleRtc.h File Reference

Go to the source code of this file.

Macros

#define APPLE_RTC_BG_COLOR_ADDR   0x30
 
#define APPLE_RTC_BG_COMPLEMENT_ADDR   0x31
 
#define APPLE_RTC_BG_COLOR_GRAY   0x00
 
#define APPLE_RTC_BG_COLOR_BLACK   0x01
 
#define APPLE_RTC_FIRMWARE_STATE_ADDR   0x38
 
#define APPLE_RTC_FIRMWARE_3D_ADDR   0x3D
 
#define APPLE_RTC_MEM_TEST_ACCEPT_ADDR   0x44
 
#define APPLE_RTC_MEM_TEST_REQUEST_ADDR   0x48
 
#define APPLE_RTC_MEM_TEST_RESULT_ADDR   0x4C
 
#define APPLE_RTC_FIRMWARE_57_ADDR   0x57
 
#define APPLE_RTC_FIRMWARE_PROGRESS_ADDR   0x5C
 
#define APPLE_RTC_RESERVED_ADDR   0x78
 
#define APPLE_RTC_RESERVED_LENGTH   8
 
#define APPLE_RTC_HIBERNATION_KEY_ADDR   0x80
 
#define APPLE_RTC_HIBERNATION_KEY_LENGTH   0x2C
 
#define APPLE_RTC_FIRMWARE_UPGRADE_ADDR   0xAC
 
#define APPLE_RTC_FIRMWARE_CHECK_ADDR   0xAF
 
#define APPLE_RTC_TRACE_POINT_ADDR   0xB0
 
#define APPLE_RTC_TRACE_POINT_LENGTH   8
 
#define APPLE_RTC_TRACE_DATA_ADDR   0xB0
 
#define APPLE_RTC_TRACE_DATA_LENGTH   4
 
#define APPLE_RTC_WL_MASK_ADDR   0xB1
 
#define APPLE_RTC_WL_MASK_BOOT_STARTED   BIT0
 Called early at boot.efi startup.
 
#define APPLE_RTC_WL_MASK_BOOT_FAILED   BIT1
 gBS->Exit: Boot failed; will sleep for 10 seconds before exiting.
 
#define APPLE_RTC_WL_MASK_BOOT_KERNEL   BIT2
 Called right before jumping to the kernel code.
 
#define APPLE_RTC_WL_MASK_CS_UNLOCKED   BIT3
 Set along with APPLE_RTC_WL_CS_VOLUME_UNLOCKED.
 
#define APPLE_RTC_WL_MASK_HIB_CLEAR_KEYS   BIT4
 Removed boot-image-key, EFI_STATUS in EXTRA.
 
#define APPLE_RTC_WL_MASK_HIB_CLEAR_IMG   BIT5
 Removed boot-image, will reboot now.
 
#define APPLE_RTC_WL_MASK_BOOT_RESET   BIT6
 gBS->Reset was called.
 
#define APPLE_RTC_WL_EVENT_ADDR   0xB2
 
#define APPLE_RTC_WL_EVENT_EXTRA_ADDR   0xB3
 
#define APPLE_RTC_WL_EVENT_DEFAULT   0
 For everything.
 
#define APPLE_RTC_WL_INIT_DEVICE_TREE   2
 Before first "Start InitDeviceTree".
 
#define APPLE_RTC_WL_KERNEL_ALLOC_CALL_GATE   3
 After "End InitDeviceTree".
 
#define APPLE_RTC_WL_INIT_MEMORY_CONFIG   4
 Before "Start InitMemoryConfig".
 
#define APPLE_RTC_WL_HIB_CHECK   5
 Before "Start CheckHibernate".
 
#define APPLE_RTC_WL_CS_LOAD_CONFIGURATION   6
 Before "Start LoadCoreStorageConfiguration".
 
#define APPLE_RTC_WL_GET_FDE_KEY   7
 Before reading HBKP key.
 
#define APPLE_RTC_WL_HIB_WAKE_START   8
 Before reading FACP table.
 
#define APPLE_RTC_WL_HIB_GET_MMAP   9
 Before GetMemoryMap for hibernation.
 
#define APPLE_RTC_WL_HIB_HWSIG_VALID   10
 After confirming FACP signature validity with the image.
 
#define APPLE_RTC_WL_HIB_MEM_ALLOC   11
 Before restore1CodePhysPage / runtimePages allocation.
 
#define APPLE_RTC_WL_HIB_SPLASH   12
 Before "Start OpenBootGraphics".
 
#define APPLE_RTC_WL_HIB_READ   13
 After "Start hibernate read".
 
#define APPLE_RTC_WL_HIB_HANDOFF   14
 Before adjusting IOHibernateImageHeader and booting kernel.
 
#define APPLE_RTC_WL_HIB_EXIT_BOOT_SERVICES   15
 Done ExitBootServices for hibernate, EFI_STATUS in EXTRA.
 
#define APPLE_RTC_WL_HIB_KERNEL_START   16
 Calling kernel entry point for hibernate.
 
#define APPLE_RTC_WL_HIB_FINISH_FDE   17
 After "Start FinishFDEHibernate".
 
#define APPLE_RTC_WL_HIB_WIRED_KEY_VALID   18
 Before APPLE_RTC_WL_HIBERNATE_WAKE_START with valid FDE key.
 
#define APPLE_RTC_WL_RECOVERY_OS_FOUND   19
 After detecting com.apple.recovery.boot in boot path.
 
#define APPLE_RTC_WL_CS_VOLUME_UNLOCKED   20
 After "End UnlockCoreStorageVolumeKey" with EFI_STATUS in EXTRA.
 
#define APPLE_RTC_WL_KERNEL_LOAD_CACHE_FAIL   22
 Failed to load kernel cache, EFI_STATUS in EXTRA.
 
#define APPLE_RTC_WL_HIB_BS_MISSING   23
 Missing boot-signature, EFI_STATUS in EXTRA.
 
#define APPLE_RTC_WL_HIB_BIK_MISSING   24
 Missing boot-image-key, EFI_STATUS in EXTRA.
 
#define APPLE_RTC_WL_RECOVERY_OS_REBOOT   25
 Before rebooting into recovery with APPLE_RTC_WL_MASK_BOOT_RESET.
 
#define APPLE_RTC_WL_LOGIN_WINDOW_PWRESET   26
 Requested FDE password recovery.
 
#define APPLE_RTC_WL_LOGIN_WINDOW_GUEST   27
 Chose guest in FV2 login window, will gBS->Reset now.
 
#define APPLE_RTC_WL_LOGIN_WINDOW_RESET   28
 Chose reset in FV2 login window, will gBS->Reset now.
 
#define APPLE_RTC_WL_LOGIN_WINDOW_HIB   29
 Will save hibernation data after FV2 login window and shutdown.
 
#define APPLE_RTC_WL_LOGIN_WINDOW_SHUTDOWN   30
 Chose shutdown in FV2 login window, will gBS->Reset now.
 
#define APPLE_RTC_WL_LOGIN_WINDOW_FAIL   31
 After "End LoginWindow Initialize", EFI_STATUS in EXTRA.
 
#define APPLE_RTC_WL_HIB_ABORT_SAFE_MODE   32
 Hibernation aborted due to safe mode, after "Start CheckHibernate".
 
#define APPLE_RTC_WL_HIB_BI_ALLOC   33
 Failed to allocate memory for boot-image, EFI_STATUS in EXTRA.
 
#define APPLE_RTC_WL_HIB_BI_MISSING   34
 Missing boot-image variable or 0 size, EFI_STATUS in EXTRA.
 
#define APPLE_RTC_WL_HIB_BI_INVALID   35
 Did not find valid data in boot-image.
 
#define APPLE_RTC_WL_HIB_BI_DP_ALLOC   36
 Failed to allocate boot-image device path(?).
 
#define APPLE_RTC_WL_HIB_BI_DP_ZERO   37
 boot-image contains empty DP(?).
 
#define APPLE_RTC_WL_HIB_BI_DP_MISSING   38
 Failed to locate boot-image device path, EFI_STATUS in EXTRA.
 
#define APPLE_RTC_WL_HIB_BI_DP_NO_DISK_IO   39
 Failed to find Disk I/O protocol, EFI_STATUS in EXTRA.
 
#define APPLE_RTC_WL_HIB_BI_DP_NI_BLOCK_IO   40
 Failed to find Block I/O protocol, EFI_STATUS in EXTRA.
 
#define APPLE_RTC_TRACE_LOGIN_WINDOW_ADDR   0xB4
 
#define APPLE_RTC_TRACE_CORE_DISPLAY_ADDR   0xB5
 
#define APPLE_RTC_TRACE_CORE_GRAPHICS_ADDR   0xB6
 
#define APPLE_RTC_TRACE_PHASE_ADDR   0xB7
 
#define APPLE_RTC_FDE_KEY_ADDR   0xD0
 
#define APPLE_RTC_FDE_KEY_LENGTH   0x20
 
#define APPLE_RTC_FDE_STATE_ADDR   0xF0
 
#define APPLE_RTC_FDE_STATE_DEFAULT   0x00
 
#define APPLE_RTC_FDE_STATE_NEED_KEY   0x41
 
#define APPLE_RTC_CHECKSUM_START   0x0E
 
#define APPLE_RTC_CORE_SIZE   0x40
 
#define APPLE_RTC_TOTAL_SIZE   0x100
 
#define APPLE_RTC_CHECKSUM_POLYNOMIAL   0x2001
 
#define APPLE_RTC_CHECKSUM_ROUNDS   7
 
#define APPLE_RTC_CORE_CHECKSUM_ADDR1   0x3E
 
#define APPLE_RTC_CORE_CHECKSUM_ADDR2   0x3F
 
#define APPLE_RTC_CORE_CHECKSUM_BYTE1(Checksum)
 
#define APPLE_RTC_CORE_CHECKSUM_BYTE2(Checksum)
 
#define APPLE_RTC_MAIN_CHECKSUM_ADDR1   0x58
 
#define APPLE_RTC_MAIN_CHECKSUM_ADDR2   0x59
 
#define APPLE_RTC_MAIN_CHECKSUM_BYTE1(Checksum)
 
#define APPLE_RTC_MAIN_CHECKSUM_BYTE2(Checksum)
 

Detailed Description

Copyright (C) 2020, vit9696. All rights reserved.

All rights reserved.

This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

Definition in file AppleRtc.h.

Macro Definition Documentation

◆ APPLE_RTC_BG_COLOR_ADDR

#define APPLE_RTC_BG_COLOR_ADDR   0x30

Sample RTC memory dump from MBP12,1 running 10.15.4:

00: 33 02 01 00 12 22 04 16 04 20 26 02 70 80 FF FF 10: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 20: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 30: 01 FE 20 FF FF FF FF FF F8 11 FF FF FF 00 1A 7C 40: 00 00 00 00 FE 00 00 00 00 00 00 00 00 00 00 00 50: 00 00 00 00 00 00 00 FF 0B D1 80 00 05 00 00 00 60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 70: 00 00 00 00 00 00 00 00 FF FF FF FF FF FF FF FF 80: 44 45 41 44 00 00 00 00 00 00 00 00 00 00 00 00 90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 B0: 76 CF 85 13 00 00 00 00 00 00 00 00 00 00 00 00 C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 APPLE_RTC_BG_COLOR_ADDR - background colour. APPLE_RTC_BG_COMPLEMENT_ADDR - complementary byte to background colour.

0x00 - Grey background (applies to 10.9 and older). 0x01 - Black background (applies to 10.10 and newer).

Valid pair gives APPLE_RTC_BG_COLOR_ADDR ^ APPLE_RTC_BG_COMPLEMENT_ADDR == 0xFF. Otherwise background colour should be treated as 0, grey.

Prior to rebooting to MacEFI firmare upgrade /usr/libexec/efiupdater removes DefaultBackgroundColor NVRAM variable and resets background to black.

When performing hibernate wake OSInfo writes chooses the background colour based on reported macOS version (grey for 10.9 and below, black otherwise).

Definition at line 55 of file AppleRtc.h.

◆ APPLE_RTC_BG_COLOR_BLACK

#define APPLE_RTC_BG_COLOR_BLACK   0x01

Definition at line 62 of file AppleRtc.h.

◆ APPLE_RTC_BG_COLOR_GRAY

#define APPLE_RTC_BG_COLOR_GRAY   0x00

APPLE_RTC_BG_COLOR_ADDR values.

Definition at line 61 of file AppleRtc.h.

◆ APPLE_RTC_BG_COMPLEMENT_ADDR

#define APPLE_RTC_BG_COMPLEMENT_ADDR   0x31

Definition at line 56 of file AppleRtc.h.

◆ APPLE_RTC_CHECKSUM_POLYNOMIAL

#define APPLE_RTC_CHECKSUM_POLYNOMIAL   0x2001

Apple checksum custom CRC polynomial. Apple checksum is a modified version of ANSI CRC16 in REFIN mode (0xA001 poly). See http://zlib.net/crc_v3.txt for more details.

Effective poly is 0x2001 due to a bitwise OR with BIT15. The change turns CRC16 into CRC14, making BIT14 and BIT15 always zero. This modification is commonly found in legacy Phoenix firmware, where it was used for password hashing as found by dogbert: http://sites.google.com/site/dogber1/blag/pwgen-5dec.py

Definition at line 357 of file AppleRtc.h.

◆ APPLE_RTC_CHECKSUM_ROUNDS

#define APPLE_RTC_CHECKSUM_ROUNDS   7

Apple checksum rounds.

Only 7 shifts per byte are performed instead of the usual 8. This might improve checksum quality against specific data, but the exact reasons are unknown. The algorithm did not change since its introduction in 10.4.x, and since Apple Developer Transition Kit was based on Phoenix firmware, this could just be a quick change to get a different checksum.

Definition at line 368 of file AppleRtc.h.

◆ APPLE_RTC_CHECKSUM_START

#define APPLE_RTC_CHECKSUM_START   0x0E

Checksum is calculated starting from this address.

Definition at line 334 of file AppleRtc.h.

◆ APPLE_RTC_CORE_CHECKSUM_ADDR1

#define APPLE_RTC_CORE_CHECKSUM_ADDR1   0x3E

Checksum for Apple RTC with core part of the memory hashed: [APPLE_RTC_CHECKSUM_SART, APPLE_RTC_CORE_SIZE).

Definition at line 374 of file AppleRtc.h.

◆ APPLE_RTC_CORE_CHECKSUM_ADDR2

#define APPLE_RTC_CORE_CHECKSUM_ADDR2   0x3F

Definition at line 375 of file AppleRtc.h.

◆ APPLE_RTC_CORE_CHECKSUM_BYTE1

#define APPLE_RTC_CORE_CHECKSUM_BYTE1 ( Checksum)
Value:
((UINT8) ((UINT32) (Checksum) & 0xFFU))
UINT8 Checksum
All 32 bits added together have to equal 1.
Definition AppleNec.h:77

Apple RTC core checksum to byte convertion macros. BYTE1 BIT0~BIT7 = CHECKSUM BIT0~BIT7 BYTE2 BIT1~BIT7 = CHECKSUM BIT8~BIT14

Definition at line 382 of file AppleRtc.h.

◆ APPLE_RTC_CORE_CHECKSUM_BYTE2

#define APPLE_RTC_CORE_CHECKSUM_BYTE2 ( Checksum)
Value:
((UINT8) (((UINT32) (Checksum) >> 7U) & 0xFEU))

Definition at line 383 of file AppleRtc.h.

◆ APPLE_RTC_CORE_SIZE

#define APPLE_RTC_CORE_SIZE   0x40

First 64 bytes are RTC core and are hashed separately.

Definition at line 339 of file AppleRtc.h.

◆ APPLE_RTC_FDE_KEY_ADDR

#define APPLE_RTC_FDE_KEY_ADDR   0xD0

256-bit full disk encryption (FDE) key used for authenticated restart. AppleRTC and other kexts name it key stash.

Written by AppleRTC at the request of IOHibernateSMCVariables I/O registry entry submitted either by XNU kernel or AppleFDEKeyStore.kext. The variable itself is a pair of 64-bit values: key size and key address in kernel memory.

This was replaced with HBKP SMC key in modern Macs.

VirtualSMC addendum ***

Since this value is no longer used due to HBKP present in almost every Mac we badly abuse this area when vertualising SMC.

When HBKP SMC key is written VirtualSMC AES-128 encrypts the submitted value with a unique key and writes the result to an NVRAM variable (vsmc-key). The AES encryption key goes to RTC at this address instead. Afterwards the EFI module implementing SMC protocol performs the decryption.

TODO: Replace AES with one-time pad, i.e. increase the temporary key size to 256 bits and just XOR the value. This will break old VirtualSmc.efi module, but we do not care anymore.

Definition at line 306 of file AppleRtc.h.

◆ APPLE_RTC_FDE_KEY_LENGTH

#define APPLE_RTC_FDE_KEY_LENGTH   0x20

FDE key maximum and default, as AES-256-XTS has 256-bit key. For smaller keys remaining bytes are zeroed.

Definition at line 312 of file AppleRtc.h.

◆ APPLE_RTC_FDE_STATE_ADDR

#define APPLE_RTC_FDE_STATE_ADDR   0xF0

FDE key state. Normally written by ApplePlatformInit.

0x00 - The key is either present or not. 0x41 - The key is not present, and should be copied to RTC from HBKP SMC key prior to transfering control to the bootloader. After the copying succeeds this value is overwritten with 0x00. Normally this is done by AppleBds.

Definition at line 323 of file AppleRtc.h.

◆ APPLE_RTC_FDE_STATE_DEFAULT

#define APPLE_RTC_FDE_STATE_DEFAULT   0x00

Known values for APPLE_RTC_FDE_STATE_ADDR.

Definition at line 328 of file AppleRtc.h.

◆ APPLE_RTC_FDE_STATE_NEED_KEY

#define APPLE_RTC_FDE_STATE_NEED_KEY   0x41

Definition at line 329 of file AppleRtc.h.

◆ APPLE_RTC_FIRMWARE_3D_ADDR

#define APPLE_RTC_FIRMWARE_3D_ADDR   0x3D

Used by ApplePlatformInit, 1 byte.

Definition at line 76 of file AppleRtc.h.

◆ APPLE_RTC_FIRMWARE_57_ADDR

#define APPLE_RTC_FIRMWARE_57_ADDR   0x57

Another unknown reserved address.

Definition at line 101 of file AppleRtc.h.

◆ APPLE_RTC_FIRMWARE_CHECK_ADDR

#define APPLE_RTC_FIRMWARE_CHECK_ADDR   0xAF

AppleBds zeroes this byte at the same time it reaches normal booting phase (0x4) in APPLE_RTC_FIRMWARE_PROGRESS_ADDR. This may be set to non-zero value by ApplePlatformInit.

Definition at line 158 of file AppleRtc.h.

◆ APPLE_RTC_FIRMWARE_PROGRESS_ADDR

#define APPLE_RTC_FIRMWARE_PROGRESS_ADDR   0x5C

Firmware boot progress, mostly maintained by AppleBds.

0x00, 0x01, 0x02 - Set by RomIntegrityPei. 0x04 - Normal boot started. At this step AppleBds will process hibernation, enable video output, check battery state, perform memory test, etc. 0x05 - Exit Boot Services called. Set in AppleBds event handler.

Definition at line 111 of file AppleRtc.h.

◆ APPLE_RTC_FIRMWARE_STATE_ADDR

#define APPLE_RTC_FIRMWARE_STATE_ADDR   0x38

By default masked out with 0xF8. Connected thunderbolt devices can set 3 lower bits. BIT3 seems to be set when InstallWindowsUEFI was present at boot.

See ThunderboltNhi and PchInitDxe.

Definition at line 71 of file AppleRtc.h.

◆ APPLE_RTC_FIRMWARE_UPGRADE_ADDR

#define APPLE_RTC_FIRMWARE_UPGRADE_ADDR   0xAC

Firmware upgrade control and status byte.

0x00 - Normal boot. AppleBds resets to this value upon BOOT_ON_FLASH_UPDATE prior to running BootRomFlash. BootRomFlash may itself reset to this value on successful(?) flashing. Mirrored to NOBP SMC key. 0x01 - Alternative unsuccessful (?) result of firmware flashing written by BootRomFlash. Mirrored to NOBP SMC key. Also set in ApplePlatformInit. 0x02 - Schedule firmware upgrade. Closed-source bless part writes this value when intending to upgrade MacEFI firmware. 0x03 - Peform firmware upgrade. BootRomFlash writes this value prior to rebooting into BOOT_ON_FLASH_UPDATE mode. Might be needed due to region unlock.

Definition at line 152 of file AppleRtc.h.

◆ APPLE_RTC_HIBERNATION_KEY_ADDR

#define APPLE_RTC_HIBERNATION_KEY_ADDR   0x80

Hibernation image encryption data, a copy of IOHibernateRTCVariables. See AppleRTCHibernateVars type in AppleHibernate.h for the definition.

  • Valid hibernation image encryption data starts with "AAPL" magic.
  • Erased hibernation image encryption data starts with "DEAD" magic. Normally handled by AppleBds prior to transfering control to the bootloader.

Definition at line 131 of file AppleRtc.h.

◆ APPLE_RTC_HIBERNATION_KEY_LENGTH

#define APPLE_RTC_HIBERNATION_KEY_LENGTH   0x2C

Effectively equals to sizeof (AppleRTCHibernateVars).

Definition at line 136 of file AppleRtc.h.

◆ APPLE_RTC_MAIN_CHECKSUM_ADDR1

#define APPLE_RTC_MAIN_CHECKSUM_ADDR1   0x58

Checksum for Apple RTC with all the memory hashed: [APPLE_RTC_CHECKSUM_SART, APPLE_RTC_TOTAL_SIZE).

Definition at line 389 of file AppleRtc.h.

◆ APPLE_RTC_MAIN_CHECKSUM_ADDR2

#define APPLE_RTC_MAIN_CHECKSUM_ADDR2   0x59

Definition at line 390 of file AppleRtc.h.

◆ APPLE_RTC_MAIN_CHECKSUM_BYTE1

#define APPLE_RTC_MAIN_CHECKSUM_BYTE1 ( Checksum)
Value:
((UINT8) (((UINT32) (Checksum) >> 8U) & 0xFFU))

Apple RTC main checksum to byte convertion macros. BYTE1 BIT0~BIT7 = CHECKSUM BIT0~BIT7 BYTE2 BIT0~BIT7 = CHECKSUM BIT8~BIT15

Definition at line 397 of file AppleRtc.h.

◆ APPLE_RTC_MAIN_CHECKSUM_BYTE2

#define APPLE_RTC_MAIN_CHECKSUM_BYTE2 ( Checksum)
Value:
((UINT8) ((UINT32) (Checksum) & 0xFFU))

Definition at line 398 of file AppleRtc.h.

◆ APPLE_RTC_MEM_TEST_ACCEPT_ADDR

#define APPLE_RTC_MEM_TEST_ACCEPT_ADDR   0x44

Bitmask of started test indices. Little endian 32-bit number. Note: memory testing statuses are a bit more complicated, but we do not need too much detail atm.

Definition at line 84 of file AppleRtc.h.

◆ APPLE_RTC_MEM_TEST_REQUEST_ADDR

#define APPLE_RTC_MEM_TEST_REQUEST_ADDR   0x48

Bitmask of request test indices. Little endian 32-bit number.

Definition at line 90 of file AppleRtc.h.

◆ APPLE_RTC_MEM_TEST_RESULT_ADDR

#define APPLE_RTC_MEM_TEST_RESULT_ADDR   0x4C

Bitmask of performed test indices. Little endian 32-bit number.

Definition at line 96 of file AppleRtc.h.

◆ APPLE_RTC_RESERVED_ADDR

#define APPLE_RTC_RESERVED_ADDR   0x78

Apple RTC reserved memory area for unclear purposes, normally filled with FF. Should not be erased during PRAM reset (CMD+OPT+P+R).

Definition at line 117 of file AppleRtc.h.

◆ APPLE_RTC_RESERVED_LENGTH

#define APPLE_RTC_RESERVED_LENGTH   8

Apple RTC reserved memory size.

Definition at line 122 of file AppleRtc.h.

◆ APPLE_RTC_TOTAL_SIZE

#define APPLE_RTC_TOTAL_SIZE   0x100

All Apple hardware cares about 256 bytes of RTC memory.

Definition at line 344 of file AppleRtc.h.

◆ APPLE_RTC_TRACE_CORE_DISPLAY_ADDR

#define APPLE_RTC_TRACE_CORE_DISPLAY_ADDR   0xB5

Definition at line 273 of file AppleRtc.h.

◆ APPLE_RTC_TRACE_CORE_GRAPHICS_ADDR

#define APPLE_RTC_TRACE_CORE_GRAPHICS_ADDR   0xB6

Definition at line 274 of file AppleRtc.h.

◆ APPLE_RTC_TRACE_DATA_ADDR

#define APPLE_RTC_TRACE_DATA_ADDR   0xB0

Trace data is a 32-bit value, which format depends on the phase (APPLE_RTC_TRACE_PHASE_ADDR) the platform is currently in.

For the kernel this may e.g. contain PCI device index currently put in sleep or being awoken (kIOPMTracePointSleepPowerPlaneDrivers or kIOPMTracePointWakePowerPlaneDrivers).

For EfiBoot this is named hibernatin wake log. It is also written to wake-failure NVRAM variable (and later DeviceTree).

Definition at line 182 of file AppleRtc.h.

◆ APPLE_RTC_TRACE_DATA_LENGTH

#define APPLE_RTC_TRACE_DATA_LENGTH   4

Trace data length.

Definition at line 187 of file AppleRtc.h.

◆ APPLE_RTC_TRACE_LOGIN_WINDOW_ADDR

#define APPLE_RTC_TRACE_LOGIN_WINDOW_ADDR   0xB4

Certain components have the ability to log their wake progress directly via RTC. See XNU IOPMPrivate.h for more details.

LoginWindow - 4 bits CoreDisplay - 8 bits CoreGraphics - 8 bits

Apparently these look mostly unused, at least in release builds. CoreDisplay is known to report 0 (very helpful) on screen wake. I guess we can abuse them if we want.

Definition at line 272 of file AppleRtc.h.

◆ APPLE_RTC_TRACE_PHASE_ADDR

#define APPLE_RTC_TRACE_PHASE_ADDR   0xB7

Trace point power phase e.g. kIOPMTracePointSystemUp. See XNU IOPMPrivate.h for more details.

Definition at line 280 of file AppleRtc.h.

◆ APPLE_RTC_TRACE_POINT_ADDR

#define APPLE_RTC_TRACE_POINT_ADDR   0xB0

Data contained in RTC allowing to trace various power management events. Called via AppleRTC::rtcRecordTracePoint and also used for EfiBoot wake log.

Definition at line 164 of file AppleRtc.h.

◆ APPLE_RTC_TRACE_POINT_LENGTH

#define APPLE_RTC_TRACE_POINT_LENGTH   8

Trace point data contains a total of 8 bytes, but they seem to have varying purpose.

Definition at line 169 of file AppleRtc.h.

◆ APPLE_RTC_WL_CS_LOAD_CONFIGURATION

#define APPLE_RTC_WL_CS_LOAD_CONFIGURATION   6

Before "Start LoadCoreStorageConfiguration".

Definition at line 225 of file AppleRtc.h.

◆ APPLE_RTC_WL_CS_VOLUME_UNLOCKED

#define APPLE_RTC_WL_CS_VOLUME_UNLOCKED   20

After "End UnlockCoreStorageVolumeKey" with EFI_STATUS in EXTRA.

Definition at line 239 of file AppleRtc.h.

◆ APPLE_RTC_WL_EVENT_ADDR

#define APPLE_RTC_WL_EVENT_ADDR   0xB2

Event index that happened last during booting. 0xB2 is the event type and 0xB3 is its subtype.

Definition at line 214 of file AppleRtc.h.

◆ APPLE_RTC_WL_EVENT_DEFAULT

#define APPLE_RTC_WL_EVENT_DEFAULT   0

For everything.

Known events.

Definition at line 220 of file AppleRtc.h.

◆ APPLE_RTC_WL_EVENT_EXTRA_ADDR

#define APPLE_RTC_WL_EVENT_EXTRA_ADDR   0xB3

Definition at line 215 of file AppleRtc.h.

◆ APPLE_RTC_WL_GET_FDE_KEY

#define APPLE_RTC_WL_GET_FDE_KEY   7

Before reading HBKP key.

Definition at line 226 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_ABORT_SAFE_MODE

#define APPLE_RTC_WL_HIB_ABORT_SAFE_MODE   32

Hibernation aborted due to safe mode, after "Start CheckHibernate".

Definition at line 250 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_BI_ALLOC

#define APPLE_RTC_WL_HIB_BI_ALLOC   33

Failed to allocate memory for boot-image, EFI_STATUS in EXTRA.

Definition at line 251 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_BI_DP_ALLOC

#define APPLE_RTC_WL_HIB_BI_DP_ALLOC   36

Failed to allocate boot-image device path(?).

Definition at line 254 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_BI_DP_MISSING

#define APPLE_RTC_WL_HIB_BI_DP_MISSING   38

Failed to locate boot-image device path, EFI_STATUS in EXTRA.

Definition at line 256 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_BI_DP_NI_BLOCK_IO

#define APPLE_RTC_WL_HIB_BI_DP_NI_BLOCK_IO   40

Failed to find Block I/O protocol, EFI_STATUS in EXTRA.

Definition at line 258 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_BI_DP_NO_DISK_IO

#define APPLE_RTC_WL_HIB_BI_DP_NO_DISK_IO   39

Failed to find Disk I/O protocol, EFI_STATUS in EXTRA.

Definition at line 257 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_BI_DP_ZERO

#define APPLE_RTC_WL_HIB_BI_DP_ZERO   37

boot-image contains empty DP(?).

Definition at line 255 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_BI_INVALID

#define APPLE_RTC_WL_HIB_BI_INVALID   35

Did not find valid data in boot-image.

Definition at line 253 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_BI_MISSING

#define APPLE_RTC_WL_HIB_BI_MISSING   34

Missing boot-image variable or 0 size, EFI_STATUS in EXTRA.

Definition at line 252 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_BIK_MISSING

#define APPLE_RTC_WL_HIB_BIK_MISSING   24

Missing boot-image-key, EFI_STATUS in EXTRA.

Definition at line 242 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_BS_MISSING

#define APPLE_RTC_WL_HIB_BS_MISSING   23

Missing boot-signature, EFI_STATUS in EXTRA.

Definition at line 241 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_CHECK

#define APPLE_RTC_WL_HIB_CHECK   5

Before "Start CheckHibernate".

Definition at line 224 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_EXIT_BOOT_SERVICES

#define APPLE_RTC_WL_HIB_EXIT_BOOT_SERVICES   15

Done ExitBootServices for hibernate, EFI_STATUS in EXTRA.

Definition at line 234 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_FINISH_FDE

#define APPLE_RTC_WL_HIB_FINISH_FDE   17

After "Start FinishFDEHibernate".

Definition at line 236 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_GET_MMAP

#define APPLE_RTC_WL_HIB_GET_MMAP   9

Before GetMemoryMap for hibernation.

Definition at line 228 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_HANDOFF

#define APPLE_RTC_WL_HIB_HANDOFF   14

Before adjusting IOHibernateImageHeader and booting kernel.

Definition at line 233 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_HWSIG_VALID

#define APPLE_RTC_WL_HIB_HWSIG_VALID   10

After confirming FACP signature validity with the image.

Definition at line 229 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_KERNEL_START

#define APPLE_RTC_WL_HIB_KERNEL_START   16

Calling kernel entry point for hibernate.

Definition at line 235 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_MEM_ALLOC

#define APPLE_RTC_WL_HIB_MEM_ALLOC   11

Before restore1CodePhysPage / runtimePages allocation.

Definition at line 230 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_READ

#define APPLE_RTC_WL_HIB_READ   13

After "Start hibernate read".

Definition at line 232 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_SPLASH

#define APPLE_RTC_WL_HIB_SPLASH   12

Before "Start OpenBootGraphics".

Definition at line 231 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_WAKE_START

#define APPLE_RTC_WL_HIB_WAKE_START   8

Before reading FACP table.

Definition at line 227 of file AppleRtc.h.

◆ APPLE_RTC_WL_HIB_WIRED_KEY_VALID

#define APPLE_RTC_WL_HIB_WIRED_KEY_VALID   18

Before APPLE_RTC_WL_HIBERNATE_WAKE_START with valid FDE key.

Definition at line 237 of file AppleRtc.h.

◆ APPLE_RTC_WL_INIT_DEVICE_TREE

#define APPLE_RTC_WL_INIT_DEVICE_TREE   2

Before first "Start InitDeviceTree".

Definition at line 221 of file AppleRtc.h.

◆ APPLE_RTC_WL_INIT_MEMORY_CONFIG

#define APPLE_RTC_WL_INIT_MEMORY_CONFIG   4

Before "Start InitMemoryConfig".

Definition at line 223 of file AppleRtc.h.

◆ APPLE_RTC_WL_KERNEL_ALLOC_CALL_GATE

#define APPLE_RTC_WL_KERNEL_ALLOC_CALL_GATE   3

After "End InitDeviceTree".

Definition at line 222 of file AppleRtc.h.

◆ APPLE_RTC_WL_KERNEL_LOAD_CACHE_FAIL

#define APPLE_RTC_WL_KERNEL_LOAD_CACHE_FAIL   22

Failed to load kernel cache, EFI_STATUS in EXTRA.

Definition at line 240 of file AppleRtc.h.

◆ APPLE_RTC_WL_LOGIN_WINDOW_FAIL

#define APPLE_RTC_WL_LOGIN_WINDOW_FAIL   31

After "End LoginWindow Initialize", EFI_STATUS in EXTRA.

Definition at line 249 of file AppleRtc.h.

◆ APPLE_RTC_WL_LOGIN_WINDOW_GUEST

#define APPLE_RTC_WL_LOGIN_WINDOW_GUEST   27

Chose guest in FV2 login window, will gBS->Reset now.

Definition at line 245 of file AppleRtc.h.

◆ APPLE_RTC_WL_LOGIN_WINDOW_HIB

#define APPLE_RTC_WL_LOGIN_WINDOW_HIB   29

Will save hibernation data after FV2 login window and shutdown.

Definition at line 247 of file AppleRtc.h.

◆ APPLE_RTC_WL_LOGIN_WINDOW_PWRESET

#define APPLE_RTC_WL_LOGIN_WINDOW_PWRESET   26

Requested FDE password recovery.

Definition at line 244 of file AppleRtc.h.

◆ APPLE_RTC_WL_LOGIN_WINDOW_RESET

#define APPLE_RTC_WL_LOGIN_WINDOW_RESET   28

Chose reset in FV2 login window, will gBS->Reset now.

Definition at line 246 of file AppleRtc.h.

◆ APPLE_RTC_WL_LOGIN_WINDOW_SHUTDOWN

#define APPLE_RTC_WL_LOGIN_WINDOW_SHUTDOWN   30

Chose shutdown in FV2 login window, will gBS->Reset now.

Definition at line 248 of file AppleRtc.h.

◆ APPLE_RTC_WL_MASK_ADDR

#define APPLE_RTC_WL_MASK_ADDR   0xB1

Mask of events, which happened during booting. These events are appended during the boot progress.

Note, unlike APPLE_RTC_WL_EVENT_ADDR/APPLE_RTC_WL_EVENT_EXTRA_ADDR, which only get updated in hibernate wake, this value is always written when a non-zero event is supplied.

Definition at line 197 of file AppleRtc.h.

◆ APPLE_RTC_WL_MASK_BOOT_FAILED

#define APPLE_RTC_WL_MASK_BOOT_FAILED   BIT1

gBS->Exit: Boot failed; will sleep for 10 seconds before exiting.

Definition at line 203 of file AppleRtc.h.

◆ APPLE_RTC_WL_MASK_BOOT_KERNEL

#define APPLE_RTC_WL_MASK_BOOT_KERNEL   BIT2

Called right before jumping to the kernel code.

Definition at line 204 of file AppleRtc.h.

◆ APPLE_RTC_WL_MASK_BOOT_RESET

#define APPLE_RTC_WL_MASK_BOOT_RESET   BIT6

gBS->Reset was called.

Definition at line 208 of file AppleRtc.h.

◆ APPLE_RTC_WL_MASK_BOOT_STARTED

#define APPLE_RTC_WL_MASK_BOOT_STARTED   BIT0

Called early at boot.efi startup.

Known event bits.

Definition at line 202 of file AppleRtc.h.

◆ APPLE_RTC_WL_MASK_CS_UNLOCKED

#define APPLE_RTC_WL_MASK_CS_UNLOCKED   BIT3

Set along with APPLE_RTC_WL_CS_VOLUME_UNLOCKED.

Definition at line 205 of file AppleRtc.h.

◆ APPLE_RTC_WL_MASK_HIB_CLEAR_IMG

#define APPLE_RTC_WL_MASK_HIB_CLEAR_IMG   BIT5

Removed boot-image, will reboot now.

Definition at line 207 of file AppleRtc.h.

◆ APPLE_RTC_WL_MASK_HIB_CLEAR_KEYS

#define APPLE_RTC_WL_MASK_HIB_CLEAR_KEYS   BIT4

Removed boot-image-key, EFI_STATUS in EXTRA.

Definition at line 206 of file AppleRtc.h.

◆ APPLE_RTC_WL_RECOVERY_OS_FOUND

#define APPLE_RTC_WL_RECOVERY_OS_FOUND   19

After detecting com.apple.recovery.boot in boot path.

Definition at line 238 of file AppleRtc.h.

◆ APPLE_RTC_WL_RECOVERY_OS_REBOOT

#define APPLE_RTC_WL_RECOVERY_OS_REBOOT   25

Before rebooting into recovery with APPLE_RTC_WL_MASK_BOOT_RESET.

Definition at line 243 of file AppleRtc.h.