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:
Axel Dörfler 2005-12-12 17:20:32 +00:00
parent 97ec781e94
commit 4f00613311
12 changed files with 319 additions and 0 deletions

View File

@ -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 ;

View File

@ -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 ;

View File

@ -0,0 +1,3 @@
SubDir HAIKU_TOP src add-ons kernel cpu ;
SubInclude HAIKU_TOP src add-ons kernel cpu $(TARGET_ARCH) ;

View File

@ -0,0 +1,2 @@
SubDir HAIKU_TOP src add-ons kernel cpu ppc ;

View 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
;

View 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,
};

View 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

View 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
};

View 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,
};

View 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

View 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,
};

View 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