1 /* 2 * Copyright 2005-2009, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Axel Dörfler, axeld@pinc-software.de 7 */ 8 9 10 #include "intel.h" 11 #include "generic_x86.h" 12 13 #include <OS.h> 14 15 16 static void 17 intel_init_mtrrs(void) 18 { 19 generic_init_mtrrs(generic_count_mtrrs()); 20 } 21 22 23 static status_t 24 intel_init(void) 25 { 26 system_info info; 27 if (get_system_info(&info) != B_OK) 28 return B_ERROR; 29 30 if ((info.cpu_type & B_CPU_x86_VENDOR_MASK) != B_CPU_INTEL_x86) 31 return B_ERROR; 32 33 generic_mtrr_compute_physical_mask(); 34 generic_dump_mtrrs(generic_count_mtrrs()); 35 36 return B_OK; 37 } 38 39 40 static void 41 intel_set_mtrrs(uint8 defaultType, const x86_mtrr_info* infos, uint32 count) 42 { 43 generic_set_mtrrs(defaultType, infos, count, generic_count_mtrrs()); 44 } 45 46 47 static status_t 48 intel_stdops(int32 op, ...) 49 { 50 switch (op) { 51 case B_MODULE_INIT: 52 return intel_init(); 53 case B_MODULE_UNINIT: 54 return B_OK; 55 } 56 57 return B_ERROR; 58 } 59 60 61 x86_cpu_module_info gIntelModule = { 62 { 63 "cpu/generic_x86/intel/v1", 64 0, 65 intel_stdops, 66 }, 67 68 generic_count_mtrrs, 69 intel_init_mtrrs, 70 71 generic_set_mtrr, 72 generic_get_mtrr, 73 intel_set_mtrrs 74 }; 75