X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/7ddcb079202367355dddccdfa4318e57d50318be..eee3565979933af707c711411001ba11fe406a3c:/pexpert/i386/pe_init.c diff --git a/pexpert/i386/pe_init.c b/pexpert/i386/pe_init.c index 80335544f..f1e24b31e 100644 --- a/pexpert/i386/pe_init.c +++ b/pexpert/i386/pe_init.c @@ -29,6 +29,7 @@ * file: pe_init.c * i386 platform expert initialization. */ + #include #include #include @@ -40,16 +41,14 @@ #include #include +#if CONFIG_CSR +#include +#endif + #include "boot_images.h" /* extern references */ extern void pe_identify_machine(void * args); -extern int -vc_display_lzss_icon(uint32_t dst_x, uint32_t dst_y, - uint32_t image_width, uint32_t image_height, - const uint8_t *compressed_image, - uint32_t compressed_size, - const uint8_t *clut); /* private globals */ PE_state_t PE_state; @@ -106,12 +105,6 @@ void PE_init_iokit(void) { enum { kMaxBootVar = 128 }; - typedef struct { - char name[32]; - unsigned long length; - unsigned long value[2]; - } DriversPackageProp; - boolean_t bootClutInitialized = FALSE; boolean_t noroot_rle_Initialized = FALSE; @@ -174,18 +167,16 @@ void PE_init_iokit(void) default_noroot_data = failedBootPict; } - /* - * Initialize the panic UI - */ - panic_ui_initialize( (unsigned char *) appleClut8 ); - /* * Initialize the spinning wheel (progress indicator). */ - vc_progress_initialize( &default_progress, default_progress_data, - (unsigned char *) appleClut8 ); + vc_progress_initialize(&default_progress, + default_progress_data1x, + default_progress_data2x, + default_progress_data3x, + (unsigned char *) appleClut8); - (void) StartIOKit( PE_state.deviceTreeHead, PE_state.bootArgs, gPEEFIRuntimeServices, NULL); + StartIOKit( PE_state.deviceTreeHead, PE_state.bootArgs, gPEEFIRuntimeServices, NULL); } void PE_init_platform(boolean_t vm_initialized, void * _args) @@ -198,14 +189,34 @@ void PE_init_platform(boolean_t vm_initialized, void * _args) // New EFI-style PE_state.bootArgs = _args; PE_state.deviceTreeHead = (void *) ml_static_ptovirt(args->deviceTreeP); - PE_state.video.v_baseAddr = args->Video.v_baseAddr; // remains physical address - PE_state.video.v_rowBytes = args->Video.v_rowBytes; - PE_state.video.v_width = args->Video.v_width; - PE_state.video.v_height = args->Video.v_height; - PE_state.video.v_depth = args->Video.v_depth; - PE_state.video.v_display = args->Video.v_display; - strlcpy(PE_state.video.v_pixelFormat, "PPPPPPPP", - sizeof(PE_state.video.v_pixelFormat)); + if (args->Video.v_baseAddr) { + PE_state.video.v_baseAddr = args->Video.v_baseAddr; // remains physical address + PE_state.video.v_rowBytes = args->Video.v_rowBytes; + PE_state.video.v_width = args->Video.v_width; + PE_state.video.v_height = args->Video.v_height; + PE_state.video.v_depth = args->Video.v_depth; + PE_state.video.v_display = args->Video.v_display; + strlcpy(PE_state.video.v_pixelFormat, "PPPPPPPP", + sizeof(PE_state.video.v_pixelFormat)); + } else { + PE_state.video.v_baseAddr = args->VideoV1.v_baseAddr; // remains physical address + PE_state.video.v_rowBytes = args->VideoV1.v_rowBytes; + PE_state.video.v_width = args->VideoV1.v_width; + PE_state.video.v_height = args->VideoV1.v_height; + PE_state.video.v_depth = args->VideoV1.v_depth; + PE_state.video.v_display = args->VideoV1.v_display; + strlcpy(PE_state.video.v_pixelFormat, "PPPPPPPP", + sizeof(PE_state.video.v_pixelFormat)); + } + +#ifdef kBootArgsFlagHiDPI + if (args->flags & kBootArgsFlagHiDPI) + PE_state.video.v_scale = kPEScaleFactor2x; + else + PE_state.video.v_scale = kPEScaleFactor1x; +#else + PE_state.video.v_scale = kPEScaleFactor1x; +#endif } if (!vm_initialized) { @@ -215,7 +226,6 @@ void PE_init_platform(boolean_t vm_initialized, void * _args) } pe_identify_machine(args); - } else { pe_init_debug(); } @@ -317,5 +327,33 @@ int (*PE_poll_input)(unsigned int options, char * c) boolean_t PE_reboot_on_panic(void) { - return FALSE; + boot_args *args = (boot_args *)PE_state.bootArgs; + + if (args->flags & kBootArgsFlagRebootOnPanic) + return TRUE; + else + return FALSE; +} + +void +PE_sync_panic_buffers(void) +{ +} + +/* rdar://problem/21244753 */ +uint32_t +PE_i_can_has_debugger(uint32_t *debug_flags) +{ +#if CONFIG_CSR + if (csr_check(CSR_ALLOW_KERNEL_DEBUGGER) != 0 && + csr_check(CSR_ALLOW_APPLE_INTERNAL) != 0) { + if (debug_flags) + *debug_flags = 0; + return FALSE; + } +#endif + if (debug_flags) { + *debug_flags = debug_boot_arg; + } + return TRUE; }