Author: attilio
Date: Thu Feb 25 14:13:39 2010
New Revision: 204309
URL: http://svn.freebsd.org/changeset/base/204309

Log:
  Introduce the new kernel sub-tree x86 which should contain all the code
  shared and generalized between our current amd64, i386 and pc98.
  
  This is just an initial step that should lead to a more complete effort.
  For the moment, a very simple porting of cpufreq modules, BIOS calls and
  the whole MD specific ISA bus part is added to the sub-tree but ideally
  a lot of code might be added and more shared support should grow.
  
  Sponsored by: Sandvine Incorporated
  Reviewed by:  emaste, kib, jhb, imp
  Discussed on: arch
  MFC:          3 weeks

Added:
  head/sys/amd64/amd64/atpic_vector.S
     - copied unchanged from r203846, head/sys/amd64/isa/atpic_vector.S
  head/sys/i386/i386/atpic_vector.s
     - copied unchanged from r203846, head/sys/i386/isa/atpic_vector.s
  head/sys/x86/
  head/sys/x86/bios/
     - copied from r203846, head/sys/i386/bios/
  head/sys/x86/cpufreq/
     - copied from r203846, head/sys/i386/cpufreq/
  head/sys/x86/isa/
  head/sys/x86/isa/atpic.c
     - copied, changed from r203846, head/sys/i386/isa/atpic.c
  head/sys/x86/isa/atrtc.c
     - copied unchanged from r203846, head/sys/isa/atrtc.c
  head/sys/x86/isa/clock.c
     - copied, changed from r203846, head/sys/i386/isa/clock.c
  head/sys/x86/isa/elcr.c
     - copied unchanged from r203846, head/sys/i386/isa/elcr.c
  head/sys/x86/isa/icu.h
     - copied, changed from r203846, head/sys/i386/isa/icu.h
  head/sys/x86/isa/isa.c
     - copied, changed from r203846, head/sys/i386/isa/isa.c
  head/sys/x86/isa/isa.h
     - copied, changed from r203846, head/sys/i386/isa/isa.h
  head/sys/x86/isa/isa_dma.c
     - copied, changed from r203846, head/sys/i386/isa/isa_dma.c
  head/sys/x86/isa/nmi.c
     - copied unchanged from r203846, head/sys/i386/isa/nmi.c
  head/sys/x86/isa/orm.c
     - copied unchanged from r203846, head/sys/isa/orm.c
Deleted:
  head/sys/amd64/isa/
  head/sys/i386/bios/smbios.c
  head/sys/i386/bios/vpd.c
  head/sys/i386/cpufreq/
  head/sys/i386/isa/atpic.c
  head/sys/i386/isa/atpic_vector.s
  head/sys/i386/isa/clock.c
  head/sys/i386/isa/elcr.c
  head/sys/i386/isa/icu.h
  head/sys/i386/isa/isa.c
  head/sys/i386/isa/isa.h
  head/sys/i386/isa/isa_dma.c
  head/sys/i386/isa/nmi.c
  head/sys/isa/atrtc.c
  head/sys/isa/orm.c
  head/sys/x86/bios/apm.c
  head/sys/x86/bios/apm.h
  head/sys/x86/bios/mca_machdep.c
  head/sys/x86/bios/mca_machdep.h
  head/sys/x86/bios/smapi.c
  head/sys/x86/bios/smapi_bios.S
Modified:
  head/sys/amd64/amd64/exception.S
  head/sys/amd64/amd64/identcpu.c
  head/sys/amd64/amd64/intr_machdep.c
  head/sys/amd64/amd64/machdep.c
  head/sys/amd64/amd64/nexus.c
  head/sys/amd64/amd64/vm_machdep.c
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/conf/files.pc98
  head/sys/i386/i386/exception.s
  head/sys/i386/i386/machdep.c
  head/sys/i386/i386/nexus.c
  head/sys/i386/i386/vm_machdep.c
  head/sys/i386/xen/clock.c
  head/sys/modules/bios/smbios/Makefile
  head/sys/modules/bios/vpd/Makefile
  head/sys/modules/cpufreq/Makefile
  head/sys/pc98/pc98/machdep.c

Copied: head/sys/amd64/amd64/atpic_vector.S (from r203846, 
head/sys/amd64/isa/atpic_vector.S)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/amd64/amd64/atpic_vector.S Thu Feb 25 14:13:39 2010        
(r204309, copy of r203846, head/sys/amd64/isa/atpic_vector.S)
@@ -0,0 +1,73 @@
+/*-
+ * Copyright (c) 1989, 1990 William F. Jolitz.
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     from: vector.s, 386BSD 0.1 unknown origin
+ * $FreeBSD$
+ */
+
+/*
+ * Interrupt entry points for external interrupts triggered by the 8259A
+ * master and slave interrupt controllers.
+ */
+
+#include <machine/asmacros.h>
+
+#include "assym.s"
+
+/*
+ * Macros for interrupt entry, call to handler, and exit.
+ */
+#define        INTR(irq_num, vec_name) \
+       .text ;                                                         \
+       SUPERALIGN_TEXT ;                                               \
+IDTVEC(vec_name) ;                                                     \
+       PUSH_FRAME ;                                                    \
+       FAKE_MCOUNT(TF_RIP(%rsp)) ;                                     \
+       movq    %rsp, %rsi      ;                                       \
+       movl    $irq_num, %edi;         /* pass the IRQ */              \
+       call    atpic_handle_intr ;                                     \
+       MEXITCOUNT ;                                                    \
+       jmp     doreti
+
+       INTR(0, atpic_intr0)
+       INTR(1, atpic_intr1)
+       INTR(2, atpic_intr2)
+       INTR(3, atpic_intr3)
+       INTR(4, atpic_intr4)
+       INTR(5, atpic_intr5)
+       INTR(6, atpic_intr6)
+       INTR(7, atpic_intr7)
+       INTR(8, atpic_intr8)
+       INTR(9, atpic_intr9)
+       INTR(10, atpic_intr10)
+       INTR(11, atpic_intr11)
+       INTR(12, atpic_intr12)
+       INTR(13, atpic_intr13)
+       INTR(14, atpic_intr14)
+       INTR(15, atpic_intr15)

