Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * mp.h
- * MultiProcessor Specification
- */
- #ifndef __MP_H
- #define __MP_H
- #include <os/system.h>
- #include <types.h>
- #define MP_FPS_SIGNATURE "_MP_"
- #define MP_FPS_SIGNATURE_LENGTH 4
- #define MP_FPS_PARAGRAPHS 1
- #define FpsLengthToParagraphs(x) ((x) >> 4)
- #define FpsParagraphToLength(x) ((x) << 4)
- enum {
- MP_SPEC_REV_0,
- MP_SPEC_REV_1,
- MP_SPEC_REV_2,
- MP_SPEC_REV_3,
- MP_SPEC_REV_4
- };
- #define MP_SUPPORTED_REVISION MP_SPEC_REV_4
- #define MP_CT_SIGNATURE "PCMP"
- #define MP_CT_SIGNATURE_LENGTH 4
- #define MP_FPS_INFO_A_CT_PRESENT 0
- #define MP_FPS_INFO_A_MP_PRESENT 1
- enum {
- MP_ET_PROCESSOR, // Processor
- MP_ET_BUS, // Bus
- MP_ET_IOAPIC, // IO/APIC
- MP_ET_IOIA, // IO/Interrupt Assignment
- MP_ET_LIA, // IO/Local Interrupt Assignment
- EP_ET_COUNT
- };
- #define MP_CPU_FLAG_UNUSABLE 0x01 // Unusable core, do not attempt to initialize
- #define MP_CPU_FLAG_BOOTSTRAP 0x02 // Bootstrap core
- #define MP_IOAPIC_FLAG_UNUSABLE 0x01 // Unusable IOAPIC
- typedef struct _FloatingPointerStructure {
- char signature[4];
- uint32 configurationTable; // This is a pointer
- uint8 length;
- uint8 specRev;
- uint8 checksum;
- uint8 infoA;
- uint8 infoB;
- uint8 infoC; // Reserved
- uint8 infoD; // Reserved
- uint8 infoE; // Reserved
- } PACKED FloatingPointerStructure;
- typedef struct _MPConfigurationTable {
- char signature[4];
- uint16 baseTableLength;
- uint8 specRev;
- uint8 checksum;
- char oemId[8];
- char productId[12];
- uint32 oemTable; // This is a pointer
- uint16 oemTableSize;
- uint16 entryCount;
- uint32 lapicAddress;
- uint16 extendedTableLength;
- uint8 extendedTableChecksum;
- uint8 reserved;
- } PACKED MPConfigurationTable;
- typedef struct _MPProcessorEntry {
- uint8 type;
- uint8 lapicId;
- uint8 lapicVersion;
- uint8 cpuFlags;
- uint32 cpuSignature;
- uint32 featureFlags; // CPUID of this core
- uint32 reserved1;
- uint32 reserved2;
- } PACKED MPProcessorEntry;
- typedef struct _MPBusEntry {
- uint8 type;
- uint8 id;
- char busType[6];
- } PACKED MPBusEntry;
- typedef struct _MPIOAPICEntry {
- uint8 type;
- uint8 id;
- uint8 version;
- uint8 flags;
- uint32 address;
- } PACKED MPIOAPICEntry;
- typedef struct _MPIOIAEntry {
- uint8 type;
- uint8 interruptType;
- uint16 flags;
- uint8 sourceBusId;
- uint8 sourceBusIrq;
- uint8 destIOAPICId;
- uint8 destIOAPICINTIN;
- } PACKED MPIOIAEntry;
- typedef struct _MPLIAEntry {
- uint8 type;
- uint8 interruptType;
- uint16 flags;
- uint8 sourceBusId;
- uint8 sourceBusIrq;
- uint8 destLAPICId;
- uint8 destLAPICINTIN;
- } MPLIAEntry;
- typedef union _MPEntry {
- uint8 type;
- MPProcessorEntry processor;
- MPBusEntry bus;
- MPIOAPICEntry ioapic;
- MPIOIAEntry ioia;
- MPLIAEntry lia;
- } PACKED MPEntry;
- MPConfigurationTable* MpGetConfigurationTable(void);
- paddr MpGetLocalAPICAddress(MPConfigurationTable* mpct);
- uint16 MpGetEntryCount(MPConfigurationTable* mpct);
- MPEntry* MpGetEntry(MPConfigurationTable* mpct, uint16 index);
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement