Added generic x86 CPU module.
Contains (emtpy) modules for Intel/AMD/VIA models. Might be separated later, though, depending on how large they will get. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15522 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
97ec781e94
commit
4f00613311
@ -75,6 +75,10 @@ AddFilesToHaikuImage beos system add-ons kernel generic
|
||||
: block_io fast_log ide_adapter locked_pool scsi_periph ;
|
||||
AddFilesToHaikuImage beos system add-ons kernel partitioning_systems : intel ;
|
||||
|
||||
if $(TARGET_ARCH) = x86 {
|
||||
AddFilesToHaikuImage beos system add-ons kernel cpu : generic_x86 ;
|
||||
}
|
||||
|
||||
# drivers
|
||||
AddDriversToHaikuImage : console dprintf keyboard null random
|
||||
<driver>tty zero ;
|
||||
|
@ -3,6 +3,7 @@ SubDir HAIKU_TOP src add-ons kernel ;
|
||||
SubInclude HAIKU_TOP src add-ons kernel bus_managers ;
|
||||
SubInclude HAIKU_TOP src add-ons kernel busses ;
|
||||
SubInclude HAIKU_TOP src add-ons kernel console ;
|
||||
SubInclude HAIKU_TOP src add-ons kernel cpu ;
|
||||
SubInclude HAIKU_TOP src add-ons kernel disk_scanner ;
|
||||
SubInclude HAIKU_TOP src add-ons kernel drivers ;
|
||||
SubInclude HAIKU_TOP src add-ons kernel file_cache ;
|
||||
|
3
src/add-ons/kernel/cpu/Jamfile
Normal file
3
src/add-ons/kernel/cpu/Jamfile
Normal file
@ -0,0 +1,3 @@
|
||||
SubDir HAIKU_TOP src add-ons kernel cpu ;
|
||||
|
||||
SubInclude HAIKU_TOP src add-ons kernel cpu $(TARGET_ARCH) ;
|
2
src/add-ons/kernel/cpu/ppc/Jamfile
Normal file
2
src/add-ons/kernel/cpu/ppc/Jamfile
Normal file
@ -0,0 +1,2 @@
|
||||
SubDir HAIKU_TOP src add-ons kernel cpu ppc ;
|
||||
|
10
src/add-ons/kernel/cpu/x86/Jamfile
Normal file
10
src/add-ons/kernel/cpu/x86/Jamfile
Normal file
@ -0,0 +1,10 @@
|
||||
SubDir HAIKU_TOP src add-ons kernel cpu x86 ;
|
||||
|
||||
UsePrivateHeaders kernel ;
|
||||
|
||||
KernelAddon generic_x86 : kernel cpu :
|
||||
generic_x86.cpp
|
||||
intel.cpp
|
||||
amd.cpp
|
||||
via.cpp
|
||||
;
|
79
src/add-ons/kernel/cpu/x86/amd.cpp
Normal file
79
src/add-ons/kernel/cpu/x86/amd.cpp
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright 2005, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
|
||||
|
||||
#include "amd.h"
|
||||
|
||||
|
||||
static uint32
|
||||
amd_count_mtrrs(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
amd_set_mtrr(uint32 index, addr_t base, addr_t length, uint32 type)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
amd_unset_mtrr(uint32 index)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
amd_init(void)
|
||||
{
|
||||
system_info info;
|
||||
if (get_system_info(&info) != B_OK)
|
||||
return B_ERROR;
|
||||
|
||||
if ((info.cpu_type & B_CPU_x86_VENDOR_MASK) != B_CPU_AMD_x86)
|
||||
return B_ERROR;
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
amd_uninit(void)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
amd_stdops(int32 op, ...)
|
||||
{
|
||||
switch (op) {
|
||||
case B_MODULE_INIT:
|
||||
return amd_init();
|
||||
case B_MODULE_UNINIT:
|
||||
return amd_uninit();
|
||||
}
|
||||
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
x86_cpu_module_info gAMDModule = {
|
||||
{
|
||||
"cpu/generic_x86/amd/v1",
|
||||
0,
|
||||
amd_stdops,
|
||||
},
|
||||
|
||||
amd_count_mtrrs,
|
||||
amd_set_mtrr,
|
||||
amd_unset_mtrr,
|
||||
};
|
14
src/add-ons/kernel/cpu/x86/amd.h
Normal file
14
src/add-ons/kernel/cpu/x86/amd.h
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright 2005, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef CPU_AMD_H
|
||||
#define CPU_AMD_H
|
||||
|
||||
|
||||
#include <arch_cpu.h>
|
||||
|
||||
|
||||
extern x86_cpu_module_info gAMDModule;
|
||||
|
||||
#endif // CPU_AMD_H
|
20
src/add-ons/kernel/cpu/x86/generic_x86.cpp
Normal file
20
src/add-ons/kernel/cpu/x86/generic_x86.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2005, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
|
||||
|
||||
#include "intel.h"
|
||||
#include "amd.h"
|
||||
#include "via.h"
|
||||
|
||||
|
||||
module_info *gModules[] = {
|
||||
(module_info *)&gIntelModule,
|
||||
(module_info *)&gAMDModule,
|
||||
(module_info *)&gVIAModule,
|
||||
NULL
|
||||
};
|
79
src/add-ons/kernel/cpu/x86/intel.cpp
Normal file
79
src/add-ons/kernel/cpu/x86/intel.cpp
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright 2005, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
|
||||
|
||||
#include "intel.h"
|
||||
|
||||
|
||||
static uint32
|
||||
intel_count_mtrrs(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
intel_set_mtrr(uint32 index, addr_t base, addr_t length, uint32 type)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
intel_unset_mtrr(uint32 index)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
intel_init(void)
|
||||
{
|
||||
system_info info;
|
||||
if (get_system_info(&info) != B_OK)
|
||||
return B_ERROR;
|
||||
|
||||
if ((info.cpu_type & B_CPU_x86_VENDOR_MASK) != B_CPU_INTEL_x86)
|
||||
return B_ERROR;
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
intel_uninit(void)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
intel_stdops(int32 op, ...)
|
||||
{
|
||||
switch (op) {
|
||||
case B_MODULE_INIT:
|
||||
return intel_init();
|
||||
case B_MODULE_UNINIT:
|
||||
return intel_uninit();
|
||||
}
|
||||
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
x86_cpu_module_info gIntelModule = {
|
||||
{
|
||||
"cpu/generic_x86/intel/v1",
|
||||
0,
|
||||
intel_stdops,
|
||||
},
|
||||
|
||||
intel_count_mtrrs,
|
||||
intel_set_mtrr,
|
||||
intel_unset_mtrr,
|
||||
};
|
14
src/add-ons/kernel/cpu/x86/intel.h
Normal file
14
src/add-ons/kernel/cpu/x86/intel.h
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright 2005, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef CPU_INTEL_H
|
||||
#define CPU_INTEL_H
|
||||
|
||||
|
||||
#include <arch_cpu.h>
|
||||
|
||||
|
||||
extern x86_cpu_module_info gIntelModule;
|
||||
|
||||
#endif // CPU_INTEL_H
|
79
src/add-ons/kernel/cpu/x86/via.cpp
Normal file
79
src/add-ons/kernel/cpu/x86/via.cpp
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright 2005, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
|
||||
|
||||
#include "via.h"
|
||||
|
||||
|
||||
static uint32
|
||||
via_count_mtrrs(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
via_set_mtrr(uint32 index, addr_t base, addr_t length, uint32 type)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
via_unset_mtrr(uint32 index)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
via_init(void)
|
||||
{
|
||||
system_info info;
|
||||
if (get_system_info(&info) != B_OK)
|
||||
return B_ERROR;
|
||||
|
||||
if ((info.cpu_type & B_CPU_x86_VENDOR_MASK) != B_CPU_VIA_IDT_x86)
|
||||
return B_ERROR;
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
via_uninit(void)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
via_stdops(int32 op, ...)
|
||||
{
|
||||
switch (op) {
|
||||
case B_MODULE_INIT:
|
||||
return via_init();
|
||||
case B_MODULE_UNINIT:
|
||||
return via_uninit();
|
||||
}
|
||||
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
x86_cpu_module_info gVIAModule = {
|
||||
{
|
||||
"cpu/generic_x86/via/v1",
|
||||
0,
|
||||
via_stdops,
|
||||
},
|
||||
|
||||
via_count_mtrrs,
|
||||
via_set_mtrr,
|
||||
via_unset_mtrr,
|
||||
};
|
14
src/add-ons/kernel/cpu/x86/via.h
Normal file
14
src/add-ons/kernel/cpu/x86/via.h
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright 2005, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef CPU_VIA_H
|
||||
#define CPU_VIA_H
|
||||
|
||||
|
||||
#include <arch_cpu.h>
|
||||
|
||||
|
||||
extern x86_cpu_module_info gVIAModule;
|
||||
|
||||
#endif // CPU_VIA_H
|
Loading…
Reference in New Issue
Block a user