Date: Thu, 6 Jul 2006 21:54:02 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 100803 for review Message-ID: <200607062154.k66Ls2kc051623@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=100803 Change 100803 by jhb@jhb_mutex on 2006/07/06 21:53:53 IFC @100799 - loopback. Affected files ... .. //depot/projects/smpng/sys/Makefile#12 integrate .. //depot/projects/smpng/sys/amd64/amd64/pmap.c#62 integrate .. //depot/projects/smpng/sys/amd64/conf/GENERIC#49 integrate .. //depot/projects/smpng/sys/amd64/linux32/linux32_proto.h#11 integrate .. //depot/projects/smpng/sys/amd64/linux32/linux32_syscall.h#11 integrate .. //depot/projects/smpng/sys/amd64/linux32/linux32_sysent.c#11 integrate .. //depot/projects/smpng/sys/amd64/linux32/syscalls.master#15 integrate .. //depot/projects/smpng/sys/arm/at91/at91_pio.c#2 integrate .. //depot/projects/smpng/sys/arm/at91/at91_pio_rm9200.h#1 branch .. //depot/projects/smpng/sys/arm/at91/at91_piovar.h#1 branch .. //depot/projects/smpng/sys/arm/at91/uart_dev_at91usart.c#6 integrate .. //depot/projects/smpng/sys/bsm/audit_kevents.h#5 integrate .. //depot/projects/smpng/sys/bsm/audit_record.h#4 integrate .. //depot/projects/smpng/sys/compat/linux/linux_ioctl.c#47 integrate .. //depot/projects/smpng/sys/compat/svr4/Makefile#3 integrate .. //depot/projects/smpng/sys/compat/svr4/svr4_ipc.c#18 integrate .. //depot/projects/smpng/sys/conf/files.ia64#55 integrate .. //depot/projects/smpng/sys/conf/kern.mk#17 integrate .. //depot/projects/smpng/sys/conf/kern.pre.mk#51 integrate .. //depot/projects/smpng/sys/conf/kmod.mk#59 integrate .. //depot/projects/smpng/sys/dev/ata/ata-chipset.c#69 integrate .. //depot/projects/smpng/sys/dev/ata/ata-lowlevel.c#35 integrate .. //depot/projects/smpng/sys/dev/ata/ata-pci.h#43 integrate .. //depot/projects/smpng/sys/dev/atkbdc/atkbdc_isa.c#4 integrate .. //depot/projects/smpng/sys/dev/bktr/CHANGELOG.TXT#4 integrate .. //depot/projects/smpng/sys/dev/fdc/fdc.c#23 integrate .. //depot/projects/smpng/sys/dev/ic/nec765.h#4 integrate .. //depot/projects/smpng/sys/dev/isp/isp.c#40 integrate .. //depot/projects/smpng/sys/dev/isp/isp_pci.c#36 integrate .. //depot/projects/smpng/sys/dev/isp/ispmbox.h#21 integrate .. //depot/projects/smpng/sys/dev/isp/ispreg.h#8 integrate .. //depot/projects/smpng/sys/dev/isp/ispvar.h#30 integrate .. //depot/projects/smpng/sys/dev/ispfw/asm_2322.h#1 branch .. //depot/projects/smpng/sys/dev/ispfw/ispfw.c#12 integrate .. //depot/projects/smpng/sys/dev/mfi/mfi.c#9 integrate .. //depot/projects/smpng/sys/dev/mii/acphy.c#14 integrate .. //depot/projects/smpng/sys/dev/mii/amphy.c#13 integrate .. //depot/projects/smpng/sys/dev/mii/bmtphy.c#9 integrate .. //depot/projects/smpng/sys/dev/mii/brgphy.c#32 integrate .. //depot/projects/smpng/sys/dev/mii/ciphy.c#5 integrate .. //depot/projects/smpng/sys/dev/mii/e1000phy.c#13 integrate .. //depot/projects/smpng/sys/dev/mii/exphy.c#13 integrate .. //depot/projects/smpng/sys/dev/mii/inphy.c#8 integrate .. //depot/projects/smpng/sys/dev/mii/lxtphy.c#14 integrate .. //depot/projects/smpng/sys/dev/mii/mii_physubr.c#14 integrate .. //depot/projects/smpng/sys/dev/mii/mlphy.c#11 integrate .. //depot/projects/smpng/sys/dev/mii/nsgphy.c#16 integrate .. //depot/projects/smpng/sys/dev/mii/nsphy.c#13 integrate .. //depot/projects/smpng/sys/dev/mii/pnaphy.c#14 integrate .. //depot/projects/smpng/sys/dev/mii/qsphy.c#14 integrate .. //depot/projects/smpng/sys/dev/mii/rgephy.c#8 integrate .. //depot/projects/smpng/sys/dev/mii/rlphy.c#17 integrate .. //depot/projects/smpng/sys/dev/mii/ruephy.c#5 integrate .. //depot/projects/smpng/sys/dev/mii/tdkphy.c#16 integrate .. //depot/projects/smpng/sys/dev/mii/tlphy.c#15 integrate .. //depot/projects/smpng/sys/dev/mii/ukphy.c#12 integrate .. //depot/projects/smpng/sys/dev/mii/xmphy.c#15 integrate .. //depot/projects/smpng/sys/dev/puc/puc.c#29 integrate .. //depot/projects/smpng/sys/dev/puc/puc_cfg.c#2 integrate .. //depot/projects/smpng/sys/dev/puc/puc_pccard.c#8 integrate .. //depot/projects/smpng/sys/dev/puc/puc_pci.c#12 integrate .. //depot/projects/smpng/sys/dev/puc/pucdata.c#37 integrate .. //depot/projects/smpng/sys/dev/sio/sio.c#61 integrate .. //depot/projects/smpng/sys/dev/sk/if_sk.c#3 integrate .. //depot/projects/smpng/sys/dev/sound/pci/solo.c#17 integrate .. //depot/projects/smpng/sys/dev/usb/if_aue.c#42 integrate .. //depot/projects/smpng/sys/dev/usb/if_ural.c#16 integrate .. //depot/projects/smpng/sys/fs/devfs/devfs_vfsops.c#27 integrate .. //depot/projects/smpng/sys/fs/devfs/devfs_vnops.c#56 integrate .. //depot/projects/smpng/sys/fs/unionfs/union_vnops.c#31 integrate .. //depot/projects/smpng/sys/geom/mirror/g_mirror.c#30 integrate .. //depot/projects/smpng/sys/geom/raid3/g_raid3.c#30 integrate .. //depot/projects/smpng/sys/i386/conf/GENERIC#79 integrate .. //depot/projects/smpng/sys/i386/i386/pmap.c#101 integrate .. //depot/projects/smpng/sys/i386/ibcs2/ibcs2_misc.c#27 integrate .. //depot/projects/smpng/sys/i386/ibcs2/ibcs2_msg.c#8 integrate .. //depot/projects/smpng/sys/i386/ibcs2/ibcs2_poll.h#3 delete .. //depot/projects/smpng/sys/i386/ibcs2/ibcs2_proto.h#12 integrate .. //depot/projects/smpng/sys/i386/ibcs2/ibcs2_syscall.h#11 integrate .. //depot/projects/smpng/sys/i386/ibcs2/ibcs2_sysent.c#13 integrate .. //depot/projects/smpng/sys/i386/ibcs2/ibcs2_xenix.h#9 integrate .. //depot/projects/smpng/sys/i386/ibcs2/ibcs2_xenix_syscall.h#8 integrate .. //depot/projects/smpng/sys/i386/ibcs2/ibcs2_xenix_sysent.c#9 integrate .. //depot/projects/smpng/sys/i386/ibcs2/syscalls.master#13 integrate .. //depot/projects/smpng/sys/i386/ibcs2/syscalls.xenix#7 integrate .. //depot/projects/smpng/sys/i386/linux/linux_proto.h#29 integrate .. //depot/projects/smpng/sys/i386/linux/linux_syscall.h#28 integrate .. //depot/projects/smpng/sys/i386/linux/linux_sysent.c#29 integrate .. //depot/projects/smpng/sys/i386/linux/syscalls.master#33 integrate .. //depot/projects/smpng/sys/ia64/ia64/emulate.c#1 branch .. //depot/projects/smpng/sys/ia64/ia64/trap.c#80 integrate .. //depot/projects/smpng/sys/ia64/include/ieeefp.h#5 integrate .. //depot/projects/smpng/sys/ia64/include/md_var.h#21 integrate .. //depot/projects/smpng/sys/kern/init_sysent.c#69 integrate .. //depot/projects/smpng/sys/kern/kern_linker.c#78 integrate .. //depot/projects/smpng/sys/kern/kern_prot.c#97 integrate .. //depot/projects/smpng/sys/kern/kern_thread.c#93 integrate .. //depot/projects/smpng/sys/kern/sched_4bsd.c#59 integrate .. //depot/projects/smpng/sys/kern/subr_acl_posix1e.c#1 branch .. //depot/projects/smpng/sys/kern/syscalls.c#69 integrate .. //depot/projects/smpng/sys/kern/syscalls.master#75 integrate .. //depot/projects/smpng/sys/kern/uipc_socket2.c#54 integrate .. //depot/projects/smpng/sys/kern/vfs_subr.c#130 integrate .. //depot/projects/smpng/sys/kern/vfs_syscalls.c#109 integrate .. //depot/projects/smpng/sys/modules/bktr/bktr_mem/Makefile#3 integrate .. //depot/projects/smpng/sys/modules/streams/Makefile#4 integrate .. //depot/projects/smpng/sys/modules/svr4/Makefile#7 integrate .. //depot/projects/smpng/sys/net/bpf.c#61 integrate .. //depot/projects/smpng/sys/net/if.c#84 integrate .. //depot/projects/smpng/sys/net/if_atmsubr.c#21 integrate .. //depot/projects/smpng/sys/net/if_enc.c#3 integrate .. //depot/projects/smpng/sys/net/if_stf.c#36 integrate .. //depot/projects/smpng/sys/net/if_tun.c#46 integrate .. //depot/projects/smpng/sys/net/rtsock.c#54 integrate .. //depot/projects/smpng/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c#14 integrate .. //depot/projects/smpng/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_var.h#4 integrate .. //depot/projects/smpng/sys/netinet/if_ether.c#49 integrate .. //depot/projects/smpng/sys/netinet/in_rmx.c#13 integrate .. //depot/projects/smpng/sys/netinet/ip_divert.c#48 integrate .. //depot/projects/smpng/sys/netinet/ip_fw2.c#74 integrate .. //depot/projects/smpng/sys/netinet/ip_ipsec.c#3 integrate .. //depot/projects/smpng/sys/netinet/libalias/libalias.3#3 integrate .. //depot/projects/smpng/sys/netinet6/in6.c#33 integrate .. //depot/projects/smpng/sys/netinet6/in6_cksum.c#10 integrate .. //depot/projects/smpng/sys/netinet6/in6_rmx.c#10 integrate .. //depot/projects/smpng/sys/netinet6/in6_var.h#16 integrate .. //depot/projects/smpng/sys/nfsclient/bootp_subr.c#31 integrate .. //depot/projects/smpng/sys/nfsclient/nfs_diskless.c#14 integrate .. //depot/projects/smpng/sys/powerpc/powerpc/mmu_oea.c#5 integrate .. //depot/projects/smpng/sys/security/audit/audit.h#3 integrate .. //depot/projects/smpng/sys/security/audit/audit_arg.c#4 integrate .. //depot/projects/smpng/sys/security/audit/audit_bsm.c#4 integrate .. //depot/projects/smpng/sys/sys/syscall.h#68 integrate .. //depot/projects/smpng/sys/sys/syscall.mk#68 integrate .. //depot/projects/smpng/sys/sys/syscallsubr.h#41 integrate .. //depot/projects/smpng/sys/sys/sysproto.h#71 integrate Differences ... ==== //depot/projects/smpng/sys/Makefile#12 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/Makefile,v 1.36 2006/05/29 19:29:41 maxim Exp $ +# $FreeBSD: src/sys/Makefile,v 1.37 2006/07/04 14:14:16 maxim Exp $ .include <bsd.own.mk> @@ -10,7 +10,7 @@ .endif # Directories to include in cscope name file and TAGS. -CSCOPEDIRS= coda compat conf contrib crypto ddb dev fs gnu i4b isa \ +CSCOPEDIRS= coda compat conf contrib crypto ddb dev fs geom gnu i4b isa \ isofs kern libkern modules net net80211 netatalk netatm \ netgraph netinet netinet6 netipx netkey netnatm netncp \ netsmb nfs nfsclient nfs4client rpc pccard pci posix4 sys \ ==== //depot/projects/smpng/sys/amd64/amd64/pmap.c#62 (text+ko) ==== @@ -77,7 +77,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.560 2006/06/27 04:28:22 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.565 2006/07/06 06:17:08 alc Exp $"); /* * Manages physical address maps. @@ -207,7 +207,7 @@ static void free_pv_entry(pmap_t pmap, pv_entry_t pv); static pv_entry_t get_pv_entry(pmap_t locked_pmap, int try); -static void pmap_clear_ptes(vm_page_t m, long bit); +static void pmap_clear_write(vm_page_t m); static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, vm_page_t mpte); @@ -490,8 +490,7 @@ * (physical) address starting relative to 0] */ void -pmap_bootstrap(firstaddr) - vm_paddr_t *firstaddr; +pmap_bootstrap(vm_paddr_t *firstaddr) { vm_offset_t va; pt_entry_t *pte, *unused; @@ -1132,8 +1131,7 @@ } void -pmap_pinit0(pmap) - struct pmap *pmap; +pmap_pinit0(pmap_t pmap) { PMAP_LOCK_INIT(pmap); @@ -1148,8 +1146,7 @@ * such as one in a vmspace structure. */ void -pmap_pinit(pmap) - register struct pmap *pmap; +pmap_pinit(pmap_t pmap) { vm_page_t pml4pg; static vm_pindex_t color; @@ -1611,9 +1608,9 @@ vm_page_flag_clear(m, PG_WRITEABLE); m->md.pv_list_count--; pmap_unuse_pt(pmap, va, ptepde); + free_pv_entry(pmap, pv); if (pmap != locked_pmap) PMAP_UNLOCK(pmap); - free_pv_entry(locked_pmap, pv); } } } @@ -1979,7 +1976,7 @@ void pmap_remove_all(vm_page_t m) { - register pv_entry_t pv; + pv_entry_t pv; pmap_t pmap; pt_entry_t *pte, tpte; pd_entry_t ptepde; @@ -2145,7 +2142,7 @@ { vm_paddr_t pa; pd_entry_t *pde; - register pt_entry_t *pte; + pt_entry_t *pte; vm_paddr_t opa; pt_entry_t origpte, newpte; vm_page_t mpte, om; @@ -2582,12 +2579,9 @@ * The mapping must already exist in the pmap. */ void -pmap_change_wiring(pmap, va, wired) - register pmap_t pmap; - vm_offset_t va; - boolean_t wired; +pmap_change_wiring(pmap_t pmap, vm_offset_t va, boolean_t wired) { - register pt_entry_t *pte; + pt_entry_t *pte; /* * Wiring is not a hardware characteristic so there is no need to @@ -2796,9 +2790,7 @@ * subset of pmaps for proper page aging. */ boolean_t -pmap_page_exists_quick(pmap, m) - pmap_t pmap; - vm_page_t m; +pmap_page_exists_quick(pmap_t pmap, vm_page_t m) { pv_entry_t pv; int loops = 0; @@ -2977,47 +2969,36 @@ } /* - * Clear the given bit in each of the given page's ptes. + * Clear the write and modified bits in each of the given page's mappings. */ static __inline void -pmap_clear_ptes(vm_page_t m, long bit) +pmap_clear_write(vm_page_t m) { - register pv_entry_t pv; + pv_entry_t pv; pmap_t pmap; - pt_entry_t pbits, *pte; + pt_entry_t oldpte, *pte; - if ((m->flags & PG_FICTITIOUS) || - (bit == PG_RW && (m->flags & PG_WRITEABLE) == 0)) + if ((m->flags & PG_FICTITIOUS) != 0 || + (m->flags & PG_WRITEABLE) == 0) return; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); - /* - * Loop over all current mappings setting/clearing as appropos If - * setting RO do we need to clear the VAC? - */ TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { pmap = PV_PMAP(pv); PMAP_LOCK(pmap); pte = pmap_pte(pmap, pv->pv_va); retry: - pbits = *pte; - if (pbits & bit) { - if (bit == PG_RW) { - if (!atomic_cmpset_long(pte, pbits, - pbits & ~(PG_RW | PG_M))) - goto retry; - if (pbits & PG_M) { - vm_page_dirty(m); - } - } else { - atomic_clear_long(pte, bit); - } + oldpte = *pte; + if (oldpte & PG_RW) { + if (!atomic_cmpset_long(pte, oldpte, oldpte & + ~(PG_RW | PG_M))) + goto retry; + if ((oldpte & PG_M) != 0) + vm_page_dirty(m); pmap_invalidate_page(pmap, pv->pv_va); } PMAP_UNLOCK(pmap); } - if (bit == PG_RW) - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_flag_clear(m, PG_WRITEABLE); } /* @@ -3030,7 +3011,7 @@ { if ((prot & VM_PROT_WRITE) == 0) { if (prot & (VM_PROT_READ | VM_PROT_EXECUTE)) { - pmap_clear_ptes(m, PG_RW); + pmap_clear_write(m); } else { pmap_remove_all(m); } @@ -3052,45 +3033,33 @@ int pmap_ts_referenced(vm_page_t m) { - register pv_entry_t pv, pvf, pvn; + pv_entry_t pv, pvf, pvn; pmap_t pmap; pt_entry_t *pte; - pt_entry_t v; int rtval = 0; if (m->flags & PG_FICTITIOUS) return (rtval); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); if ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { - pvf = pv; - do { pvn = TAILQ_NEXT(pv, pv_list); - TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); - pmap = PV_PMAP(pv); PMAP_LOCK(pmap); pte = pmap_pte(pmap, pv->pv_va); - - if (pte && ((v = pte_load(pte)) & PG_A) != 0) { + if ((*pte & PG_A) != 0) { atomic_clear_long(pte, PG_A); pmap_invalidate_page(pmap, pv->pv_va); - rtval++; - if (rtval > 4) { - PMAP_UNLOCK(pmap); - break; - } + if (rtval > 4) + pvn = NULL; } PMAP_UNLOCK(pmap); } while ((pv = pvn) != NULL && pv != pvf); } - return (rtval); } @@ -3100,7 +3069,23 @@ void pmap_clear_modify(vm_page_t m) { - pmap_clear_ptes(m, PG_M); + pv_entry_t pv; + pmap_t pmap; + pt_entry_t *pte; + + if ((m->flags & PG_FICTITIOUS) != 0) + return; + mtx_assert(&vm_page_queue_mtx, MA_OWNED); + TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { + pmap = PV_PMAP(pv); + PMAP_LOCK(pmap); + pte = pmap_pte(pmap, pv->pv_va); + if (*pte & PG_M) { + atomic_clear_long(pte, PG_M); + pmap_invalidate_page(pmap, pv->pv_va); + } + PMAP_UNLOCK(pmap); + } } /* @@ -3111,7 +3096,23 @@ void pmap_clear_reference(vm_page_t m) { - pmap_clear_ptes(m, PG_A); + pv_entry_t pv; + pmap_t pmap; + pt_entry_t *pte; + + if ((m->flags & PG_FICTITIOUS) != 0) + return; + mtx_assert(&vm_page_queue_mtx, MA_OWNED); + TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { + pmap = PV_PMAP(pv); + PMAP_LOCK(pmap); + pte = pmap_pte(pmap, pv->pv_va); + if (*pte & PG_A) { + atomic_clear_long(pte, PG_A); + pmap_invalidate_page(pmap, pv->pv_va); + } + PMAP_UNLOCK(pmap); + } } /* @@ -3125,9 +3126,7 @@ * NOT real memory. */ void * -pmap_mapdev(pa, size) - vm_paddr_t pa; - vm_size_t size; +pmap_mapdev(vm_paddr_t pa, vm_size_t size) { vm_offset_t va, tmpva, offset; @@ -3151,9 +3150,7 @@ } void -pmap_unmapdev(va, size) - vm_offset_t va; - vm_size_t size; +pmap_unmapdev(vm_offset_t va, vm_size_t size) { vm_offset_t base, offset, tmpva; @@ -3173,9 +3170,7 @@ * perform the pmap work for mincore */ int -pmap_mincore(pmap, addr) - pmap_t pmap; - vm_offset_t addr; +pmap_mincore(pmap_t pmap, vm_offset_t addr) { pt_entry_t *ptep, pte; vm_page_t m; ==== //depot/projects/smpng/sys/amd64/conf/GENERIC#49 (text+ko) ==== @@ -16,7 +16,7 @@ # If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # -# $FreeBSD: src/sys/amd64/conf/GENERIC,v 1.462 2006/06/26 22:03:20 babkin Exp $ +# $FreeBSD: src/sys/amd64/conf/GENERIC,v 1.463 2006/07/05 02:32:55 davidxu Exp $ cpu HAMMER ident GENERIC @@ -28,7 +28,6 @@ #options SCHED_ULE # ULE scheduler options SCHED_4BSD # 4BSD scheduler -#options SCHED_CORE # CORE scheduler options PREEMPTION # Enable kernel thread preemption options INET # InterNETworking options INET6 # IPv6 communications protocols ==== //depot/projects/smpng/sys/amd64/linux32/linux32_proto.h#11 (text+ko) ==== @@ -2,8 +2,8 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/amd64/linux32/linux32_proto.h,v 1.16 2006/06/27 18:32:16 jhb Exp $ - * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.14 2006/06/27 18:28:49 jhb Exp + * $FreeBSD: src/sys/amd64/linux32/linux32_proto.h,v 1.17 2006/07/06 21:43:14 jhb Exp $ + * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.15 2006/07/06 21:42:35 jhb Exp */ #ifndef _LINUX_SYSPROTO_H_ ==== //depot/projects/smpng/sys/amd64/linux32/linux32_syscall.h#11 (text+ko) ==== @@ -2,8 +2,8 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/amd64/linux32/linux32_syscall.h,v 1.16 2006/06/27 18:32:16 jhb Exp $ - * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.14 2006/06/27 18:28:49 jhb Exp + * $FreeBSD: src/sys/amd64/linux32/linux32_syscall.h,v 1.17 2006/07/06 21:43:14 jhb Exp $ + * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.15 2006/07/06 21:42:35 jhb Exp */ #define LINUX_SYS_exit 1 ==== //depot/projects/smpng/sys/amd64/linux32/linux32_sysent.c#11 (text+ko) ==== @@ -2,8 +2,8 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/amd64/linux32/linux32_sysent.c,v 1.16 2006/06/27 18:32:16 jhb Exp $ - * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.14 2006/06/27 18:28:49 jhb Exp + * $FreeBSD: src/sys/amd64/linux32/linux32_sysent.c,v 1.17 2006/07/06 21:43:14 jhb Exp $ + * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.15 2006/07/06 21:42:35 jhb Exp */ #include <bsm/audit_kevents.h> @@ -74,7 +74,7 @@ { SYF_MPSAFE | AS(acct_args), (sy_call_t *)acct, AUE_ACCT }, /* 51 = acct */ { SYF_MPSAFE | AS(linux_umount_args), (sy_call_t *)linux_umount, AUE_UMOUNT }, /* 52 = linux_umount */ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 53 = lock */ - { AS(linux_ioctl_args), (sy_call_t *)linux_ioctl, AUE_IOCTL }, /* 54 = linux_ioctl */ + { SYF_MPSAFE | AS(linux_ioctl_args), (sy_call_t *)linux_ioctl, AUE_IOCTL }, /* 54 = linux_ioctl */ { SYF_MPSAFE | AS(linux_fcntl_args), (sy_call_t *)linux_fcntl, AUE_FCNTL }, /* 55 = linux_fcntl */ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 56 = mpx */ { SYF_MPSAFE | AS(setpgid_args), (sy_call_t *)setpgid, AUE_SETPGRP }, /* 57 = setpgid */ ==== //depot/projects/smpng/sys/amd64/linux32/syscalls.master#15 (text+ko) ==== @@ -1,4 +1,4 @@ - $FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.14 2006/06/27 18:28:49 jhb Exp $ + $FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.15 2006/07/06 21:42:35 jhb Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 ; System call name/number master file (or rather, slave, from LINUX). ==== //depot/projects/smpng/sys/arm/at91/at91_pio.c#2 (text) ==== @@ -23,7 +23,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/at91/at91_pio.c,v 1.1 2006/03/24 07:39:29 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/at91/at91_pio.c,v 1.2 2006/07/02 03:50:44 imp Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -38,7 +38,9 @@ #include <sys/rman.h> #include <machine/bus.h> +#include <arm/at91/at91rm92reg.h> #include <arm/at91/at91_pioreg.h> +#include <arm/at91/at91_piovar.h> struct at91_pio_softc { @@ -103,7 +105,26 @@ static int at91_pio_probe(device_t dev) { - device_set_desc(dev, "PIO"); + const char *name; + + switch (device_get_unit(dev)) { + case 0: + name = "PIOA"; + break; + case 1: + name = "PIOB"; + break; + case 2: + name = "PIOC"; + break; + case 3: + name = "PIOD"; + break; + default: + name = "PIO"; + break; + } + device_set_desc(dev, name); return (0); } @@ -118,6 +139,9 @@ if (err) goto out; + device_printf(dev, "ABSR: %#x OSR: %#x PSR:%#x ODSR: %#x\n", + RD4(sc, PIO_ABSR), RD4(sc, PIO_OSR), RD4(sc, PIO_PSR), + RD4(sc, PIO_ODSR)); AT91_PIO_LOCK_INIT(sc); /* @@ -250,6 +274,69 @@ return (ENXIO); } +/* + * The following functions are called early in the boot process, so + * don't use bus_space, as that isn't yet available when we need to use + * them. + */ +void +at91_pio_use_periph_a(uint32_t pio, uint32_t periph_a_mask) +{ + uint32_t *PIO = (uint32_t *)(AT91RM92_BASE + pio); + + PIO[PIO_ASR / 4] = periph_a_mask; + PIO[PIO_PDR / 4] = periph_a_mask; +} + +void +at91_pio_use_periph_b(uint32_t pio, uint32_t periph_b_mask) +{ + uint32_t *PIO = (uint32_t *)(AT91RM92_BASE + pio); + + PIO[PIO_BSR / 4] = periph_b_mask; + PIO[PIO_PDR / 4] = periph_b_mask; +} + +void +at91_pio_use_gpio(uint32_t pio, uint32_t gpio_mask) +{ + uint32_t *PIO = (uint32_t *)(AT91RM92_BASE + pio); + + PIO[PIO_PER / 4] = gpio_mask; +} + +void +at91_pio_gpio_input(uint32_t pio, uint32_t input_enable_mask) +{ + uint32_t *PIO = (uint32_t *)(AT91RM92_BASE + pio); + + PIO[PIO_ODR / 4] = input_enable_mask; +} + +void +at91_pio_gpio_output(uint32_t pio, uint32_t output_enable_mask) +{ + uint32_t *PIO = (uint32_t *)(AT91RM92_BASE + pio); + + PIO[PIO_OER / 4] = output_enable_mask; +} + +void +at91_pio_gpio_set(uint32_t pio, uint32_t data_mask) +{ + uint32_t *PIO = (uint32_t *)(AT91RM92_BASE + pio); + + PIO[PIO_SODR / 4] = data_mask; +} + +void +at91_pio_gpio_clear(uint32_t pio, uint32_t data_mask) +{ + uint32_t *PIO = (uint32_t *)(AT91RM92_BASE + pio); + + PIO[PIO_CODR / 4] = data_mask; +} + static device_method_t at91_pio_methods[] = { /* Device interface */ DEVMETHOD(device_probe, at91_pio_probe), ==== //depot/projects/smpng/sys/arm/at91/uart_dev_at91usart.c#6 (text) ==== @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/at91/uart_dev_at91usart.c,v 1.6 2006/05/13 23:41:16 cognet Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/at91/uart_dev_at91usart.c,v 1.7 2006/07/02 03:45:33 imp Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -45,19 +45,29 @@ #include "uart_if.h" +#define DEFAULT_RCLK AT91C_MASTER_CLOCK +#define USART_BUFFER_SIZE 128 + /* * High-level UART interface. */ +struct at91_usart_rx { + bus_addr_t pa; + uint8_t buffer[USART_BUFFER_SIZE]; + bus_dmamap_t map; +}; + struct at91_usart_softc { struct uart_softc base; bus_dma_tag_t dmatag; /* bus dma tag for mbufs */ bus_dmamap_t tx_map; - bus_dmamap_t rx_map; + uint32_t flags; +#define HAS_TIMEOUT 1 + struct at91_usart_rx ping_pong[2]; + struct at91_usart_rx *ping; + struct at91_usart_rx *pong; }; -#define DEFAULT_RCLK AT91C_MASTER_CLOCK -#define USART_BUFFER_SIZE 128 - #define RD4(bas, reg) \ bus_space_read_4((bas)->bst, (bas)->bsh, uart_regofs(bas, reg)) #define WR4(bas, reg, value) \ @@ -72,6 +82,9 @@ } \ } while (0); +#define BAUD2DIVISOR(b) \ + ((((DEFAULT_RCLK * 10) / ((b) * 16)) + 5) / 10) + /* * Low-level UART interface. */ @@ -147,16 +160,19 @@ } /* - * Or in the stop bits. Note: The hardware supports - * 1.5 stop bits in async mode, but there's no way to - * specify that AFAICT. + * Or in the stop bits. Note: The hardware supports 1.5 stop + * bits in async mode, but there's no way to specify that + * AFAICT. Instead, rely on the convention documented at + * http://www.lammertbies.nl/comm/info/RS-232_specs.html which + * states that 1.5 stop bits are used for 5 bit bytes and + * 2 stop bits only for longer bytes. */ - if (stopbits > 1) + if (stopbits == 1) + mr |= USART_MR_NBSTOP_1; + else if (databits > 5) mr |= USART_MR_NBSTOP_2; else - mr |= USART_MR_NBSTOP_2; - /* else if (stopbits == 1.5) - mr |= USART_MR_NBSTOP_1_5; */ + mr |= USART_MR_NBSTOP_1_5; /* * We want normal plumbing mode too, none of this fancy @@ -167,6 +183,13 @@ mr &= ~USART_MR_MSBF; /* lsb first */ mr &= ~USART_MR_CKLO_SCK; /* Don't drive SCK */ + WR4(bas, USART_MR, mr); + + /* + * Set the baud rate + */ + WR4(bas, USART_BRGR, BAUD2DIVISOR(baudrate)); + /* XXX Need to take possible synchronous mode into account */ return (0); } @@ -188,25 +211,19 @@ } /* - * Initialize this device (I think as the console) + * Initialize this device for use as a console. */ static void at91_usart_init(struct uart_bas *bas, int baudrate, int databits, int stopbits, int parity) { - int cr; at91_usart_param(bas, baudrate, databits, stopbits, parity); - /* Turn on rx and tx */ - cr = USART_CR_RSTSTA | USART_CR_RSTRX | USART_CR_RSTTX; - WR4(bas, USART_CR, cr); + /* Reset the rx and tx buffers and turn on rx and tx */ + WR4(bas, USART_CR, USART_CR_RSTSTA | USART_CR_RSTRX | USART_CR_RSTTX); WR4(bas, USART_CR, USART_CR_RXEN | USART_CR_TXEN); - WR4(bas, USART_IER, USART_CSR_TIMEOUT | - USART_CSR_TXRDY | USART_CSR_RXRDY | - USART_CSR_RXBRK | USART_CSR_ENDRX | USART_CSR_ENDTX); - /* Set the receive timeout to be 1.5 character times. */ - WR4(bas, USART_RTOR, 12); + WR4(bas, USART_IDR, 0xffffffff); } /* @@ -227,8 +244,8 @@ at91_usart_putc(struct uart_bas *bas, int c) { - while (!(RD4(bas, USART_CSR) & - USART_CSR_TXRDY)); + while (!(RD4(bas, USART_CSR) & USART_CSR_TXRDY)) + continue; WR4(bas, USART_THR, c); } @@ -252,8 +269,8 @@ { int c; - while (!(RD4(bas, USART_CSR) & USART_CSR_RXRDY)) - ; + while (!(RD4(bas, USART_CSR) & USART_CSR_RXRDY)) + continue; c = RD4(bas, USART_RHR); c &= 0xff; return (c); @@ -291,14 +308,35 @@ return (0); } +#ifndef SKYEYE_WORKAROUNDS +static void +at91_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs, int error) +{ + if (error != 0) + return; + *(bus_addr_t *)arg = segs[0].ds_addr; +} +#endif + static int at91_usart_bus_attach(struct uart_softc *sc) { - int err; + int err, i; + uint32_t cr; struct at91_usart_softc *atsc; atsc = (struct at91_usart_softc *)sc; + /* + * See if we have a TIMEOUT bit. We disable all interrupts to + * minimize interference. + */ + WR4(&sc->sc_bas, USART_IDR, 0xffffffff); + WR4(&sc->sc_bas, USART_IER, USART_CSR_TIMEOUT); + if (RD4(&sc->sc_bas, USART_IMR) & USART_CSR_TIMEOUT) + atsc->flags |= HAS_TIMEOUT; + WR4(&sc->sc_bas, USART_IDR, 0xffffffff); + sc->sc_txfifosz = USART_BUFFER_SIZE; sc->sc_rxfifosz = USART_BUFFER_SIZE; sc->sc_hwiflow = 0; @@ -314,25 +352,62 @@ err = bus_dmamap_create(atsc->dmatag, 0, &atsc->tx_map); if (err != 0) goto errout; - err = bus_dmamap_create(atsc->dmatag, 0, &atsc->rx_map); - if (err != 0) - goto errout; + if (atsc->flags & HAS_TIMEOUT) { + for (i = 0; i < 2; i++) { + err = bus_dmamap_create(atsc->dmatag, 0, + &atsc->ping_pong[i].map); + if (err != 0) + goto errout; + err = bus_dmamap_load(atsc->dmatag, + atsc->ping_pong[i].map, + atsc->ping_pong[i].buffer, sc->sc_rxfifosz, + at91_getaddr, &atsc->ping_pong[i].pa, 0); + if (err != 0) + goto errout; + bus_dmamap_sync(atsc->dmatag, atsc->ping_pong[i].map, + BUS_DMASYNC_PREREAD); + } + atsc->ping = &atsc->ping_pong[0]; + atsc->pong = &atsc->ping_pong[1]; + } + + /* + * Prime the pump with the RX buffer. We use two 64 byte bounce + * buffers here to avoid data overflow. + */ + + /* Turn on rx and tx */ + cr = USART_CR_RSTSTA | USART_CR_RSTRX | USART_CR_RSTTX; + WR4(&sc->sc_bas, USART_CR, cr); + WR4(&sc->sc_bas, USART_CR, USART_CR_RXEN | USART_CR_TXEN); + + /* + * Setup the PDC to receive data. We use the ping-pong buffers + * so that we can more easily bounce between the two and so that + * we get an interrupt 1/2 way through the software 'fifo' we have + * to avoid overruns. + */ + if (atsc->flags & HAS_TIMEOUT) { + WR4(&sc->sc_bas, PDC_RPR, atsc->ping->pa); + WR4(&sc->sc_bas, PDC_RCR, sc->sc_rxfifosz); + WR4(&sc->sc_bas, PDC_RNPR, atsc->pong->pa); + WR4(&sc->sc_bas, PDC_RNCR, sc->sc_rxfifosz); + WR4(&sc->sc_bas, PDC_PTCR, PDC_PTCR_RXTEN); + + /* Set the receive timeout to be 1.5 character times. */ + WR4(&sc->sc_bas, USART_RTOR, 12); + WR4(&sc->sc_bas, USART_CR, USART_CR_STTTO); + WR4(&sc->sc_bas, USART_IER, USART_CSR_TIMEOUT | + USART_CSR_RXBUFF | USART_CSR_ENDRX); + } else { + WR4(&sc->sc_bas, USART_IER, USART_CSR_RXRDY); + } + WR4(&sc->sc_bas, USART_IER, USART_CSR_RXBRK); errout:; // XXX bad return (err); } -#ifndef SKYEYE_WORKAROUNDS -static void -at91_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs, int error) -{ - if (error != 0) - return; - *(bus_addr_t *)arg = segs[0].ds_addr; -} -#endif - - static int at91_usart_bus_transmit(struct uart_softc *sc) { @@ -359,6 +434,7 @@ WR4(&sc->sc_bas, PDC_TPR, addr); WR4(&sc->sc_bas, PDC_TCR, sc->sc_txdatasz); WR4(&sc->sc_bas, PDC_PTCR, PDC_PTCR_TXTEN); + WR4(&sc->sc_bas, USART_IER, USART_CSR_ENDTX); uart_unlock(sc->sc_hwmtx); #else for (int i = 0; i < sc->sc_txdatasz; i++) @@ -387,9 +463,7 @@ } while (!atomic_cmpset_32(&sc->sc_hwsig, old, new)); bas = &sc->sc_bas; uart_lock(sc->sc_hwmtx); - cr = RD4(bas, USART_CR); - cr &= ~(USART_CR_DTREN | USART_CR_DTRDIS | USART_CR_RTSEN | - USART_CR_RTSDIS); + cr = 0; if (new & SER_DTR) cr |= USART_CR_DTREN; else @@ -405,16 +479,14 @@ static int at91_usart_bus_receive(struct uart_softc *sc) { - - uart_lock(sc->sc_hwmtx); - uart_rx_put(sc, at91_usart_getc(&sc->sc_bas, NULL)); - uart_unlock(sc->sc_hwmtx); + return (0); } static int at91_usart_bus_param(struct uart_softc *sc, int baudrate, int databits, int stopbits, int parity) { + return (at91_usart_param(&sc->sc_bas, baudrate, databits, stopbits, parity)); } @@ -422,8 +494,9 @@ at91_usart_bus_ipend(struct uart_softc *sc) { int csr = RD4(&sc->sc_bas, USART_CSR); - int ipend = 0; + int ipend = 0, i, len; struct at91_usart_softc *atsc; + struct at91_usart_rx *p; atsc = (struct at91_usart_softc *)sc; if (csr & USART_CSR_ENDTX) { @@ -432,12 +505,85 @@ bus_dmamap_unload(atsc->dmatag, atsc->tx_map); } uart_lock(sc->sc_hwmtx); - if (csr & USART_CSR_TXRDY && sc->sc_txbusy) - ipend |= SER_INT_TXIDLE; >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607062154.k66Ls2kc051623>