Split isa bus manager to arch-specific part, that has been sitting here for a while...

PPC version must be fixed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25676 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol 2008-05-27 23:45:04 +00:00
parent 0e82c8d555
commit d4a25c07df
12 changed files with 412 additions and 78 deletions

View File

@ -4,5 +4,7 @@ UsePrivateKernelHeaders ;
KernelAddon isa :
isa.c
: isa_arch_bus_manager.a
;
SubInclude HAIKU_TOP src add-ons kernel bus_managers isa arch $(TARGET_ARCH) ;

View File

@ -0,0 +1,12 @@
SubDir HAIKU_TOP src add-ons kernel bus_managers isa arch m68k ;
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) ] ;
UsePrivateHeaders kernel [ FDirName kernel arch m68k ] ;
UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ;
KernelStaticLibrary isa_arch_bus_manager :
isa_dma.c
isa_controller.c
;

View File

@ -0,0 +1,84 @@
/*
* Copyright 2007 Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* arch-specific config manager
*
* Authors (in chronological order):
* François Revol (revol@free.fr)
*/
#include <KernelExport.h>
#include "ISA.h"
#include "arch_cpu.h"
#include "isa_arch.h"
//#define TRACE_ISA
#ifdef TRACE_ISA
# define TRACE(x) dprintf x
#else
# define TRACE(x) ;
#endif
uint8
arch_isa_read_io_8(int mapped_io_addr)
{
uint8 value = in8(mapped_io_addr);
TRACE(("isa_read8(%x->%x)\n", mapped_io_addr, value));
return value;
}
void
arch_isa_write_io_8(int mapped_io_addr, uint8 value)
{
TRACE(("isa_write8(%x->%x)\n", value, mapped_io_addr));
out8(value, mapped_io_addr);
}
uint16
arch_isa_read_io_16(int mapped_io_addr)
{
return in16(mapped_io_addr);
}
void
arch_isa_write_io_16(int mapped_io_addr, uint16 value)
{
out16(value, mapped_io_addr);
}
uint32
arch_isa_read_io_32(int mapped_io_addr)
{
return in32(mapped_io_addr);
}
void
arch_isa_write_io_32(int mapped_io_addr, uint32 value)
{
out32(value, mapped_io_addr);
}
void *
arch_isa_ram_address(const void *physical_address_in_system_memory)
{
// this is what the BeOS kernel does
return (void *)physical_address_in_system_memory;
}
status_t
arch_isa_init(void)
{
return B_OK;
}

View File

@ -0,0 +1,25 @@
/*
* Copyright 2007 Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* arch-specific config manager
*
* Authors (in chronological order):
* François Revol (revol@free.fr)
*/
#include <KernelExport.h>
#include "ISA.h"
#include "arch_cpu.h"
#include "isa_arch.h"
status_t
arch_start_isa_dma(long channel, void *buf, long transfer_count,
uchar mode, uchar e_mode)
{
// ToDo: implement this?!
return B_NOT_ALLOWED;
}

View File

@ -0,0 +1,13 @@
SubDir HAIKU_TOP src add-ons kernel bus_managers isa arch ppc ;
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) ] ;
#UsePrivateHeaders kernel [ FDirName kernel arch ppc ] ;
#UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ;
UsePrivateKernelHeaders ;
KernelStaticLibrary isa_arch_bus_manager :
isa_dma.c
isa_controller.c
;

View File

