Small cleanup in he APIC code, removed unused methods

This commit is contained in:
Stanislav Shwartsman 2006-10-02 21:49:49 +00:00
parent 719eb78a25
commit 1aa7ae677d
3 changed files with 20 additions and 30 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: apic.cc,v 1.94 2006-06-20 16:51:03 sshwarts Exp $
// $Id: apic.cc,v 1.95 2006-10-02 21:49:49 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -36,6 +36,9 @@
#define APIC_BROADCAST_PHYSICAL_DESTINATION_MODE (APIC_MAX_ID)
#define BX_LAPIC_FIRST_VECTOR 0x10
#define BX_LAPIC_LAST_VECTOR 0xfe
///////////// APIC BUS /////////////
int apic_bus_deliver_interrupt(Bit8u vector, Bit8u dest, Bit8u delivery_mode, Bit8u dest_mode, bx_bool level, bx_bool trig_mode)
@ -273,7 +276,7 @@ void bx_local_apic_c::init()
log_dest = 0;
task_priority = 0;
for(i=0; i<BX_LOCAL_APIC_MAX_INTS; i++) {
for(i=0; i<BX_LAPIC_MAX_INTS; i++) {
irr[i] = isr[i] = tmr[i] = 0;
}
@ -643,7 +646,7 @@ void bx_local_apic_c::read_aligned(bx_phy_address addr, Bit32u *data)
int bx_local_apic_c::highest_priority_int(Bit8u *array)
{
for(int i=BX_APIC_LAST_VECTOR; i>=BX_APIC_FIRST_VECTOR; i--)
for(int i=BX_LAPIC_LAST_VECTOR; i>=BX_LAPIC_FIRST_VECTOR; i--)
if(array[i]) return i;
return -1;
@ -715,7 +718,7 @@ void bx_local_apic_c::trigger_irq(unsigned vector, unsigned trigger_mode, bx_boo
{
BX_DEBUG(("Local apic on %s: trigger interrupt vector=0x%x", cpu->name, vector));
if(vector > BX_APIC_LAST_VECTOR || vector < BX_APIC_FIRST_VECTOR) {
if(vector > BX_LAPIC_LAST_VECTOR || vector < BX_LAPIC_FIRST_VECTOR) {
shadow_error_status |= APIC_ERR_RX_ILLEGAL_VEC;
BX_INFO(("bogus vector %#x, ignoring ...", vector));
return;
@ -779,7 +782,7 @@ spurious:
void bx_local_apic_c::print_status(void)
{
BX_INFO(("%s local apic: status is {:", cpu->name));
for(int vec=0; vec<BX_LOCAL_APIC_MAX_INTS; vec++) {
for(int vec=0; vec<BX_LAPIC_MAX_INTS; vec++) {
if(irr[vec] || isr[vec]) {
BX_INFO(("vec 0x%x: irr=%d, isr=%d", vec,(int)irr[vec],(int)isr[vec]));
}
@ -953,10 +956,10 @@ void bx_local_apic_c::register_state(bx_param_c *parent)
BXRS_HEX_PARAM_SIMPLE(lapic, log_dest);
BXRS_HEX_PARAM_SIMPLE(lapic, dest_format);
bx_list_c *ISR = new bx_list_c(lapic, "isr", BX_LOCAL_APIC_MAX_INTS);
bx_list_c *TMR = new bx_list_c(lapic, "tmr", BX_LOCAL_APIC_MAX_INTS);
bx_list_c *IRR = new bx_list_c(lapic, "irr", BX_LOCAL_APIC_MAX_INTS);
for (i=0; i<BX_LOCAL_APIC_MAX_INTS; i++) {
bx_list_c *ISR = new bx_list_c(lapic, "isr", BX_LAPIC_MAX_INTS);
bx_list_c *TMR = new bx_list_c(lapic, "tmr", BX_LAPIC_MAX_INTS);
bx_list_c *IRR = new bx_list_c(lapic, "irr", BX_LAPIC_MAX_INTS);
for (i=0; i<BX_LAPIC_MAX_INTS; i++) {
sprintf(name, "0x%02x", i);
new bx_shadow_num_c(ISR, name, &isr[i]);
new bx_shadow_num_c(TMR, name, &tmr[i]);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: apic.h,v 1.33 2006-06-05 05:39:21 sshwarts Exp $
// $Id: apic.h,v 1.34 2006-10-02 21:49:49 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -35,11 +35,6 @@
#if BX_SUPPORT_APIC
typedef enum {
APIC_TYPE_IOAPIC,
APIC_TYPE_LOCAL_APIC
} bx_apic_type_t;
#define APIC_LEVEL_TRIGGERED 1
#define APIC_EDGE_TRIGGERED 0
@ -63,7 +58,6 @@ public:
virtual void read_aligned(bx_phy_address address, Bit32u *data) = 0;
void write(bx_phy_address address, void *value, unsigned len);
virtual void write_aligned(bx_phy_address address, Bit32u *data) = 0;
virtual bx_apic_type_t get_type() = 0;
};
#ifdef BX_INCLUDE_LOCAL_APIC
@ -77,12 +71,8 @@ public:
#endif
#define BX_LAPIC_BASE_ADDR 0xfee00000 // default Local APIC address
#define BX_NUM_LOCAL_APICS BX_SMP_PROCESSORS
#define BX_APIC_FIRST_VECTOR 0x10
#define BX_APIC_LAST_VECTOR 0xfe
#define BX_LOCAL_APIC_MAX_INTS 256
#define BX_NUM_LOCAL_APICS BX_SMP_PROCESSORS
#define BX_LAPIC_MAX_INTS 256
class BOCHSAPI bx_local_apic_c : public bx_generic_apic_c
{
@ -96,15 +86,15 @@ class BOCHSAPI bx_local_apic_c : public bx_generic_apic_c
// ISR=in-service register. When an IRR bit is cleared, the corresponding
// bit in ISR is set.
Bit8u isr[BX_LOCAL_APIC_MAX_INTS];
Bit8u isr[BX_LAPIC_MAX_INTS];
// TMR=trigger mode register. Cleared for edge-triggered interrupts
// and set for level-triggered interrupts. If set, local APIC must send
// EOI message to all other APICs.
Bit8u tmr[BX_LOCAL_APIC_MAX_INTS];
Bit8u tmr[BX_LAPIC_MAX_INTS];
// IRR=interrupt request register. When an interrupt is triggered by
// the I/O APIC or another processor, it sets a bit in irr. The bit is
// cleared when the interrupt is acknowledged by the processor.
Bit8u irr[BX_LOCAL_APIC_MAX_INTS];
Bit8u irr[BX_LAPIC_MAX_INTS];
#define APIC_ERR_ILLEGAL_ADDR 0x80
#define APIC_ERR_RX_ILLEGAL_VEC 0x40
@ -158,10 +148,9 @@ class BOCHSAPI bx_local_apic_c : public bx_generic_apic_c
public:
bx_bool INTR;
bx_local_apic_c(BX_CPU_C *cpu);
virtual ~bx_local_apic_c(void) { }
virtual ~bx_local_apic_c() { }
virtual void reset(void);
virtual void init(void);
BX_CPU_C *get_cpu() { return cpu; }
void set_id(Bit8u newid); // redefine to set cpu->name
virtual void write_aligned(bx_phy_address addr, Bit32u *data);
virtual void read_aligned(bx_phy_address address, Bit32u *data);
@ -179,7 +168,6 @@ public:
void service_local_apic(void);
void print_status(void);
bx_bool match_logical_addr (Bit8u address);
virtual bx_apic_type_t get_type(void) { return APIC_TYPE_LOCAL_APIC; }
bx_bool deliver(Bit8u vector, Bit8u delivery_mode, Bit8u trig_mode);
Bit8u get_tpr(void);
void set_tpr(Bit8u tpr);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: ioapic.h,v 1.22 2006-06-05 05:39:21 sshwarts Exp $
// $Id: ioapic.h,v 1.23 2006-10-02 21:49:49 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -95,7 +95,6 @@ public:
void set_irq_level(Bit8u int_in, bx_bool level);
void receive_eoi(Bit8u vector);
void service_ioapic(void);
virtual bx_apic_type_t get_type() { return APIC_TYPE_IOAPIC; }
#if BX_SUPPORT_SAVE_RESTORE
virtual void register_state(void);
#endif