diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h new file mode 100644 index 00000000..3c8cc549 --- /dev/null +++ b/arch/x86/include/asm/apic.h @@ -0,0 +1,81 @@ +/* + * Copyright 2010 Stefan Lankes, Chair for Operating Systems, + * RWTH Aachen University + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * This file is part of MetalSVM. + */ + +#ifndef __ARCH_APIC_H__ +#define __ARCH_APIC_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* MP Floating Pointer Structure */ +typedef struct { + uint32_t signature; + uint32_t mp_config; + uint8_t length; + uint8_t version; + uint8_t checksum; + uint8_t features[5]; +} __attribute__ ((packed)) apic_mp_t; + +/* MP Configuration Table */ +typedef struct { + uint32_t signature; + uint16_t length; + uint8_t revision; + uint8_t checksum; + uint8_t oem_id[8]; + uint8_t product_id[12]; + uint32_t oem_table; + uint16_t oem_table_size; + uint16_t entry_count; + uint32_t lapic; + uint16_t extended_table_length; + uint8_t extended_table_checksum; +} __attribute__ ((packed)) apic_config_table_t; + +/* APIC Processor Entry */ +typedef struct { + uint8_t type; + uint8_t id; + uint8_t version; + uint8_t cpu; + uint32_t cpu_signature; + uint32_t cpu_feature; +} __attribute__ ((packed)) apic_processor_entry_t; + +/* IO APIC Entry */ +typedef struct { + uint8_t type; + uint8_t id; + uint8_t version; + uint8_t enabled; + uint32_t addr; +} __attribute__ ((packed)) apic_io_entry_t; + +int apic_init(void); +int has_apic(void); + +#ifdef __cplusplus +} +#endif + +#endif