Modified: head/sys/amd64/amd64/exception.S
==============================================================================
--- head/sys/amd64/amd64/exception.S    Thu Feb 25 13:53:09 2010        
(r204308)
+++ head/sys/amd64/amd64/exception.S    Thu Feb 25 14:13:39 2010        
(r204309)
@@ -595,7 +595,7 @@ MCOUNT_LABEL(bintr)
        .text
        SUPERALIGN_TEXT
 
-#include <amd64/isa/atpic_vector.S>
+#include <amd64/amd64/atpic_vector.S>
 #endif
 
        .text

Modified: head/sys/amd64/amd64/identcpu.c
==============================================================================
--- head/sys/amd64/amd64/identcpu.c     Thu Feb 25 13:53:09 2010        
(r204308)
+++ head/sys/amd64/amd64/identcpu.c     Thu Feb 25 14:13:39 2010        
(r204309)
@@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$");
 #include <machine/specialreg.h>
 #include <machine/md_var.h>
 
-#include <amd64/isa/icu.h>
+#include <x86/isa/icu.h>
 
 /* XXX - should be in header file: */
 void printcpuinfo(void);

Modified: head/sys/amd64/amd64/intr_machdep.c
==============================================================================
--- head/sys/amd64/amd64/intr_machdep.c Thu Feb 25 13:53:09 2010        
(r204308)
+++ head/sys/amd64/amd64/intr_machdep.c Thu Feb 25 14:13:39 2010        
(r204309)
@@ -62,8 +62,8 @@
 #include <machine/segments.h>
 #include <machine/frame.h>
 #include <dev/ic/i8259.h>
-#include <amd64/isa/icu.h>
-#include <amd64/isa/isa.h>
+#include <x86/isa/icu.h>
+#include <x86/isa/isa.h>
 #endif
 
 #define        MAX_STRAY_LOG   5

Modified: head/sys/amd64/amd64/machdep.c
==============================================================================
--- head/sys/amd64/amd64/machdep.c      Thu Feb 25 13:53:09 2010        
(r204308)
+++ head/sys/amd64/amd64/machdep.c      Thu Feb 25 14:13:39 2010        
(r204309)
@@ -128,7 +128,7 @@ __FBSDID("$FreeBSD$");
 #endif
 
 #ifdef DEV_ATPIC
-#include <amd64/isa/icu.h>
+#include <x86/isa/icu.h>
 #else
 #include <machine/apicvar.h>
 #endif

Modified: head/sys/amd64/amd64/nexus.c
==============================================================================
--- head/sys/amd64/amd64/nexus.c        Thu Feb 25 13:53:09 2010        
(r204308)
+++ head/sys/amd64/amd64/nexus.c        Thu Feb 25 14:13:39 2010        
(r204309)
@@ -69,7 +69,7 @@ __FBSDID("$FreeBSD$");
 
 #ifdef DEV_ISA
 #include <isa/isavar.h>
-#include <amd64/isa/isa.h>
+#include <x86/isa/isa.h>
 #endif
 #include <sys/rtprio.h>
 

Modified: head/sys/amd64/amd64/vm_machdep.c
==============================================================================
--- head/sys/amd64/amd64/vm_machdep.c   Thu Feb 25 13:53:09 2010        
(r204308)
+++ head/sys/amd64/amd64/vm_machdep.c   Thu Feb 25 14:13:39 2010        
(r204309)
@@ -80,7 +80,7 @@ __FBSDID("$FreeBSD$");
 #include <vm/vm_map.h>
 #include <vm/vm_param.h>
 
-#include <amd64/isa/isa.h>
+#include <x86/isa/isa.h>
 
 static void    cpu_reset_real(void);
 #ifdef SMP

Modified: head/sys/conf/files.amd64
==============================================================================
--- head/sys/conf/files.amd64   Thu Feb 25 13:53:09 2010        (r204308)
+++ head/sys/conf/files.amd64   Thu Feb 25 14:13:39 2010        (r204309)
@@ -131,13 +131,6 @@ amd64/amd64/tsc.c          standard
 amd64/amd64/uio_machdep.c      standard
 amd64/amd64/uma_machdep.c      standard
 amd64/amd64/vm_machdep.c       standard
-amd64/isa/atpic.c              optional        atpic isa
-#amd64/isa/atpic_vector.S      optional        atpic isa
-amd64/isa/clock.c              standard
-amd64/isa/elcr.c               standard
-amd64/isa/isa.c                        standard
-amd64/isa/isa_dma.c            standard
-amd64/isa/nmi.c                        standard
 amd64/pci/pci_bus.c            optional        pci
 amd64/pci/pci_cfgreg.c         optional        pci
 crypto/blowfish/bf_enc.c       optional        crypto | ipsec 
