Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2100 → Rev 2101

/trunk/kernel/genarch/src/acpi/madt.c
69,7 → 69,7
count_t cpu_count = 0;
 
struct madt_apic_header * * madt_entries_index = NULL;
int madt_entries_index_cnt = 0;
unsigned int madt_entries_index_cnt = 0;
 
char *entry[] = {
"L_APIC",
90,7 → 90,7
static bool madt_cpu_enabled(index_t i);
static bool madt_cpu_bootstrap(index_t i);
static uint8_t madt_cpu_apic_id(index_t i);
static int madt_irq_to_pin(int irq);
static int madt_irq_to_pin(unsigned int irq);
 
struct smp_config_operations madt_config_operations = {
.cpu_count = madt_cpu_count,
124,7 → 124,7
return ((struct madt_l_apic *) madt_entries_index[madt_l_apic_entry_index + i])->apic_id;
}
 
int madt_irq_to_pin(int irq)
int madt_irq_to_pin(unsigned int irq)
{
ASSERT(irq < sizeof(isa_irq_map)/sizeof(int));
return isa_irq_map[irq];
143,7 → 143,7
struct madt_apic_header *end = (struct madt_apic_header *) (((uint8_t *) acpi_madt) + acpi_madt->header.length);
struct madt_apic_header *h;
l_apic = (uint32_t *) (unative_t) acpi_madt->l_apic_address;
l_apic = (uint32_t *) (unative_t) acpi_madt->l_apic_address;
 
/* calculate madt entries */
for (h = &acpi_madt->apic_header[0]; h < end; h = (struct madt_apic_header *) (((uint8_t *) h) + h->length)) {
164,41 → 164,40
/* Quicksort MADT index structure */
qsort(madt_entries_index, madt_entries_index_cnt, sizeof(uintptr_t), &madt_cmp);
 
/* Parse MADT entries */
for (index = 0; index < madt_entries_index_cnt - 1; index++) {
h = madt_entries_index[index];
switch (h->type) {
case MADT_L_APIC:
madt_l_apic_entry((struct madt_l_apic *) h, index);
break;
case MADT_IO_APIC:
madt_io_apic_entry((struct madt_io_apic *) h, index);
break;
case MADT_INTR_SRC_OVRD:
madt_intr_src_ovrd_entry((struct madt_intr_src_ovrd *) h, index);
break;
case MADT_NMI_SRC:
case MADT_L_APIC_NMI:
case MADT_L_APIC_ADDR_OVRD:
case MADT_IO_SAPIC:
case MADT_L_SAPIC:
case MADT_PLATFORM_INTR_SRC:
printf("MADT: skipping %s entry (type=%zd)\n", entry[h->type], h->type);
break;
 
default:
if (h->type >= MADT_RESERVED_SKIP_BEGIN && h->type <= MADT_RESERVED_SKIP_END) {
printf("MADT: skipping reserved entry (type=%zd)\n", h->type);
}
if (h->type >= MADT_RESERVED_OEM_BEGIN) {
printf("MADT: skipping OEM entry (type=%zd)\n", h->type);
}
break;
/* Parse MADT entries */
if (madt_entries_index_cnt > 0) {
for (index = 0; index < madt_entries_index_cnt - 1; index++) {
h = madt_entries_index[index];
switch (h->type) {
case MADT_L_APIC:
madt_l_apic_entry((struct madt_l_apic *) h, index);
break;
case MADT_IO_APIC:
madt_io_apic_entry((struct madt_io_apic *) h, index);
break;
case MADT_INTR_SRC_OVRD:
madt_intr_src_ovrd_entry((struct madt_intr_src_ovrd *) h, index);
break;
case MADT_NMI_SRC:
case MADT_L_APIC_NMI:
case MADT_L_APIC_ADDR_OVRD:
case MADT_IO_SAPIC:
case MADT_L_SAPIC:
case MADT_PLATFORM_INTR_SRC:
printf("MADT: skipping %s entry (type=%zd)\n", entry[h->type], h->type);
break;
default:
if (h->type >= MADT_RESERVED_SKIP_BEGIN && h->type <= MADT_RESERVED_SKIP_END) {
printf("MADT: skipping reserved entry (type=%zd)\n", h->type);
}
if (h->type >= MADT_RESERVED_OEM_BEGIN) {
printf("MADT: skipping OEM entry (type=%zd)\n", h->type);
}
break;
}
}
}
 
if (cpu_count)
config.cpu_count = cpu_count;
/trunk/kernel/arch/ia32xen/src/smp/mps.c
92,7 → 92,7
static bool is_cpu_enabled(index_t i);
static bool is_bsp(index_t i);
static uint8_t get_cpu_apic_id(index_t i);
static int mps_irq_to_pin(int irq);
static int mps_irq_to_pin(unsigned int irq);
 
struct smp_config_operations mps_config_operations = {
.cpu_count = get_cpu_count,
415,11 → 415,11
}
}
 
int mps_irq_to_pin(int irq)
int mps_irq_to_pin(unsigned int irq)
{
int i;
for(i=0;i<io_intr_entry_cnt;i++) {
for (i = 0; i < io_intr_entry_cnt; i++) {
if (io_intr_entries[i].src_bus_irq == irq && io_intr_entries[i].intr_type == 0)
return io_intr_entries[i].dst_io_apic_pin;
}
/trunk/kernel/arch/ia32xen/src/smp/smp.c
162,7 → 162,7
}
}
 
int smp_irq_to_pin(int irq)
int smp_irq_to_pin(unsigned int irq)
{
ASSERT(ops != NULL);
return ops->irq_to_pin(irq);
/trunk/kernel/arch/ia32xen/src/smp/apic.c
124,7 → 124,7
void apic_init(void)
{
io_apic_id_t idreg;
int i;
unsigned int i;
 
exc_register(VECTOR_APIC_SPUR, "apic_spurious", (iroutine) apic_spurious);
 
528,10 → 528,11
void io_apic_disable_irqs(uint16_t irqmask)
{
io_redirection_reg_t reg;
int i, pin;
unsigned int i;
int pin;
for (i=0;i<16;i++) {
if (irqmask & (1<<i)) {
for (i = 0; i < 16; i++) {
if (irqmask & (1 << i)) {
/*
* Mask the signal input in IO APIC if there is a
* mapping for the respective IRQ number.
553,11 → 554,12
*/
void io_apic_enable_irqs(uint16_t irqmask)
{
int i, pin;
unsigned int i;
int pin;
io_redirection_reg_t reg;
for (i=0;i<16;i++) {
if (irqmask & (1<<i)) {
for (i = 0; i < 16; i++) {
if (irqmask & (1 << i)) {
/*
* Unmask the signal input in IO APIC if there is a
* mapping for the respective IRQ number.
/trunk/kernel/arch/ia32/include/smp/smp.h
43,10 → 43,10
bool (* cpu_enabled)(index_t i); /**< Check whether the processor of index i is enabled. */
bool (*cpu_bootstrap)(index_t i); /**< Check whether the processor of index i is BSP. */
uint8_t (*cpu_apic_id)(index_t i); /**< Return APIC ID of the processor of index i. */
int (*irq_to_pin)(int irq); /**< Return mapping between irq and APIC pin. */
int (*irq_to_pin)(unsigned int irq); /**< Return mapping between irq and APIC pin. */
};
 
extern int smp_irq_to_pin(int irq);
extern int smp_irq_to_pin(unsigned int irq);
 
#endif
 
/trunk/kernel/arch/ia32/src/smp/mps.c
90,7 → 90,7
static bool is_cpu_enabled(index_t i);
static bool is_bsp(index_t i);
static uint8_t get_cpu_apic_id(index_t i);
static int mps_irq_to_pin(int irq);
static int mps_irq_to_pin(unsigned int irq);
 
struct smp_config_operations mps_config_operations = {
.cpu_count = get_cpu_count,
413,11 → 413,11
}
}
 
int mps_irq_to_pin(int irq)
int mps_irq_to_pin(unsigned int irq)
{
unsigned int i;
for(i = 0; i < io_intr_entry_cnt; i++) {
for (i = 0; i < io_intr_entry_cnt; i++) {
if (io_intr_entries[i].src_bus_irq == irq && io_intr_entries[i].intr_type == 0)
return io_intr_entries[i].dst_io_apic_pin;
}
/trunk/kernel/arch/ia32/src/smp/smp.c
170,7 → 170,7
}
}
 
int smp_irq_to_pin(int irq)
int smp_irq_to_pin(unsigned int irq)
{
ASSERT(ops != NULL);
return ops->irq_to_pin(irq);
/trunk/kernel/arch/ia32/src/smp/apic.c
146,7 → 146,7
void apic_init(void)
{
io_apic_id_t idreg;
int i;
unsigned int i;
 
exc_register(VECTOR_APIC_SPUR, "apic_spurious", (iroutine) apic_spurious);
 
172,7 → 172,7
int pin;
if ((pin = smp_irq_to_pin(i)) != -1)
io_apic_change_ioredtbl(pin, DEST_ALL, IVT_IRQBASE+i, LOPRI);
io_apic_change_ioredtbl(pin, DEST_ALL, IVT_IRQBASE + i, LOPRI);
}
/*
534,10 → 534,11
void io_apic_disable_irqs(uint16_t irqmask)
{
io_redirection_reg_t reg;
int i, pin;
unsigned int i;
int pin;
for (i=0;i<16;i++) {
if (irqmask & (1<<i)) {
for (i = 0; i < 16; i++) {
if (irqmask & (1 << i)) {
/*
* Mask the signal input in IO APIC if there is a
* mapping for the respective IRQ number.
544,9 → 545,9
*/
pin = smp_irq_to_pin(i);
if (pin != -1) {
reg.lo = io_apic_read(IOREDTBL + pin*2);
reg.lo = io_apic_read(IOREDTBL + pin * 2);
reg.masked = true;
io_apic_write(IOREDTBL + pin*2, reg.lo);
io_apic_write(IOREDTBL + pin * 2, reg.lo);
}
}
559,11 → 560,12
*/
void io_apic_enable_irqs(uint16_t irqmask)
{
int i, pin;
unsigned int i;
int pin;
io_redirection_reg_t reg;
for (i=0;i<16;i++) {
if (irqmask & (1<<i)) {
for (i = 0;i < 16; i++) {
if (irqmask & (1 << i)) {
/*
* Unmask the signal input in IO APIC if there is a
* mapping for the respective IRQ number.
570,9 → 572,9
*/
pin = smp_irq_to_pin(i);
if (pin != -1) {
reg.lo = io_apic_read(IOREDTBL + pin*2);
reg.lo = io_apic_read(IOREDTBL + pin * 2);
reg.masked = false;
io_apic_write(IOREDTBL + pin*2, reg.lo);
io_apic_write(IOREDTBL + pin * 2, reg.lo);
}
}