PERFORCE change 115480 for review
John Baldwin
jhb at FreeBSD.org
Wed Mar 7 19:18:11 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=115480
Change 115480 by jhb at jhb_mutex on 2007/03/07 19:17:11
IFC @115477.
Affected files ...
.. //depot/projects/smpng/sys/amd64/acpica/madt.c#12 integrate
.. //depot/projects/smpng/sys/amd64/amd64/busdma_machdep.c#24 integrate
.. //depot/projects/smpng/sys/amd64/amd64/intr_machdep.c#25 integrate
.. //depot/projects/smpng/sys/amd64/amd64/io_apic.c#19 integrate
.. //depot/projects/smpng/sys/amd64/amd64/local_apic.c#27 integrate
.. //depot/projects/smpng/sys/amd64/amd64/mp_machdep.c#41 integrate
.. //depot/projects/smpng/sys/amd64/amd64/mptable.c#10 integrate
.. //depot/projects/smpng/sys/amd64/amd64/pmap.c#72 integrate
.. //depot/projects/smpng/sys/amd64/include/apicvar.h#16 integrate
.. //depot/projects/smpng/sys/amd64/include/intr_machdep.h#14 integrate
.. //depot/projects/smpng/sys/amd64/include/smp.h#14 integrate
.. //depot/projects/smpng/sys/amd64/linux32/linux.h#11 integrate
.. //depot/projects/smpng/sys/amd64/linux32/linux32_machdep.c#20 integrate
.. //depot/projects/smpng/sys/arm/at91/at91.c#10 integrate
.. //depot/projects/smpng/sys/arm/sa11x0/sa11x0.c#9 integrate
.. //depot/projects/smpng/sys/arm/xscale/ixp425/ixp425_npe.c#4 integrate
.. //depot/projects/smpng/sys/arm/xscale/ixp425/ixp425_pci.c#4 integrate
.. //depot/projects/smpng/sys/boot/pc98/cdboot/cdboot.s#2 integrate
.. //depot/projects/smpng/sys/compat/linprocfs/linprocfs.c#54 integrate
.. //depot/projects/smpng/sys/compat/linux/linux_emul.c#9 integrate
.. //depot/projects/smpng/sys/compat/linux/linux_stats.c#36 integrate
.. //depot/projects/smpng/sys/conf/files#200 integrate
.. //depot/projects/smpng/sys/conf/kmod.mk#63 integrate
.. //depot/projects/smpng/sys/contrib/dev/ipw/LICENSE#1 branch
.. //depot/projects/smpng/sys/contrib/dev/ipw/ipw2100-1.3-i.fw.uu#1 branch
.. //depot/projects/smpng/sys/contrib/dev/ipw/ipw2100-1.3-p.fw.uu#1 branch
.. //depot/projects/smpng/sys/contrib/dev/ipw/ipw2100-1.3.fw.uu#1 branch
.. //depot/projects/smpng/sys/contrib/dev/iwi/LICENSE#1 branch
.. //depot/projects/smpng/sys/contrib/dev/iwi/ipw2200-bss.fw.uu#1 branch
.. //depot/projects/smpng/sys/contrib/dev/iwi/ipw2200-ibss.fw.uu#1 branch
.. //depot/projects/smpng/sys/contrib/dev/iwi/ipw2200-sniffer.fw.uu#1 branch
.. //depot/projects/smpng/sys/dev/acpica/acpi_thermal.c#39 integrate
.. //depot/projects/smpng/sys/dev/arcmsr/arcmsr.c#13 integrate
.. //depot/projects/smpng/sys/dev/arcmsr/arcmsr.h#4 integrate
.. //depot/projects/smpng/sys/dev/ata/ata-chipset.c#78 integrate
.. //depot/projects/smpng/sys/dev/ath/if_ath.c#51 integrate
.. //depot/projects/smpng/sys/dev/ath/if_athvar.h#31 integrate
.. //depot/projects/smpng/sys/dev/bce/if_bce.c#15 integrate
.. //depot/projects/smpng/sys/dev/bge/if_bge.c#89 integrate
.. //depot/projects/smpng/sys/dev/ixgb/if_ixgb.c#19 integrate
.. //depot/projects/smpng/sys/dev/msk/if_msk.c#5 integrate
.. //depot/projects/smpng/sys/dev/nfe/if_nfe.c#8 integrate
.. //depot/projects/smpng/sys/dev/nge/if_nge.c#52 integrate
.. //depot/projects/smpng/sys/dev/pccbb/pccbb.c#64 integrate
.. //depot/projects/smpng/sys/dev/pci/pci.c#87 integrate
.. //depot/projects/smpng/sys/dev/pci/pcireg.h#21 integrate
.. //depot/projects/smpng/sys/dev/ppbus/ppbconf.c#5 integrate
.. //depot/projects/smpng/sys/dev/ppc/ppc.c#16 integrate
.. //depot/projects/smpng/sys/dev/re/if_re.c#53 integrate
.. //depot/projects/smpng/sys/dev/sound/pci/ds1.c#23 integrate
.. //depot/projects/smpng/sys/dev/sound/pci/emu10k1.c#31 integrate
.. //depot/projects/smpng/sys/dev/sound/pci/emu10kx-pcm.c#4 integrate
.. //depot/projects/smpng/sys/dev/sound/pci/envy24.c#8 integrate
.. //depot/projects/smpng/sys/dev/sound/pcm/ac97.c#35 integrate
.. //depot/projects/smpng/sys/dev/stge/if_stge.c#6 integrate
.. //depot/projects/smpng/sys/dev/sym/sym_hipd.c#29 integrate
.. //depot/projects/smpng/sys/dev/ti/if_ti.c#8 integrate
.. //depot/projects/smpng/sys/dev/txp/if_txp.c#36 integrate
.. //depot/projects/smpng/sys/dev/vge/if_vge.c#20 integrate
.. //depot/projects/smpng/sys/dev/zs/z8530reg.h#5 delete
.. //depot/projects/smpng/sys/dev/zs/z8530var.h#4 delete
.. //depot/projects/smpng/sys/dev/zs/zs.c#26 delete
.. //depot/projects/smpng/sys/dev/zs/zs_macio.c#7 delete
.. //depot/projects/smpng/sys/fs/fifofs/fifo_vnops.c#41 integrate
.. //depot/projects/smpng/sys/geom/eli/g_eli.c#19 integrate
.. //depot/projects/smpng/sys/geom/eli/g_eli_ctl.c#8 integrate
.. //depot/projects/smpng/sys/gnu/fs/ext2fs/ext2_vnops.c#7 integrate
.. //depot/projects/smpng/sys/i386/acpica/madt.c#18 integrate
.. //depot/projects/smpng/sys/i386/i386/busdma_machdep.c#41 integrate
.. //depot/projects/smpng/sys/i386/i386/intr_machdep.c#25 integrate
.. //depot/projects/smpng/sys/i386/i386/io_apic.c#21 integrate
.. //depot/projects/smpng/sys/i386/i386/local_apic.c#48 integrate
.. //depot/projects/smpng/sys/i386/i386/machdep.c#125 integrate
.. //depot/projects/smpng/sys/i386/i386/mp_machdep.c#106 integrate
.. //depot/projects/smpng/sys/i386/i386/mptable.c#18 integrate
.. //depot/projects/smpng/sys/i386/i386/nexus.c#25 integrate
.. //depot/projects/smpng/sys/i386/i386/pmap.c#114 integrate
.. //depot/projects/smpng/sys/i386/i386/vm_machdep.c#81 integrate
.. //depot/projects/smpng/sys/i386/include/apicvar.h#25 integrate
.. //depot/projects/smpng/sys/i386/include/intr_machdep.h#16 integrate
.. //depot/projects/smpng/sys/i386/include/smp.h#22 integrate
.. //depot/projects/smpng/sys/i386/isa/clock.c#53 integrate
.. //depot/projects/smpng/sys/i386/linux/linux.h#18 integrate
.. //depot/projects/smpng/sys/i386/linux/linux_machdep.c#45 integrate
.. //depot/projects/smpng/sys/ia64/ia64/busdma_machdep.c#27 integrate
.. //depot/projects/smpng/sys/kern/kern_acct.c#49 integrate
.. //depot/projects/smpng/sys/kern/kern_acl.c#29 delete
.. //depot/projects/smpng/sys/kern/kern_alq.c#14 integrate
.. //depot/projects/smpng/sys/kern/kern_context.c#7 integrate
.. //depot/projects/smpng/sys/kern/kern_descrip.c#102 integrate
.. //depot/projects/smpng/sys/kern/kern_environment.c#25 integrate
.. //depot/projects/smpng/sys/kern/kern_event.c#50 integrate
.. //depot/projects/smpng/sys/kern/kern_exec.c#102 integrate
.. //depot/projects/smpng/sys/kern/kern_exit.c#120 integrate
.. //depot/projects/smpng/sys/kern/kern_fork.c#107 integrate
.. //depot/projects/smpng/sys/kern/kern_intr.c#85 integrate
.. //depot/projects/smpng/sys/kern/kern_jail.c#46 integrate
.. //depot/projects/smpng/sys/kern/kern_ktrace.c#59 integrate
.. //depot/projects/smpng/sys/kern/kern_linker.c#86 integrate
.. //depot/projects/smpng/sys/kern/kern_module.c#24 integrate
.. //depot/projects/smpng/sys/kern/kern_mutex.c#142 integrate
.. //depot/projects/smpng/sys/kern/kern_ntptime.c#21 integrate
.. //depot/projects/smpng/sys/kern/kern_prot.c#102 integrate
.. //depot/projects/smpng/sys/kern/kern_resource.c#70 integrate
.. //depot/projects/smpng/sys/kern/kern_shutdown.c#66 integrate
.. //depot/projects/smpng/sys/kern/kern_sig.c#132 integrate
.. //depot/projects/smpng/sys/kern/kern_sx.c#42 integrate
.. //depot/projects/smpng/sys/kern/kern_synch.c#113 integrate
.. //depot/projects/smpng/sys/kern/kern_sysctl.c#53 integrate
.. //depot/projects/smpng/sys/kern/kern_time.c#50 integrate
.. //depot/projects/smpng/sys/kern/kern_umtx.c#31 integrate
.. //depot/projects/smpng/sys/kern/kern_uuid.c#12 integrate
.. //depot/projects/smpng/sys/kern/kern_xxx.c#19 integrate
.. //depot/projects/smpng/sys/kern/p1003_1b.c#2 integrate
.. //depot/projects/smpng/sys/kern/subr_prof.c#29 integrate
.. //depot/projects/smpng/sys/kern/subr_trap.c#83 integrate
.. //depot/projects/smpng/sys/kern/sys_generic.c#48 integrate
.. //depot/projects/smpng/sys/kern/sys_pipe.c#58 integrate
.. //depot/projects/smpng/sys/kern/sys_process.c#57 integrate
.. //depot/projects/smpng/sys/kern/sys_socket.c#26 integrate
.. //depot/projects/smpng/sys/kern/sysv_msg.c#36 integrate
.. //depot/projects/smpng/sys/kern/sysv_sem.c#45 integrate
.. //depot/projects/smpng/sys/kern/sysv_shm.c#38 integrate
.. //depot/projects/smpng/sys/kern/uipc_mqueue.c#11 integrate
.. //depot/projects/smpng/sys/kern/uipc_sem.c#23 integrate
.. //depot/projects/smpng/sys/kern/uipc_syscalls.c#98 integrate
.. //depot/projects/smpng/sys/kern/vfs_acl.c#1 branch
.. //depot/projects/smpng/sys/kern/vfs_aio.c#77 integrate
.. //depot/projects/smpng/sys/kern/vfs_cache.c#33 integrate
.. //depot/projects/smpng/sys/kern/vfs_cluster.c#47 integrate
.. //depot/projects/smpng/sys/kern/vfs_mount.c#69 integrate
.. //depot/projects/smpng/sys/kern/vfs_syscalls.c#122 integrate
.. //depot/projects/smpng/sys/modules/Makefile#135 integrate
.. //depot/projects/smpng/sys/modules/ipwfw/Makefile#1 branch
.. //depot/projects/smpng/sys/modules/ipwfw/ipw_bss/Makefile#1 branch
.. //depot/projects/smpng/sys/modules/ipwfw/ipw_ibss/Makefile#1 branch
.. //depot/projects/smpng/sys/modules/ipwfw/ipw_monitor/Makefile#1 branch
.. //depot/projects/smpng/sys/modules/iwifw/Makefile#1 branch
.. //depot/projects/smpng/sys/modules/iwifw/iwi_bss/Makefile#1 branch
.. //depot/projects/smpng/sys/modules/iwifw/iwi_ibss/Makefile#1 branch
.. //depot/projects/smpng/sys/modules/iwifw/iwi_monitor/Makefile#1 branch
.. //depot/projects/smpng/sys/net/ethernet.h#12 integrate
.. //depot/projects/smpng/sys/net80211/_ieee80211.h#8 integrate
.. //depot/projects/smpng/sys/net80211/ieee80211_freebsd.h#9 integrate
.. //depot/projects/smpng/sys/net80211/ieee80211_input.c#36 integrate
.. //depot/projects/smpng/sys/net80211/ieee80211_ioctl.c#31 integrate
.. //depot/projects/smpng/sys/net80211/ieee80211_node.c#31 integrate
.. //depot/projects/smpng/sys/net80211/ieee80211_proto.c#23 integrate
.. //depot/projects/smpng/sys/net80211/ieee80211_proto.h#14 integrate
.. //depot/projects/smpng/sys/net80211/ieee80211_var.h#25 integrate
.. //depot/projects/smpng/sys/netgraph/ng_source.c#16 integrate
.. //depot/projects/smpng/sys/netgraph/ng_source.h#8 integrate
.. //depot/projects/smpng/sys/netinet/ip_mroute.c#55 integrate
.. //depot/projects/smpng/sys/nfsserver/nfs_syscalls.c#32 integrate
.. //depot/projects/smpng/sys/pc98/cbus/clock.c#9 integrate
.. //depot/projects/smpng/sys/powerpc/powermac/pswitch.c#5 integrate
.. //depot/projects/smpng/sys/powerpc/powerpc/nexus.c#11 integrate
.. //depot/projects/smpng/sys/powerpc/powerpc/pic_if.m#3 integrate
.. //depot/projects/smpng/sys/security/audit/audit.c#8 integrate
.. //depot/projects/smpng/sys/security/audit/audit_syscalls.c#9 integrate
.. //depot/projects/smpng/sys/security/mac/mac_syscalls.c#2 integrate
.. //depot/projects/smpng/sys/sparc64/sparc64/upa.c#6 integrate
.. //depot/projects/smpng/sys/sys/extattr.h#10 integrate
.. //depot/projects/smpng/sys/sys/mbuf.h#68 integrate
.. //depot/projects/smpng/sys/sys/param.h#111 integrate
.. //depot/projects/smpng/sys/sys/priv.h#4 integrate
.. //depot/projects/smpng/sys/tools/fw_stub.awk#5 integrate
.. //depot/projects/smpng/sys/ufs/ffs/ffs_vnops.c#50 integrate
.. //depot/projects/smpng/sys/ufs/ufs/extattr.h#8 integrate
.. //depot/projects/smpng/sys/ufs/ufs/ufs_vnops.c#62 integrate
.. //depot/projects/smpng/sys/vm/vm_fault.c#64 integrate
Differences ...
==== //depot/projects/smpng/sys/amd64/acpica/madt.c#12 (text+ko) ====
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/acpica/madt.c,v 1.21 2006/08/11 19:22:55 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/acpica/madt.c,v 1.22 2007/03/05 20:35:16 jhb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -336,7 +336,7 @@
{
madt = pmap_mapbios(madt_physaddr, madt_length);
- lapic_init((uintptr_t)madt->LocalApicAddress);
+ lapic_init(madt->LocalApicAddress);
printf("ACPI APIC Table: <%.*s %.*s>\n",
(int)sizeof(madt->OemId), madt->OemId,
(int)sizeof(madt->OemTableId), madt->OemTableId);
@@ -482,9 +482,8 @@
if (ioapics[apic->IoApicId].io_apic != NULL)
panic("%s: Double APIC ID %d", __func__,
apic->IoApicId);
- ioapics[apic->IoApicId].io_apic = ioapic_create(
- (uintptr_t)apic->Address, apic->IoApicId,
- apic->Interrupt);
+ ioapics[apic->IoApicId].io_apic = ioapic_create(apic->Address,
+ apic->IoApicId, apic->Interrupt);
ioapics[apic->IoApicId].io_vector = apic->Interrupt;
break;
default:
==== //depot/projects/smpng/sys/amd64/amd64/busdma_machdep.c#24 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/busdma_machdep.c,v 1.78 2006/10/15 16:52:59 hrs Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/busdma_machdep.c,v 1.79 2007/03/06 18:28:42 scottl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -906,7 +906,6 @@
* want to add support for invalidating
* the caches on broken hardware
*/
- dmat->bounce_zone->total_bounced++;
CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x op 0x%x "
"performing bounce", __func__, op, dmat, dmat->flags);
@@ -917,6 +916,7 @@
bpage->datacount);
bpage = STAILQ_NEXT(bpage, links);
}
+ dmat->bounce_zone->total_bounced++;
}
if (op & BUS_DMASYNC_POSTREAD) {
@@ -926,6 +926,7 @@
bpage->datacount);
bpage = STAILQ_NEXT(bpage, links);
}
+ dmat->bounce_zone->total_bounced++;
}
}
}
==== //depot/projects/smpng/sys/amd64/amd64/intr_machdep.c#25 (text+ko) ====
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/amd64/amd64/intr_machdep.c,v 1.29 2007/02/23 20:03:23 jhb Exp $
+ * $FreeBSD: src/sys/amd64/amd64/intr_machdep.c,v 1.30 2007/03/06 17:16:46 jhb Exp $
*/
/*
@@ -52,6 +52,7 @@
#include <sys/systm.h>
#include <machine/clock.h>
#include <machine/intr_machdep.h>
+#include <machine/smp.h>
#ifdef DDB
#include <ddb/ddb.h>
#endif
@@ -429,8 +430,9 @@
* allocate CPUs round-robin.
*/
-static u_int cpu_apic_ids[MAXCPU];
-static int current_cpu, num_cpus;
+/* The BSP is always a valid target. */
+static cpumask_t intr_cpus = (1 << 0);
+static int current_cpu, num_cpus = 1;
static void
intr_assign_next_cpu(struct intsrc *isrc)
@@ -443,25 +445,29 @@
*/
pic = isrc->is_pic;
apic_id = cpu_apic_ids[current_cpu];
- current_cpu++;
- if (current_cpu >= num_cpus)
- current_cpu = 0;
pic->pic_assign_cpu(isrc, apic_id);
+ do {
+ current_cpu++;
+ if (current_cpu >= num_cpus)
+ current_cpu = 0;
+ } while (!(intr_cpus & (1 << current_cpu)));
}
/*
- * Add a local APIC ID to our list of valid local APIC IDs that can
- * be destinations of interrupts.
+ * Add a CPU to our mask of valid CPUs that can be destinations of
+ * interrupts.
*/
void
-intr_add_cpu(u_int apic_id)
+intr_add_cpu(u_int cpu)
{
+ if (cpu >= MAXCPU)
+ panic("%s: Invalid CPU ID", __func__);
if (bootverbose)
- printf("INTR: Adding local APIC %d as a target\n", apic_id);
- if (num_cpus >= MAXCPU)
- panic("WARNING: Local APIC IDs exhausted!");
- cpu_apic_ids[num_cpus] = apic_id;
+ printf("INTR: Adding local APIC %d as a target\n",
+ cpu_apic_ids[cpu]);
+
+ intr_cpus |= (1 << cpu);
num_cpus++;
}
==== //depot/projects/smpng/sys/amd64/amd64/io_apic.c#19 (text+ko) ====
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/io_apic.c,v 1.26 2006/11/17 16:41:03 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/io_apic.c,v 1.28 2007/03/05 20:35:16 jhb Exp $");
#include "opt_isa.h"
@@ -36,11 +36,15 @@
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
-#include <sys/lock.h>
+#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/sysctl.h>
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+
#include <vm/vm.h>
#include <vm/pmap.h>
@@ -428,7 +432,7 @@
* Create a plain I/O APIC object.
*/
void *
-ioapic_create(uintptr_t addr, int32_t apic_id, int intbase)
+ioapic_create(vm_paddr_t addr, int32_t apic_id, int intbase)
{
struct ioapic *io;
struct ioapic_intsrc *intpin;
@@ -727,3 +731,46 @@
if (pin->io_irq < NUM_IO_INTS)
intr_register_source(&pin->io_intsrc);
}
+
+/* A simple new-bus driver to consume PCI I/O APIC devices. */
+static int
+ioapic_pci_probe(device_t dev)
+{
+
+ if (pci_get_class(dev) == PCIC_BASEPERIPH &&
+ pci_get_subclass(dev) == PCIS_BASEPERIPH_PIC) {
+ switch (pci_get_progif(dev)) {
+ case PCIP_BASEPERIPH_PIC_IO_APIC:
+ device_set_desc(dev, "IO APIC");
+ break;
+ case PCIP_BASEPERIPH_PIC_IOX_APIC:
+ device_set_desc(dev, "IO(x) APIC");
+ break;
+ default:
+ return (ENXIO);
+ }
+ device_quiet(dev);
+ return (-10000);
+ }
+ return (ENXIO);
+}
+
+static int
+ioapic_pci_attach(device_t dev)
+{
+
+ return (0);
+}
+
+static device_method_t ioapic_pci_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, ioapic_pci_probe),
+ DEVMETHOD(device_attach, ioapic_pci_attach),
+
+ { 0, 0 }
+};
+
+DEFINE_CLASS_0(ioapic, ioapic_pci_driver, ioapic_pci_methods, 0);
+
+static devclass_t ioapic_devclass;
+DRIVER_MODULE(ioapic, pci, ioapic_pci_driver, ioapic_devclass, 0, 0);
==== //depot/projects/smpng/sys/amd64/amd64/local_apic.c#27 (text+ko) ====
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/local_apic.c,v 1.34 2006/12/17 06:48:39 kmacy Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/local_apic.c,v 1.36 2007/03/06 17:16:46 jhb Exp $");
#include "opt_hwpmc_hooks.h"
@@ -205,7 +205,7 @@
* Map the local APIC and setup necessary interrupt vectors.
*/
void
-lapic_init(uintptr_t addr)
+lapic_init(vm_paddr_t addr)
{
/* Map the local APIC and setup the spurious interrupt handler. */
@@ -220,7 +220,6 @@
/* Set BSP's per-CPU local APIC ID. */
PCPU_SET(apic_id, lapic_id());
- intr_add_cpu(PCPU_GET(apic_id));
/* Local APIC timer interrupt. */
setidt(APIC_TIMER_INT, IDTVEC(timerint), SDT_SYSIGT, SEL_KPL, 0);
==== //depot/projects/smpng/sys/amd64/amd64/mp_machdep.c#41 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.281 2007/02/08 16:49:58 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.283 2007/03/06 17:16:46 jhb Exp $");
#include "opt_cpu.h"
#include "opt_kstack_pages.h"
@@ -152,7 +152,7 @@
int cpu_bsp:1;
int cpu_disabled:1;
} static cpu_info[MAXCPU];
-static int cpu_apic_ids[MAXCPU];
+int cpu_apic_ids[MAXCPU];
/* Holds pending bitmap based IPIs per CPU */
static volatile u_int cpu_ipi_pending[MAXCPU];
@@ -625,10 +625,11 @@
static void
set_interrupt_apic_ids(void)
{
- u_int apic_id;
+ u_int i, apic_id;
- for (apic_id = 0; apic_id < MAXCPU; apic_id++) {
- if (!cpu_info[apic_id].cpu_present)
+ for (i = 0; i < MAXCPU; i++) {
+ apic_id = cpu_apic_ids[i];
+ if (apic_id == -1)
continue;
if (cpu_info[apic_id].cpu_bsp)
continue;
@@ -640,7 +641,7 @@
apic_id % hyperthreading_cpus != 0)
continue;
- intr_add_cpu(apic_id);
+ intr_add_cpu(i);
}
}
@@ -835,13 +836,16 @@
ncpu = mp_ncpus - 1; /* does not shootdown self */
if (ncpu < 1)
return; /* no other cpus */
- mtx_assert(&smp_ipi_mtx, MA_OWNED);
+ if (!(read_rflags() & PSL_I))
+ panic("%s: interrupts disabled", __func__);
+ mtx_lock_spin(&smp_ipi_mtx);
smp_tlb_addr1 = addr1;
smp_tlb_addr2 = addr2;
atomic_store_rel_int(&smp_tlb_wait, 0);
ipi_all_but_self(vector);
while (smp_tlb_wait < ncpu)
ia32_pause();
+ mtx_unlock_spin(&smp_ipi_mtx);
}
static void
@@ -869,7 +873,9 @@
if (ncpu < 1)
return;
}
- mtx_assert(&smp_ipi_mtx, MA_OWNED);
+ if (!(read_rflags() & PSL_I))
+ panic("%s: interrupts disabled", __func__);
+ mtx_lock_spin(&smp_ipi_mtx);
smp_tlb_addr1 = addr1;
smp_tlb_addr2 = addr2;
atomic_store_rel_int(&smp_tlb_wait, 0);
@@ -879,6 +885,7 @@
ipi_selected(mask, vector);
while (smp_tlb_wait < ncpu)
ia32_pause();
+ mtx_unlock_spin(&smp_ipi_mtx);
}
void
==== //depot/projects/smpng/sys/amd64/amd64/mptable.c#10 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/mptable.c,v 1.237 2005/10/31 15:41:17 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/mptable.c,v 1.238 2007/03/05 20:35:16 jhb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -323,7 +323,7 @@
lapic_init(DEFAULT_APIC_BASE);
printf("Default Configuration %d", mpfps->config_type);
} else {
- lapic_init((uintptr_t)mpct->apic_address);
+ lapic_init(mpct->apic_address);
printf("%.*s %.*s", (int)sizeof(mpct->oem_id), mpct->oem_id,
(int)sizeof(mpct->product_id), mpct->product_id);
}
@@ -514,8 +514,8 @@
if (ioapics[apic->apic_id] != NULL)
panic("%s: Double APIC ID %d", __func__,
apic->apic_id);
- ioapics[apic->apic_id] = ioapic_create(
- (uintptr_t)apic->apic_address, apic->apic_id, -1);
+ ioapics[apic->apic_id] = ioapic_create(apic->apic_address,
+ apic->apic_id, -1);
break;
default:
break;
==== //depot/projects/smpng/sys/amd64/amd64/pmap.c#72 (text+ko) ====
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.579 2007/02/19 10:55:16 kib Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.580 2007/03/05 21:40:10 alc Exp $");
/*
* Manages physical address maps.
@@ -752,18 +752,7 @@
u_int cpumask;
u_int other_cpus;
- if (smp_started) {
- if (!(read_rflags() & PSL_I))
- panic("%s: interrupts disabled", __func__);
- mtx_lock_spin(&smp_ipi_mtx);
- } else
- critical_enter();
- /*
- * We need to disable interrupt preemption but MUST NOT have
- * interrupts disabled here.
- * XXX we may need to hold schedlock to get a coherent pm_active
- * XXX critical sections disable interrupts again
- */
+ sched_pin();
if (pmap == kernel_pmap || pmap->pm_active == all_cpus) {
invlpg(va);
smp_invlpg(va);
@@ -775,10 +764,7 @@
if (pmap->pm_active & other_cpus)
smp_masked_invlpg(pmap->pm_active & other_cpus, va);
}
- if (smp_started)
- mtx_unlock_spin(&smp_ipi_mtx);
- else
- critical_exit();
+ sched_unpin();
}
void
@@ -788,18 +774,7 @@
u_int other_cpus;
vm_offset_t addr;
- if (smp_started) {
- if (!(read_rflags() & PSL_I))
- panic("%s: interrupts disabled", __func__);
- mtx_lock_spin(&smp_ipi_mtx);
- } else
- critical_enter();
- /*
- * We need to disable interrupt preemption but MUST NOT have
- * interrupts disabled here.
- * XXX we may need to hold schedlock to get a coherent pm_active
- * XXX critical sections disable interrupts again
- */
+ sched_pin();
if (pmap == kernel_pmap || pmap->pm_active == all_cpus) {
for (addr = sva; addr < eva; addr += PAGE_SIZE)
invlpg(addr);
@@ -814,10 +789,7 @@
smp_masked_invlpg_range(pmap->pm_active & other_cpus,
sva, eva);
}
- if (smp_started)
- mtx_unlock_spin(&smp_ipi_mtx);
- else
- critical_exit();
+ sched_unpin();
}
void
@@ -826,18 +798,7 @@
u_int cpumask;
u_int other_cpus;
- if (smp_started) {
- if (!(read_rflags() & PSL_I))
- panic("%s: interrupts disabled", __func__);
- mtx_lock_spin(&smp_ipi_mtx);
- } else
- critical_enter();
- /*
- * We need to disable interrupt preemption but MUST NOT have
- * interrupts disabled here.
- * XXX we may need to hold schedlock to get a coherent pm_active
- * XXX critical sections disable interrupts again
- */
+ sched_pin();
if (pmap == kernel_pmap || pmap->pm_active == all_cpus) {
invltlb();
smp_invltlb();
@@ -849,34 +810,17 @@
if (pmap->pm_active & other_cpus)
smp_masked_invltlb(pmap->pm_active & other_cpus);
}
- if (smp_started)
- mtx_unlock_spin(&smp_ipi_mtx);
- else
- critical_exit();
+ sched_unpin();
}
void
pmap_invalidate_cache(void)
{
- if (smp_started) {
- if (!(read_rflags() & PSL_I))
- panic("%s: interrupts disabled", __func__);
- mtx_lock_spin(&smp_ipi_mtx);
- } else
- critical_enter();
- /*
- * We need to disable interrupt preemption but MUST NOT have
- * interrupts disabled here.
- * XXX we may need to hold schedlock to get a coherent pm_active
- * XXX critical sections disable interrupts again
- */
+ sched_pin();
wbinvd();
smp_cache_flush();
- if (smp_started)
- mtx_unlock_spin(&smp_ipi_mtx);
- else
- critical_exit();
+ sched_unpin();
}
#else /* !SMP */
/*
==== //depot/projects/smpng/sys/amd64/include/apicvar.h#16 (text+ko) ====
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/amd64/include/apicvar.h,v 1.21 2006/12/17 06:48:40 kmacy Exp $
+ * $FreeBSD: src/sys/amd64/include/apicvar.h,v 1.22 2007/03/05 20:35:16 jhb Exp $
*/
#ifndef _MACHINE_APICVAR_H_
@@ -180,7 +180,7 @@
void apic_free_vector(u_int vector, u_int irq);
u_int apic_idt_to_irq(u_int vector);
void apic_register_enumerator(struct apic_enumerator *enumerator);
-void *ioapic_create(uintptr_t addr, int32_t id, int intbase);
+void *ioapic_create(vm_paddr_t addr, int32_t apic_id, int intbase);
int ioapic_disable_pin(void *cookie, u_int pin);
int ioapic_get_vector(void *cookie, u_int pin);
void ioapic_register(void *cookie);
@@ -197,7 +197,7 @@
void lapic_dump(const char *str);
void lapic_eoi(void);
int lapic_id(void);
-void lapic_init(uintptr_t addr);
+void lapic_init(vm_paddr_t addr);
int lapic_intr_pending(u_int vector);
void lapic_ipi_raw(register_t icrlo, u_int dest);
void lapic_ipi_vectored(u_int vector, int dest);
==== //depot/projects/smpng/sys/amd64/include/intr_machdep.h#14 (text+ko) ====
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/amd64/include/intr_machdep.h,v 1.15 2007/02/23 12:18:26 piso Exp $
+ * $FreeBSD: src/sys/amd64/include/intr_machdep.h,v 1.16 2007/03/06 17:16:46 jhb Exp $
*/
#ifndef __MACHINE_INTR_MACHDEP_H__
@@ -131,9 +131,7 @@
void elcr_resume(void);
void elcr_write_trigger(u_int irq, enum intr_trigger trigger);
#ifdef SMP
-void intr_add_cpu(u_int apic_id);
-#else
-#define intr_add_cpu(apic_id)
+void intr_add_cpu(u_int cpu);
#endif
int intr_add_handler(const char *name, int vector, driver_filter_t filter,
driver_intr_t handler, void *arg, enum intr_type flags,
==== //depot/projects/smpng/sys/amd64/include/smp.h#14 (text+ko) ====
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $FreeBSD: src/sys/amd64/include/smp.h,v 1.88 2006/05/01 21:36:47 jhb Exp $
+ * $FreeBSD: src/sys/amd64/include/smp.h,v 1.89 2007/03/06 17:16:46 jhb Exp $
*
*/
@@ -34,6 +34,7 @@
extern int boot_cpu_id;
extern struct pcb stoppcbs[];
extern struct mtx smp_tlb_mtx;
+extern int cpu_apic_ids[];
/* IPI handlers */
inthand_t
==== //depot/projects/smpng/sys/amd64/linux32/linux.h#11 (text+ko) ====
@@ -8,7 +8,7 @@
* 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
+ * notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
@@ -27,11 +27,11 @@
* (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: src/sys/amd64/linux32/linux.h,v 1.13 2007/02/24 16:49:24 netchild Exp $
+ * $FreeBSD: src/sys/amd64/linux32/linux.h,v 1.14 2007/03/02 00:08:47 jkim Exp $
*/
-#ifndef _AMD64_LINUX_LINUX_H_
-#define _AMD64_LINUX_LINUX_H_
+#ifndef _AMD64_LINUX_H_
+#define _AMD64_LINUX_H_
#include <amd64/linux32/linux32_syscall.h>
@@ -39,20 +39,20 @@
* debugging support
*/
extern u_char linux_debug_map[];
-#define ldebug(name) isclr(linux_debug_map, LINUX_SYS_linux_ ## name)
-#define ARGS(nm, fmt) "linux(%ld): "#nm"("fmt")\n", (long)td->td_proc->p_pid
-#define LMSG(fmt) "linux(%ld): "fmt"\n", (long)td->td_proc->p_pid
+#define ldebug(name) isclr(linux_debug_map, LINUX_SYS_linux_ ## name)
+#define ARGS(nm, fmt) "linux(%ld): "#nm"("fmt")\n", (long)td->td_proc->p_pid
+#define LMSG(fmt) "linux(%ld): "fmt"\n", (long)td->td_proc->p_pid
#ifdef MALLOC_DECLARE
MALLOC_DECLARE(M_LINUX);
#endif
-#define LINUX32_USRSTACK ((1ul << 32) - PAGE_SIZE)
+#define LINUX32_USRSTACK ((1ul << 32) - PAGE_SIZE)
/* XXX 16 = sizeof(linux32_ps_strings) */
-#define LINUX32_PS_STRINGS (LINUX32_USRSTACK - 16)
-#define LINUX32_MAXDSIZ (512*1024*1024) /* 512MB */
-#define LINUX32_MAXSSIZ (64*1024*1024) /* 64MB */
-#define LINUX32_MAXVMEM 0 /* Unlimited */
+#define LINUX32_PS_STRINGS (LINUX32_USRSTACK - 16)
+#define LINUX32_MAXDSIZ (512 * 1024 * 1024) /* 512MB */
+#define LINUX32_MAXSSIZ (64 * 1024 * 1024) /* 64MB */
+#define LINUX32_MAXVMEM 0 /* Unlimited */
#define PTRIN(v) (void *)(uintptr_t)(v)
#define PTROUT(v) (l_uintptr_t)(uintptr_t)(v)
@@ -132,7 +132,7 @@
#define LINUX_RLIMIT_NPROC 6
#define LINUX_RLIMIT_NOFILE 7
#define LINUX_RLIMIT_MEMLOCK 8
-#define LINUX_RLIMIT_AS 9 /* address space limit */
+#define LINUX_RLIMIT_AS 9 /* Address space limit */
#define LINUX_RLIM_NLIMITS 10
@@ -205,21 +205,21 @@
} __packed;
struct l_stat {
- l_ushort st_dev;
- l_ulong st_ino;
- l_ushort st_mode;
- l_ushort st_nlink;
- l_ushort st_uid;
- l_ushort st_gid;
- l_ushort st_rdev;
- l_long st_size;
- struct l_timespec st_atimespec;
- struct l_timespec st_mtimespec;
- struct l_timespec st_ctimespec;
- l_long st_blksize;
- l_long st_blocks;
- l_ulong st_flags;
- l_ulong st_gen;
+ l_ushort st_dev;
+ l_ulong st_ino;
+ l_ushort st_mode;
+ l_ushort st_nlink;
+ l_ushort st_uid;
+ l_ushort st_gid;
+ l_ushort st_rdev;
+ l_long st_size;
+ struct l_timespec st_atimespec;
+ struct l_timespec st_mtimespec;
+ struct l_timespec st_ctimespec;
+ l_long st_blksize;
+ l_long st_blocks;
+ l_ulong st_flags;
+ l_ulong st_gen;
};
struct l_stat64 {
@@ -315,9 +315,9 @@
#define LINUX_SIGADDSET(set, sig) SIGADDSET(set, sig)
/* sigaltstack */
-#define LINUX_MINSIGSTKSZ 2048
-#define LINUX_SS_ONSTACK 1
-#define LINUX_SS_DISABLE 2
+#define LINUX_MINSIGSTKSZ 2048
+#define LINUX_SS_ONSTACK 1
+#define LINUX_SS_DISABLE 2
int linux_to_bsd_sigaltstack(int lsa);
int bsd_to_linux_sigaltstack(int bsa);
@@ -380,11 +380,11 @@
l_uintptr_t uc_link;
l_stack_t uc_stack;
struct l_sigcontext uc_mcontext;
- l_sigset_t uc_sigmask;
+ l_sigset_t uc_sigmask;
} __packed;
-#define LINUX_SI_MAX_SIZE 128
-#define LINUX_SI_PAD_SIZE ((LINUX_SI_MAX_SIZE/sizeof(l_int)) - 3)
+#define LINUX_SI_MAX_SIZE 128
+#define LINUX_SI_PAD_SIZE ((LINUX_SI_MAX_SIZE/sizeof(l_int)) - 3)
union l_sigval {
l_int sival_int;
@@ -423,41 +423,41 @@
} __packed _sigchld;
struct {
- l_uintptr_t _addr; /* faulting insn/memory ref. */
+ l_uintptr_t _addr; /* Faulting insn/memory ref. */
} __packed _sigfault;
struct {
- l_int _band; /* POLL_IN,POLL_OUT,POLL_MSG */
+ l_int _band; /* POLL_IN,POLL_OUT,POLL_MSG */
l_int _fd;
} __packed _sigpoll;
} _sifields;
} __packed l_siginfo_t;
-#define lsi_pid _sifields._kill._pid
-#define lsi_uid _sifields._kill._uid
-#define lsi_status _sifields._sigchld._status
-#define lsi_utime _sifields._sigchld._utime
-#define lsi_stime _sifields._sigchld._stime
-#define lsi_value _sifields._rt._sigval
-#define lsi_int _sifields._rt._sigval.sival_int
-#define lsi_ptr _sifields._rt._sigval.sival_ptr
-#define lsi_addr _sifields._sigfault._addr
-#define lsi_band _sifields._sigpoll._band
-#define lsi_fd _sifields._sigpoll._fd
+#define lsi_pid _sifields._kill._pid
+#define lsi_uid _sifields._kill._uid
+#define lsi_status _sifields._sigchld._status
+#define lsi_utime _sifields._sigchld._utime
+#define lsi_stime _sifields._sigchld._stime
+#define lsi_value _sifields._rt._sigval
+#define lsi_int _sifields._rt._sigval.sival_int
+#define lsi_ptr _sifields._rt._sigval.sival_ptr
+#define lsi_addr _sifields._sigfault._addr
+#define lsi_band _sifields._sigpoll._band
+#define lsi_fd _sifields._sigpoll._fd
struct l_fpreg {
- u_int16_t significand[4];
- u_int16_t exponent;
+ u_int16_t significand[4];
+ u_int16_t exponent;
} __packed;
struct l_fpxreg {
- u_int16_t significand[4];
- u_int16_t exponent;
- u_int16_t padding[3];
+ u_int16_t significand[4];
+ u_int16_t exponent;
+ u_int16_t padding[3];
} __packed;
struct l_xmmreg {
- u_int32_t element[4];
+ u_int32_t element[4];
} __packed;
struct l_fpstate {
@@ -471,13 +471,13 @@
u_int32_t datasel;
struct l_fpreg _st[8];
u_int16_t status;
- u_int16_t magic; /* 0xffff = regular FPU data */
+ u_int16_t magic; /* 0xffff = regular FPU data */
/* FXSR FPU environment */
- u_int32_t _fxsr_env[6]; /* env is ignored */
+ u_int32_t _fxsr_env[6]; /* env is ignored. */
u_int32_t mxcsr;
u_int32_t reserved;
- struct l_fpxreg _fxsr_st[8]; /* reg data is ignored */
+ struct l_fpxreg _fxsr_st[8]; /* reg data is ignored. */
struct l_xmmreg _xmm[8];
u_int32_t padding[56];
} __packed;
@@ -528,22 +528,22 @@
/*
* open/fcntl flags
*/
-#define LINUX_O_RDONLY 00
-#define LINUX_O_WRONLY 01
-#define LINUX_O_RDWR 02
-#define LINUX_O_CREAT 0100
-#define LINUX_O_EXCL 0200
-#define LINUX_O_NOCTTY 0400
-#define LINUX_O_TRUNC 01000
-#define LINUX_O_APPEND 02000
-#define LINUX_O_NONBLOCK 04000
+#define LINUX_O_RDONLY 00000000
+#define LINUX_O_WRONLY 00000001
+#define LINUX_O_RDWR 00000002
+#define LINUX_O_CREAT 00000100
+#define LINUX_O_EXCL 00000200
+#define LINUX_O_NOCTTY 00000400
+#define LINUX_O_TRUNC 00001000
+#define LINUX_O_APPEND 00002000
+#define LINUX_O_NONBLOCK 00004000
#define LINUX_O_NDELAY LINUX_O_NONBLOCK
-#define LINUX_O_SYNC 010000
-#define LINUX_FASYNC 020000
-#define LINUX_O_DIRECT 040000 /* direct disk access hint */
-#define LINUX_O_LARGEFILE 0100000
-#define LINUX_O_DIRECTORY 0200000 /* must be a directory */
-#define LINUX_O_NOFOLLOW 0400000 /* don't follow links */
+#define LINUX_O_SYNC 00010000
+#define LINUX_FASYNC 00020000
+#define LINUX_O_DIRECT 00040000 /* Direct disk access hint */
+#define LINUX_O_LARGEFILE 00100000
+#define LINUX_O_DIRECTORY 00200000 /* Must be a directory */
+#define LINUX_O_NOFOLLOW 00400000 /* Do not follow links */
#define LINUX_O_NOATIME 01000000
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list