@@ -228,8 +221,6 @@ dev/syscons/scvgarndr.c             optional        sc vga
 dev/syscons/scvtb.c            optional        sc
 dev/uart/uart_cpu_amd64.c      optional        uart
 dev/wpi/if_wpi.c               optional        wpi
-isa/atrtc.c                    standard
-isa/orm.c                      optional        isa
 isa/syscons_isa.c              optional        sc
 isa/vga_isa.c                  optional        vga
 kern/link_elf_obj.c            standard
@@ -289,12 +280,6 @@ compat/ndis/subr_ntoskrnl.c        optional        ndi
 compat/ndis/subr_pe.c          optional        ndisapi pci
 compat/ndis/subr_usbd.c                optional        ndisapi pci
 compat/ndis/winx64_wrap.S      optional        ndisapi pci
-i386/bios/smbios.c             optional        smbios
-i386/bios/vpd.c                        optional        vpd
-i386/cpufreq/powernow.c                optional        cpufreq
-i386/cpufreq/est.c             optional        cpufreq
-i386/cpufreq/hwpstate.c                optional        cpufreq
-i386/cpufreq/p4tcc.c           optional        cpufreq
 #
 libkern/memmove.c              standard
 libkern/memset.c               standard
@@ -303,3 +288,20 @@ libkern/memset.c           standard
 #
 compat/x86bios/x86bios.c       optional x86bios | atkbd | dpms | vesa
 contrib/x86emu/x86emu.c                optional x86bios | atkbd | dpms | vesa
+#
+# x86 shared code between IA32, AMD64 and PC98 architectures
+#
+x86/bios/smbios.c              optional        smbios
+x86/bios/vpd.c                 optional        vpd
+x86/cpufreq/powernow.c         optional        cpufreq
+x86/cpufreq/est.c              optional        cpufreq
+x86/cpufreq/hwpstate.c         optional        cpufreq
+x86/cpufreq/p4tcc.c            optional        cpufreq
+x86/isa/atpic.c                        optional        atpic isa
+x86/isa/atrtc.c                        optional        atpic
+x86/isa/clock.c                        standard
+x86/isa/elcr.c                 standard
+x86/isa/isa.c                  standard
+x86/isa/isa_dma.c              standard
+x86/isa/nmi.c                  standard
+x86/isa/orm.c                  optional        isa

Modified: head/sys/conf/files.i386
==============================================================================
--- head/sys/conf/files.i386    Thu Feb 25 13:53:09 2010        (r204308)
+++ head/sys/conf/files.i386    Thu Feb 25 14:13:39 2010        (r204309)
@@ -244,13 +244,6 @@ i386/bios/apm.c                    optional apm
 i386/bios/mca_machdep.c                optional mca
 i386/bios/smapi.c              optional smapi
 i386/bios/smapi_bios.S         optional smapi
-i386/bios/smbios.c             optional smbios
-i386/bios/vpd.c                        optional vpd
-i386/cpufreq/est.c             optional cpufreq
-i386/cpufreq/hwpstate.c                optional cpufreq
-i386/cpufreq/p4tcc.c           optional cpufreq
-i386/cpufreq/powernow.c                optional cpufreq
-i386/cpufreq/smist.c           optional cpufreq
 #i386/i386/apic_vector.s               optional apic
 i386/i386/atomic.c             standard                \
        compile-with    "${CC} -c ${CFLAGS} 
${DEFINED_PROF:S/^$/-fomit-frame-pointer/} ${.IMPSRC}"
@@ -329,17 +322,10 @@ i386/ibcs2/ibcs2_util.c           optional ibcs2
 i386/ibcs2/ibcs2_xenix.c       optional ibcs2
 i386/ibcs2/ibcs2_xenix_sysent.c        optional ibcs2
 i386/ibcs2/imgact_coff.c       optional ibcs2
-i386/isa/atpic.c               optional atpic  
-#i386/isa/atpic_vector.s               standard
-i386/isa/clock.c               optional native
 i386/xen/clock.c               optional xen
 i386/xen/xen_clock_util.c      optional xen
 i386/xen/xen_rtc.c             optional xen
-i386/isa/elcr.c                        standard
 i386/isa/elink.c               optional ep | ie
-i386/isa/isa.c                 optional isa
-i386/isa/isa_dma.c             optional isa
-i386/isa/nmi.c                 standard
 i386/isa/npx.c                 optional npx
 i386/isa/pmtimer.c             optional pmtimer
 i386/isa/prof_machdep.c                optional profiling-routine
@@ -362,8 +348,6 @@ i386/svr4/svr4_locore.s             optional compat
        warning "COMPAT_SVR4 is broken and should be avoided"
 i386/svr4/svr4_machdep.c       optional compat_svr4
 #
-isa/atrtc.c                    optional atpic
-isa/orm.c                      optional isa
 isa/syscons_isa.c              optional sc
 isa/vga_isa.c                  optional vga
 kern/imgact_aout.c             optional compat_aout
@@ -387,3 +371,21 @@ i386/xbox/pic16l.s         optional xbox
 #
 compat/x86bios/x86bios.c       optional x86bios | atkbd | dpms | vesa
 contrib/x86emu/x86emu.c                optional x86bios | atkbd | dpms | vesa
