/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
*
- * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
- *
- * 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
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
+ * 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
+ * compliance with the License. The rights granted to you under the
+ * License may not be used to create, or enable the creation or
+ * redistribution of, 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,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
+ *
+ * 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,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * 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_LICENSE_HEADER_END@
+ *
+ * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
*/
/*
* file: pe_init.c
extern void initialize_screen(void *, unsigned int);
/* Local references */
-static vm_offset_t mapframebuffer(caddr_t,int);
-static vm_offset_t PE_fb_vaddr = 0;
static int PE_fb_mode = TEXT_MODE;
-static KERNBOOTSTRUCT * PE_kbp = 0;
/* private globals */
PE_state_t PE_state;
dt_data gMemoryMapNode;
dt_data gDriversProp;
+dt_data gRootpathProp;
+dt_data gCompatibleProp;
/* Clock Frequency Info */
clock_frequency_info_t gPEClockFrequencyInfo;
* Refuse changes from outside pexpert.
* The video mode setup by the booter cannot be changed.
*/
- if ( info && (info == &PE_state.video) )
+ if ( info )
{
- bootInfo.v_baseAddr = PE_fb_vaddr;
+ bootInfo.v_baseAddr = info->v_baseAddr;
bootInfo.v_rowBytes = info->v_rowBytes;
bootInfo.v_width = info->v_width;
bootInfo.v_height = info->v_height;
bootInfo.v_depth = info->v_depth;
- bootInfo.v_display = PE_fb_mode;
bInfo = &bootInfo;
+ if (info == &PE_state.video) {
+ bootInfo.v_display = PE_fb_mode;
+ } else {
+ bootInfo.v_display = GRAPHICS_MODE;
+ }
}
else
bInfo = 0;
{
long * dt;
int i;
+ KernelBootArgs_t *kap = (KernelBootArgs_t *)PE_state.bootArgs;
+ enum { kMaxBootVar = 128 };
+ char *rdValue, *platformValue;
typedef struct {
char name[32];
unsigned long value[2];
} DriversPackageProp;
+ PE_init_kprintf(TRUE);
+ PE_init_printf(TRUE);
+
/*
* Update the fake device tree with the driver information provided by
* the booter.
*/
- gDriversProp.length = PE_kbp->numBootDrivers * sizeof(DriversPackageProp);
+ gDriversProp.length = kap->numBootDrivers * sizeof(DriversPackageProp);
gMemoryMapNode.length = 2 * sizeof(long);
+ rdValue = kalloc(kMaxBootVar);
+ if ( PE_parse_boot_arg("rd", rdValue) ) {
+ if (*rdValue == '*') {
+ gRootpathProp.address = (rdValue + 1);
+ } else {
+ gRootpathProp.address = rdValue;
+ }
+ strcat(rdValue, ",");
+ } else {
+ gRootpathProp.address = rdValue;
+ rdValue[0] = '\0';
+ }
+ strcat(rdValue, kap->bootFile);
+ gRootpathProp.length = strlen(rdValue) + 1;
+
+ platformValue = kalloc(kMaxBootVar);
+ if ( ! PE_parse_boot_arg("platform", platformValue) ) {
+ strcpy(platformValue, kDefaultPlatformName);
+ }
+ gCompatibleProp.address = platformValue;
+ gCompatibleProp.length = strlen(platformValue) + 1;
+
dt = (long *) createdt( fakePPCDeviceTree,
&((boot_args*)PE_state.fakePPCBootArgs)->deviceTreeLength );
+ kfree(rdValue, kMaxBootVar);
+ kfree(platformValue, kMaxBootVar);
+
+
if ( dt )
{
DriversPackageProp * prop = (DriversPackageProp *) gDriversProp.address;
/* Copy driver info in kernBootStruct to fake device tree */
- for ( i = 0; i < PE_kbp->numBootDrivers; i++, prop++ )
+ for ( i = 0; i < kap->numBootDrivers; i++, prop++ )
{
- switch ( PE_kbp->driverConfig[i].type )
+ switch ( kap->driverConfig[i].type )
{
case kBootDriverTypeKEXT:
- sprintf(prop->name, "Driver-%lx", PE_kbp->driverConfig[i].address);
+ sprintf(prop->name, "Driver-%lx", kap->driverConfig[i].address);
break;
case kBootDriverTypeMKEXT:
- sprintf(prop->name, "DriversPackage-%lx", PE_kbp->driverConfig[i].address);
+ sprintf(prop->name, "DriversPackage-%lx", kap->driverConfig[i].address);
break;
default:
- sprintf(prop->name, "DriverBogus-%lx", PE_kbp->driverConfig[i].address);
+ sprintf(prop->name, "DriverBogus-%lx", kap->driverConfig[i].address);
break;
}
prop->length = sizeof(prop->value);
- prop->value[0] = PE_kbp->driverConfig[i].address;
- prop->value[1] = PE_kbp->driverConfig[i].size;
+ prop->value[0] = kap->driverConfig[i].address;
+ prop->value[1] = kap->driverConfig[i].size;
}
- *gMemoryMapNode.address = PE_kbp->numBootDrivers + 1;
+ *((long *)gMemoryMapNode.address) = kap->numBootDrivers + 1;
}
/* Setup powermac_info and powermac_machine_info structures */
((boot_args*)PE_state.fakePPCBootArgs)->deviceTreeP = (unsigned long *) dt;
- ((boot_args*)PE_state.fakePPCBootArgs)->topOfKernelData = (unsigned int) kalloc(0x2000);
+ ((boot_args*)PE_state.fakePPCBootArgs)->topOfKernelData = (unsigned long) kalloc(0x2000);
/*
* Setup the OpenFirmware Device Tree routines
/*
* Fetch the CLUT and the noroot image.
*/
- bcopy( bootClut, appleClut8, sizeof(appleClut8) );
+ bcopy( (void *) (uintptr_t) bootClut, (void *) appleClut8, sizeof(appleClut8) );
default_noroot.width = kFailedBootWidth;
default_noroot.height = kFailedBootHeight;
default_noroot.dx = 0;
default_noroot.dy = kFailedBootOffset;
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 );
- PE_initialize_console( (PE_Video *) 0, kPEAcquireScreen );
-
- (void) StartIOKit( (void*)dt, (void*)PE_state.fakePPCBootArgs, 0, 0);
+ (void) StartIOKit( (void*)dt, PE_state.bootArgs, 0, 0);
}
void PE_init_platform(boolean_t vm_initialized, void * args)
{
if (PE_state.initialized == FALSE)
{
- PE_kbp = (KERNBOOTSTRUCT *) args;
+ KernelBootArgs_t *kap = (KernelBootArgs_t *) args;
PE_state.initialized = TRUE;
PE_state.bootArgs = args;
- PE_state.video.v_baseAddr = PE_kbp->video.v_baseAddr;
- PE_state.video.v_rowBytes = PE_kbp->video.v_rowBytes;
- PE_state.video.v_height = PE_kbp->video.v_height;
- PE_state.video.v_width = PE_kbp->video.v_width;
- PE_state.video.v_depth = PE_kbp->video.v_depth;
- PE_state.video.v_display = PE_kbp->video.v_display;
- PE_fb_mode = PE_kbp->graphicsMode;
+ PE_state.video.v_baseAddr = kap->video.v_baseAddr;
+ PE_state.video.v_rowBytes = kap->video.v_rowBytes;
+ PE_state.video.v_height = kap->video.v_height;
+ PE_state.video.v_width = kap->video.v_width;
+ PE_state.video.v_depth = kap->video.v_depth;
+ PE_state.video.v_display = kap->video.v_display;
+ PE_fb_mode = kap->graphicsMode;
PE_state.fakePPCBootArgs = (boot_args *)&fakePPCBootArgs;
((boot_args *)PE_state.fakePPCBootArgs)->machineType = 386;
}
}
- if (!vm_initialized)
- {
+ if (!vm_initialized)
+ {
/* Hack! FIXME.. */
outb(0x21, 0xff); /* Maskout all interrupts Pic1 */
outb(0xa1, 0xff); /* Maskout all interrupts Pic2 */
pe_identify_machine(args);
- }
- else
- {
+ }
+ else
+ {
pe_init_debug();
-
- PE_create_console();
- }
+ }
}
void PE_create_console( void )
{
- if ( (PE_fb_vaddr == 0) && (PE_state.video.v_baseAddr != 0) )
- {
- PE_fb_vaddr = mapframebuffer((caddr_t) PE_state.video.v_baseAddr,
- (PE_fb_mode == TEXT_MODE) ?
- /* text mode */ PE_state.video.v_rowBytes :
- /* grfx mode */ PE_state.video.v_rowBytes *
- PE_state.video.v_height);
- }
-
- if (PE_state.video.v_display)
+ if ( PE_state.video.v_display )
PE_initialize_console( &PE_state.video, kPEGraphicsMode );
else
PE_initialize_console( &PE_state.video, kPETextMode );
return (0);
}
-void PE_display_icon( unsigned int flags, const char * name )
+void PE_display_icon( __unused unsigned int flags, __unused const char * name )
{
if ( default_noroot_data )
vc_display_icon( &default_noroot, default_noroot_data );
}
-extern boolean_t PE_get_hotkey( unsigned char key )
+extern boolean_t PE_get_hotkey( __unused unsigned char key )
{
return (FALSE);
}
if (gTimebaseCallback) gTimebaseCallback(&timebase_freq);
}
-/*
- * map the framebuffer into kernel vm and return the (virtual)
- * address.
- */
-static vm_offset_t
-mapframebuffer( caddr_t physaddr, /* start of framebuffer */
- int length) /* num bytes to map */
-{
- vm_offset_t vmaddr;
-
- if (physaddr != (caddr_t)trunc_page(physaddr))
- panic("Framebuffer not on page boundary");
-
- vmaddr = io_map((vm_offset_t)physaddr, length);
- if (vmaddr == 0)
- panic("can't alloc VM for framebuffer");
-
- return vmaddr;
-}
-
/*
* The default (non-functional) PE_poll_input handler.
*/
static int
-PE_stub_poll_input(unsigned int options, char * c)
+PE_stub_poll_input(__unused unsigned int options, char * c)
{
*c = 0xff;
return 1; /* 0 for success, 1 for unsupported */
*/
int (*PE_poll_input)(unsigned int options, char * c)
= PE_stub_poll_input;
+
+
+