1*af7b0868SMatt Evans #include "kvm/ioport.h" 2*af7b0868SMatt Evans 3*af7b0868SMatt Evans #include <stdlib.h> 4*af7b0868SMatt Evans 5*af7b0868SMatt Evans static bool debug_io_out(struct ioport *ioport, struct kvm *kvm, u16 port, void *data, int size) 6*af7b0868SMatt Evans { 7*af7b0868SMatt Evans exit(EXIT_SUCCESS); 8*af7b0868SMatt Evans } 9*af7b0868SMatt Evans 10*af7b0868SMatt Evans static struct ioport_operations debug_ops = { 11*af7b0868SMatt Evans .io_out = debug_io_out, 12*af7b0868SMatt Evans }; 13*af7b0868SMatt Evans 14*af7b0868SMatt Evans static bool dummy_io_in(struct ioport *ioport, struct kvm *kvm, u16 port, void *data, int size) 15*af7b0868SMatt Evans { 16*af7b0868SMatt Evans return true; 17*af7b0868SMatt Evans } 18*af7b0868SMatt Evans 19*af7b0868SMatt Evans static bool dummy_io_out(struct ioport *ioport, struct kvm *kvm, u16 port, void *data, int size) 20*af7b0868SMatt Evans { 21*af7b0868SMatt Evans return true; 22*af7b0868SMatt Evans } 23*af7b0868SMatt Evans 24*af7b0868SMatt Evans static struct ioport_operations dummy_read_write_ioport_ops = { 25*af7b0868SMatt Evans .io_in = dummy_io_in, 26*af7b0868SMatt Evans .io_out = dummy_io_out, 27*af7b0868SMatt Evans }; 28*af7b0868SMatt Evans 29*af7b0868SMatt Evans static struct ioport_operations dummy_write_only_ioport_ops = { 30*af7b0868SMatt Evans .io_out = dummy_io_out, 31*af7b0868SMatt Evans }; 32*af7b0868SMatt Evans 33*af7b0868SMatt Evans void ioport__setup_arch(void) 34*af7b0868SMatt Evans { 35*af7b0868SMatt Evans /* Legacy ioport setup */ 36*af7b0868SMatt Evans 37*af7b0868SMatt Evans /* 0x0020 - 0x003F - 8259A PIC 1 */ 38*af7b0868SMatt Evans ioport__register(0x0020, &dummy_read_write_ioport_ops, 2, NULL); 39*af7b0868SMatt Evans 40*af7b0868SMatt Evans /* PORT 0040-005F - PIT - PROGRAMMABLE INTERVAL TIMER (8253, 8254) */ 41*af7b0868SMatt Evans ioport__register(0x0040, &dummy_read_write_ioport_ops, 4, NULL); 42*af7b0868SMatt Evans 43*af7b0868SMatt Evans /* 0x00A0 - 0x00AF - 8259A PIC 2 */ 44*af7b0868SMatt Evans ioport__register(0x00A0, &dummy_read_write_ioport_ops, 2, NULL); 45*af7b0868SMatt Evans 46*af7b0868SMatt Evans /* PORT 00E0-00EF are 'motherboard specific' so we use them for our 47*af7b0868SMatt Evans internal debugging purposes. */ 48*af7b0868SMatt Evans ioport__register(IOPORT_DBG, &debug_ops, 1, NULL); 49*af7b0868SMatt Evans 50*af7b0868SMatt Evans /* PORT 00ED - DUMMY PORT FOR DELAY??? */ 51*af7b0868SMatt Evans ioport__register(0x00ED, &dummy_write_only_ioport_ops, 1, NULL); 52*af7b0868SMatt Evans 53*af7b0868SMatt Evans /* 0x00F0 - 0x00FF - Math co-processor */ 54*af7b0868SMatt Evans ioport__register(0x00F0, &dummy_write_only_ioport_ops, 2, NULL); 55*af7b0868SMatt Evans 56*af7b0868SMatt Evans /* PORT 03D4-03D5 - COLOR VIDEO - CRT CONTROL REGISTERS */ 57*af7b0868SMatt Evans ioport__register(0x03D4, &dummy_read_write_ioport_ops, 1, NULL); 58*af7b0868SMatt Evans ioport__register(0x03D5, &dummy_write_only_ioport_ops, 1, NULL); 59*af7b0868SMatt Evans } 60