1 /*
2 * Copyright 2007 Haiku, Inc.
3 * Distributed under the terms of the MIT License.
4 *
5 * arch-specific config manager
6 *
7 * Authors (in chronological order):
8 * François Revol (revol@free.fr)
9 */
10
11 #include <KernelExport.h>
12 #include "ISA.h"
13 #include "arch_cpu.h"
14 #include "isa_arch.h"
15
16 //#define TRACE_ISA
17 #ifdef TRACE_ISA
18 # define TRACE(x) dprintf x
19 #else
20 # define TRACE(x) ;
21 #endif
22
23
24 uint8
arch_isa_read_io_8(int mapped_io_addr)25 arch_isa_read_io_8(int mapped_io_addr)
26 {
27 uint8 value = in8(mapped_io_addr);
28
29 TRACE(("isa_read8(%x->%x)\n", mapped_io_addr, value));
30
31 return value;
32 }
33
34
35 void
arch_isa_write_io_8(int mapped_io_addr,uint8 value)36 arch_isa_write_io_8(int mapped_io_addr, uint8 value)
37 {
38 TRACE(("isa_write8(%x->%x)\n", value, mapped_io_addr));
39
40 out8(value, mapped_io_addr);
41 }
42
43
44 uint16
arch_isa_read_io_16(int mapped_io_addr)45 arch_isa_read_io_16(int mapped_io_addr)
46 {
47 return in16(mapped_io_addr);
48 }
49
50
51 void
arch_isa_write_io_16(int mapped_io_addr,uint16 value)52 arch_isa_write_io_16(int mapped_io_addr, uint16 value)
53 {
54 out16(value, mapped_io_addr);
55 }
56
57
58 uint32
arch_isa_read_io_32(int mapped_io_addr)59 arch_isa_read_io_32(int mapped_io_addr)
60 {
61 return in32(mapped_io_addr);
62 }
63
64
65 void
arch_isa_write_io_32(int mapped_io_addr,uint32 value)66 arch_isa_write_io_32(int mapped_io_addr, uint32 value)
67 {
68 out32(value, mapped_io_addr);
69 }
70
71
72 phys_addr_t
arch_isa_ram_address(phys_addr_t physical_address_in_system_memory)73 arch_isa_ram_address(phys_addr_t physical_address_in_system_memory)
74 {
75 // this is what the BeOS kernel does
76 return physical_address_in_system_memory;
77 }
78
79
80 status_t
arch_isa_init(void)81 arch_isa_init(void)
82 {
83 return B_OK;
84 }
85