+#
+# x86 shared code between IA32, AMD64 and PC98 architectures
+#
+x86/bios/smbios.c              optional smbios
+x86/bios/vpd.c                 optional vpd
+x86/cpufreq/est.c              optional cpufreq
+x86/cpufreq/hwpstate.c         optional cpufreq
+x86/cpufreq/p4tcc.c            optional cpufreq
+x86/cpufreq/powernow.c         optional cpufreq
+x86/cpufreq/smist.c            optional cpufreq
+x86/isa/atpic.c                        optional atpic  
+x86/isa/atrtc.c                        optional atpic
+x86/isa/clock.c                        optional native
+x86/isa/elcr.c                 standard
+x86/isa/isa.c                  optional isa
+x86/isa/isa_dma.c              optional isa
+x86/isa/nmi.c                  standard
+x86/isa/orm.c                  optional isa

Modified: head/sys/conf/files.pc98
==============================================================================
--- head/sys/conf/files.pc98    Thu Feb 25 13:53:09 2010        (r204308)
+++ head/sys/conf/files.pc98    Thu Feb 25 14:13:39 2010        (r204309)
@@ -195,7 +195,6 @@ i386/ibcs2/ibcs2_xenix.c    optional ibcs2
 i386/ibcs2/ibcs2_xenix_sysent.c        optional ibcs2
 i386/ibcs2/imgact_coff.c       optional ibcs2
 i386/isa/atpic.c               optional atpic  
-#i386/isa/atpic_vector.s               standard
 i386/isa/elink.c               optional ep | ie
 i386/isa/isa.c                 optional isa
 i386/isa/npx.c                 optional npx

Copied: head/sys/i386/i386/atpic_vector.s (from r203846, 
head/sys/i386/isa/atpic_vector.s)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/i386/i386/atpic_vector.s   Thu Feb 25 14:13:39 2010        
(r204309, copy of r203846, head/sys/i386/isa/atpic_vector.s)
@@ -0,0 +1,77 @@
+/*-
+ * Copyright (c) 1989, 1990 William F. Jolitz.
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     from: vector.s, 386BSD 0.1 unknown origin
+ * $FreeBSD$
+ */
+
+/*
+ * Interrupt entry points for external interrupts triggered by the 8259A
+ * master and slave interrupt controllers.
+ */
+
+#include <machine/asmacros.h>
+
+#include "assym.s"
+
+/*
+ * Macros for interrupt entry, call to handler, and exit.
+ */
+#define        INTR(irq_num, vec_name) \
+       .text ;                                                         \
+       SUPERALIGN_TEXT ;                                               \
+IDTVEC(vec_name) ;                                                     \
+       PUSH_FRAME ;                                                    \
+       SET_KERNEL_SREGS ;                                              \
+;                                                                      \
+       FAKE_MCOUNT(TF_EIP(%esp)) ;                                     \
+       pushl   %esp            ;                                       \
+       pushl   $irq_num;       /* pass the IRQ */                      \
+       call    atpic_handle_intr ;                                     \
+       addl    $8, %esp ;      /* discard the parameters */            \
+;                                                                      \
+       MEXITCOUNT ;                                                    \
+       jmp     doreti
+
+       INTR(0, atpic_intr0)
+       INTR(1, atpic_intr1)
+       INTR(2, atpic_intr2)
+       INTR(3, atpic_intr3)
+       INTR(4, atpic_intr4)
+       INTR(5, atpic_intr5)
+       INTR(6, atpic_intr6)
+       INTR(7, atpic_intr7)
+       INTR(8, atpic_intr8)
+       INTR(9, atpic_intr9)
+       INTR(10, atpic_intr10)
+       INTR(11, atpic_intr11)
+       INTR(12, atpic_intr12)
+       INTR(13, atpic_intr13)
+       INTR(14, atpic_intr14)
+       INTR(15, atpic_intr15)

Modified: head/sys/i386/i386/exception.s
==============================================================================
--- head/sys/i386/i386/exception.s      Thu Feb 25 13:53:09 2010        
(r204308)
+++ head/sys/i386/i386/exception.s      Thu Feb 25 14:13:39 2010        
(r204309)
@@ -294,7 +294,7 @@ ENTRY(fork_trampoline)
        SUPERALIGN_TEXT
 MCOUNT_LABEL(bintr)
 
-#include <i386/isa/atpic_vector.s>
+#include <i386/i386/atpic_vector.s>
 
 #ifdef DEV_APIC
        .data

Modified: head/sys/i386/i386/machdep.c
==============================================================================
--- head/sys/i386/i386/machdep.c        Thu Feb 25 13:53:09 2010        
(r204308)
+++ head/sys/i386/i386/machdep.c        Thu Feb 25 14:13:39 2010        
(r204309)
@@ -132,7 +132,7 @@ __FBSDID("$FreeBSD$");
 #endif
 
 #ifdef DEV_ISA
-#include <i386/isa/icu.h>
+#include <x86/isa/icu.h>
 #endif
 
 #ifdef XBOX

Modified: head/sys/i386/i386/nexus.c
==============================================================================
--- head/sys/i386/i386/nexus.c  Thu Feb 25 13:53:09 2010        (r204308)
+++ head/sys/i386/i386/nexus.c  Thu Feb 25 14:13:39 2010        (r204309)
@@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$");
 #ifdef PC98
 #include <pc98/cbus/cbus.h>
 #else
