xref: /haiku/src/add-ons/kernel/bus_managers/isa/arch/x86/isa_controller.cpp (revision aef94baf32b4370979ce315902c400d23076366c)
15774b5afSAlex Smith /*
25774b5afSAlex Smith  * Copyright 2007 Haiku, Inc.
35774b5afSAlex Smith  * Distributed under the terms of the MIT License.
45774b5afSAlex Smith  *
55774b5afSAlex Smith  * arch-specific config manager
65774b5afSAlex Smith  *
75774b5afSAlex Smith  * Authors (in chronological order):
85774b5afSAlex Smith  *              François Revol (revol@free.fr)
95774b5afSAlex Smith  */
105774b5afSAlex Smith 
115774b5afSAlex Smith #include <KernelExport.h>
125774b5afSAlex Smith #include "ISA.h"
135774b5afSAlex Smith #include "arch_cpu.h"
145774b5afSAlex Smith #include "isa_arch.h"
155774b5afSAlex Smith 
165774b5afSAlex Smith //#define TRACE_ISA
175774b5afSAlex Smith #ifdef TRACE_ISA
185774b5afSAlex Smith #       define TRACE(x) dprintf x
195774b5afSAlex Smith #else
205774b5afSAlex Smith #       define TRACE(x) ;
215774b5afSAlex Smith #endif
225774b5afSAlex Smith 
235774b5afSAlex Smith 
245774b5afSAlex Smith uint8
arch_isa_read_io_8(int mapped_io_addr)255774b5afSAlex Smith arch_isa_read_io_8(int mapped_io_addr)
265774b5afSAlex Smith {
275774b5afSAlex Smith 	uint8 value = in8(mapped_io_addr);
285774b5afSAlex Smith 
295774b5afSAlex Smith 	TRACE(("isa_read8(%x->%x)\n", mapped_io_addr, value));
305774b5afSAlex Smith 
315774b5afSAlex Smith 	return value;
325774b5afSAlex Smith }
335774b5afSAlex Smith 
345774b5afSAlex Smith 
355774b5afSAlex Smith void
arch_isa_write_io_8(int mapped_io_addr,uint8 value)365774b5afSAlex Smith arch_isa_write_io_8(int mapped_io_addr, uint8 value)
375774b5afSAlex Smith {
385774b5afSAlex Smith 	TRACE(("isa_write8(%x->%x)\n", value, mapped_io_addr));
395774b5afSAlex Smith 
405774b5afSAlex Smith 	out8(value, mapped_io_addr);
415774b5afSAlex Smith }
425774b5afSAlex Smith 
435774b5afSAlex Smith 
445774b5afSAlex Smith uint16
arch_isa_read_io_16(int mapped_io_addr)455774b5afSAlex Smith arch_isa_read_io_16(int mapped_io_addr)
465774b5afSAlex Smith {
475774b5afSAlex Smith 	return in16(mapped_io_addr);
485774b5afSAlex Smith }
495774b5afSAlex Smith 
505774b5afSAlex Smith 
515774b5afSAlex Smith void
arch_isa_write_io_16(int mapped_io_addr,uint16 value)525774b5afSAlex Smith arch_isa_write_io_16(int mapped_io_addr, uint16 value)
535774b5afSAlex Smith {
545774b5afSAlex Smith 	out16(value, mapped_io_addr);
555774b5afSAlex Smith }
565774b5afSAlex Smith 
575774b5afSAlex Smith 
585774b5afSAlex Smith uint32
arch_isa_read_io_32(int mapped_io_addr)595774b5afSAlex Smith arch_isa_read_io_32(int mapped_io_addr)
605774b5afSAlex Smith {
615774b5afSAlex Smith 	return in32(mapped_io_addr);
625774b5afSAlex Smith }
635774b5afSAlex Smith 
645774b5afSAlex Smith 
655774b5afSAlex Smith void
arch_isa_write_io_32(int mapped_io_addr,uint32 value)665774b5afSAlex Smith arch_isa_write_io_32(int mapped_io_addr, uint32 value)
675774b5afSAlex Smith {
685774b5afSAlex Smith 	out32(value, mapped_io_addr);
695774b5afSAlex Smith }
705774b5afSAlex Smith 
715774b5afSAlex Smith 
72*aef94bafSFrançois Revol phys_addr_t
arch_isa_ram_address(phys_addr_t physical_address_in_system_memory)73*aef94bafSFrançois Revol arch_isa_ram_address(phys_addr_t physical_address_in_system_memory)
745774b5afSAlex Smith {
755774b5afSAlex Smith 	// this is what the BeOS kernel does
76*aef94bafSFrançois Revol 	return physical_address_in_system_memory;
775774b5afSAlex Smith }
785774b5afSAlex Smith 
795774b5afSAlex Smith 
805774b5afSAlex Smith status_t
arch_isa_init(void)815774b5afSAlex Smith arch_isa_init(void)
825774b5afSAlex Smith {
835774b5afSAlex Smith 	return B_OK;
845774b5afSAlex Smith }
85