@ -0,0 +1,85 @@
/*
* Copyright 2007 Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* arch-specific config manager
*
* Authors (in chronological order):
* François Revol (revol@free.fr)
*/
#include <KernelExport.h>
#include "ISA.h"
#include "arch_cpu.h"
#include "isa_arch.h"
//#define TRACE_ISA
#ifdef TRACE_ISA
# define TRACE(x) dprintf x
#else
# define TRACE(x) ;
#endif
#warning PPC: WRITEME!
uint8
arch_isa_read_io_8(int mapped_io_addr)
{
uint8 value = in8(mapped_io_addr);
TRACE(("isa_read8(%x->%x)\n", mapped_io_addr, value));
return value;
}
void
arch_isa_write_io_8(int mapped_io_addr, uint8 value)
{
TRACE(("isa_write8(%x->%x)\n", value, mapped_io_addr));
out8(value, mapped_io_addr);
}
uint16
arch_isa_read_io_16(int mapped_io_addr)
{
return in16(mapped_io_addr);
}
void
arch_isa_write_io_16(int mapped_io_addr, uint16 value)
{
out16(value, mapped_io_addr);
}
uint32
arch_isa_read_io_32(int mapped_io_addr)
{
return in32(mapped_io_addr);
}
void
arch_isa_write_io_32(int mapped_io_addr, uint32 value)
{
out32(value, mapped_io_addr);
}
void *
arch_isa_ram_address(const void *physical_address_in_system_memory)
{
// this is what the BeOS kernel does
return (void *)physical_address_in_system_memory;
}
status_t
arch_isa_init(void)
{
return B_OK;
}

View File

@ -0,0 +1,24 @@
/*
* Copyright 2007 Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* arch-specific config manager
*
* Authors (in chronological order):
* François Revol (revol@free.fr)
*/
#include <KernelExport.h>
#include "ISA.h"
#include "arch_cpu.h"
#include "isa_arch.h"
status_t
arch_start_isa_dma(long channel, void *buf, long transfer_count,
uchar mode, uchar e_mode)
{
// ToDo: implement this?!
return B_NOT_ALLOWED;
}

View File

@ -0,0 +1,12 @@
SubDir HAIKU_TOP src add-ons kernel bus_managers isa arch x86 ;
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) ] ;
UsePrivateHeaders kernel [ FDirName kernel arch x86 ] ;
UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ;
KernelStaticLibrary isa_arch_bus_manager :
isa_dma.c
isa_controller.c
;

View File

@ -0,0 +1,84 @@
/*
* Copyright 2007 Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* arch-specific config manager
*
* Authors (in chronological order):
* François Revol (revol@free.fr)
*/
#include <KernelExport.h>
#include "ISA.h"
#include "arch_cpu.h"
#include "isa_arch.h"
//#define TRACE_ISA
#ifdef TRACE_ISA
# define TRACE(x) dprintf x
#else
# define TRACE(x) ;
#endif
uint8
arch_isa_read_io_8(int mapped_io_addr)
{
uint8 value = in8(mapped_io_addr);
TRACE(("isa_read8(%x->%x)\n", mapped_io_addr, value));
return value;
}
void
arch_isa_write_io_8(int mapped_io_addr, uint8 value)
{
TRACE(("isa_write8(%x->%x)\n", value, mapped_io_addr));
out8(value, mapped_io_addr);
}
uint16
arch_isa_read_io_16(int mapped_io_addr)
{
return in16(mapped_io_addr);
}
void
arch_isa_write_io_16(int mapped_io_addr, uint16 value)
{
out16(value, mapped_io_addr);
}
uint32
arch_isa_read_io_32(int mapped_io_addr)
{
return in32(mapped_io_addr);
}
void
arch_isa_write_io_32(int mapped_io_addr, uint32 value)
{
out32(value, mapped_io_addr);
}
void *
arch_isa_ram_address(const void *physical_address_in_system_memory)
{
// this is what the BeOS kernel does
return (void *)physical_address_in_system_memory;
}
status_t
arch_isa_init(void)
{
return B_OK;
}

View File

@ -0,0 +1,22 @@
/*
* Copyright 2007 Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* arch-specific config manager
*
* Authors (in chronological order):
* François Revol (revol@free.fr)
*/
#include <KernelExport.h>
#include "ISA.h"
#include "arch_cpu.h"
#include "isa_arch.h"
status_t
arch_start_isa_dma(long channel, void *buf, long transfer_count,
uchar mode, uchar e_mode)
{
// ToDo: implement this?!
return B_NOT_ALLOWED;
}

View File

