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 <cpu.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 if (gCPU[0].arch.vendor != VENDOR_INTEL) 27 return B_ERROR; 28 29 generic_mtrr_compute_physical_mask(); 30 generic_dump_mtrrs(generic_count_mtrrs()); 31 32 return B_OK; 33 } 34 35 36 static void 37 intel_set_mtrrs(uint8 defaultType, const x86_mtrr_info* infos, uint32 count) 38 { 39 generic_set_mtrrs(defaultType, infos, count, generic_count_mtrrs()); 40 } 41 42 43 static status_t 44 intel_stdops(int32 op, ...) 45 { 46 switch (op) { 47 case B_MODULE_INIT: 48 return intel_init(); 49 case B_MODULE_UNINIT: 50 return B_OK; 51 } 52 53 return B_ERROR; 54 } 55 56 57 x86_cpu_module_info gIntelModule = { 58 { 59 "cpu/generic_x86/intel/v1", 60 0, 61 intel_stdops, 62 }, 63 64 generic_count_mtrrs, 65 intel_init_mtrrs, 66 67 generic_set_mtrr, 68 generic_get_mtrr, 69 intel_set_mtrrs 70 }; 71