1/* 2 * Copyright 2013, winocm. <winocm@icloud.com> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without modification, 6 * are permitted provided that the following conditions are met: 7 * 8 * Redistributions of source code must retain the above copyright notice, this 9 * list of conditions and the following disclaimer. 10 * 11 * Redistributions in binary form must reproduce the above copyright notice, this 12 * list of conditions and the following disclaimer in the documentation and/or 13 * other materials provided with the distribution. 14 * 15 * If you are going to use this software in any form that does not involve 16 * releasing the source to this project or improving it, let me know beforehand. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 22 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29/* 30 * Machine identification routine. 31 */ 32 33#include <mach/mach_types.h> 34#include <pexpert/pexpert.h> 35#include <pexpert/machine/protos.h> 36#include <pexpert/machine/boot.h> 37#include <kern/debug.h> 38#include <mach/vm_param.h> 39 40clock_frequency_info_t gPEClockFrequencyInfo; 41 42/* 43 * Technically, the pe_arm_stuff should be implemented, but I'm choosing to ignore 44 * those for right now. When done, put the crap in pe_identify_machine. 45 * 46 * Todo: 47 * - pe_arm_get_soc_base_phys 48 * - pe_arm_get_soc_revision 49 */ 50 51/** 52 * pe_identify_machine 53 * 54 * Fill out machine dependent timer information. Will actually also be refilled 55 * during actual SoC dependent init. 56 */ 57void pe_identify_machine(__unused boot_args * args) 58{ 59 PE_early_puts("pe_identify_machine: Dummying out gPEClockFrequencyInfo (for now)\n"); 60 61 /* 62 * Clear the gPEClockFrequencyInfo struct 63 */ 64 bzero((void *) &gPEClockFrequencyInfo, sizeof(clock_frequency_info_t)); 65 66 /* 67 * Start with default values that were blatantly stolen from i386. 68 */ 69 gPEClockFrequencyInfo.timebase_frequency_hz = 1000000000; 70 gPEClockFrequencyInfo.bus_frequency_hz = 100000000; 71 gPEClockFrequencyInfo.cpu_frequency_hz = 300000000; 72 73 gPEClockFrequencyInfo.bus_frequency_min_hz = gPEClockFrequencyInfo.bus_frequency_hz; 74 gPEClockFrequencyInfo.bus_frequency_max_hz = gPEClockFrequencyInfo.bus_frequency_hz; 75 gPEClockFrequencyInfo.cpu_frequency_min_hz = gPEClockFrequencyInfo.cpu_frequency_hz; 76 gPEClockFrequencyInfo.cpu_frequency_max_hz = gPEClockFrequencyInfo.cpu_frequency_hz; 77 78 gPEClockFrequencyInfo.dec_clock_rate_hz = gPEClockFrequencyInfo.timebase_frequency_hz; 79 gPEClockFrequencyInfo.bus_clock_rate_hz = gPEClockFrequencyInfo.bus_frequency_hz; 80 gPEClockFrequencyInfo.cpu_clock_rate_hz = gPEClockFrequencyInfo.cpu_frequency_hz; 81 82 // Fill out the info from DeviceTree. 83} 84