-#include <i386/isa/isa.h>
+#include <x86/isa/isa.h>
 #endif
 #endif
 #include <sys/rtprio.h>

Modified: head/sys/i386/i386/vm_machdep.c
==============================================================================
--- head/sys/i386/i386/vm_machdep.c     Thu Feb 25 13:53:09 2010        
(r204308)
+++ head/sys/i386/i386/vm_machdep.c     Thu Feb 25 14:13:39 2010        
(r204309)
@@ -95,7 +95,7 @@ __FBSDID("$FreeBSD$");
 #ifdef PC98
 #include <pc98/cbus/cbus.h>
 #else
-#include <i386/isa/isa.h>
+#include <x86/isa/isa.h>
 #endif
 
 #ifdef XBOX

Modified: head/sys/i386/xen/clock.c
==============================================================================
--- head/sys/i386/xen/clock.c   Thu Feb 25 13:53:09 2010        (r204308)
+++ head/sys/i386/xen/clock.c   Thu Feb 25 14:13:39 2010        (r204309)
@@ -74,8 +74,8 @@ __FBSDID("$FreeBSD$");
 #include <machine/specialreg.h>
 #include <machine/timerreg.h>
 
-#include <i386/isa/icu.h>
-#include <i386/isa/isa.h>
+#include <x86/isa/icu.h>
+#include <x86/isa/isa.h>
 #include <isa/rtc.h>
 
 #include <xen/xen_intr.h>

Modified: head/sys/modules/bios/smbios/Makefile
==============================================================================
--- head/sys/modules/bios/smbios/Makefile       Thu Feb 25 13:53:09 2010        
(r204308)
+++ head/sys/modules/bios/smbios/Makefile       Thu Feb 25 14:13:39 2010        
(r204309)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 #
 
-.PATH:  ${.CURDIR}/../../../i386/bios
+.PATH:  ${.CURDIR}/../../../x86/bios
 
 KMOD=  smbios
 SRCS=  smbios.c \

Modified: head/sys/modules/bios/vpd/Makefile
==============================================================================
--- head/sys/modules/bios/vpd/Makefile  Thu Feb 25 13:53:09 2010        
(r204308)
+++ head/sys/modules/bios/vpd/Makefile  Thu Feb 25 14:13:39 2010        
(r204309)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 #
 
-.PATH:  ${.CURDIR}/../../../i386/bios
+.PATH:  ${.CURDIR}/../../../x86/bios
 
 KMOD=  vpd
 SRCS=  vpd.c \

Modified: head/sys/modules/cpufreq/Makefile
==============================================================================
--- head/sys/modules/cpufreq/Makefile   Thu Feb 25 13:53:09 2010        
(r204308)
+++ head/sys/modules/cpufreq/Makefile   Thu Feb 25 14:13:39 2010        
(r204309)
@@ -8,7 +8,7 @@ SRCS=   ichss.c
 SRCS+= bus_if.h cpufreq_if.h device_if.h pci_if.h
 
 .if ${MACHINE} == "i386" || ${MACHINE} == "amd64"
-.PATH: ${.CURDIR}/../../i386/cpufreq
+.PATH: ${.CURDIR}/../../x86/cpufreq
 
 SRCS+= acpi_if.h opt_acpi.h
 SRCS+= est.c hwpstate.c p4tcc.c powernow.c

Modified: head/sys/pc98/pc98/machdep.c
==============================================================================
--- head/sys/pc98/pc98/machdep.c        Thu Feb 25 13:53:09 2010        
(r204308)
+++ head/sys/pc98/pc98/machdep.c        Thu Feb 25 14:13:39 2010        
(r204309)
@@ -129,7 +129,7 @@ __FBSDID("$FreeBSD$");
 #endif
 
 #ifdef DEV_ISA
-#include <i386/isa/icu.h>
+#include <x86/isa/icu.h>
 #endif
 
 /* Sanity check for __curthread() */

Copied and modified: head/sys/x86/isa/atpic.c (from r203846, 
head/sys/i386/isa/atpic.c)
==============================================================================
--- head/sys/i386/isa/atpic.c   Sat Feb 13 19:17:06 2010        (r203846, copy 
source)
+++ head/sys/x86/isa/atpic.c    Thu Feb 25 14:13:39 2010        (r204309)
@@ -53,14 +53,22 @@ __FBSDID("$FreeBSD$");
 #include <machine/segments.h>
 
 #include <dev/ic/i8259.h>
-#include <i386/isa/icu.h>
+#include <x86/isa/icu.h>
 #ifdef PC98
 #include <pc98/cbus/cbus.h>
 #else
-#include <i386/isa/isa.h>
+#include <x86/isa/isa.h>
 #endif
 #include <isa/isavar.h>
 
+#ifdef __amd64__
+#define        SDT_ATPIC       SDT_SYSIGT
+#define        GSEL_ATPIC      0
+#else
+#define        SDT_ATPIC       SDT_SYS386IGT
+#define        GSEL_ATPIC      GSEL(GCODE_SEL, SEL_KPL)
+#endif
+
 #define        MASTER  0
 #define        SLAVE   1
 
@@ -468,8 +476,7 @@ atpic_startup(void)
                ai->at_intsrc.is_count = &ai->at_count;
                ai->at_intsrc.is_straycount = &ai->at_straycount;
                setidt(((struct atpic *)ai->at_intsrc.is_pic)->at_intbase +
-                   ai->at_irq, ai->at_intr, SDT_SYS386IGT, SEL_KPL,
-                   GSEL(GCODE_SEL, SEL_KPL));
+                   ai->at_irq, ai->at_intr, SDT_ATPIC, SEL_KPL, GSEL_ATPIC);
        }
 
 #ifdef DEV_MCA

Copied: head/sys/x86/isa/atrtc.c (from r203846, head/sys/isa/atrtc.c)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/x86/isa/atrtc.c    Thu Feb 25 14:13:39 2010        (r204309, copy 
of r203846, head/sys/isa/atrtc.c)
@@ -0,0 +1,331 @@
+/*-
+ * Copyright (c) 2008 Poul-Henning Kamp
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "opt_isa.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/clock.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+
+#include <isa/rtc.h>
+#ifdef DEV_ISA
+#include <isa/isareg.h>
+#include <isa/isavar.h>
+#endif
+
+#define        RTC_LOCK        mtx_lock_spin(&clock_lock)
+#define        RTC_UNLOCK      mtx_unlock_spin(&clock_lock)
+
+int    atrtcclock_disable = 0;
+
+static int     rtc_reg = -1;
+static u_char  rtc_statusa = RTCSA_DIVIDER | RTCSA_NOPROF;
+static u_char  rtc_statusb = RTCSB_24HR;
+
+/*
+ * RTC support routines
+ */
+
+int
+rtcin(int reg)
+{
+       u_char val;
+
+       RTC_LOCK;
+       if (rtc_reg != reg) {
+               inb(0x84);
+               outb(IO_RTC, reg);
+               rtc_reg = reg;
+               inb(0x84);
+       }
+       val = inb(IO_RTC + 1);
+       RTC_UNLOCK;
+       return (val);
+}
+
+void
+writertc(int reg, u_char val)
+{
+
+       RTC_LOCK;
+       if (rtc_reg != reg) {
+               inb(0x84);
+               outb(IO_RTC, reg);
+               rtc_reg = reg;
+               inb(0x84);
+       }
+       outb(IO_RTC + 1, val);
+       inb(0x84);
+       RTC_UNLOCK;
+}
+
+static __inline int
+readrtc(int port)
+{
+       return(bcd2bin(rtcin(port)));
+}
+
+void
+atrtc_start(void)
+{
+
+       writertc(RTC_STATUSA, rtc_statusa);
+       writertc(RTC_STATUSB, RTCSB_24HR);
+}
+
+void
+atrtc_rate(unsigned rate)
+{
+
+       rtc_statusa = RTCSA_DIVIDER | rate;
+       writertc(RTC_STATUSA, rtc_statusa);
+}
+
+void
+atrtc_enable_intr(void)
+{
+
+       rtc_statusb |= RTCSB_PINTR;
+       writertc(RTC_STATUSB, rtc_statusb);
+       rtcin(RTC_INTR);
+}
+
+void
+atrtc_restore(void)
+{
+
+       /* Restore all of the RTC's "status" (actually, control) registers. */
+       rtcin(RTC_STATUSA);     /* dummy to get rtc_reg set */
+       writertc(RTC_STATUSB, RTCSB_24HR);
+       writertc(RTC_STATUSA, rtc_statusa);
+       writertc(RTC_STATUSB, rtc_statusb);
+       rtcin(RTC_INTR);
+}
+
+int
+atrtc_setup_clock(void)
+{
+       int diag;
+
+       if (atrtcclock_disable)
+               return (0);
+
+       diag = rtcin(RTC_DIAG);
+       if (diag != 0) {
+               printf("RTC BIOS diagnostic error %b\n",
+                   diag, RTCDG_BITS);
+               return (0);
+       }
+
+       stathz = RTC_NOPROFRATE;
+       profhz = RTC_PROFRATE;
+
+       return (1);
+}
+
+/**********************************************************************
+ * RTC driver for subr_rtc
+ */
+
+#include "clock_if.h"
+
+#include <sys/rman.h>
+
+struct atrtc_softc {
+       int port_rid, intr_rid;
+       struct resource *port_res;
+       struct resource *intr_res;
+};
+
+/*
+ * Attach to the ISA PnP descriptors for the timer and realtime clock.
+ */
+static struct isa_pnp_id atrtc_ids[] = {
+       { 0x000bd041 /* PNP0B00 */, "AT realtime clock" },
+       { 0 }
+};
+
+static int
+atrtc_probe(device_t dev)
+{
+       int result;
+       
+       device_set_desc(dev, "AT Real Time Clock");
+       result = ISA_PNP_PROBE(device_get_parent(dev), dev, atrtc_ids);
+       /* ENXIO if wrong PnP-ID, ENOENT ifno PnP-ID, zero if good PnP-iD */
+       if (result != ENOENT)
+               return(result);
+       /* All PC's have an RTC, and we're hosed without it, so... */
+       return (BUS_PROBE_LOW_PRIORITY);
+}
+
+static int
+atrtc_attach(device_t dev)
+{
+       struct atrtc_softc *sc;
+       int i;
+
+       /*
+        * Not that we need them or anything, but grab our resources
+        * so they show up, correctly attributed, in the big picture.
+        */
+       
+       sc = device_get_softc(dev);
+       if (!(sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT,
+           &sc->port_rid, IO_RTC, IO_RTC + 1, 2, RF_ACTIVE)))
+               device_printf(dev,"Warning: Couldn't map I/O.\n");
+       if (!(sc->intr_res = bus_alloc_resource(dev, SYS_RES_IRQ,
+           &sc->intr_rid, 8, 8, 1, RF_ACTIVE)))
+               device_printf(dev,"Warning: Couldn't map Interrupt.\n");
+       clock_register(dev, 1000000);
+       if (resource_int_value("atrtc", 0, "clock", &i) == 0 && i == 0)
+               atrtcclock_disable = 1;
+       return(0);
+}
+
+static int
+atrtc_resume(device_t dev)
+{
+
+       atrtc_restore();
+       return(0);
+}
+
+static int
+atrtc_settime(device_t dev __unused, struct timespec *ts)
+{
+       struct clocktime ct;
+
+       clock_ts_to_ct(ts, &ct);
+
+       /* Disable RTC updates and interrupts. */
+       writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR);
+
+       writertc(RTC_SEC, bin2bcd(ct.sec));             /* Write back Seconds */
+       writertc(RTC_MIN, bin2bcd(ct.min));             /* Write back Minutes */
+       writertc(RTC_HRS, bin2bcd(ct.hour));            /* Write back Hours   */
+
+       writertc(RTC_WDAY, ct.dow + 1);                 /* Write back Weekday */
+       writertc(RTC_DAY, bin2bcd(ct.day));             /* Write back Day */
+       writertc(RTC_MONTH, bin2bcd(ct.mon));           /* Write back Month   */
+       writertc(RTC_YEAR, bin2bcd(ct.year % 100));     /* Write back Year    */
+#ifdef USE_RTC_CENTURY
+       writertc(RTC_CENTURY, bin2bcd(ct.year / 100));  /* ... and Century    */
+#endif
+
+       /* Reenable RTC updates and interrupts. */
+       writertc(RTC_STATUSB, rtc_statusb);
+       rtcin(RTC_INTR);
+       return (0);
+}
+
+static int
+atrtc_gettime(device_t dev, struct timespec *ts)
+{
+       struct clocktime ct;
+       int s;
+
+       /* Look if we have a RTC present and the time is valid */
+       if (!(rtcin(RTC_STATUSD) & RTCSD_PWR)) {
+               device_printf(dev, "WARNING: Battery failure indication\n");
+               return (EINVAL);
+       }
+
+       /* wait for time update to complete */
+       /* If RTCSA_TUP is zero, we have at least 244us before next update */
+       s = splhigh();
+       while (rtcin(RTC_STATUSA) & RTCSA_TUP) {
+               splx(s);
+               s = splhigh();
+       }
+       ct.nsec = 0;
+       ct.sec = readrtc(RTC_SEC);
+       ct.min = readrtc(RTC_MIN);
+       ct.hour = readrtc(RTC_HRS);
+       ct.day = readrtc(RTC_DAY);
+       ct.dow = readrtc(RTC_WDAY) - 1;
+       ct.mon = readrtc(RTC_MONTH);
+       ct.year = readrtc(RTC_YEAR);
+#ifdef USE_RTC_CENTURY
+       ct.year += readrtc(RTC_CENTURY) * 100;
+#else
+       ct.year += 2000;
+#endif
+       /* Set dow = -1 because some clocks don't set it correctly. */
+       ct.dow = -1;
+       return (clock_ct_to_ts(&ct, ts));
+}
+
+static device_method_t atrtc_methods[] = {
+       /* Device interface */
+       DEVMETHOD(device_probe,         atrtc_probe),
+       DEVMETHOD(device_attach,        atrtc_attach),
+       DEVMETHOD(device_detach,        bus_generic_detach),
+       DEVMETHOD(device_shutdown,      bus_generic_shutdown),
+       DEVMETHOD(device_suspend,       bus_generic_suspend),
+               /* XXX stop statclock? */
+       DEVMETHOD(device_resume,        atrtc_resume),
+
+       /* clock interface */
+       DEVMETHOD(clock_gettime,        atrtc_gettime),
+       DEVMETHOD(clock_settime,        atrtc_settime),
+
+       { 0, 0 }
+};
+
+static driver_t atrtc_driver = {
+       "atrtc",
+       atrtc_methods,
+       sizeof(struct atrtc_softc),
+};
+
+static devclass_t atrtc_devclass;
+
+DRIVER_MODULE(atrtc, isa, atrtc_driver, atrtc_devclass, 0, 0);
+DRIVER_MODULE(atrtc, acpi, atrtc_driver, atrtc_devclass, 0, 0);
+
+#include "opt_ddb.h"
+#ifdef DDB
+#include <ddb/ddb.h>
+
+DB_SHOW_COMMAND(rtc, rtc)
+{
+       printf("%02x/%02x/%02x %02x:%02x:%02x, A = %02x, B = %02x, C = %02x\n",
+               rtcin(RTC_YEAR), rtcin(RTC_MONTH), rtcin(RTC_DAY),
+               rtcin(RTC_HRS), rtcin(RTC_MIN), rtcin(RTC_SEC),
+               rtcin(RTC_STATUSA), rtcin(RTC_STATUSB), rtcin(RTC_INTR));
+}
+#endif /* DDB */

Copied and modified: head/sys/x86/isa/clock.c (from r203846, 
head/sys/i386/isa/clock.c)
==============================================================================
--- head/sys/i386/isa/clock.c   Sat Feb 13 19:17:06 2010        (r203846, copy 
source)
+++ head/sys/x86/isa/clock.c    Thu Feb 25 14:13:39 2010        (r204309)
@@ -39,12 +39,13 @@ __FBSDID("$FreeBSD$");
  * Routines to handle clock hardware.
  */
 
+#ifndef __amd64__
 #include "opt_apic.h"
+#endif
 #include "opt_clock.h"
 #include "opt_kdtrace.h"
 #include "opt_isa.h"
 #include "opt_mca.h"
-#include "opt_xbox.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -62,7 +63,6 @@ __FBSDID("$FreeBSD$");
 
 #include <machine/clock.h>
 #include <machine/cpu.h>
-#include <machine/frame.h>
 #include <machine/intr_machdep.h>
 #include <machine/md_var.h>
 #include <machine/apicvar.h>
@@ -480,12 +480,15 @@ i8254_restore(void)
        mtx_unlock_spin(&clock_lock);
 }
 
+#ifndef __amd64__
 /*
  * Restore all the timers non-atomically (XXX: should be atomically).
  *
  * This function is called from pmtimer_resume() to restore all the timers.
  * This should not be necessary, but there are broken laptops that do not
  * restore all the timers on resume.
+ * As long as pmtimer is not part of amd64 suport, skip this for the amd64
+ * case.
  */
 void
 timer_restore(void)
