Non-functional changes, little bit optimize ioapic code
This commit is contained in:
parent
99fae60a0e
commit
90059c8faa
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: ioapic.cc,v 1.19 2005-06-04 17:44:58 vruppert Exp $
|
||||
// $Id: ioapic.cc,v 1.20 2005-12-13 20:27:23 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
#include <stdio.h>
|
||||
@ -12,16 +12,16 @@ class bx_ioapic_c bx_ioapic;
|
||||
|
||||
void bx_io_redirect_entry_t::parse_value ()
|
||||
{
|
||||
dest = (Bit8u)((value >> 56) & APIC_ID_MASK);
|
||||
masked = (Bit8u)((value >> 16) & 1);
|
||||
trig_mode = (Bit8u)((value >> 15) & 1);
|
||||
remote_irr = (Bit8u)((value >> 14) & 1);
|
||||
polarity = (Bit8u)((value >> 13) & 1);
|
||||
//delivery_status = (value >> 12) & 1;
|
||||
dest = (Bit8u)((hi >> 24) & APIC_ID_MASK);
|
||||
masked = (Bit8u)((lo >> 16) & 1);
|
||||
trig_mode = (Bit8u)((lo >> 15) & 1);
|
||||
remote_irr = (Bit8u)((lo >> 14) & 1);
|
||||
polarity = (Bit8u)((lo >> 13) & 1);
|
||||
//delivery_status = (lo >> 12) & 1;
|
||||
delivery_status = 0; // we'll change this later...
|
||||
dest_mode = (Bit8u)((value >> 11) & 1);
|
||||
delivery_mode = (Bit8u)((value >> 8) & 7);
|
||||
vector = (Bit8u)(value & 0xff);
|
||||
dest_mode = (Bit8u)((lo >> 11) & 1);
|
||||
delivery_mode = (Bit8u)((lo >> 8) & 7);
|
||||
vector = (Bit8u)(lo & 0xff);
|
||||
}
|
||||
|
||||
void bx_io_redirect_entry_t::sprintf_self (char *buf)
|
||||
@ -75,8 +75,7 @@ void bx_ioapic_c::read_aligned(Bit32u address, Bit32u *data, unsigned len)
|
||||
*data = ((id & APIC_ID_MASK) << 24);
|
||||
return;
|
||||
case 0x01: // version
|
||||
*data = (((BX_IOAPIC_NUM_PINS-1) & 0xff) << 16)
|
||||
| (BX_IOAPIC_VERSION_ID & 0x0f);
|
||||
*data = BX_IOAPIC_VERSION_ID;
|
||||
return;
|
||||
case 0x02:
|
||||
BX_INFO(("IOAPIC: arbitration ID unsupported, returned 0"));
|
||||
@ -162,7 +161,7 @@ void bx_ioapic_c::service_ioapic ()
|
||||
if (irr & (1<<bit)) {
|
||||
bx_io_redirect_entry_t *entry = ioredtbl + bit;
|
||||
entry->parse_value();
|
||||
if (!entry->masked) {
|
||||
if (! entry->masked) {
|
||||
// clear irr bit and deliver
|
||||
bx_bool done = deliver (entry->dest, entry->dest_mode, entry->delivery_mode, entry->vector, entry->polarity, entry->trig_mode);
|
||||
if (done) {
|
||||
|
@ -1,32 +1,37 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: ioapic.h,v 1.9 2005-06-04 17:44:58 vruppert Exp $
|
||||
// $Id: ioapic.h,v 1.10 2005-12-13 20:27:23 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern class bx_ioapic_c bx_ioapic;
|
||||
|
||||
#define BX_IOAPIC_VERSION_ID 0x00170011 // same version as 82093 IOAPIC
|
||||
#define BX_IOAPIC_NUM_PINS 0x18
|
||||
#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)
|
||||
|
||||
class bx_io_redirect_entry_t {
|
||||
Bit64u value;
|
||||
Bit32u hi, lo;
|
||||
|
||||
public:
|
||||
Bit32u get_even_word () { return (Bit32u)(value & 0xffffffff); }
|
||||
Bit32u get_odd_word () { return (Bit32u)((value>>32) & 0xffffffff); }
|
||||
bx_io_redirect_entry_t(): hi(0), lo(0x10000) {}
|
||||
|
||||
Bit32u get_even_word () const { return lo; }
|
||||
Bit32u get_odd_word () const { return hi; }
|
||||
void set_even_word (Bit32u even) {
|
||||
// keep high 32 bits of value, replace low 32
|
||||
value = ((value >> 32) << 32) | (even & 0xffffffff);
|
||||
lo = even;
|
||||
parse_value ();
|
||||
}
|
||||
void set_odd_word (Bit32u odd) {
|
||||
// keep low 32 bits of value, replace high 32
|
||||
value = (((Bit64u)odd & 0xffffffff) << 32) | (value & 0xffffffff);
|
||||
hi = odd;
|
||||
parse_value ();
|
||||
}
|
||||
void parse_value ();
|
||||
void sprintf_self (char *buf);
|
||||
// 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;
|
||||
void sprintf_self (char *buf);
|
||||
};
|
||||
|
||||
class bx_ioapic_c : public bx_generic_apic_c {
|
||||
@ -37,6 +42,7 @@ class bx_ioapic_c : public bx_generic_apic_c {
|
||||
// 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;
|
||||
|
||||
public:
|
||||
bx_io_redirect_entry_t ioredtbl[BX_IOAPIC_NUM_PINS]; // table of redirections
|
||||
bx_ioapic_c ();
|
||||
|
Loading…
Reference in New Issue
Block a user