@ -21,6 +21,7 @@
#include <stdlib.h>
#include <string.h>
#include "isa_arch.h"
//#define TRACE_ISA
#ifdef TRACE_ISA
@ -38,62 +39,6 @@
device_manager_info *pnp;
static uint8
isa_read_io_8(int mapped_io_addr)
{
uint8 value = in8(mapped_io_addr);
TRACE(("isa_read8(%x->%x)\n", mapped_io_addr, value));
return value;
}
static void
isa_write_io_8(int mapped_io_addr, uint8 value)
{
TRACE(("isa_write8(%x->%x)\n", value, mapped_io_addr));
out8(value, mapped_io_addr);
}
static uint16
isa_read_io_16(int mapped_io_addr)
{
return in16(mapped_io_addr);
}
static void
isa_write_io_16(int mapped_io_addr, uint16 value)
{
out16(value, mapped_io_addr);
}
static uint32
isa_read_io_32(int mapped_io_addr)
{
return in32(mapped_io_addr);
}
static void
isa_write_io_32(int mapped_io_addr, uint32 value)
{
out32(value, mapped_io_addr);
}
static void *
ram_address(const void *physical_address_in_system_memory)
{
// this is what the BeOS kernel does
return (void *)physical_address_in_system_memory;
}
static long
make_isa_dma_table(const void *buffer, long buffer_size, ulong num_bits,
isa_dma_entry *table, long num_entries)
@ -103,15 +48,6 @@ make_isa_dma_table(const void *buffer, long buffer_size, ulong num_bits,
}
static status_t
start_isa_dma(long channel, void *buf, long transfer_count,
uchar mode, uchar e_mode)
{
// ToDo: implement this?!
return B_NOT_ALLOWED;
}
static long
start_scattered_isa_dma(long channel, const isa_dma_entry *table,
uchar mode, uchar emode)
@ -211,6 +147,7 @@ std_ops(int32 op, ...)
{
switch (op) {
case B_MODULE_INIT:
return arch_isa_init();
case B_MODULE_UNINIT:
return B_OK;
@ -234,15 +171,15 @@ static isa_module_info isa_module = {
},
NULL // rescan
},
&isa_read_io_8,
&isa_write_io_8,
&isa_read_io_16,
&isa_write_io_16,
&isa_read_io_32,
&isa_write_io_32,
&ram_address,
&arch_isa_read_io_8,
&arch_isa_write_io_8,
&arch_isa_read_io_16,
&arch_isa_write_io_16,
&arch_isa_read_io_32,
&arch_isa_write_io_32,
&arch_isa_ram_address,
&make_isa_dma_table,
&start_isa_dma,
&arch_start_isa_dma,
&start_scattered_isa_dma,
&lock_isa_dma_channel,
&unlock_isa_dma_channel
@ -273,13 +210,13 @@ static isa2_module_info isa2_module = {
NULL, // rescan bus
},
isa_read_io_8, isa_write_io_8,
isa_read_io_16, isa_write_io_16,
isa_read_io_32, isa_write_io_32,
arch_isa_read_io_8, arch_isa_write_io_8,
arch_isa_read_io_16, arch_isa_write_io_16,
arch_isa_read_io_32, arch_isa_write_io_32,
ram_address,
arch_isa_ram_address,
start_isa_dma,
arch_start_isa_dma,
};
#endif

View File

@ -0,0 +1,34 @@
/*
* Copyright 2007 Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* François Revol (revol@free.fr)
*/
/*
ISA bus manager
arch-dependant functions
*/
#ifdef __cplusplus
extern "C" {
#endif
/* implemented in arch/<cpu>/ */
extern status_t arch_isa_init(void);
extern uint8 arch_isa_read_io_8(int mapped_io_addr);
extern void arch_isa_write_io_8(int mapped_io_addr, uint8 value);
extern uint16 arch_isa_read_io_16(int mapped_io_addr);
extern void arch_isa_write_io_16(int mapped_io_addr, uint16 value);
extern uint32 arch_isa_read_io_32(int mapped_io_addr);
extern void arch_isa_write_io_32(int mapped_io_addr, uint32 value);
extern void *arch_isa_ram_address(const void *);
extern status_t arch_start_isa_dma(long channel, void *buf,
long transfer_count,
uchar mode, uchar e_mode);
#ifdef __cplusplus
}
#endif