* Fixed warning and bad coding style.

* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25290 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-05-02 13:00:27 +00:00
parent 2239c25b29
commit 248f01553f
+24 -21
View File
@@ -1,19 +1,20 @@
/* /*
* Copyright 2004-2005, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2004-2008, Axel Dörfler, [email protected]. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#include <arch/system_info.h>
#include <string.h>
#include <KernelExport.h> #include <KernelExport.h>
#include <OS.h> #include <OS.h>
#include <boot/kernel_args.h>
#include <cpu.h>
#include <kernel.h> #include <kernel.h>
#include <smp.h> #include <smp.h>
#include <cpu.h>
#include <arch/system_info.h>
#include <boot/kernel_args.h>
#include <string.h>
uint32 sCpuType; uint32 sCpuType;
@@ -22,7 +23,8 @@ int64 sCpuClockSpeed;
static bool static bool
get_cpuid_for(cpuid_info *info, uint32 currentCPU, uint32 eaxRegister, uint32 forCPU) get_cpuid_for(cpuid_info *info, uint32 currentCPU, uint32 eaxRegister,
uint32 forCPU)
{ {
if (currentCPU != forCPU) if (currentCPU != forCPU)
return false; return false;
@@ -81,7 +83,7 @@ arch_system_info_init(struct kernel_args *args)
uint32 base; uint32 base;
uint32 model = 0; uint32 model = 0;
cpu_ent *cpu = get_cpu_struct(); cpu_ent *cpu = get_cpu_struct();
switch (cpu->arch.vendor) { switch (cpu->arch.vendor) {
case VENDOR_INTEL: case VENDOR_INTEL:
base = B_CPU_INTEL_x86; base = B_CPU_INTEL_x86;
@@ -114,29 +116,30 @@ arch_system_info_init(struct kernel_args *args)
base = B_CPU_x86; base = B_CPU_x86;
} }
if (base != B_CPU_x86) if (base != B_CPU_x86) {
if (base == B_CPU_INTEL_x86) if (base == B_CPU_INTEL_x86) {
model = (cpu->arch.extended_family << 20) + (cpu->arch.extended_model << 16) + model = (cpu->arch.extended_family << 20)
(cpu->arch.family << 4) + cpu->arch.model; + (cpu->arch.extended_model << 16)
else + (cpu->arch.family << 4) + cpu->arch.model;
} else {
model = (cpu->arch.family << 4) + model = (cpu->arch.family << 4) +
cpu->arch.model; cpu->arch.model;
/* There isn't much useful information yet in the extended // There isn't much useful information yet in the extended
family and extended model fields of AMD processors // family and extended model fields of AMD processors
and is probably undefined for others */ // and is probably undefined for others
}
}
sCpuRevision = (cpu->arch.extended_family << 18) sCpuRevision = (cpu->arch.extended_family << 18)
| (cpu->arch.extended_model << 14) | (cpu->arch.extended_model << 14) | (cpu->arch.type << 12)
| (cpu->arch.type << 12) | (cpu->arch.family << 8) | (cpu->arch.model << 4) | cpu->arch.stepping;
| (cpu->arch.family << 8)
| (cpu->arch.model << 4)
| cpu->arch.stepping;
sCpuType = base + model; sCpuType = base + model;
sCpuClockSpeed = args->arch_args.cpu_clock_speed; sCpuClockSpeed = args->arch_args.cpu_clock_speed;
return B_OK; return B_OK;
} }
// #pragma mark - // #pragma mark -