Subversion Repositories HelenOS

Rev

Rev 2089 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2089 Rev 2101
Line 67... Line 67...
67
count_t madt_l_apic_entry_cnt = 0;
67
count_t madt_l_apic_entry_cnt = 0;
68
count_t madt_io_apic_entry_cnt = 0;
68
count_t madt_io_apic_entry_cnt = 0;
69
count_t cpu_count = 0;
69
count_t cpu_count = 0;
70
 
70
 
71
struct madt_apic_header * * madt_entries_index = NULL;
71
struct madt_apic_header * * madt_entries_index = NULL;
72
int madt_entries_index_cnt = 0;
72
unsigned int madt_entries_index_cnt = 0;
73
 
73
 
74
char *entry[] = {
74
char *entry[] = {
75
    "L_APIC",
75
    "L_APIC",
76
    "IO_APIC",
76
    "IO_APIC",
77
    "INTR_SRC_OVRD",
77
    "INTR_SRC_OVRD",
Line 88... Line 88...
88
 */
88
 */
89
static count_t madt_cpu_count(void);
89
static count_t madt_cpu_count(void);
90
static bool madt_cpu_enabled(index_t i);
90
static bool madt_cpu_enabled(index_t i);
91
static bool madt_cpu_bootstrap(index_t i);
91
static bool madt_cpu_bootstrap(index_t i);
92
static uint8_t madt_cpu_apic_id(index_t i);
92
static uint8_t madt_cpu_apic_id(index_t i);
93
static int madt_irq_to_pin(int irq);
93
static int madt_irq_to_pin(unsigned int irq);
94
 
94
 
95
struct smp_config_operations madt_config_operations = {
95
struct smp_config_operations madt_config_operations = {
96
    .cpu_count = madt_cpu_count,
96
    .cpu_count = madt_cpu_count,
97
    .cpu_enabled = madt_cpu_enabled,
97
    .cpu_enabled = madt_cpu_enabled,
98
    .cpu_bootstrap = madt_cpu_bootstrap,
98
    .cpu_bootstrap = madt_cpu_bootstrap,
Line 122... Line 122...
122
{
122
{
123
    ASSERT(i < madt_l_apic_entry_cnt);
123
    ASSERT(i < madt_l_apic_entry_cnt);
124
    return ((struct madt_l_apic *) madt_entries_index[madt_l_apic_entry_index + i])->apic_id;
124
    return ((struct madt_l_apic *) madt_entries_index[madt_l_apic_entry_index + i])->apic_id;
125
}
125
}
126
 
126
 
127
int madt_irq_to_pin(int irq)
127
int madt_irq_to_pin(unsigned int irq)
128
{
128
{
129
    ASSERT(irq < sizeof(isa_irq_map)/sizeof(int));
129
    ASSERT(irq < sizeof(isa_irq_map)/sizeof(int));
130
        return isa_irq_map[irq];
130
        return isa_irq_map[irq];
131
}
131
}
132
 
132
 
Line 163... Line 163...
163
 
163
 
164
    /* Quicksort MADT index structure */
164
    /* Quicksort MADT index structure */
165
    qsort(madt_entries_index, madt_entries_index_cnt, sizeof(uintptr_t), &madt_cmp);
165
    qsort(madt_entries_index, madt_entries_index_cnt, sizeof(uintptr_t), &madt_cmp);
166
 
166
 
167
    /* Parse MADT entries */   
167
    /* Parse MADT entries */
-
 
168
    if (madt_entries_index_cnt > 0) {  
168
    for (index = 0; index < madt_entries_index_cnt - 1; index++) {
169
        for (index = 0; index < madt_entries_index_cnt - 1; index++) {
169
        h = madt_entries_index[index];
170
            h = madt_entries_index[index];
170
        switch (h->type) {
171
            switch (h->type) {
171
            case MADT_L_APIC:
172
                case MADT_L_APIC:
172
                madt_l_apic_entry((struct madt_l_apic *) h, index);
173
                    madt_l_apic_entry((struct madt_l_apic *) h, index);
Line 193... Line 194...
193
                if (h->type >= MADT_RESERVED_OEM_BEGIN) {
194
                    if (h->type >= MADT_RESERVED_OEM_BEGIN) {
194
                    printf("MADT: skipping OEM entry (type=%zd)\n", h->type);
195
                        printf("MADT: skipping OEM entry (type=%zd)\n", h->type);
195
                }
196
                    }
196
                break;
197
                    break;
197
        }
198
            }
198
   
-
 
199
   
-
 
200
    }
199
        }
201
   
200
    }
202
 
201
 
203
    if (cpu_count)
202
    if (cpu_count)
204
        config.cpu_count = cpu_count;
203
        config.cpu_count = cpu_count;
205
}
204
}
206
 
205