|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * The contents of this file constitute Original Code as defined in and ! 7: * are subject to the Apple Public Source License Version 1.1 (the ! 8: * "License"). You may not use this file except in compliance with the ! 9: * License. Please obtain a copy of the License at ! 10: * http://www.apple.com/publicsource and read it before using this file. ! 11: * ! 12: * This Original Code and all software distributed under the License are ! 13: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 16: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 17: * License for the specific language governing rights and limitations ! 18: * under the License. ! 19: * ! 20: * @APPLE_LICENSE_HEADER_END@ ! 21: */ ! 22: /* ! 23: * file: pe_init.c ! 24: * i386 platform expert initialization. ! 25: */ ! 26: #include <pexpert/pexpert.h> ! 27: #include <pexpert/boot.h> ! 28: ! 29: #include "fakePPCStructs.h" ! 30: #include "fakePPCDeviceTree.h" ! 31: ! 32: /* extern references */ ! 33: void pe_identify_machine(void *args); ! 34: ! 35: /* Local references */ ! 36: void display_machine_class(void); ! 37: ! 38: /* private globals */ ! 39: PE_state_t PE_state; ! 40: ! 41: static __inline__ void outb(unsigned short port, ! 42: unsigned char datum) ! 43: { ! 44: __asm__ volatile("outb %0, %1" : : "a" (datum), "d" (port)); ! 45: } ! 46: ! 47: void PE_init_iokit(void) ! 48: { ! 49: extern int StartIOKit( void * p1, void * p2, void * p3, void * p4); ! 50: long *dt; ! 51: ! 52: dt = (long *) createdt( ! 53: fakePPCDeviceTree, ! 54: &((boot_args*)PE_state.fakePPCBootArgs)->deviceTreeLength); ! 55: ! 56: /* Setup powermac_info and powermac_machine_info structures */ ! 57: ! 58: ((boot_args*)PE_state.fakePPCBootArgs)->deviceTreeP = (unsigned long) dt; ! 59: ((boot_args*)PE_state.fakePPCBootArgs)->topOfKernelData = (unsigned int) kalloc(0x2000); ! 60: ! 61: /* ! 62: * Setup the OpenFirmware Device Tree routines ! 63: * so the console can be found and the right I/O space ! 64: * can be used.. ! 65: */ ! 66: DTInit(dt); ! 67: ! 68: (void) StartIOKit( (void*)dt, (void*)PE_state.fakePPCBootArgs, 0, 0); ! 69: } ! 70: ! 71: ! 72: ! 73: void PE_init_platform(boolean_t vm_initialized, void *args) ! 74: { ! 75: if (PE_state.initialized == FALSE) ! 76: { ! 77: PE_state.initialized = TRUE; ! 78: PE_state.bootArgs = args; ! 79: PE_state.video.v_baseAddr = ((KERNBOOTSTRUCT *)args)->video.v_baseAddr; ! 80: PE_state.video.v_rowBytes = ((KERNBOOTSTRUCT *)args)->video.v_rowBytes; ! 81: PE_state.video.v_height = ((KERNBOOTSTRUCT *)args)->video.v_height; ! 82: PE_state.video.v_width = ((KERNBOOTSTRUCT *)args)->video.v_width; ! 83: PE_state.video.v_depth = ((KERNBOOTSTRUCT *)args)->video.v_depth; ! 84: PE_state.fakePPCBootArgs = (boot_args *)&fakePPCBootArgs; ! 85: ((boot_args *)PE_state.fakePPCBootArgs)->machineType = 386; ! 86: } ! 87: ! 88: if (!vm_initialized) ! 89: { ! 90: /* Hack! FIXME.. */ ! 91: outb(0x21, 0xff); /* Maskout all interrupts Pic1 */ ! 92: outb(0xa1, 0xff); /* Maskout all interrupts Pic2 */ ! 93: ! 94: //pe_identify_machine(args); ! 95: } ! 96: else ! 97: { ! 98: } ! 99: } ! 100: ! 101: int PE_current_console( PE_Video * info ) ! 102: { ! 103: *info = PE_state.video; ! 104: return( 0); ! 105: } ! 106: ! 107: int PE_initialize_console( PE_Video * info, int enable ) ! 108: { ! 109: return( 0); ! 110: } ! 111: ! 112: extern boolean_t PE_get_hotkey( unsigned char key) ! 113: { ! 114: return( FALSE); ! 115: } ! 116: ! 117: void PE_display_icon( unsigned int flags, ! 118: const char * name ) ! 119: { ! 120: } ! 121: ! 122: void display_machine_class() ! 123: { ! 124: } ! 125: ! 126: void PE_pause(int seconds) ! 127: { ! 128: int x, y, z; ! 129: ! 130: for (x = 0; x < (500000*seconds); x++) ! 131: for (y = 0; y < 100; y++) ! 132: z = x ^ y; ! 133: } ! 134: ! 135: void NO_ENTRY() { } ! 136: ! 137: void PE_register_timebase_callback(timebase_callback_func callback) ! 138: { ! 139: // This should save the callback. ! 140: // powermac_info.timebase_callback = callback; ! 141: ! 142: PE_call_timebase_callback(); ! 143: } ! 144: ! 145: void PE_call_timebase_callback(void) ! 146: { ! 147: struct timebase_freq_t timebase_freq; ! 148: ! 149: // This should return the real time base freq... ! 150: timebase_freq.timebase_num = 25000000; ! 151: timebase_freq.timebase_den = 1; ! 152: ! 153: // This should call the saved callback. ! 154: // if (powermac_info.timebase_callback) ! 155: // powermac_info.timebase_callback(&timebase_freq); ! 156: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.