ia64/xen-unstable

annotate tools/ioemu/hw/ioapic.h @ 6552:a9873d384da4

Merge.
author adsharma@los-vmm.sc.intel.com
date Thu Aug 25 12:24:48 2005 -0700 (2005-08-25)
parents 112d44270733 4669354bba9a
children dfaf788ab18c
rev   line source
arun@5615 1 /////////////////////////////////////////////////////////////////////////
arun@5615 2 //
arun@5615 3 // Copyright (C) 2001 MandrakeSoft S.A.
arun@5615 4 //
arun@5615 5 // MandrakeSoft S.A.
arun@5615 6 // 43, rue d'Aboukir
arun@5615 7 // 75002 Paris - France
arun@5615 8 // http://www.linux-mandrake.com/
arun@5615 9 // http://www.mandrakesoft.com/
arun@5615 10 //
arun@5615 11 // This library is free software; you can redistribute it and/or
arun@5615 12 // modify it under the terms of the GNU Lesser General Public
arun@5615 13 // License as published by the Free Software Foundation; either
arun@5615 14 // version 2 of the License, or (at your option) any later version.
arun@5615 15 //
arun@5615 16 // This library is distributed in the hope that it will be useful,
arun@5615 17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
arun@5615 18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
arun@5615 19 // Lesser General Public License for more details.
arun@5615 20 //
arun@5615 21 // You should have received a copy of the GNU Lesser General Public
arun@5615 22 // License along with this library; if not, write to the Free Software
arun@5615 23 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
arun@5615 24 //
arun@5615 25
arun@5615 26 #ifndef __IOAPIC_H
arun@5615 27 #define __IOAPIC_H
arun@5615 28
cl349@6403 29 #include "xenctrl.h"
arun@5615 30 #include <io/ioreq.h>
arun@5615 31 #include <io/vmx_vlapic.h>
arun@5615 32
arun@5615 33 #define IOAPIC_NUM_PINS 24
arun@5615 34 #define IOAPIC_VERSION_ID 0x11
arun@5615 35 #define IOAPIC_LEVEL_TRIGGER 1
arun@5615 36 #define APIC_DM_FIXED 0
arun@5615 37 #define APIC_DM_LOWPRI 1
arun@5615 38
arun@5615 39
arun@5615 40
arun@5615 41 #ifdef CONFIG_SMP
arun@5615 42 #define LOCK_PREFIX "lock ; "
arun@5615 43 #else
arun@5615 44 #define LOCK_PREFIX ""
arun@5615 45 #endif
arun@5615 46
arun@5615 47 #ifdef __I386__
arun@5615 48 #define __OS "q"
arun@5615 49 #define __OP "r"
arun@5615 50 #else
arun@5615 51 #define __OS "l" /* Operation Suffix */
arun@5615 52 #define __OP "e" /* Operand Prefix */
arun@5615 53 #endif
arun@5615 54
arun@5615 55 #define ADDR (*(volatile long *) addr)
arun@5615 56 #if 0
arun@5615 57 #endif
arun@5615 58 extern void *shared_page;
arun@5615 59 extern FILE *logfile;
arun@5615 60 #ifdef __BIGENDIAN__
arun@5615 61 typedef union RedirStatus
arun@5615 62 {
arun@5615 63 uint64_t value;
arun@5615 64 struct {
arun@5615 65 uint8_t dest_id;
arun@5615 66 uint8_t reserved[4];
arun@5615 67 uint8_t reserve:7;
arun@5615 68 uint8_t mask:1; /* interrupt mask*/
arun@5615 69 uint8_t trigmod:1;
arun@5615 70 uint8_t remoteirr:1;
arun@5615 71 uint8_t polarity:1;
arun@5615 72 uint8_t delivestatus:1;
arun@5615 73 uint8_t destmode:1;
arun@5615 74 uint8_t deliver_mode:3;
arun@5615 75 uint8_t vector;
arun@5615 76 }RedirForm;
arun@5615 77 }RedirStatus;
arun@5615 78 #else
arun@5615 79 typedef union RedirStatus
arun@5615 80 {
arun@5615 81 uint64_t value;
arun@5615 82 struct {
arun@5615 83 uint8_t vector;
arun@5615 84 uint8_t deliver_mode:3;
arun@5615 85 uint8_t destmode:1;
arun@5615 86 uint8_t delivestatus:1;
arun@5615 87 uint8_t polarity:1;
arun@5615 88 uint8_t remoteirr:1;
arun@5615 89 uint8_t trigmod:1;
arun@5615 90 uint8_t mask:1; /* interrupt mask*/
arun@5615 91 uint8_t reserve:7;
arun@5615 92 uint8_t reserved[4];
arun@5615 93 uint8_t dest_id;
arun@5615 94 }RedirForm;
arun@5615 95 }RedirStatus;
arun@5615 96 #endif
arun@5615 97 /*
arun@5615 98 * IOAPICState stands for a instance of a IOAPIC
arun@5615 99 */
arun@5615 100
arun@5615 101 /* FIXME tmp before working with Local APIC */
arun@5615 102 #define IOAPIC_MEM_LENGTH 0x100
arun@5615 103 #define IOAPIC_ENABLE_MASK 0x0
arun@5615 104 #define IOAPIC_ENABLE_FLAG (1 << IOAPIC_ENABLE_MASK)
arun@5615 105 #define MAX_LAPIC_NUM 32
arun@5615 106
arun@5615 107 struct IOAPICState{
arun@5615 108 uint32_t INTR;
arun@5615 109 uint32_t id;
arun@5615 110 uint32_t arb_id;
arun@5615 111 uint32_t flags;
arun@5615 112 unsigned long base_address;
arun@5615 113 uint32_t irr;
arun@5615 114 uint32_t isr; /* This is used for level trigger */
arun@5615 115 uint8_t vector_irr[256];
arun@5615 116 RedirStatus redirtbl[IOAPIC_NUM_PINS];
arun@5615 117 uint32_t ioregsel;
arun@5615 118 uint32_t lapic_count;
arun@5615 119 vlapic_info *lapic_info[MAX_LAPIC_NUM];
arun@5615 120 };
arun@5615 121 #define IOAPIC_REG_APIC_ID 0x0
arun@5615 122 #define IOAPIC_REG_VERSION 0x1
arun@5615 123 #define IOAPIC_REG_ARB_ID 0x2
arun@5615 124 #define IOAPICEnabled(s) (s->flags & IOAPIC_ENABLE_FLAG)
arun@5615 125
arun@5615 126 typedef struct IOAPICState IOAPICState;
arun@5615 127
arun@5615 128 #endif