svn commit: r205960 - in stable/8/sys:
cddl/contrib/opensolaris/common/atomic/ia64 conf ia64/conf
ia64/ia64 ia64/include ia64/pci modules
Marcel Moolenaar
marcel at FreeBSD.org
Wed Mar 31 05:05:28 UTC 2010
Author: marcel
Date: Wed Mar 31 05:05:28 2010
New Revision: 205960
URL: http://svn.freebsd.org/changeset/base/205960
Log:
MFC rev 199727, 200888, 201031, 202904, 203054, 203106, 203572, 203884,
204183, 204184, 204185, 204425, 204904, 204905, 205172, 205234, 205357,
205428, 205429, 205431, 205432, 205433, 205434, 205435, 205454, 205665,
205713, 205723, 205726 and 205727:
Bring ia64 machine-dependent changes from 9-current to 8-stable.
Deleted:
stable/8/sys/ia64/include/nexusvar.h
stable/8/sys/ia64/include/sapicreg.h
stable/8/sys/ia64/include/sapicvar.h
Modified:
stable/8/sys/cddl/contrib/opensolaris/common/atomic/ia64/opensolaris_atomic.S
stable/8/sys/conf/files.ia64
stable/8/sys/ia64/conf/GENERIC
stable/8/sys/ia64/ia64/autoconf.c
stable/8/sys/ia64/ia64/clock.c
stable/8/sys/ia64/ia64/context.S
stable/8/sys/ia64/ia64/db_machdep.c
stable/8/sys/ia64/ia64/exception.S
stable/8/sys/ia64/ia64/highfp.c
stable/8/sys/ia64/ia64/interrupt.c
stable/8/sys/ia64/ia64/locore.S
stable/8/sys/ia64/ia64/machdep.c
stable/8/sys/ia64/ia64/mp_machdep.c
stable/8/sys/ia64/ia64/nexus.c
stable/8/sys/ia64/ia64/pmap.c
stable/8/sys/ia64/ia64/sal.c
stable/8/sys/ia64/ia64/sapic.c
stable/8/sys/ia64/ia64/support.S
stable/8/sys/ia64/ia64/syscall.S
stable/8/sys/ia64/ia64/trap.c
stable/8/sys/ia64/ia64/vm_machdep.c
stable/8/sys/ia64/include/acpica_machdep.h
stable/8/sys/ia64/include/clock.h
stable/8/sys/ia64/include/cpufunc.h
stable/8/sys/ia64/include/frame.h
stable/8/sys/ia64/include/intr.h
stable/8/sys/ia64/include/intrcnt.h
stable/8/sys/ia64/include/mca.h
stable/8/sys/ia64/include/pcb.h
stable/8/sys/ia64/include/pci_cfgreg.h
stable/8/sys/ia64/include/pcpu.h
stable/8/sys/ia64/include/smp.h
stable/8/sys/ia64/pci/pci_cfgreg.c
stable/8/sys/modules/Makefile
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
stable/8/sys/dev/xen/xenpci/ (props changed)
Modified: stable/8/sys/cddl/contrib/opensolaris/common/atomic/ia64/opensolaris_atomic.S
==============================================================================
--- stable/8/sys/cddl/contrib/opensolaris/common/atomic/ia64/opensolaris_atomic.S Wed Mar 31 03:58:57 2010 (r205959)
+++ stable/8/sys/cddl/contrib/opensolaris/common/atomic/ia64/opensolaris_atomic.S Wed Mar 31 05:05:28 2010 (r205960)
@@ -76,7 +76,7 @@ ENTRY(atomic_or_8_nv, 2)
END(atomic_or_8_nv)
ENTRY(membar_producer, 0)
- mf.a
+ mf
;;
br.ret.sptk rp
END(membar_producer)
Modified: stable/8/sys/conf/files.ia64
==============================================================================
--- stable/8/sys/conf/files.ia64 Wed Mar 31 03:58:57 2010 (r205959)
+++ stable/8/sys/conf/files.ia64 Wed Mar 31 05:05:28 2010 (r205960)
@@ -45,8 +45,6 @@ contrib/ia64/libuwx/src/uwx_uinfo.c sta
contrib/ia64/libuwx/src/uwx_utable.c standard
crypto/blowfish/bf_enc.c optional crypto | ipsec
crypto/des/des_enc.c optional crypto | ipsec | netsmb
-dev/advansys/adv_isa.c optional adv isa
-dev/aic/aic_isa.c optional aic isa
dev/atkbdc/atkbd.c optional atkbd atkbdc
dev/atkbdc/atkbd_atkbdc.c optional atkbd atkbdc
dev/atkbdc/atkbdc.c optional atkbdc
Modified: stable/8/sys/ia64/conf/GENERIC
==============================================================================
--- stable/8/sys/ia64/conf/GENERIC Wed Mar 31 03:58:57 2010 (r205959)
+++ stable/8/sys/ia64/conf/GENERIC Wed Mar 31 05:05:28 2010 (r205960)
@@ -20,7 +20,7 @@
#
# $FreeBSD$
-cpu ITANIUM
+cpu ITANIUM2
ident GENERIC
makeoptions DEBUG=-g # Build kernel with debug information.
@@ -28,10 +28,12 @@ makeoptions DEBUG=-g # Build kernel with
options AUDIT # Security event auditing
options CD9660 # ISO 9660 Filesystem
options COMPAT_43TTY # BSD 4.3 TTY compat (sgtty)
-options COMPAT_FREEBSD6 # Compatible with FreeBSD6
options COMPAT_FREEBSD7 # Compatible with FreeBSD7
options FFS # Berkeley Fast Filesystem
+options FLOWTABLE # per-cpu routing cache
+options GDB # Support remote GDB
options GEOM_LABEL # Provides labelization
+options INCLUDE_CONFIG_FILE # Include this file in kernel
options INET # InterNETworking
options INET6 # IPv6 communications protocols
options INVARIANTS # Enable calls of extra sanity checking
@@ -41,9 +43,11 @@ options MAC # TrustedBSD MAC Framework
options MD_ROOT # MD usable as root device
options MSDOSFS # MSDOS Filesystem
options NFSCLIENT # Network Filesystem Client
-options NFSSERVER # Network Filesystem Server
options NFSLOCKD # Network Lock Manager
+options NFSSERVER # Network Filesystem Server
options NFS_ROOT # NFS usable as root device
+options P1003_1B_SEMAPHORES # POSIX-style semaphores
+options PREEMPTION # Enable kernel thread preemption
options PRINTF_BUFR_SIZE=128 # Printf buffering to limit interspersion
options PROCFS # Process filesystem (/proc)
options PSEUDOFS # Pseudo-filesystem framework
@@ -56,13 +60,10 @@ options STACK # stack(9) support
options SYSVMSG # SYSV-style message queues
options SYSVSEM # SYSV-style semaphores
options SYSVSHM # SYSV-style shared memory
-options P1003_1B_SEMAPHORES # POSIX-style semaphores
options UFS_ACL # Support for access control lists
options UFS_DIRHASH # Hash-based directory lookup scheme
options UFS_GJOURNAL # Enable gjournal-based UFS journaling
options _KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B RT extensions
-options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4)
-options INCLUDE_CONFIG_FILE # Include this file in kernel
# Various "busses"
device firewire # FireWire bus code
@@ -76,20 +77,25 @@ device ata # ATA controller
device atadisk # ATA disk drives
device atapicd # ATAPI CDROM drives
device atapifd # ATAPI floppy drives
+device atapist # ATAPI tape drives
device ataraid # ATA RAID drives
# SCSI Controllers
device ahc # AHA2940 and AIC7xxx devices
device ahd # AHA39320/29320 and AIC79xx devices
+device hptiop # Highpoint RocketRaid 3xxx series
device isp # Qlogic family
device mpt # LSI-Logic MPT-Fusion
device sym # NCR/Symbios Logic
# RAID controllers interfaced to the SCSI subsystem
+device amr # AMI MegaRAID
device ciss # Compaq Smart RAID 5*
device dpt # DPT Smartcache III, IV
device iir # Intel Integrated RAID
+device ips # IBM (Adaptec) ServeRAID
device mly # Mylex AcceleRAID/eXtremeRAID
+device twa # 3ware 9000 series PATA/SATA RAID
# SCSI peripherals
device cd # CD-ROM, DVD-ROM etc.
@@ -102,7 +108,6 @@ device ses # Environmental Services (a
# RAID controllers
device aac # Adaptec FSA RAID
device aacp # SCSI passthrough for aac (requires CAM)
-device amr # AMI MegaRAID
device ida # Compaq Smart RAID
device mlx # Mylex DAC960 family
@@ -118,34 +123,58 @@ device ums # Mouse
# PCI Ethernet NICs.
device de # DEC/Intel DC21x4x (``Tulip'')
-device em # Intel PRO/1000 adapter Gigabit Ethernet Card
-device le # AMD Am7900 LANCE and Am79C9xx PCnet
+device em # Intel PRO/1000 Gigabit Ethernet Family
+device igb # Intel PRO/1000 PCIE Server Gigabit Family
+device ixgbe # Intel PRO/10GbE PCIE Ethernet Family
device txp # 3Com 3cR990 (``Typhoon'')
-device vx # 3Com 3c590, 3c595 (``Vortex'')
# PCI Ethernet NICs that use the common MII bus controller code.
+device ae # Attansic/Atheros L2 FastEthernet
+device age # Attansic/Atheros L1 Gigabit Ethernet
+device alc # Atheros AR8131/AR8132 Ethernet
+device ale # Atheros AR8121/AR8113/AR8114 Ethernet
+device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet
+device bfe # Broadcom BCM440x 10/100 Ethernet
device bge # Broadcom BCM570xx Gigabit Ethernet
-device dc # DEC/Intel 21143 and various workalikes
+device et # Agere ET1310 10/100/Gigabit Ethernet
+device jme # JMicron JMC250 Gigabit/JMC260 Fast Ethernet
+device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet
+device nge # NatSemi DP83820 gigabit Ethernet
device fxp # Intel EtherExpress PRO/100B (82557, 82558)
-device pcn # AMD Am79C97x PCI 10/100 (precedence over 'le')
device re # RealTek 8139C+/8169/8169S/8110S
-device rl # RealTek 8129/8139
device sf # Adaptec AIC-6915 (``Starfire'')
-device sis # Silicon Integrated Systems SiS 900/SiS 7016
+device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet
+device ste # Sundance ST201 (D-Link DFE-550TX)
+device stge # Sundance/Tamarack TC9021 gigabit Ethernet
+device tx # SMC EtherPower II (83c170 ``EPIC'')
+device vge # VIA VT612x gigabit Ethernet
device xl # 3Com 3c90x ("Boomerang", "Cyclone")
# USB Ethernet
device aue # ADMtek USB Ethernet
+device axe # ASIX Electronics USB Ethernet
device cdce # Generic USB over Ethernet
device cue # CATC USB Ethernet
device kue # Kawasaki LSI USB Ethernet
+device rue # RealTek RTL8150 USB Ethernet
+device udav # Davicom DM9601E USB
+
+# USB Serial
+device uark # Technologies ARK3116 based serial adapters
+device ubsa # Belkin F5U103 and compatible serial adapters
+device uftdi # For FTDI usb serial adapters
+device uipaq # Some WinCE based devices
+device uplcom # Prolific PL-2303 serial adapters
+device uslcom # SI Labs CP2101/CP2102 serial adapters
+device uvisor # Visor and Palm devices
+device uvscom # USB serial support for DDI pocket's PHS
# FireWire support
-#device sbp # SCSI over FireWire (need scbus & da)
+device fwip # IP over FireWire (RFC 2734,3146)
+device sbp # SCSI over FireWire (need scbus & da)
# Various (pseudo) devices
device ether # Ethernet support
-device vlan # 802.1Q VLAN support
device faith # IPv6-to-IPv4 relaying (translation)
device gif # IPv6 and IPv4 tunneling
device loop # Network loopback
@@ -155,6 +184,7 @@ device puc # Multi I/O cards and multi
device random # Entropy device
device tun # Packet tunnel.
device uart # Serial port (UART)
+device vlan # 802.1Q VLAN support
device firmware # firmware assist module
# The `bpf' device enables the Berkeley Packet Filter.
Modified: stable/8/sys/ia64/ia64/autoconf.c
==============================================================================
--- stable/8/sys/ia64/ia64/autoconf.c Wed Mar 31 03:58:57 2010 (r205959)
+++ stable/8/sys/ia64/ia64/autoconf.c Wed Mar 31 05:05:28 2010 (r205960)
@@ -39,15 +39,9 @@
#include <sys/bus.h>
#include <sys/cons.h>
-#include <machine/md_var.h>
#include <machine/bootinfo.h>
-
-#include <cam/cam.h>
-#include <cam/cam_ccb.h>
-#include <cam/cam_sim.h>
-#include <cam/cam_periph.h>
-#include <cam/cam_xpt_sim.h>
-#include <cam/cam_debug.h>
+#include <machine/intr.h>
+#include <machine/md_var.h>
static void configure_first(void *);
static void configure(void *);
@@ -97,12 +91,9 @@ static void
configure_final(void *dummy)
{
- /*
- * Now we're ready to handle (pending) interrupts.
- * XXX this is slightly misplaced.
- */
- enable_intr();
-
cninit_finish();
+
+ ia64_enable_intr();
+
cold = 0;
}
Modified: stable/8/sys/ia64/ia64/clock.c
==============================================================================
--- stable/8/sys/ia64/ia64/clock.c Wed Mar 31 03:58:57 2010 (r205959)
+++ stable/8/sys/ia64/ia64/clock.c Wed Mar 31 05:05:28 2010 (r205960)
@@ -29,19 +29,42 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/kernel.h>
+#include <sys/bus.h>
+#include <sys/interrupt.h>
+#include <sys/priority.h>
#include <sys/queue.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
-#include <sys/bus.h>
#include <sys/timetc.h>
#include <sys/pcpu.h>
-#include <machine/clock.h>
#include <machine/cpu.h>
#include <machine/efi.h>
+#include <machine/intr.h>
+#include <machine/intrcnt.h>
#include <machine/md_var.h>
+#include <machine/smp.h>
+
+SYSCTL_NODE(_debug, OID_AUTO, clock, CTLFLAG_RW, 0, "clock statistics");
+
+static int adjust_edges = 0;
+SYSCTL_INT(_debug_clock, OID_AUTO, adjust_edges, CTLFLAG_RD,
+ &adjust_edges, 0, "Number of times ITC got more than 12.5% behind");
+
+static int adjust_excess = 0;
+SYSCTL_INT(_debug_clock, OID_AUTO, adjust_excess, CTLFLAG_RD,
+ &adjust_excess, 0, "Total number of ignored ITC interrupts");
-uint64_t ia64_clock_reload;
+static int adjust_lost = 0;
+SYSCTL_INT(_debug_clock, OID_AUTO, adjust_lost, CTLFLAG_RD,
+ &adjust_lost, 0, "Total number of lost ITC interrupts");
+
+static int adjust_ticks = 0;
+SYSCTL_INT(_debug_clock, OID_AUTO, adjust_ticks, CTLFLAG_RD,
+ &adjust_ticks, 0, "Total number of ITC interrupts with adjustment");
+
+static u_int ia64_clock_xiv;
+static uint64_t ia64_clock_reload;
#ifndef SMP
static timecounter_get_t ia64_get_timecount;
@@ -54,26 +77,80 @@ static struct timecounter ia64_timecount
"ITC" /* name */
};
-static unsigned
+static u_int
ia64_get_timecount(struct timecounter* tc)
{
return ia64_get_itc();
}
#endif
-void
-pcpu_initclock(void)
+static u_int
+ia64_ih_clock(struct thread *td, u_int xiv, struct trapframe *tf)
{
+ uint64_t adj, clk, itc;
+ int64_t delta;
+ int count;
+
+ PCPU_INC(md.stats.pcs_nclks);
+
+ if (PCPU_GET(cpuid) == 0) {
+ /*
+ * Clock processing on the BSP.
+ */
+ intrcnt[INTRCNT_CLOCK]++;
+
+ itc = ia64_get_itc();
+
+ adj = PCPU_GET(md.clockadj);
+ clk = PCPU_GET(md.clock);
+
+ delta = itc - clk;
+ count = 0;
+ while (delta >= ia64_clock_reload) {
+#ifdef SMP
+ ipi_all_but_self(ia64_clock_xiv);
+#endif
+ hardclock(TRAPF_USERMODE(tf), TRAPF_PC(tf));
+ if (profprocs != 0)
+ profclock(TRAPF_USERMODE(tf), TRAPF_PC(tf));
+ statclock(TRAPF_USERMODE(tf));
+ delta -= ia64_clock_reload;
+ clk += ia64_clock_reload;
+ if (adj != 0)
+ adjust_ticks++;
+ count++;
+ }
+ ia64_set_itm(ia64_get_itc() + ia64_clock_reload - adj);
+ ia64_srlz_d();
+ if (count > 0) {
+ adjust_lost += count - 1;
+ if (delta > (ia64_clock_reload >> 3)) {
+ if (adj == 0)
+ adjust_edges++;
+ adj = ia64_clock_reload >> 4;
+ } else
+ adj = 0;
+ } else {
+ adj = 0;
+ adjust_excess++;
+ }
+ PCPU_SET(md.clock, clk);
+ PCPU_SET(md.clockadj, adj);
+ } else {
+ /*
+ * Clock processing on the BSP.
+ */
+ hardclock_cpu(TRAPF_USERMODE(tf));
+ if (profprocs != 0)
+ profclock(TRAPF_USERMODE(tf), TRAPF_PC(tf));
+ statclock(TRAPF_USERMODE(tf));
+ }
- PCPU_SET(md.clockadj, 0);
- PCPU_SET(md.clock, ia64_get_itc());
- ia64_set_itm(PCPU_GET(md.clock) + ia64_clock_reload);
- ia64_set_itv(CLOCK_VECTOR); /* highest priority class */
- ia64_srlz_d();
+ return (0);
}
/*
- * Start the real-time and statistics clocks. We use cr.itc and cr.itm
+ * Start the real-time and statistics clocks. We use ar.itc and cr.itm
* to implement a 1000hz clock.
*/
void
@@ -81,6 +158,11 @@ cpu_initclocks()
{
u_long itc_freq;
+ ia64_clock_xiv = ia64_xiv_alloc(PI_REALTIME, IA64_XIV_IPI,
+ ia64_ih_clock);
+ if (ia64_clock_xiv == 0)
+ panic("No XIV for clock interrupts");
+
itc_freq = (u_long)ia64_itc_freq() * 1000000ul;
stathz = hz;
@@ -91,7 +173,11 @@ cpu_initclocks()
tc_init(&ia64_timecounter);
#endif
- pcpu_initclock();
+ PCPU_SET(md.clockadj, 0);
+ PCPU_SET(md.clock, ia64_get_itc());
+ ia64_set_itm(PCPU_GET(md.clock) + ia64_clock_reload);
+ ia64_set_itv(ia64_clock_xiv);
+ ia64_srlz_d();
}
void
Modified: stable/8/sys/ia64/ia64/context.S
==============================================================================
--- stable/8/sys/ia64/ia64/context.S Wed Mar 31 03:58:57 2010 (r205959)
+++ stable/8/sys/ia64/ia64/context.S Wed Mar 31 05:05:28 2010 (r205960)
@@ -86,18 +86,18 @@ ENTRY(restorectx, 1)
{ .mmi
ld8.fill r6=[r14],16 // r6
ld8.fill r7=[r15],16 // r7
- nop 1
+ nop 0
;;
}
{ .mmi
mov ar.unat=r16
mov ar.rsc=3
- nop 2
+ nop 0
}
{ .mmi
ld8 r17=[r14],16 // b1
ld8 r18=[r15],16 // b2
- nop 3
+ nop 0
;;
}
{ .mmi
@@ -286,7 +286,7 @@ ENTRY(swapctx, 2)
(p15) br.ret.sptk rp
;;
}
-{ .mfb
+{ .mib
mov r32=r33
nop 0
br.sptk restorectx
@@ -338,10 +338,10 @@ ENTRY(save_callee_saved, 1)
mov r17=b5
;;
}
-{ .mfi
+{ .mii
st8 [r14]=r17,16 // b5
- nop 0
mov r16=ar.lc
+ nop 0
;;
}
{ .mmb
@@ -363,13 +363,13 @@ ENTRY(restore_callee_saved, 1)
add r31=-8,r32
;;
}
-{ .mmb
+{ .mmi
ld8.fill r4=[r31],16 // r4
ld8.fill r5=[r32],16 // r5
nop 0
;;
}
-{ .mmb
+{ .mmi
ld8.fill r6=[r31],16 // r6
ld8.fill r7=[r32],16 // r7
nop 0
Modified: stable/8/sys/ia64/ia64/db_machdep.c
==============================================================================
--- stable/8/sys/ia64/ia64/db_machdep.c Wed Mar 31 03:58:57 2010 (r205959)
+++ stable/8/sys/ia64/ia64/db_machdep.c Wed Mar 31 05:05:28 2010 (r205960)
@@ -577,6 +577,13 @@ db_write_bytes(vm_offset_t addr, size_t
void
db_show_mdpcpu(struct pcpu *pc)
{
+ struct pcpu_md *md = &pc->pc_md;
+
+ db_printf("MD: vhpt = %#lx\n", md->vhpt);
+ db_printf("MD: lid = %#lx\n", md->lid);
+ db_printf("MD: clock = %#lx/%#lx\n", md->clock, md->clockadj);
+ db_printf("MD: stats = %p\n", &md->stats);
+ db_printf("MD: pmap = %p\n", md->current_pmap);
}
void
Modified: stable/8/sys/ia64/ia64/exception.S
==============================================================================
--- stable/8/sys/ia64/ia64/exception.S Wed Mar 31 03:58:57 2010 (r205959)
+++ stable/8/sys/ia64/ia64/exception.S Wed Mar 31 05:05:28 2010 (r205960)
@@ -89,10 +89,10 @@ xhead: data8 xtrace
addl r29=1024*5*8,r0 ;; \
(p15) sub r27=r28,r29 ;; \
} ; \
-{ .mib ; \
+{ .mmi ; \
st8 [r28]=r27 ; \
- mov pr=r25,0x1ffff ; \
- nop 0 ;; \
+ nop 0 ; \
+ mov pr=r25,0x1ffff ;; \
}
#else
@@ -148,10 +148,10 @@ ENTRY_NOPROFILE(exception_save, 0)
add r31=8,r30
;;
}
-{ .mib
+{ .mmi
mov r22=cr.iip
- addl r29=NTLBRT_SAVE,r0 // 22-bit restart token.
nop 0
+ addl r29=NTLBRT_SAVE,r0 // 22-bit restart token.
;;
}
@@ -235,7 +235,7 @@ exception_save_restart:
nop 0
;;
}
-{ .mmb
+{ .mmi
(p13) mov ar.rnat=r19
mov r18=ar.bsp
nop 0
@@ -248,7 +248,7 @@ exception_save_restart:
;;
}
// r19=ifs, r22=iip
-{ .mmb
+{ .mmi
st8 [r31]=r18,16 // ndirty
st8 [r30]=r19,16 // cfm
nop 0
@@ -260,7 +260,7 @@ exception_save_restart:
add r29=16,r30
;;
}
-{ .mmb
+{ .mmi
st8 [r30]=r17,24 // ifa
st8 [r31]=r18,24 // isr
nop 0
@@ -407,7 +407,7 @@ exception_save_restart:
movl gp=__gp
;;
}
-{ .mfb
+{ .mib
srlz.d
nop 0
br.sptk b7
@@ -567,7 +567,7 @@ ENTRY_NOPROFILE(exception_restore, 0)
cmp.le p14,p15=5,r28
;;
}
-{ .mmb
+{ .mmi
ld8 r25=[r30] // cfm
ld8 r19=[r31] // ip
nop 0
@@ -606,13 +606,13 @@ exception_restore_restart:
dep r31=0,r31,0,13 // 8KB aligned
;;
}
-{ .mmb
+{ .mmi
mov ar.k6=r31
mov ar.rnat=r21
nop 0
;;
}
-{ .mmb
+{ .mmi
mov ar.unat=r17
mov cr.iip=r19
nop 0
@@ -656,7 +656,7 @@ END(exception_restore)
add out1=16,sp ; \
br.call.sptk rp=_func_ ;; \
} ; \
-{ .mfb ; \
+{ .mib ; \
nop 0 ; \
nop 0 ; \
br.sptk exception_restore ;; \
@@ -1021,10 +1021,10 @@ IVT_ENTRY(Data_Nested_TLB, 0x1400)
movl r27=kstack
;;
}
-{ .mib
+{ .mmi
mov r28=sp
- addl r27=KSTACK_PAGES*PAGE_SIZE-16,r0
nop 0
+ addl r27=KSTACK_PAGES*PAGE_SIZE-16,r0
;;
}
{ .mmi
@@ -1287,13 +1287,13 @@ IVT_ENTRY(Break_Instruction, 0x2c00)
(p11) srlz.d
add out1=16,sp
}
-{ .mfb
+{ .mib
nop 0
nop 0
br.call.sptk rp=trap
;;
}
-{ .mfb
+{ .mib
nop 0
nop 0
br.sptk exception_restore
@@ -1303,24 +1303,24 @@ IVT_END(Break_Instruction)
IVT_ENTRY(External_Interrupt, 0x3000)
{ .mib
- mov r17=cr.ivr // Put the vector in the trap frame.
+ mov r17=ar.itc // Put the ITC in the trapframe.
mov r16=ip
br.sptk exception_save
;;
}
-{ .mfb
+{ .mmi
alloc r15=ar.pfs,0,0,1,0
nop 0
nop 0
;;
}
-{ .mfb
+{ .mib
add out0=16,sp
nop 0
- br.call.sptk rp=interrupt
+ br.call.sptk rp=ia64_handle_intr
;;
}
-{ .mfb
+{ .mib
nop 0
nop 0
br.sptk exception_restore
Modified: stable/8/sys/ia64/ia64/highfp.c
==============================================================================
--- stable/8/sys/ia64/ia64/highfp.c Wed Mar 31 03:58:57 2010 (r205959)
+++ stable/8/sys/ia64/ia64/highfp.c Wed Mar 31 05:05:28 2010 (r205960)
@@ -53,7 +53,7 @@ ia64_highfp_ipi(struct pcpu *cpu)
{
int error;
- ipi_send(cpu, IPI_HIGH_FP);
+ ipi_send(cpu, ia64_ipi_highfp);
error = msleep_spin(&cpu->pc_fpcurthread, &ia64_highfp_mtx,
"High FP", 0);
return (error);
@@ -92,8 +92,6 @@ ia64_highfp_enable(struct thread *td, st
pcb = td->td_pcb;
mtx_lock_spin(&ia64_highfp_mtx);
- KASSERT((tf->tf_special.psr & IA64_PSR_DFH) != 0,
- ("(tf->tf_special.psr & IA64_PSR_DFH) == 0"));
cpu = pcb->pcb_fpcpu;
#ifdef SMP
if (cpu != NULL && cpu != pcpup) {
Modified: stable/8/sys/ia64/ia64/interrupt.c
==============================================================================
--- stable/8/sys/ia64/ia64/interrupt.c Wed Mar 31 03:58:57 2010 (r205959)
+++ stable/8/sys/ia64/ia64/interrupt.c Wed Mar 31 05:05:28 2010 (r205960)
@@ -43,6 +43,7 @@
#include <sys/proc.h>
#include <sys/vmmeter.h>
#include <sys/bus.h>
+#include <sys/interrupt.h>
#include <sys/malloc.h>
#include <sys/ktr.h>
#include <sys/lock.h>
@@ -52,246 +53,141 @@
#include <sys/sysctl.h>
#include <sys/syslog.h>
-#include <machine/clock.h>
#include <machine/cpu.h>
#include <machine/fpu.h>
#include <machine/frame.h>
#include <machine/intr.h>
+#include <machine/intrcnt.h>
#include <machine/md_var.h>
#include <machine/pcb.h>
#include <machine/reg.h>
-#include <machine/sapicvar.h>
#include <machine/smp.h>
-#ifdef EVCNT_COUNTERS
-struct evcnt clock_intr_evcnt; /* event counter for clock intrs. */
-#else
-#include <sys/interrupt.h>
-#include <machine/intrcnt.h>
-#endif
-
#ifdef DDB
#include <ddb/ddb.h>
#endif
-static void ia64_dispatch_intr(void *, u_int);
-
-static void
-dummy_perf(unsigned long vector, struct trapframe *tf)
-{
- printf("performance interrupt!\n");
-}
-
-void (*perf_irq)(unsigned long, struct trapframe *) = dummy_perf;
-
-SYSCTL_NODE(_debug, OID_AUTO, clock, CTLFLAG_RW, 0, "clock statistics");
-
-static int adjust_edges = 0;
-SYSCTL_INT(_debug_clock, OID_AUTO, adjust_edges, CTLFLAG_RD,
- &adjust_edges, 0, "Number of times ITC got more than 12.5% behind");
+struct ia64_intr {
+ struct intr_event *event; /* interrupt event */
+ volatile long *cntp; /* interrupt counter */
+ struct sapic *sapic;
+ u_int irq;
+};
-static int adjust_excess = 0;
-SYSCTL_INT(_debug_clock, OID_AUTO, adjust_excess, CTLFLAG_RD,
- &adjust_excess, 0, "Total number of ignored ITC interrupts");
+ia64_ihtype *ia64_handler[IA64_NXIVS];
-static int adjust_lost = 0;
-SYSCTL_INT(_debug_clock, OID_AUTO, adjust_lost, CTLFLAG_RD,
- &adjust_lost, 0, "Total number of lost ITC interrupts");
+static enum ia64_xiv_use ia64_xiv[IA64_NXIVS];
+static struct ia64_intr *ia64_intrs[IA64_NXIVS];
-static int adjust_ticks = 0;
-SYSCTL_INT(_debug_clock, OID_AUTO, adjust_ticks, CTLFLAG_RD,
- &adjust_ticks, 0, "Total number of ITC interrupts with adjustment");
+static ia64_ihtype ia64_ih_invalid;
+static ia64_ihtype ia64_ih_irq;
void
-interrupt(struct trapframe *tf)
+ia64_xiv_init(void)
{
- struct thread *td;
- uint64_t adj, clk, itc;
- int64_t delta;
- u_int vector;
- int count;
- uint8_t inta;
+ u_int xiv;
- ia64_set_fpsr(IA64_FPSR_DEFAULT);
+ for (xiv = 0; xiv < IA64_NXIVS; xiv++) {
+ ia64_handler[xiv] = ia64_ih_invalid;
+ ia64_xiv[xiv] = IA64_XIV_FREE;
+ ia64_intrs[xiv] = NULL;
+ }
+ (void)ia64_xiv_reserve(15, IA64_XIV_ARCH, NULL);
+}
- td = curthread;
+int
+ia64_xiv_free(u_int xiv, enum ia64_xiv_use what)
+{
- PCPU_INC(cnt.v_intr);
+ if (xiv >= IA64_NXIVS)
+ return (EINVAL);
+ if (what == IA64_XIV_FREE || what == IA64_XIV_ARCH)
+ return (EINVAL);
+ if (ia64_xiv[xiv] != what)
+ return (ENXIO);
+ ia64_xiv[xiv] = IA64_XIV_FREE;
+ ia64_handler[xiv] = ia64_ih_invalid;
+ return (0);
+}
- vector = tf->tf_special.ifa;
+int
+ia64_xiv_reserve(u_int xiv, enum ia64_xiv_use what, ia64_ihtype ih)
+{
- next:
- /*
- * Handle ExtINT interrupts by generating an INTA cycle to
- * read the vector.
- * IPI_STOP_HARD is mapped to IPI_STOP so it is not necessary
- * to add it to this switch-like construct.
- */
- if (vector == 0) {
- PCPU_INC(md.stats.pcs_nextints);
- inta = ia64_ld1(&ia64_pib->ib_inta);
- if (inta == 15) {
- PCPU_INC(md.stats.pcs_nstrays);
- __asm __volatile("mov cr.eoi = r0;; srlz.d");
- goto stray;
- }
- vector = (int)inta;
- } else if (vector == 15) {
- PCPU_INC(md.stats.pcs_nstrays);
- goto stray;
- }
+ if (xiv >= IA64_NXIVS)
+ return (EINVAL);
+ if (what == IA64_XIV_FREE)
+ return (EINVAL);
+ if (ia64_xiv[xiv] != IA64_XIV_FREE)
+ return (EBUSY);
+ ia64_xiv[xiv] = what;
+ ia64_handler[xiv] = (ih == NULL) ? ia64_ih_invalid: ih;
+ if (bootverbose)
+ printf("XIV %u: use=%u, IH=%p\n", xiv, what, ih);
+ return (0);
+}
- if (vector == CLOCK_VECTOR) {/* clock interrupt */
- /* CTR0(KTR_INTR, "clock interrupt"); */
+u_int
+ia64_xiv_alloc(u_int prio, enum ia64_xiv_use what, ia64_ihtype ih)
+{
+ u_int hwprio;
+ u_int xiv0, xiv;
- itc = ia64_get_itc();
+ hwprio = prio >> 2;
+ if (hwprio > IA64_MAX_HWPRIO)
+ hwprio = IA64_MAX_HWPRIO;
- PCPU_INC(md.stats.pcs_nclks);
-#ifdef EVCNT_COUNTERS
- clock_intr_evcnt.ev_count++;
-#else
- intrcnt[INTRCNT_CLOCK]++;
-#endif
+ xiv0 = IA64_NXIVS - (hwprio + 1) * 16;
- critical_enter();
+ KASSERT(xiv0 >= IA64_MIN_XIV, ("%s: min XIV", __func__));
+ KASSERT(xiv0 < IA64_NXIVS, ("%s: max XIV", __func__));
- adj = PCPU_GET(md.clockadj);
- clk = PCPU_GET(md.clock);
- delta = itc - clk;
- count = 0;
- while (delta >= ia64_clock_reload) {
- /* Only the BSP runs the real clock */
- if (PCPU_GET(cpuid) == 0)
- hardclock(TRAPF_USERMODE(tf), TRAPF_PC(tf));
- else
- hardclock_cpu(TRAPF_USERMODE(tf));
- if (profprocs != 0)
- profclock(TRAPF_USERMODE(tf), TRAPF_PC(tf));
- statclock(TRAPF_USERMODE(tf));
- delta -= ia64_clock_reload;
- clk += ia64_clock_reload;
- if (adj != 0)
- adjust_ticks++;
- count++;
- }
- ia64_set_itm(ia64_get_itc() + ia64_clock_reload - adj);
- if (count > 0) {
- adjust_lost += count - 1;
- if (delta > (ia64_clock_reload >> 3)) {
- if (adj == 0)
- adjust_edges++;
- adj = ia64_clock_reload >> 4;
- } else
- adj = 0;
- } else {
- adj = 0;
- adjust_excess++;
- }
- PCPU_SET(md.clock, clk);
- PCPU_SET(md.clockadj, adj);
- critical_exit();
- ia64_srlz_d();
+ xiv = xiv0;
+ while (xiv < IA64_NXIVS && ia64_xiv_reserve(xiv, what, ih))
+ xiv++;
-#ifdef SMP
- } else if (vector == ipi_vector[IPI_AST]) {
- PCPU_INC(md.stats.pcs_nasts);
- CTR1(KTR_SMP, "IPI_AST, cpuid=%d", PCPU_GET(cpuid));
- } else if (vector == ipi_vector[IPI_HIGH_FP]) {
- PCPU_INC(md.stats.pcs_nhighfps);
- ia64_highfp_save_ipi();
- } else if (vector == ipi_vector[IPI_RENDEZVOUS]) {
- PCPU_INC(md.stats.pcs_nrdvs);
- CTR1(KTR_SMP, "IPI_RENDEZVOUS, cpuid=%d", PCPU_GET(cpuid));
- enable_intr();
- smp_rendezvous_action();
- disable_intr();
- } else if (vector == ipi_vector[IPI_STOP]) {
- PCPU_INC(md.stats.pcs_nstops);
- cpumask_t mybit = PCPU_GET(cpumask);
-
- savectx(PCPU_PTR(md.pcb));
- atomic_set_int(&stopped_cpus, mybit);
- while ((started_cpus & mybit) == 0)
- cpu_spinwait();
- atomic_clear_int(&started_cpus, mybit);
- atomic_clear_int(&stopped_cpus, mybit);
- } else if (vector == ipi_vector[IPI_PREEMPT]) {
- PCPU_INC(md.stats.pcs_npreempts);
- CTR1(KTR_SMP, "IPI_PREEMPT, cpuid=%d", PCPU_GET(cpuid));
- __asm __volatile("mov cr.eoi = r0;; srlz.d");
- enable_intr();
- sched_preempt(curthread);
- disable_intr();
- goto stray;
-#endif
- } else {
- PCPU_INC(md.stats.pcs_nhwints);
- atomic_add_int(&td->td_intr_nesting_level, 1);
- ia64_dispatch_intr(tf, vector);
- atomic_subtract_int(&td->td_intr_nesting_level, 1);
- }
+ if (xiv < IA64_NXIVS)
+ return (xiv);
- __asm __volatile("mov cr.eoi = r0;; srlz.d");
- vector = ia64_get_ivr();
- if (vector != 15)
- goto next;
+ xiv = xiv0;
+ while (xiv >= IA64_MIN_XIV && ia64_xiv_reserve(xiv, what, ih))
+ xiv--;
-stray:
- if (TRAPF_USERMODE(tf)) {
- enable_intr();
- userret(td, tf);
- mtx_assert(&Giant, MA_NOTOWNED);
- do_ast(tf);
- }
+ return ((xiv >= IA64_MIN_XIV) ? xiv : 0);
}
-/*
- * Hardware irqs have vectors starting at this offset.
- */
-#define IA64_HARDWARE_IRQ_BASE 0x20
-
-struct ia64_intr {
- struct intr_event *event; /* interrupt event */
- volatile long *cntp; /* interrupt counter */
- struct sapic *sapic;
- u_int irq;
-};
-
-static struct ia64_intr *ia64_intrs[256];
-
static void
ia64_intr_eoi(void *arg)
{
- u_int vector = (uintptr_t)arg;
+ u_int xiv = (uintptr_t)arg;
struct ia64_intr *i;
- i = ia64_intrs[vector];
- if (i != NULL)
- sapic_eoi(i->sapic, vector);
+ i = ia64_intrs[xiv];
+ KASSERT(i != NULL, ("%s", __func__));
+ sapic_eoi(i->sapic, xiv);
}
static void
ia64_intr_mask(void *arg)
{
- u_int vector = (uintptr_t)arg;
+ u_int xiv = (uintptr_t)arg;
struct ia64_intr *i;
- i = ia64_intrs[vector];
- if (i != NULL) {
- sapic_mask(i->sapic, i->irq);
- sapic_eoi(i->sapic, vector);
- }
+ i = ia64_intrs[xiv];
+ KASSERT(i != NULL, ("%s", __func__));
+ sapic_mask(i->sapic, i->irq);
+ sapic_eoi(i->sapic, xiv);
}
static void
ia64_intr_unmask(void *arg)
{
- u_int vector = (uintptr_t)arg;
+ u_int xiv = (uintptr_t)arg;
struct ia64_intr *i;
- i = ia64_intrs[vector];
- if (i != NULL)
- sapic_unmask(i->sapic, i->irq);
+ i = ia64_intrs[xiv];
+ KASSERT(i != NULL, ("%s", __func__));
+ sapic_unmask(i->sapic, i->irq);
}
int
@@ -301,57 +197,79 @@ ia64_setup_intr(const char *name, int ir
struct ia64_intr *i;
struct sapic *sa;
char *intrname;
- u_int vector;
+ u_int prio, xiv;
int error;
- /* Get the I/O SAPIC that corresponds to the IRQ. */
- sa = sapic_lookup(irq);
- if (sa == NULL)
+ prio = intr_priority(flags);
+ if (prio > PRI_MAX_ITHD)
return (EINVAL);
+ /* XXX lock */
+
+ /* Get the I/O SAPIC and XIV that corresponds to the IRQ. */
+ sa = sapic_lookup(irq, &xiv);
+ if (sa == NULL) {
+ /* XXX unlock */
+ return (EINVAL);
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list