@@ -494,6 +497,7 @@ timer_restore(void)
        i8254_restore();                /* restore i8254_freq and hz */
        atrtc_restore();                /* reenable RTC interrupts */
 }
+#endif
 
 /* This is separate from startrtclock() so that it can be called early. */
 void
@@ -523,7 +527,7 @@ void
 cpu_initclocks()
 {
 
-#ifdef DEV_APIC
+#if defined(__amd64__) || defined(DEV_APIC)
        using_lapic_timer = lapic_setup_clock();
 #endif
        /*
@@ -625,11 +629,15 @@ i8254_simple_get_timecount(struct timeco
 static unsigned
 i8254_get_timecount(struct timecounter *tc)
 {
+       register_t flags;
        u_int count;
        u_int high, low;
-       u_int eflags;
 
-       eflags = read_eflags();
+#ifdef __amd64__
+       flags = read_rflags();
+#else
+       flags = read_eflags();
+#endif
        mtx_lock_spin(&clock_lock);
 
        /* Select timer0 and latch counter value. */
@@ -640,7 +648,7 @@ i8254_get_timecount(struct timecounter *
        count = i8254_max_count - ((high << 8) | low);
        if (count < i8254_lastcount ||
            (!i8254_ticked && (clkintr_pending ||
-           ((count < 20 || (!(eflags & PSL_I) &&
+           ((count < 20 || (!(flags & PSL_I) &&
            count < i8254_max_count / 2u)) &&
            i8254_pending != NULL && i8254_pending(i8254_intsrc))))) {
                i8254_ticked = 1;
@@ -678,6 +686,14 @@ attimer_attach(device_t dev)
        return(0);
 }
 
+static int
+attimer_resume(device_t dev)
+{
+
+       i8254_restore();
+       return (0);
+}
+
 static device_method_t attimer_methods[] = {
        /* Device interface */
        DEVMETHOD(device_probe,         attimer_probe),
@@ -685,7 +701,7 @@ static device_method_t attimer_methods[]
        DEVMETHOD(device_detach,        bus_generic_detach),
        DEVMETHOD(device_shutdown,      bus_generic_shutdown),
        DEVMETHOD(device_suspend,       bus_generic_suspend),
-       DEVMETHOD(device_resume,        bus_generic_resume),
+       DEVMETHOD(device_resume,        attimer_resume),
        { 0, 0 }
 };
 

Copied: head/sys/x86/isa/elcr.c (from r203846, head/sys/i386/isa/elcr.c)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/x86/isa/elcr.c     Thu Feb 25 14:13:39 2010        (r204309, copy 
of r203846, head/sys/i386/isa/elcr.c)
@@ -0,0 +1,139 @@
+/*-
+ * Copyright (c) 2004 John Baldwin <j...@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the names of any co-contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * The ELCR is a register that controls the trigger mode and polarity of
+ * EISA and ISA interrupts.  In FreeBSD 3.x and 4.x, the ELCR was only
+ * consulted for determining the appropriate trigger mode of EISA
+ * interrupts when using an APIC.  However, it seems that almost all
+ * systems that include PCI also include an ELCR that manages the ISA
+ * IRQs 0 through 15.  Thus, we check for the presence of an ELCR on
+ * every machine by checking to see if the values found at bootup are
+ * sane.  Note that the polarity of ISA and EISA IRQs are linked to the
+ * trigger mode.  All edge triggered IRQs use active-hi polarity, and
+ * all level triggered interrupts use active-lo polarity.
+ *
+ * The format of the ELCR is simple: it is a 16-bit bitmap where bit 0
+ * controls IRQ 0, bit 1 controls IRQ 1, etc.  If the bit is zero, the
+ * associated IRQ is edge triggered.  If the bit is one, the IRQ is
+ * level triggered.
+ */
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/systm.h>
+#include <machine/intr_machdep.h>
+
+#define        ELCR_PORT       0x4d0
+#define        ELCR_MASK(irq)  (1 << (irq))
+

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to