hv: ioapic: clean up HV_DEBUG usage

remove the usage of HV_DEBUG in ioapic.c

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Shiqing Gao
2018-11-22 11:33:50 +08:00
committed by wenlingz
parent 9d529fb9e6
commit e49929a776
3 changed files with 85 additions and 87 deletions

View File

@@ -9,13 +9,8 @@
#define IOAPIC_MAX_PIN 240U
#define IOAPIC_INVALID_PIN 0xffU
struct gsi_table {
uint8_t ioapic_id;
uint8_t pin;
void *addr;
};
static struct gsi_table gsi_table[NR_MAX_GSI];
static uint32_t nr_gsi;
struct gsi_table gsi_table[NR_MAX_GSI];
uint32_t nr_gsi;
static spinlock_t ioapic_lock;
static union ioapic_rte saved_rte[NR_IOAPICS][IOAPIC_MAX_PIN];
@@ -134,9 +129,7 @@ get_ioapic_base(uint8_t apic_id)
return addr[apic_id];
}
static inline void
ioapic_get_rte_entry(void *ioapic_addr,
uint8_t pin, union ioapic_rte *rte)
void ioapic_get_rte_entry(void *ioapic_addr, uint8_t pin, union ioapic_rte *rte)
{
uint32_t rte_addr = ((uint32_t)pin * 2U) + 0x10U;
rte->u.lo_32 = ioapic_read_reg32(ioapic_addr, rte_addr);
@@ -425,67 +418,3 @@ void resume_ioapic(void)
}
}
}
#ifdef HV_DEBUG
static void get_rte_info(union ioapic_rte rte, bool *mask, bool *irr,
bool *phys, uint32_t *delmode, bool *level, uint32_t *vector, uint32_t *dest)
{
*mask = ((rte.full & IOAPIC_RTE_INTMASK) == IOAPIC_RTE_INTMSET);
*irr = ((rte.full & IOAPIC_RTE_REM_IRR) == IOAPIC_RTE_REM_IRR);
*phys = ((rte.full & IOAPIC_RTE_DESTMOD) == IOAPIC_RTE_DESTPHY);
*delmode = (uint32_t)(rte.full & IOAPIC_RTE_DELMOD);
*level = ((rte.full & IOAPIC_RTE_TRGRLVL) != 0UL);
*vector = (uint32_t)(rte.full & IOAPIC_RTE_INTVEC);
*dest = (uint32_t)(rte.full >> APIC_ID_SHIFT);
}
int get_ioapic_info(char *str_arg, size_t str_max_len)
{
char *str = str_arg;
uint32_t irq;
size_t len, size = str_max_len;
len = snprintf(str, size, "\r\nIRQ\tPIN\tRTE.HI32\tRTE.LO32\tVEC\tDST\tDM\tTM\tDELM\tIRR\tMASK");
if (len >= size) {
goto overflow;
}
size -= len;
str += len;
for (irq = 0U; irq < nr_gsi; irq++) {
void *addr = gsi_table[irq].addr;
uint8_t pin = gsi_table[irq].pin;
union ioapic_rte rte;
bool irr, phys, level, mask;
uint32_t delmode, vector, dest;
ioapic_get_rte_entry(addr, pin, &rte);
get_rte_info(rte, &mask, &irr, &phys, &delmode, &level,
&vector, &dest);
len = snprintf(str, size, "\r\n%03d\t%03hhu\t0x%08X\t0x%08X\t", irq, pin, rte.u.hi_32, rte.u.lo_32);
if (len >= size) {
goto overflow;
}
size -= len;
str += len;
len = snprintf(str, size, "0x%02X\t0x%02X\t%s\t%s\t%u\t%d\t%d",
vector, dest, phys ? "phys" : "logic", level ? "level" : "edge", delmode >> 8, irr, mask);
if (len >= size) {
goto overflow;
}
size -= len;
str += len;
}
snprintf(str, size, "\r\n");
return 0;
overflow:
printf("buffer size could not be enough! please check!\n");
return 0;
}
#endif /* HV_DEBUG */