Date: Mon, 7 Feb 2005 19:51:34 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 70540 for review Message-ID: <200502071951.j17JpYeW034901@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=70540 Change 70540 by jhb@jhb_slimer on 2005/02/07 19:51:24 IFC @70538. Affected files ... .. //depot/projects/smpng/sys/alpha/alpha/machdep.c#77 integrate .. //depot/projects/smpng/sys/alpha/include/cpuconf.h#4 integrate .. //depot/projects/smpng/sys/alpha/isa/isa_dma.c#8 integrate .. //depot/projects/smpng/sys/alpha/pci/lca.c#7 integrate .. //depot/projects/smpng/sys/alpha/pci/lcareg.h#3 integrate .. //depot/projects/smpng/sys/amd64/amd64/legacy.c#6 integrate .. //depot/projects/smpng/sys/amd64/amd64/machdep.c#35 integrate .. //depot/projects/smpng/sys/amd64/amd64/pmap.c#41 integrate .. //depot/projects/smpng/sys/amd64/conf/NOTES#11 integrate .. //depot/projects/smpng/sys/amd64/isa/isa_dma.c#8 integrate .. //depot/projects/smpng/sys/arm/arm/machdep.c#9 integrate .. //depot/projects/smpng/sys/arm/include/cpu.h#4 integrate .. //depot/projects/smpng/sys/bsm/audit_kevents.h#1 branch .. //depot/projects/smpng/sys/coda/coda_vnops.c#21 integrate .. //depot/projects/smpng/sys/compat/linux/linux_ipc.c#19 integrate .. //depot/projects/smpng/sys/compat/linux/linux_misc.c#53 integrate .. //depot/projects/smpng/sys/compat/linux/linux_stats.c#22 integrate .. //depot/projects/smpng/sys/compat/linux/linux_util.c#13 integrate .. //depot/projects/smpng/sys/conf/Makefile.powerpc#26 integrate .. //depot/projects/smpng/sys/conf/NOTES#92 integrate .. //depot/projects/smpng/sys/conf/files#135 integrate .. //depot/projects/smpng/sys/conf/files.i386#75 integrate .. //depot/projects/smpng/sys/conf/files.pc98#70 integrate .. //depot/projects/smpng/sys/conf/kmod.mk#42 integrate .. //depot/projects/smpng/sys/conf/options#93 integrate .. //depot/projects/smpng/sys/conf/options.pc98#44 integrate .. //depot/projects/smpng/sys/contrib/dev/oltr/if_oltr.c#12 integrate .. //depot/projects/smpng/sys/contrib/dev/oltr/if_oltr_isa.c#1 branch .. //depot/projects/smpng/sys/contrib/dev/oltr/if_oltr_pci.c#1 branch .. //depot/projects/smpng/sys/contrib/dev/oltr/if_oltrvar.h#1 branch .. //depot/projects/smpng/sys/dev/acpica/acpi.c#78 integrate .. //depot/projects/smpng/sys/dev/acpica/acpi_cpu.c#30 integrate .. //depot/projects/smpng/sys/dev/acpica/acpi_package.c#4 integrate .. //depot/projects/smpng/sys/dev/acpica/acpi_perf.c#1 branch .. //depot/projects/smpng/sys/dev/acpica/acpi_throttle.c#1 branch .. //depot/projects/smpng/sys/dev/acpica/acpivar.h#51 integrate .. //depot/projects/smpng/sys/dev/ata/ata-all.c#66 integrate .. //depot/projects/smpng/sys/dev/cardbus/cardbus.c#23 integrate .. //depot/projects/smpng/sys/dev/cardbus/cardbus_cis.c#23 integrate .. //depot/projects/smpng/sys/dev/cardbus/cardbus_cis.h#8 integrate .. //depot/projects/smpng/sys/dev/cardbus/cardbusvar.h#9 integrate .. //depot/projects/smpng/sys/dev/cpufreq/ichss.c#1 branch .. //depot/projects/smpng/sys/dev/em/if_em.c#44 integrate .. //depot/projects/smpng/sys/dev/fe/mb86960.h#1 branch .. //depot/projects/smpng/sys/dev/hme/if_hme.c#21 integrate .. //depot/projects/smpng/sys/dev/ic/i8237.h#2 integrate .. //depot/projects/smpng/sys/dev/ieee488/ibfoo_int.h#1 branch .. //depot/projects/smpng/sys/dev/ieee488/pcii.c#1 branch .. //depot/projects/smpng/sys/dev/ieee488/ugpib.h#1 branch .. //depot/projects/smpng/sys/dev/ieee488/upd7210.c#1 branch .. //depot/projects/smpng/sys/dev/ieee488/upd7210.h#1 branch .. //depot/projects/smpng/sys/dev/ncv/ncr53c500_pccard.c#16 integrate .. //depot/projects/smpng/sys/dev/nsp/nsp_pccard.c#13 integrate .. //depot/projects/smpng/sys/dev/owi/if_owi_pccard.c#4 integrate .. //depot/projects/smpng/sys/dev/pccard/pccarddevs#42 integrate .. //depot/projects/smpng/sys/dev/pci/pci.c#51 integrate .. //depot/projects/smpng/sys/dev/random/probe.c#2 integrate .. //depot/projects/smpng/sys/dev/ray/if_ray.c#18 integrate .. //depot/projects/smpng/sys/dev/sio/sio.c#52 integrate .. //depot/projects/smpng/sys/dev/sound/pci/cmi.c#24 integrate .. //depot/projects/smpng/sys/dev/sound/pci/maestro.c#14 integrate .. //depot/projects/smpng/sys/dev/streams/streams.c#22 integrate .. //depot/projects/smpng/sys/dev/usb/hid.c#9 integrate .. //depot/projects/smpng/sys/dev/vx/if_vx.c#18 integrate .. //depot/projects/smpng/sys/dev/wi/if_wi_pccard.c#32 integrate .. //depot/projects/smpng/sys/fs/nullfs/null_vnops.c#20 integrate .. //depot/projects/smpng/sys/fs/unionfs/union_subr.c#24 integrate .. //depot/projects/smpng/sys/fs/unionfs/union_vnops.c#24 integrate .. //depot/projects/smpng/sys/geom/gate/g_gate.c#9 integrate .. //depot/projects/smpng/sys/i386/conf/NOTES#95 integrate .. //depot/projects/smpng/sys/i386/conf/PAE#11 integrate .. //depot/projects/smpng/sys/i386/i386/legacy.c#9 integrate .. //depot/projects/smpng/sys/i386/i386/machdep.c#88 integrate .. //depot/projects/smpng/sys/i386/i386/p4tcc.c#5 integrate .. //depot/projects/smpng/sys/i386/i386/pmap.c#81 integrate .. //depot/projects/smpng/sys/i386/isa/clock.c#37 integrate .. //depot/projects/smpng/sys/i386/isa/isa_dma.c#10 integrate .. //depot/projects/smpng/sys/i386/linux/linux_machdep.c#29 integrate .. //depot/projects/smpng/sys/i386/linux/linux_sysvec.c#43 integrate .. //depot/projects/smpng/sys/ia64/conf/NOTES#5 integrate .. //depot/projects/smpng/sys/ia64/ia64/machdep.c#90 integrate .. //depot/projects/smpng/sys/ia64/isa/isa_dma.c#7 integrate .. //depot/projects/smpng/sys/isa/isavar.h#8 integrate .. //depot/projects/smpng/sys/kern/cpufreq_if.m#1 branch .. //depot/projects/smpng/sys/kern/kern_cpu.c#1 branch .. //depot/projects/smpng/sys/kern/kern_descrip.c#77 integrate .. //depot/projects/smpng/sys/kern/kern_idle.c#24 integrate .. //depot/projects/smpng/sys/kern/kern_mbuf.c#4 integrate .. //depot/projects/smpng/sys/kern/kern_sysctl.c#45 integrate .. //depot/projects/smpng/sys/kern/kern_time.c#32 integrate .. //depot/projects/smpng/sys/kern/kern_timeout.c#23 integrate .. //depot/projects/smpng/sys/kern/sched_ule.c#51 integrate .. //depot/projects/smpng/sys/kern/sysv_msg.c#27 integrate .. //depot/projects/smpng/sys/kern/vfs_bio.c#74 integrate .. //depot/projects/smpng/sys/kern/vfs_default.c#36 integrate .. //depot/projects/smpng/sys/kern/vfs_lookup.c#24 integrate .. //depot/projects/smpng/sys/kern/vfs_mount.c#45 integrate .. //depot/projects/smpng/sys/kern/vfs_subr.c#96 integrate .. //depot/projects/smpng/sys/kern/vfs_syscalls.c#83 integrate .. //depot/projects/smpng/sys/kern/vnode_if.src#23 integrate .. //depot/projects/smpng/sys/libkern/gets.c#1 branch .. //depot/projects/smpng/sys/libkern/strlcat.c#4 integrate .. //depot/projects/smpng/sys/libkern/strlcpy.c#4 integrate .. //depot/projects/smpng/sys/modules/Makefile#90 integrate .. //depot/projects/smpng/sys/modules/acpi/Makefile#25 integrate .. //depot/projects/smpng/sys/modules/acpi/acpi_perf/Makefile#1 branch .. //depot/projects/smpng/sys/modules/cpufreq/Makefile#1 branch .. //depot/projects/smpng/sys/modules/netgraph/Makefile#19 integrate .. //depot/projects/smpng/sys/modules/netgraph/ipfw/Makefile#1 branch .. //depot/projects/smpng/sys/modules/oltr/Makefile#5 integrate .. //depot/projects/smpng/sys/net80211/ieee80211_output.c#11 integrate .. //depot/projects/smpng/sys/netgraph/atm/ng_atm.c#11 integrate .. //depot/projects/smpng/sys/netgraph/netflow/netflow.c#5 integrate .. //depot/projects/smpng/sys/netgraph/ng_device.c#14 integrate .. //depot/projects/smpng/sys/netgraph/ng_eiface.c#16 integrate .. //depot/projects/smpng/sys/netgraph/ng_eiface.h#6 integrate .. //depot/projects/smpng/sys/netgraph/ng_ether.c#22 integrate .. //depot/projects/smpng/sys/netgraph/ng_fec.c#12 integrate .. //depot/projects/smpng/sys/netgraph/ng_gif.c#12 integrate .. //depot/projects/smpng/sys/netgraph/ng_iface.c#19 integrate .. //depot/projects/smpng/sys/netgraph/ng_iface.h#6 integrate .. //depot/projects/smpng/sys/netgraph/ng_ipfw.c#1 branch .. //depot/projects/smpng/sys/netgraph/ng_ipfw.h#1 branch .. //depot/projects/smpng/sys/netgraph/ng_message.h#11 integrate .. //depot/projects/smpng/sys/netgraph/ng_sample.c#11 integrate .. //depot/projects/smpng/sys/netgraph/ng_socket.c#28 integrate .. //depot/projects/smpng/sys/netgraph/ng_sppp.c#6 integrate .. //depot/projects/smpng/sys/netgraph/ng_sppp.h#3 integrate .. //depot/projects/smpng/sys/netinet/ip_fw.h#27 integrate .. //depot/projects/smpng/sys/netinet/ip_fw2.c#49 integrate .. //depot/projects/smpng/sys/netinet/ip_fw_pfil.c#11 integrate .. //depot/projects/smpng/sys/netinet/tcp_subr.c#64 integrate .. //depot/projects/smpng/sys/netinet/tcp_usrreq.c#37 integrate .. //depot/projects/smpng/sys/netinet/tcp_var.h#33 integrate .. //depot/projects/smpng/sys/netinet6/raw_ip6.c#32 integrate .. //depot/projects/smpng/sys/nfsclient/nfs_nfsiod.c#16 integrate .. //depot/projects/smpng/sys/pc98/i386/machdep.c#76 integrate .. //depot/projects/smpng/sys/pc98/pc98/isa_dma.c#8 integrate .. //depot/projects/smpng/sys/pc98/pc98/sio.c#50 integrate .. //depot/projects/smpng/sys/powerpc/include/atomic.h#5 integrate .. //depot/projects/smpng/sys/powerpc/include/bus.h#15 integrate .. //depot/projects/smpng/sys/powerpc/include/hid.h#3 integrate .. //depot/projects/smpng/sys/powerpc/include/spr.h#6 integrate .. //depot/projects/smpng/sys/powerpc/powerpc/clock.c#15 integrate .. //depot/projects/smpng/sys/powerpc/powerpc/cpu.c#5 integrate .. //depot/projects/smpng/sys/powerpc/powerpc/machdep.c#58 integrate .. //depot/projects/smpng/sys/sparc64/isa/isa_dma.c#2 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/machdep.c#72 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/pmap.c#57 integrate .. //depot/projects/smpng/sys/sys/callout.h#9 integrate .. //depot/projects/smpng/sys/sys/cpu.h#1 branch .. //depot/projects/smpng/sys/sys/file.h#22 integrate .. //depot/projects/smpng/sys/sys/kernel.h#30 integrate .. //depot/projects/smpng/sys/sys/libkern.h#16 integrate .. //depot/projects/smpng/sys/sys/param.h#77 integrate .. //depot/projects/smpng/sys/sys/syscallsubr.h#16 integrate .. //depot/projects/smpng/sys/sys/sysctl.h#33 integrate .. //depot/projects/smpng/sys/sys/systm.h#61 integrate .. //depot/projects/smpng/sys/sys/vnode.h#57 integrate .. //depot/projects/smpng/sys/ufs/ffs/ffs_softdep.c#40 integrate .. //depot/projects/smpng/sys/ufs/ufs/ufs_vnops.c#47 integrate .. //depot/projects/smpng/sys/vm/vm_zeroidle.c#25 integrate Differences ... ==== //depot/projects/smpng/sys/alpha/alpha/machdep.c#77 (text+ko) ==== @@ -88,7 +88,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/alpha/alpha/machdep.c,v 1.228 2005/01/05 20:05:49 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/alpha/alpha/machdep.c,v 1.232 2005/02/06 01:55:06 njl Exp $"); #include "opt_compat.h" #include "opt_ddb.h" @@ -97,60 +97,63 @@ #include "opt_maxmem.h" #include <sys/param.h> +#include <sys/proc.h> #include <sys/systm.h> +#include <sys/bio.h> +#include <sys/buf.h> +#include <sys/bus.h> +#include <sys/cons.h> +#include <sys/cpu.h> #include <sys/eventhandler.h> +#include <sys/exec.h> #include <sys/imgact.h> #include <sys/kdb.h> -#include <sys/sysproto.h> +#include <sys/kernel.h> #include <sys/ktr.h> -#include <sys/signalvar.h> -#include <sys/kernel.h> -#include <sys/proc.h> +#include <sys/linker.h> #include <sys/lock.h> +#include <sys/malloc.h> +#include <sys/mbuf.h> +#include <sys/msgbuf.h> #include <sys/mutex.h> #include <sys/pcpu.h> -#include <sys/malloc.h> +#include <sys/ptrace.h> #include <sys/reboot.h> -#include <sys/bio.h> -#include <sys/buf.h> -#include <sys/bus.h> -#include <sys/cons.h> -#include <sys/mbuf.h> -#include <sys/vmmeter.h> -#include <sys/msgbuf.h> -#include <sys/exec.h> +#include <sys/signalvar.h> #include <sys/smp.h> #include <sys/sysctl.h> +#include <sys/sysproto.h> +#include <sys/ucontext.h> #include <sys/uio.h> -#include <sys/linker.h> -#include <sys/cons.h> +#include <sys/vmmeter.h> +#include <sys/vnode.h> + #include <net/netisr.h> + #include <vm/vm.h> +#include <vm/vm_extern.h> #include <vm/vm_kern.h> #include <vm/vm_page.h> #include <vm/vm_map.h> -#include <vm/vm_extern.h> #include <vm/vm_object.h> #include <vm/vm_pager.h> -#include <sys/ptrace.h> -#include <sys/ucontext.h> + +#include <machine/bootinfo.h> +#include <machine/chipset.h> #include <machine/clock.h> +#include <machine/cpuconf.h> +#include <machine/elf.h> +#include <machine/fpu.h> #include <machine/md_var.h> -#include <machine/fpu.h> #include <machine/pal.h> -#include <machine/cpuconf.h> -#include <machine/bootinfo.h> #include <machine/pcb.h> +#include <machine/prom.h> #include <machine/rpb.h> -#include <machine/prom.h> -#include <machine/chipset.h> +#include <machine/sigframe.h> #include <machine/vmparam.h> -#include <machine/elf.h> + #include <alpha/alpha/db_instruction.h> -#include <sys/vnode.h> -#include <machine/sigframe.h> - u_int64_t cycles_per_usec; u_int32_t cycles_per_sec; int cold = 1; @@ -1718,6 +1721,14 @@ { } +/* Get current clock frequency for the given cpu id. */ +int +cpu_est_clockrate(int cpu_id, uint64_t *rate) +{ + + return (ENXIO); +} + /* * Shutdown the CPU as much as possible */ @@ -1727,10 +1738,18 @@ prom_halt(1); } +static int cpu_idle_hlt = 1; +SYSCTL_INT(_machdep, OID_AUTO, cpu_idle_hlt, CTLFLAG_RW, + &cpu_idle_hlt, 0, "Idle loop HLT enable"); + +/* + * call platform specific code to halt (until next interrupt) for the idle loop + */ void cpu_idle(void) { - /* Insert code to halt (until next interrupt) for the idle loop */ + if (cpu_idle_hlt && platform.cpu_idle != NULL) + platform.cpu_idle(); } /* ==== //depot/projects/smpng/sys/alpha/include/cpuconf.h#4 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/alpha/include/cpuconf.h,v 1.13 2005/01/05 20:05:50 imp Exp $ */ +/* $FreeBSD: src/sys/alpha/include/cpuconf.h,v 1.14 2005/01/31 23:07:42 ticso Exp $ */ /* $NetBSD: cpuconf.h,v 1.7 1997/11/06 00:42:03 thorpej Exp $ */ #ifndef _ALPHA_CPUCONF_H #define _ALPHA_CPUCONF_H @@ -71,6 +71,7 @@ void (*clockintr)(void *); void (*mcheck_handler)(unsigned long, struct trapframe *, unsigned long, unsigned long); + void (*cpu_idle)(void); void (*pci_intr_init)(void); void (*pci_intr_map)(void *); int (*pci_intr_route)(struct device *, struct device *, int); ==== //depot/projects/smpng/sys/alpha/isa/isa_dma.c#8 (text+ko) ==== @@ -44,7 +44,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/alpha/isa/isa_dma.c,v 1.12 2004/09/15 12:09:49 phk Exp $"); +__FBSDID("$FreeBSD: src/sys/alpha/isa/isa_dma.c,v 1.13 2005/02/06 13:46:38 phk Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -60,24 +60,6 @@ #include <dev/ic/i8237.h> #include <machine/bus.h> -/* -** Register definitions for DMA controller 1 (channels 0..3): -*/ -#define DMA1_CHN(c) (IO_DMA1 + 1*(2*(c))) /* addr reg for channel c */ -#define DMA1_SMSK (IO_DMA1 + 1*10) /* single mask register */ -#define DMA1_MODE (IO_DMA1 + 1*11) /* mode register */ -#define DMA1_FFC (IO_DMA1 + 1*12) /* clear first/last FF */ -#define DMA1_RESET (IO_DMA1 + 1*13) /* reset */ - -/* -** Register definitions for DMA controller 2 (channels 4..7): -*/ -#define DMA2_CHN(c) (IO_DMA2 + 2*(2*(c))) /* addr reg for channel c */ -#define DMA2_SMSK (IO_DMA2 + 2*10) /* single mask register */ -#define DMA2_MODE (IO_DMA2 + 2*11) /* mode register */ -#define DMA2_FFC (IO_DMA2 + 2*12) /* clear first/last FF */ -#define DMA2_RESET (IO_DMA2 + 2*13) /* reset */ - static bus_dma_tag_t dma_tag[8]; static bus_dmamap_t dma_map[8]; static u_int8_t dma_busy = 0; /* Used in isa_dmastart() */ @@ -487,6 +469,19 @@ } /* + * Reached terminal count yet ? + */ +int +isa_dmatc(int chan) +{ + + if (chan < 4) + return(inb(DMA1_STATUS) & (1 << chan)); + else + return(inb(DMA2_STATUS) & (1 << (chan & 3))); +} + +/* * Stop a DMA transfer currently in progress. */ int ==== //depot/projects/smpng/sys/alpha/pci/lca.c#7 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/alpha/pci/lca.c,v 1.20 2003/08/17 06:42:08 marcel Exp $"); +__FBSDID("$FreeBSD: src/sys/alpha/pci/lca.c,v 1.21 2005/01/31 23:07:42 ticso Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -35,6 +35,8 @@ #include <sys/bus.h> #include <machine/bus.h> #include <sys/rman.h> +#include <sys/proc.h> +#include <sys/sched.h> #include <alpha/pci/lcareg.h> #include <alpha/pci/lcavar.h> @@ -222,6 +224,8 @@ lca_machine_check(unsigned long mces, struct trapframe *framep, unsigned long vector, unsigned long param); +static void lca_cpu_idle (void); + static int lca_probe(device_t dev) { @@ -234,6 +238,7 @@ lca_init_sgmap(); platform.mcheck_handler = lca_machine_check; + platform.cpu_idle = lca_cpu_idle; device_add_child(dev, "pcib", 0); @@ -270,5 +275,29 @@ REGVAL64(LCA_IOC_STAT0) = stat0; } +void +lca_cpu_idle (void) +{ + /* + * 0x0 = 1 + * 0x1 = 1.5 + * 0x2 = 2 + * 0x3 = 4 + * 0x4 = 8 + * 0x5 = 16 + */ + long override = 0x0; + long primary = 0x5; + long dma_ovr = 1; + long intr_ovr = 1; + + REGVAL64(LCA_PMR) = + (dma_ovr << 7) | (intr_ovr << 6) | (override << 3) | primary; + if (sched_runnable()) { + REGVAL64(LCA_PMR) = + (override << 3) | override; + } +} + DRIVER_MODULE(lca, root, lca_driver, lca_devclass, 0, 0); ==== //depot/projects/smpng/sys/alpha/pci/lcareg.h#3 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/alpha/pci/lcareg.h,v 1.3 2005/01/05 20:05:52 imp Exp $ */ +/* $FreeBSD: src/sys/alpha/pci/lcareg.h,v 1.4 2005/01/31 23:07:42 ticso Exp $ */ /* $NetBSD: lcareg.h,v 1.8 1997/09/05 02:14:31 thorpej Exp $ */ /*- @@ -44,6 +44,8 @@ #define LCA_PCI_SPARSE 0x200000000L /* PCI Sparse Space */ #define LCA_PCI_DENSE 0x300000000L /* PCI Dense Space */ +#define LCA_PMR 0x120000098L /* Power Management (21066A)*/ + #define LCA_IOC_HAE LCA_IOC_BASE /* Host Address Ext. (64) */ #define IOC_HAE_ADDREXT 0x00000000f8000000UL #define IOC_HAE_RSVSD 0xffffffff07ffffffUL ==== //depot/projects/smpng/sys/amd64/amd64/legacy.c#6 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/legacy.c,v 1.56 2004/08/16 22:54:50 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/legacy.c,v 1.58 2005/02/06 07:36:08 njl Exp $"); /* * This code implements a system driver for legacy systems that do not @@ -38,6 +38,7 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> +#include <sys/cpu.h> #include <sys/kernel.h> #include <sys/malloc.h> #include <sys/module.h> @@ -132,31 +133,24 @@ { device_t child; int i; - struct pcpu *pc; + + /* First, attach the CPU pseudo-driver. */ + for (i = 0; i <= mp_maxid; i++) + if (!CPU_ABSENT(i)) { + child = BUS_ADD_CHILD(dev, 0, "cpu", i); + if (child == NULL) + panic("legacy_attach cpu"); + device_probe_and_attach(child); + } /* - * First, let our child driver's identify any child devices that + * Second, let our child driver's identify any child devices that * they can find. Once that is done attach any devices that we * found. */ bus_generic_probe(dev); bus_generic_attach(dev); - /* Attach CPU pseudo-driver. */ - if (!devclass_get_device(devclass_find("cpu"), 0)) { - for (i = 0; i <= mp_maxid; i++) - if (!CPU_ABSENT(i)) { - pc = pcpu_find(i); - KASSERT(pc != NULL, ("pcpu_find failed")); - child = BUS_ADD_CHILD(dev, 0, "cpu", i); - if (child == NULL) - panic("legacy_attach cpu"); - device_probe_and_attach(child); - pc->pc_device = child; - device_set_ivars(child, pc); - } - } - /* * If we didn't see ISA on a pci bridge, create some * connection points now so it shows up "on motherboard". @@ -244,6 +238,14 @@ */ static int cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result); +static device_t cpu_add_child(device_t bus, int order, const char *name, + int unit); +static struct resource_list *cpu_get_rlist(device_t dev, device_t child); + +struct cpu_device { + struct resource_list cd_rl; + struct pcpu *cd_pcpu; +}; static device_method_t cpu_methods[] = { /* Device interface */ @@ -255,10 +257,15 @@ DEVMETHOD(device_resume, bus_generic_resume), /* Bus interface */ + DEVMETHOD(bus_add_child, cpu_add_child), DEVMETHOD(bus_read_ivar, cpu_read_ivar), DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), + DEVMETHOD(bus_get_resource_list, cpu_get_rlist), + DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), + DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), + DEVMETHOD(bus_alloc_resource, bus_generic_rl_alloc_resource), + DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource), + DEVMETHOD(bus_driver_added, bus_generic_driver_added), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), @@ -275,16 +282,47 @@ static devclass_t cpu_devclass; DRIVER_MODULE(cpu, legacy, cpu_driver, cpu_devclass, 0, 0); +static device_t +cpu_add_child(device_t bus, int order, const char *name, int unit) +{ + struct cpu_device *cd; + device_t child; + struct pcpu *pc; + + if ((cd = malloc(sizeof(*cd), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) + return (NULL); + + resource_list_init(&cd->cd_rl); + pc = pcpu_find(unit); + KASSERT(pc != NULL, ("pcpu_find failed")); + cd->cd_pcpu = pc; + + child = device_add_child_ordered(bus, order, name, unit); + if (child != NULL) { + pc->pc_device = child; + device_set_ivars(child, cd); + } else + free(cd, M_DEVBUF); + return (child); +} + +static struct resource_list * +cpu_get_rlist(device_t dev, device_t child) +{ + struct cpu_device *cpdev; + + cpdev = device_get_ivars(child); + return (&cpdev->cd_rl); +} + static int cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result) { - struct pcpu *pc; + struct cpu_device *cpdev; - if (index != 0) + if (index != CPU_IVAR_PCPU) return (ENOENT); - pc = device_get_ivars(child); - if (pc == NULL) - return (ENOENT); - *result = (uintptr_t)pc; + cpdev = device_get_ivars(dev); + *result = (uintptr_t)cpdev->cd_pcpu; return (0); } ==== //depot/projects/smpng/sys/amd64/amd64/machdep.c#35 (text+ko) ==== @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.626 2005/01/21 06:01:19 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.629 2005/02/06 01:55:06 njl Exp $"); #include "opt_atalk.h" #include "opt_atpic.h" @@ -55,9 +55,16 @@ #include "opt_perfmon.h" #include <sys/param.h> +#include <sys/proc.h> #include <sys/systm.h> -#include <sys/sysproto.h> -#include <sys/signalvar.h> +#include <sys/bio.h> +#include <sys/buf.h> +#include <sys/bus.h> +#include <sys/callout.h> +#include <sys/cons.h> +#include <sys/cpu.h> +#include <sys/eventhandler.h> +#include <sys/exec.h> #include <sys/imgact.h> #include <sys/kdb.h> #include <sys/kernel.h> @@ -66,35 +73,27 @@ #include <sys/lock.h> #include <sys/malloc.h> #include <sys/memrange.h> +#include <sys/msgbuf.h> #include <sys/mutex.h> #include <sys/pcpu.h> -#include <sys/proc.h> -#include <sys/bio.h> -#include <sys/buf.h> +#include <sys/ptrace.h> #include <sys/reboot.h> -#include <sys/callout.h> -#include <sys/msgbuf.h> #include <sys/sched.h> +#include <sys/signalvar.h> +#include <sys/sysctl.h> #include <sys/sysent.h> -#include <sys/sysctl.h> +#include <sys/sysproto.h> #include <sys/ucontext.h> #include <sys/vmmeter.h> -#include <sys/bus.h> -#include <sys/eventhandler.h> - -#include <machine/pcb.h> #include <vm/vm.h> -#include <vm/vm_param.h> +#include <vm/vm_extern.h> #include <vm/vm_kern.h> -#include <vm/vm_object.h> #include <vm/vm_page.h> #include <vm/vm_map.h> +#include <vm/vm_object.h> #include <vm/vm_pager.h> -#include <vm/vm_extern.h> - -#include <sys/exec.h> -#include <sys/cons.h> +#include <vm/vm_param.h> #ifdef DDB #ifndef KDB @@ -105,16 +104,18 @@ #include <net/netisr.h> +#include <machine/clock.h> #include <machine/cpu.h> #include <machine/cputypes.h> -#include <machine/reg.h> -#include <machine/clock.h> -#include <machine/specialreg.h> #include <machine/intr_machdep.h> #include <machine/md_var.h> +#include <machine/metadata.h> #include <machine/pc/bios.h> -#include <machine/metadata.h> +#include <machine/pcb.h> #include <machine/proc.h> +#include <machine/reg.h> +#include <machine/sigframe.h> +#include <machine/specialreg.h> #ifdef PERFMON #include <machine/perfmon.h> #endif @@ -127,8 +128,6 @@ #include <isa/isareg.h> #include <isa/rtc.h> -#include <sys/ptrace.h> -#include <machine/sigframe.h> /* Sanity check for __curthread() */ CTASSERT(offsetof(struct pcpu, pc_curthread) == 0); @@ -450,6 +449,52 @@ { } +/* Get current clock frequency for the given cpu id. */ +int +cpu_est_clockrate(int cpu_id, uint64_t *rate) +{ + register_t reg; + uint64_t tsc1, tsc2; + + if (pcpu_find(cpu_id) == NULL || rate == NULL) + return (EINVAL); + + /* If we're booting, trust the rate calibrated moments ago. */ + if (cold) { + *rate = tsc_freq; + return (0); + } + +#ifdef SMP + /* Schedule ourselves on the indicated cpu. */ + mtx_lock_spin(&sched_lock); + sched_bind(curthread, cpu_id); + mtx_unlock_spin(&sched_lock); +#endif + + /* Calibrate by measuring a short delay. */ + reg = intr_disable(); + tsc1 = rdtsc(); + DELAY(1000); + tsc2 = rdtsc(); + intr_restore(reg); + +#ifdef SMP + mtx_lock_spin(&sched_lock); + sched_unbind(curthread); + mtx_unlock_spin(&sched_lock); +#endif + + /* + * Calculate the difference in readings, convert to Mhz, and + * subtract 0.5% of the total. Empirical testing has shown that + * overhead in DELAY() works out to approximately this value. + */ + tsc2 -= tsc1; + *rate = tsc2 * 1000 - tsc2 * 5; + return (0); +} + /* * Shutdown the CPU as much as possible */ ==== //depot/projects/smpng/sys/amd64/amd64/pmap.c#41 (text+ko) ==== @@ -75,7 +75,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.514 2004/12/23 20:16:09 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.515 2005/02/05 19:21:54 alc Exp $"); /* * Manages physical address maps. @@ -1810,7 +1810,10 @@ if (pbits != obits) { if (!atomic_cmpset_long(pte, obits, pbits)) goto retry; - anychanged = 1; + if (obits & PG_G) + pmap_invalidate_page(pmap, sva); + else + anychanged = 1; } } } ==== //depot/projects/smpng/sys/amd64/conf/NOTES#11 (text+ko) ==== @@ -4,7 +4,7 @@ # This file contains machine dependent kernel configuration notes. For # machine independent notes, look in /sys/conf/NOTES. # -# $FreeBSD: src/sys/amd64/conf/NOTES,v 1.20 2004/09/22 01:04:54 peter Exp $ +# $FreeBSD: src/sys/amd64/conf/NOTES,v 1.21 2005/02/05 21:01:09 njl Exp $ # # @@ -205,6 +205,9 @@ #!options ACPI_NO_SEMAPHORES #!options ACPICA_PEDANTIC +# Support for ACPI CPU Performance states via cpufreq(4) +device acpi_perf + # DRM options: # mgadrm: AGP Matrox G200, G400, G450, G550 # r128drm: ATI Rage 128 ==== //depot/projects/smpng/sys/amd64/isa/isa_dma.c#8 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/isa/isa_dma.c,v 1.20 2004/09/15 12:09:49 phk Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/isa/isa_dma.c,v 1.21 2005/02/06 13:46:38 phk Exp $"); /* * code to manage AT bus @@ -61,22 +61,6 @@ #include <dev/ic/i8237.h> #include <isa/isavar.h> -/* -** Register definitions for DMA controller 1 (channels 0..3): -*/ -#define DMA1_CHN(c) (IO_DMA1 + 1*(2*(c))) /* addr reg for channel c */ -#define DMA1_SMSK (IO_DMA1 + 1*10) /* single mask register */ -#define DMA1_MODE (IO_DMA1 + 1*11) /* mode register */ -#define DMA1_FFC (IO_DMA1 + 1*12) /* clear first/last FF */ - -/* -** Register definitions for DMA controller 2 (channels 4..7): -*/ -#define DMA2_CHN(c) (IO_DMA2 + 2*(2*(c))) /* addr reg for channel c */ -#define DMA2_SMSK (IO_DMA2 + 2*10) /* single mask register */ -#define DMA2_MODE (IO_DMA2 + 2*11) /* mode register */ -#define DMA2_FFC (IO_DMA2 + 2*12) /* clear first/last FF */ - #define ISARAM_END 0x1000000 static int isa_dmarangecheck(caddr_t va, u_int length, int chan); @@ -489,6 +473,19 @@ } /* + * Reached terminal count yet ? + */ +int +isa_dmatc(int chan) +{ + + if (chan < 4) + return(inb(DMA1_STATUS) & (1 << chan)); + else + return(inb(DMA2_STATUS) & (1 << (chan & 3))); +} + +/* * Stop a DMA transfer currently in progress. */ int ==== //depot/projects/smpng/sys/arm/arm/machdep.c#9 (text+ko) ==== @@ -44,12 +44,17 @@ #include "opt_compat.h" #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/arm/machdep.c,v 1.9 2005/01/10 22:43:16 cognet Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/arm/machdep.c,v 1.12 2005/02/06 01:55:07 njl Exp $"); #include <sys/param.h> +#include <sys/proc.h> #include <sys/systm.h> -#include <sys/sysproto.h> -#include <sys/signalvar.h> +#include <sys/bio.h> +#include <sys/buf.h> +#include <sys/bus.h> +#include <sys/cons.h> +#include <sys/cpu.h> +#include <sys/exec.h> #include <sys/imgact.h> #include <sys/kernel.h> #include <sys/linker.h> @@ -57,34 +62,31 @@ #include <sys/malloc.h> #include <sys/mutex.h> #include <sys/pcpu.h> -#include <sys/proc.h> #include <sys/ptrace.h> -#include <sys/cons.h> -#include <sys/bio.h> -#include <sys/buf.h> -#include <sys/exec.h> +#include <sys/signalvar.h> #include <sys/sysent.h> +#include <sys/sysproto.h> #include <sys/uio.h> -#include <machine/reg.h> -#include <machine/cpu.h> -#include <machine/trap.h> -#include <vm/vm.h> #include <vm/pmap.h> #include <vm/vm.h> +#include <vm/vm_map.h> #include <vm/vm_object.h> #include <vm/vm_page.h> #include <vm/vm_pager.h> -#include <vm/vm_map.h> #include <vm/vnode_pager.h> + +#include <machine/armreg.h> +#include <machine/cpu.h> +#include <machine/machdep.h> +#include <machine/md_var.h> +#include <machine/metadata.h> +#include <machine/pcb.h> #include <machine/pmap.h> +#include <machine/reg.h> +#include <machine/trap.h> +#include <machine/undefined.h> #include <machine/vmparam.h> -#include <machine/pcb.h> -#include <machine/undefined.h> -#include <machine/machdep.h> -#include <machine/metadata.h> -#include <machine/armreg.h> -#include <machine/md_var.h> #define MDROOT_ADDR 0xd0400000 @@ -236,6 +238,14 @@ SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL) +/* Get current clock frequency for the given cpu id. */ +int +cpu_est_clockrate(int cpu_id, uint64_t *rate) +{ + + return (ENXIO); +} + void cpu_idle(void) { ==== //depot/projects/smpng/sys/arm/include/cpu.h#4 (text+ko) ==== @@ -1,5 +1,5 @@ /* $NetBSD: cpu.h,v 1.2 2001/02/23 21:23:52 reinoud Exp $ */ -/* $FreeBSD: src/sys/arm/include/cpu.h,v 1.3 2004/11/04 19:15:43 cognet Exp $ */ +/* $FreeBSD: src/sys/arm/include/cpu.h,v 1.4 2005/02/01 06:36:27 njl Exp $ */ #ifndef MACHINE_CPU_H #define MACHINE_CPU_H @@ -45,10 +45,10 @@ extern vm_offset_t vector_page; -void fork_trampoline(void); -void *initarm(void *, void *); -void arm_vector_init(vm_offset_t, int); -void identify_arm_cpu(void); +void arm_vector_init(vm_offset_t, int); +void fork_trampoline(void); +void identify_arm_cpu(void); +void *initarm(void *, void *); extern char btext[]; extern char etext[]; ==== //depot/projects/smpng/sys/coda/coda_vnops.c#21 (text+ko) ==== @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/coda/coda_vnops.c,v 1.62 2005/01/28 14:42:15 phk Exp $"); +__FBSDID("$FreeBSD: src/sys/coda/coda_vnops.c,v 1.63 2005/02/07 08:04:24 phk Exp $"); >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200502071951.j17JpYeW034901>