]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/i386/apic.h
xnu-792.25.20.tar.gz
[apple/xnu.git] / osfmk / i386 / apic.h
index f18199a24b1c3358f9f28e33de8a1644f277f30d..40e558ca93502b10987056adb8b1efcd7d35ffc7 100644 (file)
@@ -3,22 +3,19 @@
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
- * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
+ * The contents of this file constitute Original Code as defined in and
+ * are subject to the Apple Public Source License Version 1.1 (the
+ * "License").  You may not use this file except in compliance with the
+ * License.  Please obtain a copy of the License at
+ * http://www.apple.com/publicsource and read it before using this file.
  * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * This Original Code and all software distributed under the License are
+ * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
+ * License for the specific language governing rights and limitations
+ * under the License.
  * 
  * @APPLE_LICENSE_HEADER_END@
  */
@@ -26,6 +23,8 @@
  * @OSF_COPYRIGHT@
  * 
  */
+#ifndef _I386_APIC_H_
+#define _I386_APIC_H_
 
 #define LAPIC_START                    0xFEE00000
 #define LAPIC_SIZE                     0x00000400
 #define LAPIC_ICRD                     0x00000310
 #define                LAPIC_ICRD_DEST_SHIFT   24
 #define LAPIC_LVT_TIMER                        0x00000320
+#define LAPIC_LVT_THERMAL              0x00000330
+#define LAPIC_LVT_PERFCNT              0x00000340
 #define LAPIC_LVT_LINT0                        0x00000350
 #define LAPIC_LVT_LINT1                        0x00000360
 #define LAPIC_LVT_ERROR                        0x00000370
-#define                LAPIC_LVT_VECTOR_MASK   0x0000F
+#define                LAPIC_LVT_VECTOR_MASK   0x000FF
 #define                LAPIC_LVT_DM_SHIFT      8
 #define                LAPIC_LVT_DM_MASK       0x00007
 #define                LAPIC_LVT_DM_FIXED      0x00000
 #define                LAPIC_LVT_TM_LEVEL      0x08000
 #define                LAPIC_LVT_MASKED        0x10000
 #define                LAPIC_LVT_PERIODIC      0x20000
-#define LAPIC_INITIAL_COUNT_TIMER      0x00000380
-#define LAPIC_CURRENT_COUNT_TIMER      0x00000390
+#define LAPIC_TIMER_INITIAL_COUNT      0x00000380
+#define LAPIC_TIMER_CURRENT_COUNT      0x00000390
 #define LAPIC_TIMER_DIVIDE_CONFIG      0x000003E0
+/* divisor encoded by bits 0,1,3 with bit 2 always 0: */
+#define        LAPIC_TIMER_DIVIDE_MASK 0x0000000F
+#define        LAPIC_TIMER_DIVIDE_2    0x00000000
+#define        LAPIC_TIMER_DIVIDE_4    0x00000001
+#define        LAPIC_TIMER_DIVIDE_8    0x00000002
+#define        LAPIC_TIMER_DIVIDE_16   0x00000003
+#define        LAPIC_TIMER_DIVIDE_32   0x00000008
+#define        LAPIC_TIMER_DIVIDE_64   0x00000009
+#define        LAPIC_TIMER_DIVIDE_128  0x0000000A
+#define        LAPIC_TIMER_DIVIDE_1    0x0000000B
+
+#ifndef        ASSEMBLER
+#include <stdint.h>
+typedef enum {
+       periodic,
+       one_shot
+} lapic_timer_mode_t;
+typedef enum { 
+       divide_by_1   = LAPIC_TIMER_DIVIDE_1,
+       divide_by_2   = LAPIC_TIMER_DIVIDE_2,
+       divide_by_4   = LAPIC_TIMER_DIVIDE_4,
+       divide_by_8   = LAPIC_TIMER_DIVIDE_8,
+       divide_by_16  = LAPIC_TIMER_DIVIDE_16,
+       divide_by_32  = LAPIC_TIMER_DIVIDE_32,
+       divide_by_64  = LAPIC_TIMER_DIVIDE_64,
+       divide_by_128 = LAPIC_TIMER_DIVIDE_128
+} lapic_timer_divide_t;
+typedef uint32_t lapic_timer_count_t;
+#endif /* ASSEMBLER */
 
 #define IOAPIC_START                   0xFEC00000
 #define        IOAPIC_SIZE                     0x00000020
 #define                IOA_R_R_IP_PLRITY_LOW   0x02000
 #define                IOA_R_R_TM_LEVEL        0x08000
 #define                IOA_R_R_MASKED          0x10000
+
+#endif /* _I386_APIC_H_ */
+