2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2006-01-01 14:33:06 +03:00
|
|
|
// $Id: ioapic.h,v 1.13 2006-01-01 11:33:06 vruppert Exp $
|
2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2004-10-16 23:34:17 +04:00
|
|
|
|
2001-05-23 11:48:11 +04:00
|
|
|
extern class bx_ioapic_c bx_ioapic;
|
|
|
|
|
2005-12-13 23:27:23 +03:00
|
|
|
#define BX_IOAPIC_NUM_PINS (0x18)
|
|
|
|
|
|
|
|
// use the same version as 82093 IOAPIC (0x00170011)
|
|
|
|
#define BX_IOAPIC_VERSION_ID (((BX_IOAPIC_NUM_PINS - 1) << 16) | 0x11)
|
2001-05-23 11:48:11 +04:00
|
|
|
|
|
|
|
class bx_io_redirect_entry_t {
|
2005-12-13 23:27:23 +03:00
|
|
|
Bit32u hi, lo;
|
|
|
|
|
2001-05-23 11:48:11 +04:00
|
|
|
public:
|
2005-12-13 23:27:23 +03:00
|
|
|
bx_io_redirect_entry_t(): hi(0), lo(0x10000) {}
|
|
|
|
|
|
|
|
Bit32u get_even_word () const { return lo; }
|
|
|
|
Bit32u get_odd_word () const { return hi; }
|
2001-05-23 11:48:11 +04:00
|
|
|
void set_even_word (Bit32u even) {
|
|
|
|
// keep high 32 bits of value, replace low 32
|
2005-12-13 23:27:23 +03:00
|
|
|
lo = even;
|
2001-05-23 11:48:11 +04:00
|
|
|
parse_value ();
|
|
|
|
}
|
|
|
|
void set_odd_word (Bit32u odd) {
|
|
|
|
// keep low 32 bits of value, replace high 32
|
2005-12-13 23:27:23 +03:00
|
|
|
hi = odd;
|
2001-05-23 11:48:11 +04:00
|
|
|
parse_value ();
|
|
|
|
}
|
|
|
|
void parse_value ();
|
2005-12-13 23:27:23 +03:00
|
|
|
void sprintf_self (char *buf);
|
2001-05-23 11:48:11 +04:00
|
|
|
// parse_value sets the value and all the fields below. Do not change
|
|
|
|
// these fields except by calling parse_value.
|
|
|
|
Bit8u dest, masked, trig_mode, remote_irr, polarity, delivery_status, dest_mode, delivery_mode, vector;
|
|
|
|
};
|
|
|
|
|
|
|
|
class bx_ioapic_c : public bx_generic_apic_c {
|
|
|
|
Bit32u ioregsel; // selects between various registers
|
|
|
|
// interrupt request bitmask, not visible from the outside. Bits in the
|
|
|
|
// irr are set when trigger_irq is called, and cleared when the interrupt
|
|
|
|
// is delivered to the processor. If an interrupt is masked, the irr
|
|
|
|
// will still be set but delivery will not occur until it is unmasked.
|
|
|
|
// It's not clear if this is how the real device works.
|
|
|
|
Bit32u irr;
|
2005-12-13 23:27:23 +03:00
|
|
|
|
2001-05-23 11:48:11 +04:00
|
|
|
public:
|
|
|
|
bx_io_redirect_entry_t ioredtbl[BX_IOAPIC_NUM_PINS]; // table of redirections
|
|
|
|
bx_ioapic_c ();
|
|
|
|
~bx_ioapic_c ();
|
|
|
|
virtual void init ();
|
2002-08-27 23:54:46 +04:00
|
|
|
virtual void reset (unsigned type);
|
2001-05-23 11:48:11 +04:00
|
|
|
virtual void read_aligned(Bit32u address, Bit32u *data, unsigned len);
|
|
|
|
virtual void write(Bit32u address, Bit32u *value, unsigned len);
|
2006-01-01 14:33:06 +03:00
|
|
|
void set_irq_level(Bit8u int_in, bx_bool level);
|
2001-05-23 11:48:11 +04:00
|
|
|
void service_ioapic ();
|
|
|
|
virtual bx_apic_type_t get_type () { return APIC_TYPE_IOAPIC; }
|
|
|
|
};
|