svn commit: r232817 - head/sys/conf

2012-03-11 Thread Juli Mallett
Author: jmallett
Date: Sun Mar 11 08:12:30 2012
New Revision: 232817
URL: http://svn.freebsd.org/changeset/base/232817

Log:
  Reenable -Winline on MIPS now that we're not compiling Cavium's error
  decoding stuff, which is impossibly-huge.

Modified:
  head/sys/conf/kern.mk

Modified: head/sys/conf/kern.mk
==
--- head/sys/conf/kern.mk   Sun Mar 11 06:55:17 2012(r232816)
+++ head/sys/conf/kern.mk   Sun Mar 11 08:12:30 2012(r232817)
@@ -131,9 +131,6 @@ CFLAGS+=-mcall-aixdesc
 .if ${MACHINE_CPUARCH} == "mips"
 CFLAGS+=   -msoft-float
 INLINE_LIMIT?= 8000
-# XXX Disable -Winline.  This is needed because of the monstrous code that is
-# the Cavium Octeon Simple Executive.
-CWARNFLAGS:=   ${CWARNFLAGS:N-Winline}
 .endif
 
 #
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r232821 - in head: . include sys/fs/cd9660 sys/fs/ext2fs sys/fs/fifofs sys/fs/nfs sys/fs/tmpfs sys/fs/udf sys/gnu/fs/xfs/FreeBSD sys/kern sys/nfsclient sys/sys sys/ufs/ufs

2012-03-11 Thread Konstantin Belousov
Author: kib
Date: Sun Mar 11 12:19:58 2012
New Revision: 232821
URL: http://svn.freebsd.org/changeset/base/232821

Log:
  Remove fifo.h. The only used function declaration from the header is
  migrated to sys/vnode.h.
  
  Submitted by: gianni

Deleted:
  head/sys/fs/fifofs/fifo.h
Modified:
  head/ObsoleteFiles.inc
  head/include/Makefile
  head/sys/fs/cd9660/cd9660_vnops.c
  head/sys/fs/ext2fs/ext2_vnops.c
  head/sys/fs/fifofs/fifo_vnops.c
  head/sys/fs/nfs/nfsport.h
  head/sys/fs/tmpfs/tmpfs_vnops.c
  head/sys/fs/udf/udf_vnops.c
  head/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c
  head/sys/kern/sys_pipe.c
  head/sys/nfsclient/nfs_vnops.c
  head/sys/sys/vnode.h
  head/sys/ufs/ufs/ufs_vnops.c

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Sun Mar 11 09:29:02 2012(r232820)
+++ head/ObsoleteFiles.inc  Sun Mar 11 12:19:58 2012(r232821)
@@ -38,6 +38,9 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20120309: Remove fifofs header files.
+OLD_FILES+=usr/include/fs/fifofs/fifo.h
+OLD_DIRS+=usr/include/fs/fifofs
 # 20120225: libarchive 3.0.3
 OLD_FILES+=usr/share/man/man3/archive_read_data_into_buffer.3.gz \
usr/share/man/man3/archive_read_support_compression_all.3.gz \

Modified: head/include/Makefile
==
--- head/include/Makefile   Sun Mar 11 09:29:02 2012(r232820)
+++ head/include/Makefile   Sun Mar 11 12:19:58 2012(r232821)
@@ -43,7 +43,7 @@ LSUBDIRS= cam/ata cam/scsi \
dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/ofw \
dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \
dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \
-   fs/devfs fs/fdescfs fs/fifofs fs/msdosfs fs/nfs fs/ntfs fs/nullfs \
+   fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/ntfs fs/nullfs \
${_fs_nwfs} fs/portalfs fs/procfs fs/smbfs fs/udf fs/unionfs \
geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \
geom/mirror geom/mountver geom/multipath geom/nop \

Modified: head/sys/fs/cd9660/cd9660_vnops.c
==
--- head/sys/fs/cd9660/cd9660_vnops.c   Sun Mar 11 09:29:02 2012
(r232820)
+++ head/sys/fs/cd9660/cd9660_vnops.c   Sun Mar 11 12:19:58 2012
(r232821)
@@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: head/sys/fs/ext2fs/ext2_vnops.c
==
--- head/sys/fs/ext2fs/ext2_vnops.c Sun Mar 11 09:29:02 2012
(r232820)
+++ head/sys/fs/ext2fs/ext2_vnops.c Sun Mar 11 12:19:58 2012
(r232821)
@@ -71,8 +71,6 @@
 
 #include "opt_directio.h"
 
-#include 
-
 #include 
 
 #include 

Modified: head/sys/fs/fifofs/fifo_vnops.c
==
--- head/sys/fs/fifofs/fifo_vnops.c Sun Mar 11 09:29:02 2012
(r232820)
+++ head/sys/fs/fifofs/fifo_vnops.c Sun Mar 11 12:19:58 2012
(r232821)
@@ -52,7 +52,6 @@
 #include 
 #include 
 #include 
-#include 
 
 /*
  * This structure is associated with the FIFO vnode and stores

Modified: head/sys/fs/nfs/nfsport.h
==
--- head/sys/fs/nfs/nfsport.h   Sun Mar 11 09:29:02 2012(r232820)
+++ head/sys/fs/nfs/nfsport.h   Sun Mar 11 12:19:58 2012(r232821)
@@ -78,7 +78,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==
--- head/sys/fs/tmpfs/tmpfs_vnops.c Sun Mar 11 09:29:02 2012
(r232820)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c Sun Mar 11 12:19:58 2012
(r232821)
@@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
 #include 
 #include 
 

Modified: head/sys/fs/udf/udf_vnops.c
==
--- head/sys/fs/udf/udf_vnops.c Sun Mar 11 09:29:02 2012(r232820)
+++ head/sys/fs/udf/udf_vnops.c Sun Mar 11 12:19:58 2012(r232821)
@@ -48,7 +48,6 @@
 
 #include 
 
-#include 
 #include 
 #include 
 #include 

Modified: head/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c
==
--- head/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c Sun Mar 11 09:29:02 2012
(r232820)
+++ head/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c Sun Mar 11 12:19:58 2012
(r232821)
@@ -46,8 +46,6 @@
 #include 
 #include 
 
-#include 
-
 #define NO_VFS_MACROS
 #include "xfs.h"
 #include "xfs_types.h"

Modified: head/sys/kern/sys_pipe.c
==
--- hea

svn commit: r232822 - head/sys/boot/common

2012-03-11 Thread Marius Strobl
Author: marius
Date: Sun Mar 11 13:39:19 2012
New Revision: 232822
URL: http://svn.freebsd.org/changeset/base/232822

Log:
  Fix a bug introduced in r223938; on big-endian machines coping a 32-bit
  quantum bytewise to the address of a 64-bit variable results in writing
  to the "wrong" 32-bit half so adjust the address accordingly. This fix
  is implemented in a hackish way for two reasons:
  o in order to be able to get it into 8.3 with zero impact on the little-
endian architectures where this bug has no effect and
  o to avoid blowing the x86 boot2 out of the water again when compiling
it with clang, which all sane versions of this fix tested do.
  This change fixes booting from UFS1 file systems on big-endian machines.
  
  MFC after:3 days

Modified:
  head/sys/boot/common/ufsread.c

Modified: head/sys/boot/common/ufsread.c
==
--- head/sys/boot/common/ufsread.c  Sun Mar 11 12:19:58 2012
(r232821)
+++ head/sys/boot/common/ufsread.c  Sun Mar 11 13:39:19 2012
(r232822)
@@ -46,6 +46,8 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
+
 #include 
 #include 
 #include 
@@ -262,15 +264,28 @@ fsread(ino_t inode, void *buf, size_t nb
}
n = (lbn - NDADDR) & (n - 1);
 #if defined(UFS1_ONLY)
+#if BYTE_ORDER == BIG_ENDIAN
+   memcpy((char *)&addr + sizeof(addr) -
+   sizeof(ufs1_daddr_t), (ufs1_daddr_t *)indbuf + n,
+   sizeof(ufs1_daddr_t));
+#else
memcpy(&addr, (ufs1_daddr_t *)indbuf + n,
sizeof(ufs1_daddr_t));
+#endif
 #elif defined(UFS2_ONLY)
memcpy(&addr, (ufs2_daddr_t *)indbuf + n,
sizeof(ufs2_daddr_t));
 #else
if (fs.fs_magic == FS_UFS1_MAGIC)
+#if BYTE_ORDER == BIG_ENDIAN
+   memcpy((char *)&addr + sizeof(addr) -
+   sizeof(ufs1_daddr_t),
+   (ufs1_daddr_t *)indbuf + n,
+   sizeof(ufs1_daddr_t));
+#else
memcpy(&addr, (ufs1_daddr_t *)indbuf + n,
sizeof(ufs1_daddr_t));
+#endif
else
memcpy(&addr, (ufs2_daddr_t *)indbuf + n,
sizeof(ufs2_daddr_t));
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r232823 - head/sys/fs/fifofs

2012-03-11 Thread Konstantin Belousov
Author: kib
Date: Sun Mar 11 15:58:27 2012
New Revision: 232823
URL: http://svn.freebsd.org/changeset/base/232823

Log:
  Update comment.
  
  Submitted by: gianni

Modified:
  head/sys/fs/fifofs/fifo_vnops.c

Modified: head/sys/fs/fifofs/fifo_vnops.c
==
--- head/sys/fs/fifofs/fifo_vnops.c Sun Mar 11 13:39:19 2012
(r232822)
+++ head/sys/fs/fifofs/fifo_vnops.c Sun Mar 11 15:58:27 2012
(r232823)
@@ -59,7 +59,7 @@
  * Notes about locking:
  *   - fi_pipe is invariant since init time.
  *   - fi_readers and fi_writers are protected by the vnode lock.
- *   - fi_wgen is protected by the pipe mutex.
+ *   - fi_wgen and fi_seqcount are protected by the pipe mutex.
  */
 struct fifoinfo {
struct pipe *fi_pipe;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r232824 - head/sys/net

2012-03-11 Thread Luigi Rizzo
Author: luigi
Date: Sun Mar 11 17:35:12 2012
New Revision: 232824
URL: http://svn.freebsd.org/changeset/base/232824

Log:
  - remove an extra parenthesis in a closing brace;
  - add the macro NETMAP_RING_FIRST_RESERVED() which returns
the index of the first non-released buffer in the ring
(this is useful for code that retains buffers for some time
instead of processing them immediately)

Modified:
  head/sys/net/netmap_user.h

Modified: head/sys/net/netmap_user.h
==
--- head/sys/net/netmap_user.h  Sun Mar 11 15:58:27 2012(r232823)
+++ head/sys/net/netmap_user.h  Sun Mar 11 17:35:12 2012(r232824)
@@ -77,11 +77,16 @@
 
 #define NETMAP_BUF_IDX(ring, buf)  \
( ((char *)(buf) - ((char *)(ring) + (ring)->buf_ofs) ) / \
-   (ring)->nr_buf_size) ) 
+   (ring)->nr_buf_size ) 
 
 #defineNETMAP_RING_NEXT(r, i)  \
((i)+1 == (r)->num_slots ? 0 : (i) + 1 )
 
+#defineNETMAP_RING_FIRST_RESERVED(r)   \
+   ( (r)->cur < (r)->reserved ?\
+ (r)->cur + (r)->num_slots - (r)->reserved :   \
+ (r)->cur - (r)->reserved )
+
 /*
  * Return 1 if the given tx ring is empty.
  */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r232825 - head/sys/netgraph

2012-03-11 Thread Adrian Chadd
Author: adrian
Date: Sun Mar 11 19:08:56 2012
New Revision: 232825
URL: http://svn.freebsd.org/changeset/base/232825

Log:
  Upgrade the netgraph vlan node to support 802.1q, encapsulation type,
  PCP and CFI fields.
  
  * Ethernet_type for VLAN encapsulation is tunable, default is 0x8100;
  * PCP (Priority code point) and CFI (canonical format indicator) is
tunable per VID;
  * Tunable encapsulation to support 802.1q
  * Encapsulation/Decapsulation code improvements
  
  New messages have been added for this netgraph node to support the
  new features.
  
  However, the legacy "vlan" id is still supported and compiled in by
  default.  It can be disabled in a future release.
  
  TODO:
  
  * Documentation
  * Examples
  
  PR:   kern/161908
  Submitted by: Ivan 

Modified:
  head/sys/netgraph/ng_vlan.c
  head/sys/netgraph/ng_vlan.h

Modified: head/sys/netgraph/ng_vlan.c
==
--- head/sys/netgraph/ng_vlan.c Sun Mar 11 17:35:12 2012(r232824)
+++ head/sys/netgraph/ng_vlan.c Sun Mar 11 19:08:56 2012(r232825)
@@ -1,5 +1,6 @@
 /*-
  * Copyright (c) 2003 IPNET Internet Communication Company
+ * Copyright (c) 2011 - 2012 Rozhuk Ivan 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -46,6 +47,22 @@
 #include 
 #include 
 
+struct ng_vlan_private {
+   hook_p  downstream_hook;
+   hook_p  nomatch_hook;
+   uint32_tdecap_enable;
+   uint32_tencap_enable;
+   uint16_tencap_proto;
+   hook_p  vlan_hook[(EVL_VLID_MASK + 1)];
+};
+typedef struct ng_vlan_private *priv_p;
+
+#defineETHER_VLAN_HDR_LEN (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN)
+#defineVLAN_TAG_MASK   0x
+#defineHOOK_VLAN_TAG_SET_MASK ((uintptr_t)((~0) & ~(VLAN_TAG_MASK)))
+#defineIS_HOOK_VLAN_SET(hdata) \
+   uintptr_t)hdata) & HOOK_VLAN_TAG_SET_MASK) == 
HOOK_VLAN_TAG_SET_MASK)
+
 static ng_constructor_tng_vlan_constructor;
 static ng_rcvmsg_t ng_vlan_rcvmsg;
 static ng_shutdown_t   ng_vlan_shutdown;
@@ -110,6 +127,55 @@ static const struct ng_cmdlist ng_vlan_c
  NULL,
  &ng_vlan_table_type
},
+   {
+ NGM_VLAN_COOKIE,
+ NGM_VLAN_DEL_VID_FLT,
+ "delvidflt",
+ &ng_parse_uint16_type,
+ NULL
+   },
+   {
+ NGM_VLAN_COOKIE,
+ NGM_VLAN_GET_DECAP,
+ "getdecap",
+ NULL,
+ &ng_parse_hint32_type
+   },
+   {
+ NGM_VLAN_COOKIE,
+ NGM_VLAN_SET_DECAP,
+ "setdecap",
+ &ng_parse_hint32_type,
+ NULL
+   },
+   {
+ NGM_VLAN_COOKIE,
+ NGM_VLAN_GET_ENCAP,
+ "getencap",
+ NULL,
+ &ng_parse_hint32_type
+   },
+   {
+ NGM_VLAN_COOKIE,
+ NGM_VLAN_SET_ENCAP,
+ "setencap",
+ &ng_parse_hint32_type,
+ NULL
+   },
+   {
+ NGM_VLAN_COOKIE,
+ NGM_VLAN_GET_ENCAP_PROTO,
+ "getencapproto",
+ NULL,
+ &ng_parse_hint16_type
+   },
+   {
+ NGM_VLAN_COOKIE,
+ NGM_VLAN_SET_ENCAP_PROTO,
+ "setencapproto",
+ &ng_parse_hint16_type,
+ NULL
+   },
{ 0 }
 };
 
@@ -126,44 +192,40 @@ static struct ng_type ng_vlan_typestruct
 };
 NETGRAPH_INIT(vlan, &ng_vlan_typestruct);
 
-struct filter {
-   LIST_ENTRY(filter) next;
-   u_int16_t   vlan;
-   hook_p  hook;
-};
 
-#defineHASHSIZE16
-#defineHASH(id)id) >> 8) ^ ((id) >> 4) ^ (id)) & 0x0f)
-LIST_HEAD(filterhead, filter);
-
-typedef struct {
-   hook_p  downstream_hook;
-   hook_p  nomatch_hook;
-   struct filterhead hashtable[HASHSIZE];
-   u_int32_t   nent;
-} *priv_p;
+/*
+ * Helper functions.
+ */
 
-static struct filter *
-ng_vlan_findentry(priv_p priv, u_int16_t vlan)
+static __inline int
+m_chk(struct mbuf **mp, int len)
 {
-   struct filterhead *chain = &priv->hashtable[HASH(vlan)];
-   struct filter *f;
 
-   LIST_FOREACH(f, chain, next)
-   if (f->vlan == vlan)
-   return (f);
-   return (NULL);
+   if ((*mp)->m_pkthdr.len < len) {
+   m_freem((*mp));
+   (*mp) = NULL;
+   return (EINVAL);
+   }
+   if ((*mp)->m_len < len && ((*mp) = m_pullup((*mp), len)) == NULL)
+   return (ENOBUFS);
+
+   return (0);
 }
 
+
+/*
+ * Netgraph node functions.
+ */
+
 static int
 ng_vlan_constructor(node_p node)
 {
priv_p priv;
-   int i;
 
priv = malloc(sizeof(*priv), M_NETGRAPH, M_WAITOK | M_ZERO);
-   for (i = 0; i < HASHSIZE; i++)
-   LIST_INIT(&priv->hashtable[i]);
+   priv->decap_enable = 0;
+   priv->encap_enable = VLAN_ENCAP_FROM_FILTER;
+   priv->encap_proto = ht

svn commit: r232828 - head/sys/kern

2012-03-11 Thread Konstantin Belousov
Author: kib
Date: Sun Mar 11 19:38:49 2012
New Revision: 232828
URL: http://svn.freebsd.org/changeset/base/232828

Log:
  ELF image can have several PT_NOTE program headers.  Look for the ELF
  brand note in each header, instead of using only first one.
  
  Reviewed by:  kan
  Tested by:andrew (arm), flo (sparc64)
  MFC after:3 weeks

Modified:
  head/sys/kern/imgact_elf.c

Modified: head/sys/kern/imgact_elf.c
==
--- head/sys/kern/imgact_elf.c  Sun Mar 11 19:23:42 2012(r232827)
+++ head/sys/kern/imgact_elf.c  Sun Mar 11 19:38:49 2012(r232828)
@@ -1549,32 +1549,14 @@ __elfN(putnote)(void *dst, size_t *off, 
*off += roundup2(note.n_descsz, sizeof(Elf_Size));
 }
 
-/*
- * Try to find the appropriate ABI-note section for checknote,
- * fetch the osreldate for binary from the ELF OSABI-note. Only the
- * first page of the image is searched, the same as for headers.
- */
 static boolean_t
-__elfN(check_note)(struct image_params *imgp, Elf_Brandnote *checknote,
-int32_t *osrel)
+__elfN(parse_notes)(struct image_params *imgp, Elf_Brandnote *checknote,
+int32_t *osrel, const Elf_Phdr *pnote)
 {
const Elf_Note *note, *note0, *note_end;
-   const Elf_Phdr *phdr, *pnote;
-   const Elf_Ehdr *hdr;
const char *note_name;
int i;
 
-   pnote = NULL;
-   hdr = (const Elf_Ehdr *)imgp->image_header;
-   phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff);
-
-   for (i = 0; i < hdr->e_phnum; i++) {
-   if (phdr[i].p_type == PT_NOTE) {
-   pnote = &phdr[i];
-   break;
-   }
-   }
-
if (pnote == NULL || pnote->p_offset >= PAGE_SIZE ||
pnote->p_offset + pnote->p_filesz >= PAGE_SIZE)
return (FALSE);
@@ -1613,6 +1595,31 @@ nextnote:
 }
 
 /*
+ * Try to find the appropriate ABI-note section for checknote,
+ * fetch the osreldate for binary from the ELF OSABI-note. Only the
+ * first page of the image is searched, the same as for headers.
+ */
+static boolean_t
+__elfN(check_note)(struct image_params *imgp, Elf_Brandnote *checknote,
+int32_t *osrel)
+{
+   const Elf_Phdr *phdr;
+   const Elf_Ehdr *hdr;
+   int i;
+
+   hdr = (const Elf_Ehdr *)imgp->image_header;
+   phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff);
+
+   for (i = 0; i < hdr->e_phnum; i++) {
+   if (phdr[i].p_type == PT_NOTE &&
+   __elfN(parse_notes)(imgp, checknote, osrel, &phdr[i]))
+   return (TRUE);
+   }
+   return (FALSE);
+
+}
+
+/*
  * Tell kern_execve.c about it, with a little help from the linker.
  */
 static struct execsw __elfN(execsw) = {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r232830 - head/lib/csu/common

2012-03-11 Thread Konstantin Belousov
Author: kib
Date: Sun Mar 11 19:56:58 2012
New Revision: 232830
URL: http://svn.freebsd.org/changeset/base/232830

Log:
  Add a header with definitions useful for constructing ELF notes.
  
  Reviewed by: kan
  MFC after:   3 weeks

Added:
  head/lib/csu/common/notes.h   (contents, props changed)

Added: head/lib/csu/common/notes.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/csu/common/notes.h Sun Mar 11 19:56:58 2012(r232830)
@@ -0,0 +1,38 @@
+/*-
+ * Copyright 2012 Konstantin Belousov 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndefCSU_COMMON_NOTES_H
+#defineCSU_COMMON_NOTES_H
+
+#define NOTE_FREEBSD_VENDOR"FreeBSD"
+
+#define NOTE_SECTION   ".note.tag"
+
+#define ABI_NOTETYPE   1
+#defineCRT_NOINIT_NOTETYPE 2
+
+#endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r232831 - in head/libexec/rtld-elf: . amd64 arm i386 ia64 mips powerpc powerpc64 sparc64

2012-03-11 Thread Konstantin Belousov
Author: kib
Date: Sun Mar 11 20:03:09 2012
New Revision: 232831
URL: http://svn.freebsd.org/changeset/base/232831

Log:
  Add support for preinit, init and fini arrays.  Some ABIs, in
  particular on ARM, do require working init arrays.
  
  Traditional FreeBSD crt1 calls _init and _fini of the binary, instead
  of allowing runtime linker to arrange the calls.  This was probably
  done to have the same crt code serve both statically and dynamically
  linked binaries.  Since ABI mandates that first is called preinit
  array functions, then init, and then init array functions, the init
  have to be called from rtld now.
  
  To provide binary compatibility to old FreeBSD crt1, which calls _init
  itself, rtld only calls intializers and finalizers for main binary if
  binary has a note indicating that new crt was used for linking.  Add
  parsing of ELF notes to rtld, and cache p_osrel value since we parsed
  it anyway.
  
  The patch is inspired by init_array support for DragonflyBSD, written
  by John Marino.
  
  Reviewed by:  kan
  Tested by:andrew (arm, previous version), flo (sparc64, previous version)
  MFC after:3 weeks

Modified:
  head/libexec/rtld-elf/Makefile
  head/libexec/rtld-elf/amd64/rtld_machdep.h
  head/libexec/rtld-elf/arm/rtld_machdep.h
  head/libexec/rtld-elf/i386/rtld_machdep.h
  head/libexec/rtld-elf/ia64/reloc.c
  head/libexec/rtld-elf/ia64/rtld_machdep.h
  head/libexec/rtld-elf/map_object.c
  head/libexec/rtld-elf/mips/rtld_machdep.h
  head/libexec/rtld-elf/powerpc/rtld_machdep.h
  head/libexec/rtld-elf/powerpc64/rtld_machdep.h
  head/libexec/rtld-elf/rtld.c
  head/libexec/rtld-elf/rtld.h
  head/libexec/rtld-elf/sparc64/rtld_machdep.h

Modified: head/libexec/rtld-elf/Makefile
==
--- head/libexec/rtld-elf/Makefile  Sun Mar 11 19:56:58 2012
(r232830)
+++ head/libexec/rtld-elf/Makefile  Sun Mar 11 20:03:09 2012
(r232831)
@@ -10,6 +10,7 @@ SRCS= rtld_start.S \
 MAN=   rtld.1
 CSTD?= gnu99
 CFLAGS+=   -Wall -DFREEBSD_ELF -DIN_RTLD
+CFLAGS+=   -I${.CURDIR}/../../lib/csu/common
 .if exists(${.CURDIR}/${MACHINE_ARCH})
 RTLD_ARCH= ${MACHINE_ARCH}
 .else

Modified: head/libexec/rtld-elf/amd64/rtld_machdep.h
==
--- head/libexec/rtld-elf/amd64/rtld_machdep.h  Sun Mar 11 19:56:58 2012
(r232830)
+++ head/libexec/rtld-elf/amd64/rtld_machdep.h  Sun Mar 11 20:03:09 2012
(r232831)
@@ -58,6 +58,9 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr 
 #define call_initfini_pointer(obj, target) \
(((InitFunc)(target))())
 
+#define call_init_pointer(obj, target) \
+   (((InitArrFunc)(target))(main_argc, main_argv, environ))
+
 #define round(size, align) \
(((size) + (align) - 1) & ~((align) - 1))
 #define calculate_first_tls_offset(size, align) \

Modified: head/libexec/rtld-elf/arm/rtld_machdep.h
==
--- head/libexec/rtld-elf/arm/rtld_machdep.hSun Mar 11 19:56:58 2012
(r232830)
+++ head/libexec/rtld-elf/arm/rtld_machdep.hSun Mar 11 20:03:09 2012
(r232831)
@@ -48,6 +48,9 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, 
 #define call_initfini_pointer(obj, target) \
(((InitFunc)(target))())

+#define call_init_pointer(obj, target) \
+   (((InitArrFunc)(target))(main_argc, main_argv, environ))
+
 #defineTLS_TCB_SIZE8
 typedef struct {
unsigned long ti_module;

Modified: head/libexec/rtld-elf/i386/rtld_machdep.h
==
--- head/libexec/rtld-elf/i386/rtld_machdep.h   Sun Mar 11 19:56:58 2012
(r232830)
+++ head/libexec/rtld-elf/i386/rtld_machdep.h   Sun Mar 11 20:03:09 2012
(r232831)
@@ -58,6 +58,9 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr 
 #define call_initfini_pointer(obj, target) \
(((InitFunc)(target))())
 
+#define call_init_pointer(obj, target) \
+   (((InitArrFunc)(target))(main_argc, main_argv, environ))
+
 #define round(size, align) \
(((size) + (align) - 1) & ~((align) - 1))
 #define calculate_first_tls_offset(size, align) \

Modified: head/libexec/rtld-elf/ia64/reloc.c
==
--- head/libexec/rtld-elf/ia64/reloc.c  Sun Mar 11 19:56:58 2012
(r232830)
+++ head/libexec/rtld-elf/ia64/reloc.c  Sun Mar 11 20:03:09 2012
(r232831)
@@ -586,6 +586,18 @@ call_initfini_pointer(const Obj_Entry *o
((InitFunc) &fptr)();
 }
 
+void
+call_init_pointer(const Obj_Entry *obj, Elf_Addr target)
+{
+   struct fptr fptr;
+
+   fptr.gp = (Elf_Addr) obj->pltgot;
+   fptr.target = target;
+   dbg(" initfini: target=%p, gp=%p",
+   (void *) fptr.target, (void *) fptr.gp);
+   ((InitArrFunc) &fptr)(main_argc, main_argv, enviro

svn commit: r232832 - in head/lib/csu: . amd64 arm common i386-elf mips powerpc powerpc64 sparc64

2012-03-11 Thread Konstantin Belousov
Author: kib
Date: Sun Mar 11 20:04:09 2012
New Revision: 232832
URL: http://svn.freebsd.org/changeset/base/232832

Log:
  Stop calling _init/_fini methods from crt1 for dynamic binaries.  Do
  call preinit, init and fini arrays methods from crt1 for static binaries.
  
  Mark new crt1 with FreeBSD-specific ELF note.
  
  Move some common crt1 code into new MI file ignore_init.c, to reduce
  duplication.  Also, conservatively adjust nearby sources for style.
  
  Reviewed by:  kan
  Tested by:andrew (arm), flo (sparc64)
  MFC after:3 weeks

Added:
  head/lib/csu/common/ignore_init.c   (contents, props changed)
Modified:
  head/lib/csu/Makefile.inc
  head/lib/csu/amd64/Makefile
  head/lib/csu/amd64/crt1.c
  head/lib/csu/arm/Makefile
  head/lib/csu/arm/crt1.c
  head/lib/csu/common/crtbrand.c
  head/lib/csu/i386-elf/Makefile
  head/lib/csu/i386-elf/crt1_c.c
  head/lib/csu/mips/Makefile
  head/lib/csu/mips/crt1.c
  head/lib/csu/powerpc/Makefile
  head/lib/csu/powerpc/crt1.c
  head/lib/csu/powerpc64/Makefile
  head/lib/csu/powerpc64/crt1.c
  head/lib/csu/sparc64/crt1.c

Modified: head/lib/csu/Makefile.inc
==
--- head/lib/csu/Makefile.inc   Sun Mar 11 20:03:09 2012(r232831)
+++ head/lib/csu/Makefile.inc   Sun Mar 11 20:04:09 2012(r232832)
@@ -2,4 +2,6 @@
 
 SSP_CFLAGS=
 
+SED_FIX_NOTE = -i "" -e '/\.note\.tag/s/progbits/note/'
+
 .include "../Makefile.inc"

Modified: head/lib/csu/amd64/Makefile
==
--- head/lib/csu/amd64/Makefile Sun Mar 11 20:03:09 2012(r232831)
+++ head/lib/csu/amd64/Makefile Sun Mar 11 20:04:09 2012(r232832)
@@ -19,21 +19,21 @@ CLEANFILES+=crt1.s gcrt1.s Scrt1.s
 
 crt1.s: crt1.c
${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1.c
-   sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET}
+   sed ${SED_FIX_NOTE} ${.TARGET}
 
 crt1.o: crt1.s
${CC} ${CFLAGS} -c -o ${.TARGET} crt1.s
 
 gcrt1.s: crt1.c
${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1.c
-   sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET}
+   sed ${SED_FIX_NOTE} ${.TARGET}
 
 gcrt1.o: gcrt1.s
${CC} ${CFLAGS} -c -o ${.TARGET} gcrt1.s
 
 Scrt1.s: crt1.c
${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.CURDIR}/crt1.c
-   sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET}
+   sed ${SED_FIX_NOTE} ${.TARGET}
 
 Scrt1.o: Scrt1.s
${CC} ${CFLAGS} -c -o ${.TARGET} Scrt1.s

Modified: head/lib/csu/amd64/crt1.c
==
--- head/lib/csu/amd64/crt1.c   Sun Mar 11 20:03:09 2012(r232831)
+++ head/lib/csu/amd64/crt1.c   Sun Mar 11 20:04:09 2012(r232832)
@@ -37,16 +37,10 @@ __FBSDID("$FreeBSD$");
 
 #include "libc_private.h"
 #include "crtbrand.c"
-
-extern int _DYNAMIC;
-#pragma weak _DYNAMIC
+#include "ignore_init.c"
 
 typedef void (*fptr)(void);
 
-extern void _fini(void);
-extern void _init(void);
-extern int main(int, char **, char **);
-
 #ifdef GCRT
 extern void _mcleanup(void);
 extern void monstartup(void *, void *);
@@ -54,9 +48,6 @@ extern int eprol;
 extern int etext;
 #endif
 
-char **environ;
-const char *__progname = "";
-
 void _start(char **, void (*)(void));
 
 /* The entry function. */
@@ -66,18 +57,13 @@ _start(char **ap, void (*cleanup)(void))
int argc;
char **argv;
char **env;
-   const char *s;
 
argc = *(long *)(void *)ap;
argv = ap + 1;
env = ap + 2 + argc;
environ = env;
-   if (argc > 0 && argv[0] != NULL) {
-   __progname = argv[0];
-   for (s = __progname; *s != '\0'; s++)
-   if (*s == '/')
-   __progname = s + 1;
-   }
+   if (argc > 0 && argv[0] != NULL)
+   handle_progname(argv[0]);
 
if (&_DYNAMIC != NULL)
atexit(cleanup);
@@ -86,12 +72,10 @@ _start(char **ap, void (*cleanup)(void))
 
 #ifdef GCRT
atexit(_mcleanup);
-#endif
-   atexit(_fini);
-#ifdef GCRT
monstartup(&eprol, &etext);
 __asm__("eprol:");
 #endif
-   _init();
-   exit( main(argc, argv, env) );
+
+   handle_static_init(argc, argv, env);
+   exit(main(argc, argv, env));
 }

Modified: head/lib/csu/arm/Makefile
==
--- head/lib/csu/arm/Makefile   Sun Mar 11 20:03:09 2012(r232831)
+++ head/lib/csu/arm/Makefile   Sun Mar 11 20:04:09 2012(r232832)
@@ -18,21 +18,21 @@ CLEANFILES+=crt1.s gcrt1.s Scrt1.s
 
 crt1.s: crt1.c
${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1.c
-   sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET}
+   sed ${SED_FIX_NOTE} ${.TARGET}
 
 crt1.o: crt1.s
${CC} ${CFLAGS} -c -o ${.TARGET} crt1.s
 
 gcrt1.s: crt1.c

svn commit: r232833 - head/sys/ufs/ffs

2012-03-11 Thread Konstantin Belousov
Author: kib
Date: Sun Mar 11 20:15:12 2012
New Revision: 232833
URL: http://svn.freebsd.org/changeset/base/232833

Log:
  Remove not needed ARGSUSED lint command.
  
  Submitted by: bde
  MFC after:3 days

Modified:
  head/sys/ufs/ffs/ffs_vnops.c

Modified: head/sys/ufs/ffs/ffs_vnops.c
==
--- head/sys/ufs/ffs/ffs_vnops.cSun Mar 11 20:04:09 2012
(r232832)
+++ head/sys/ufs/ffs/ffs_vnops.cSun Mar 11 20:15:12 2012
(r232833)
@@ -409,7 +409,6 @@ ffs_lock(ap)
 /*
  * Vnode op for reading.
  */
-/* ARGSUSED */
 static int
 ffs_read(ap)
struct vop_read_args /* {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r232834 - head/sys/ufs/ffs

2012-03-11 Thread Konstantin Belousov
Author: kib
Date: Sun Mar 11 20:18:14 2012
New Revision: 232834
URL: http://svn.freebsd.org/changeset/base/232834

Log:
  In ffs_syncvnode(), pass boolean false as second argument of ffs_update().
  Synchronous inode block update is not needed for MNT_LAZY callers (syncer),
  and since waitfor values are not zero, code did unneccessary synchronous
  update.
  
  Submitted by: bde
  Reviewed by:  mckusick
  Tested by:pho
  MFC after:2 weeks

Modified:
  head/sys/ufs/ffs/ffs_vnops.c

Modified: head/sys/ufs/ffs/ffs_vnops.c
==
--- head/sys/ufs/ffs/ffs_vnops.cSun Mar 11 20:15:12 2012
(r232833)
+++ head/sys/ufs/ffs/ffs_vnops.cSun Mar 11 20:18:14 2012
(r232834)
@@ -305,7 +305,7 @@ next:
if (noupdate)
return (0);
else
-   return (ffs_update(vp, waitfor));
+   return (ffs_update(vp, 0));
}
/* Drain IO to see if we're done. */
bufobj_wwait(bo, 0, 0);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r232835 - head/sys/ufs/ffs

2012-03-11 Thread Konstantin Belousov
Author: kib
Date: Sun Mar 11 20:23:46 2012
New Revision: 232835
URL: http://svn.freebsd.org/changeset/base/232835

Log:
  Do not fall back to slow synchronous i/o when low on memory or buffers.
  The bawrite() schedules the write to happen immediately, and its use
  frees the current thread to do more cleanups.
  
  Submitted by: bde
  Reviewed by:  mckusick
  Tested by:pho
  MFC after:2 weeks

Modified:
  head/sys/ufs/ffs/ffs_inode.c

Modified: head/sys/ufs/ffs/ffs_inode.c
==
--- head/sys/ufs/ffs/ffs_inode.cSun Mar 11 20:18:14 2012
(r232834)
+++ head/sys/ufs/ffs/ffs_inode.cSun Mar 11 20:23:46 2012
(r232835)
@@ -133,9 +133,11 @@ ffs_update(vp, waitfor)
else
*((struct ufs2_dinode *)bp->b_data +
ino_to_fsbo(fs, ip->i_number)) = *ip->i_din2;
-   if ((waitfor && !DOINGASYNC(vp)) ||
-   (vm_page_count_severe() || buf_dirty_count_severe())) {
+   if ((waitfor && !DOINGASYNC(vp)))
error = bwrite(bp);
+   else if (vm_page_count_severe() || buf_dirty_count_severe()) {
+   bawrite(bp);
+   error = 0;
} else {
if (bp->b_bufsize == fs->fs_bsize)
bp->b_flags |= B_CLUSTEROK;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r232836 - head/sys/ufs/ffs

2012-03-11 Thread Konstantin Belousov
Author: kib
Date: Sun Mar 11 20:26:19 2012
New Revision: 232836
URL: http://svn.freebsd.org/changeset/base/232836

Log:
  Do schedule delayed writes for async mounts.
  While there, make some style adjustments, like missed () around
  return values.
  
  Submitted by: bde
  Reviewed by:  mckusick
  Tested by:pho
  MFC after:2 weeks

Modified:
  head/sys/ufs/ffs/ffs_inode.c

Modified: head/sys/ufs/ffs/ffs_inode.c
==
--- head/sys/ufs/ffs/ffs_inode.cSun Mar 11 20:23:46 2012
(r232835)
+++ head/sys/ufs/ffs/ffs_inode.cSun Mar 11 20:26:19 2012
(r232836)
@@ -244,7 +244,7 @@ ffs_truncate(vp, length, flags, cred, td
ip->i_din2->di_extb[i] = 0;
}
ip->i_flag |= IN_CHANGE;
-   if ((error = ffs_update(vp, 1)))
+   if ((error = ffs_update(vp, !DOINGASYNC(vp
return (error);
for (i = 0; i < NXADDR; i++) {
if (oldblks[i] == 0)
@@ -270,13 +270,13 @@ ffs_truncate(vp, length, flags, cred, td
ip->i_flag |= IN_CHANGE | IN_UPDATE;
if (needextclean)
goto extclean;
-   return ffs_update(vp, 1);
+   return (ffs_update(vp, !DOINGASYNC(vp)));
}
if (ip->i_size == length) {
ip->i_flag |= IN_CHANGE | IN_UPDATE;
if (needextclean)
goto extclean;
-   return ffs_update(vp, 0);
+   return (ffs_update(vp, 0));
}
if (fs->fs_ronly)
panic("ffs_truncate: read-only filesystem");
@@ -303,10 +303,12 @@ ffs_truncate(vp, length, flags, cred, td
bp->b_flags |= B_CLUSTEROK;
if (flags & IO_SYNC)
bwrite(bp);
+   else if (DOINGASYNC(vp))
+   bdwrite(bp);
else
bawrite(bp);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
-   return ffs_update(vp, 1);
+   return (ffs_update(vp, !DOINGASYNC(vp)));
}
if (DOINGSOFTDEP(vp)) {
if (softdeptrunc == 0 && journaltrunc == 0) {
@@ -378,6 +380,8 @@ ffs_truncate(vp, length, flags, cred, td
bp->b_flags |= B_CLUSTEROK;
if (flags & IO_SYNC)
bwrite(bp);
+   else if (DOINGASYNC(vp))
+   bdwrite(bp);
else
bawrite(bp);
}
@@ -411,7 +415,7 @@ ffs_truncate(vp, length, flags, cred, td
DIP_SET(ip, i_db[i], 0);
}
ip->i_flag |= IN_CHANGE | IN_UPDATE;
-   allerror = ffs_update(vp, 1);
+   allerror = ffs_update(vp, !DOINGASYNC(vp));

/*
 * Having written the new inode to disk, save its new configuration
@@ -543,7 +547,7 @@ extclean:
softdep_journal_freeblocks(ip, cred, length, IO_EXT);
else
softdep_setup_freeblocks(ip, length, IO_EXT);
-   return ffs_update(vp, MNT_WAIT);
+   return (ffs_update(vp, !DOINGASYNC(vp)));
 }
 
 /*
@@ -624,7 +628,7 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, lev
else
bap2[i] = 0;
if (DOINGASYNC(vp)) {
-   bawrite(bp);
+   bdwrite(bp);
} else {
error = bwrite(bp);
if (error)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r232837 - head/sys/ufs/ffs

2012-03-11 Thread Konstantin Belousov
Author: kib
Date: Sun Mar 11 21:25:42 2012
New Revision: 232837
URL: http://svn.freebsd.org/changeset/base/232837

Log:
  Remove superfluous brackets.
  
  Submitted by: alc
  MFC after:2 weeks

Modified:
  head/sys/ufs/ffs/ffs_inode.c

Modified: head/sys/ufs/ffs/ffs_inode.c
==
--- head/sys/ufs/ffs/ffs_inode.cSun Mar 11 20:26:19 2012
(r232836)
+++ head/sys/ufs/ffs/ffs_inode.cSun Mar 11 21:25:42 2012
(r232837)
@@ -133,7 +133,7 @@ ffs_update(vp, waitfor)
else
*((struct ufs2_dinode *)bp->b_data +
ino_to_fsbo(fs, ip->i_number)) = *ip->i_din2;
-   if ((waitfor && !DOINGASYNC(vp)))
+   if (waitfor && !DOINGASYNC(vp))
error = bwrite(bp);
else if (vm_page_count_severe() || buf_dirty_count_severe()) {
bawrite(bp);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r232839 - head/tools/regression/bin/sh/expansion

2012-03-11 Thread Jilles Tjoelker
Author: jilles
Date: Sun Mar 11 22:12:05 2012
New Revision: 232839
URL: http://svn.freebsd.org/changeset/base/232839

Log:
  sh: Add a test for variables with underscores in arithmetic.
  
  Things like $((_x+1)) are broken in stable/8 sh but work in stable/9 and
  head.

Added:
  head/tools/regression/bin/sh/expansion/arith12.0   (contents, props changed)

Added: head/tools/regression/bin/sh/expansion/arith12.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/bin/sh/expansion/arith12.0Sun Mar 11 22:12:05 
2012(r232839)
@@ -0,0 +1,4 @@
+# $FreeBSD$
+
+_x=4 y_=5 z_z=6
+[ "$((_x*100+y_*10+z_z))" = 456 ]
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r232840 - head/sys/mips/conf

2012-03-11 Thread Juli Mallett
Author: jmallett
Date: Sun Mar 11 22:17:01 2012
New Revision: 232840
URL: http://svn.freebsd.org/changeset/base/232840

Log:
  We've supported 64-bit PTEs for some time.

Modified:
  head/sys/mips/conf/SWARM64
  head/sys/mips/conf/SWARM64_SMP

Modified: head/sys/mips/conf/SWARM64
==
--- head/sys/mips/conf/SWARM64  Sun Mar 11 22:12:05 2012(r232839)
+++ head/sys/mips/conf/SWARM64  Sun Mar 11 22:17:01 2012(r232840)
@@ -10,12 +10,3 @@ machine  mips mips64eb
 makeoptionsARCH_FLAGS="-mabi=64 -march=mips64"
 makeoptionsLDSCRIPT_NAME=ldscript.mips.cfe
 makeoptionsKERNLOADADDR=0x80001000
-
-#
-# XXX restrict memory to maximum 4GB because page table entries in pmap
-# are still 32 bits wide
-
-#
-# MAXMEM is specified in units of KB
-#
-optionsMAXMEM=0x40

Modified: head/sys/mips/conf/SWARM64_SMP
==
--- head/sys/mips/conf/SWARM64_SMP  Sun Mar 11 22:12:05 2012
(r232839)
+++ head/sys/mips/conf/SWARM64_SMP  Sun Mar 11 22:17:01 2012
(r232840)
@@ -13,12 +13,3 @@ machine  mips mips64eb
 makeoptionsARCH_FLAGS="-mabi=64 -march=mips64"
 makeoptionsLDSCRIPT_NAME=ldscript.mips.cfe
 makeoptionsKERNLOADADDR=0x80001000
-
-#
-# XXX restrict memory to maximum 4GB because page table entries in pmap
-# are still 32 bits wide
-
-#
-# MAXMEM is specified in units of KB
-#
-optionsMAXMEM=0x40
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r232841 - head/sbin/init

2012-03-11 Thread Ed Schouten
Author: ed
Date: Sun Mar 11 22:30:06 2012
New Revision: 232841
URL: http://svn.freebsd.org/changeset/base/232841

Log:
  Fix whitespace.
  
  MFC after:1 week

Modified:
  head/sbin/init/init.c

Modified: head/sbin/init/init.c
==
--- head/sbin/init/init.c   Sun Mar 11 22:17:01 2012(r232840)
+++ head/sbin/init/init.c   Sun Mar 11 22:30:06 2012(r232841)
@@ -86,13 +86,13 @@ static const char rcsid[] =
  */
 #defineGETTY_SPACING5  /* N secs minimum getty spacing 
*/
 #defineGETTY_SLEEP 30  /* sleep N secs after spacing 
problem */
-#defineGETTY_NSPACE 3  /* max. spacing count to bring 
reaction */
+#defineGETTY_NSPACE 3  /* max. spacing count to bring 
reaction */
 #defineWINDOW_WAIT  3  /* wait N secs after starting 
window */
 #defineSTALL_TIMEOUT   30  /* wait N secs after warning */
 #defineDEATH_WATCH 10  /* wait N secs for procs to die 
*/
 #defineDEATH_SCRIPT120 /* wait for 2min for 
/etc/rc.shutdown */
 #defineRESOURCE_RC "daemon"
-#defineRESOURCE_WINDOW "default"
+#defineRESOURCE_WINDOW "default"
 #defineRESOURCE_GETTY  "default"
 
 static void handle(sig_t, ...);
@@ -149,15 +149,15 @@ typedef struct init_session {
int se_flags;   /* status of session */
 #defineSE_SHUTDOWN 0x1 /* session won't be restarted */
 #defineSE_PRESENT  0x2 /* session is in /etc/ttys */
-   int se_nspace;  /* spacing count */
+   int se_nspace;  /* spacing count */
char*se_device; /* filename of port */
char*se_getty;  /* what to run on that port */
-   char*se_getty_argv_space;   /* pre-parsed argument array space */
+   char*se_getty_argv_space;   /* pre-parsed argument array space */
char**se_getty_argv;/* pre-parsed argument array */
char*se_window; /* window system (started only once) */
-   char*se_window_argv_space;  /* pre-parsed argument array space */
+   char*se_window_argv_space;  /* pre-parsed argument array space */
char**se_window_argv;   /* pre-parsed argument array */
-   char*se_type;   /* default terminal type */
+   char*se_type;   /* default terminal type */
struct  init_session *se_prev;
struct  init_session *se_next;
 } session_t;
@@ -657,7 +657,7 @@ single_user(void)
_exit(0);
password = crypt(clear, pp->pw_passwd);
bzero(clear, _PASSWORD_LEN);
-   if (password == NULL || 
+   if (password == NULL ||
strcmp(password, pp->pw_passwd) == 0)
break;
warning("single-user login failed\n");
@@ -800,7 +800,7 @@ run_script(const char *script)
 
setctty(_PATH_CONSOLE);
 
-   char _sh[]  = "sh";
+   char _sh[]  = "sh";
char _autoboot[]= "autoboot";
 
argv[0] = _sh;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r232839 - head/tools/regression/bin/sh/expansion

2012-03-11 Thread Bjoern A. Zeeb

On 11. Mar 2012, at 22:12 , Jilles Tjoelker wrote:

> Author: jilles
> Date: Sun Mar 11 22:12:05 2012
> New Revision: 232839
> URL: http://svn.freebsd.org/changeset/base/232839
> 
> Log:
>  sh: Add a test for variables with underscores in arithmetic.
> 
>  Things like $((_x+1)) are broken in stable/8 sh but work in stable/9 and
>  head.

Thanks!

> Added:
>  head/tools/regression/bin/sh/expansion/arith12.0   (contents, props changed)
> 
> Added: head/tools/regression/bin/sh/expansion/arith12.0
> ==
> --- /dev/null 00:00:00 1970   (empty, because file is newly added)
> +++ head/tools/regression/bin/sh/expansion/arith12.0  Sun Mar 11 22:12:05 
> 2012(r232839)
> @@ -0,0 +1,4 @@
> +# $FreeBSD$
> +
> +_x=4 y_=5 z_z=6
> +[ "$((_x*100+y_*10+z_z))" = 456 ]

-- 
Bjoern A. Zeeb You have to have visions!
   It does not matter how good you are. It matters what good you do!

___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r232842 - head/sys/amd64/amd64

2012-03-11 Thread Alan Cox
Author: alc
Date: Mon Mar 12 00:47:13 2012
New Revision: 232842
URL: http://svn.freebsd.org/changeset/base/232842

Log:
  Simplify the error checking in one branch of trap_pfault() and update
  the nearby comment.
  
  Add missing whitespace to a return statement in trap_pfault().
  
  Submitted by: kib [2]

Modified:
  head/sys/amd64/amd64/trap.c

Modified: head/sys/amd64/amd64/trap.c
==
--- head/sys/amd64/amd64/trap.c Sun Mar 11 22:30:06 2012(r232841)
+++ head/sys/amd64/amd64/trap.c Mon Mar 12 00:47:13 2012(r232842)
@@ -645,7 +645,7 @@ trap_pfault(frame, usermode)
int usermode;
 {
vm_offset_t va;
-   struct vmspace *vm = NULL;
+   struct vmspace *vm;
vm_map_t map;
int rv = 0;
vm_prot_t ftype;
@@ -664,14 +664,10 @@ trap_pfault(frame, usermode)
map = kernel_map;
} else {
/*
-* This is a fault on non-kernel virtual memory.
-* vm is initialized above to NULL. If curproc is NULL
-* or curproc->p_vmspace is NULL the fault is fatal.
+* This is a fault on non-kernel virtual memory.  If either
+* p or p->p_vmspace is NULL, then the fault is fatal.
 */
-   if (p != NULL)
-   vm = p->p_vmspace;
-
-   if (vm == NULL)
+   if (p == NULL || (vm = p->p_vmspace) == NULL)
goto nogo;
 
map = &vm->vm_map;
@@ -735,8 +731,7 @@ nogo:
trap_fatal(frame, eva);
return (-1);
}
-
-   return((rv == KERN_PROTECTION_FAILURE) ? SIGBUS : SIGSEGV);
+   return ((rv == KERN_PROTECTION_FAILURE) ? SIGBUS : SIGSEGV);
 }
 
 static void
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r232844 - head/contrib/ntp/ntpd

2012-03-11 Thread Ed Maste
Author: emaste
Date: Mon Mar 12 01:06:29 2012
New Revision: 232844
URL: http://svn.freebsd.org/changeset/base/232844

Log:
  Remove extraneous log message
  
  When ntp switched between PLL and FLL mode it produced a log message
  "kernel time sync status change %04x".  This issue is reported in ntp
  bug 452[1] which claims that this behaviour is normal and the log
  message isn't necessary.  I'm not sure exactly when it was removed, but
  it's gone in the latest ntp release (4.2.6p5).
  
  [1] http://bugs.ntp.org/show_bug.cgi?id=452
  
  Approved by:roberto

Modified:
  head/contrib/ntp/ntpd/ntp_loopfilter.c

Modified: head/contrib/ntp/ntpd/ntp_loopfilter.c
==
--- head/contrib/ntp/ntpd/ntp_loopfilter.c  Mon Mar 12 00:48:20 2012
(r232843)
+++ head/contrib/ntp/ntpd/ntp_loopfilter.c  Mon Mar 12 01:06:29 2012
(r232844)
@@ -646,12 +646,6 @@ local_clock(
msyslog(LOG_NOTICE,
"kernel time sync error %04x", ntv.status);
ntv.status &= ~(STA_PPSFREQ | STA_PPSTIME);
-   } else {
-   if ((ntv.status ^ pll_status) & ~STA_FLL)
-   NLOG(NLOG_SYNCEVENT | NLOG_SYSEVENT)
-   msyslog(LOG_NOTICE,
-   "kernel time sync status change %04x",
-   ntv.status);
}
pll_status = ntv.status;
 #ifdef STA_NANO
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r232845 - head/sys/mips/conf

2012-03-11 Thread Adrian Chadd
Author: adrian
Date: Mon Mar 12 01:15:58 2012
New Revision: 232845
URL: http://svn.freebsd.org/changeset/base/232845

Log:
  Begin modifying the PB92 config file to actually generate a flashable,
  bootable image.
  
  The kernel has to fit inside an 896KiB area in a 4MB SPI flash.
  So a bunch of stuff can't be included (and more is to come), including
  (unfortunately) IPv6.
  
  TODO:
  
  * GPIO modules need to be created
  * Shrink the image a bit more by removing some of the CAM layer debugging
strings.

Modified:
  head/sys/mips/conf/PB92

Modified: head/sys/mips/conf/PB92
==
--- head/sys/mips/conf/PB92 Mon Mar 12 01:06:29 2012(r232844)
+++ head/sys/mips/conf/PB92 Mon Mar 12 01:15:58 2012(r232845)
@@ -13,6 +13,17 @@ options  HZ=1000
 # The PB92 has 32mb of RAM; hard-code that
 optionsAR71XX_REALMEM=32*1024*1024
 
+# It's UBOOT, not Redboot - without this, things will hang at startup
+optionsAR71XX_ENV_UBOOT
+
+# We have to build most things as modules rather than in the kernel.
+# The PB92 has 4MB of SPI flash and the default kernel "partition"
+# is only 892KiB.  In order to try and squeeze into that (so people
+# who already are using it without modifying the default flash layout)
+# we need to cut down on a lot of things.
+
+makeoptionsMODULES_OVERRIDE="ath ath_pci ath_ahb bridgestp if_bridge 
if_gif if_gre random wlan wlan_acl wlan_amrr wlan_ccmp wlan_rssadapt wlan_tkip 
wlan_wep wlan_xauth usb ar71xx"
+
 hints  "PB92.hints"
 include"../atheros/std.ar71xx"
 
@@ -24,7 +35,8 @@ options   KDB
 
 optionsSCHED_4BSD  #4BSD scheduler
 optionsINET#InterNETworking
-optionsINET6
+# Can't do IPv6 - it just doesn't fit.
+# options  INET6
 # options  NFSCL   #Network Filesystem Client
 optionsPSEUDOFS#Pseudo-filesystem framework
 options_KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time 
extensions
@@ -41,11 +53,10 @@ options FFS 
 #options UFS_ACL #Support for access control lists
 #options UFS_DIRHASH #Improve performance on big 
directories
 
-optionsMD_ROOT
-optionsMD_ROOT_SIZE=5120
-device geom_uzip
-optionsGEOM_UZIP
-optionsROOTDEVNAME=\"ufs:/dev/md0.uzip\"
+# Support uncompress lzma rootfs
+device geom_uncompress
+optionsGEOM_UNCOMPRESS
+optionsROOTDEVNAME=\"ufs:/dev/map/rootfs.uncompress\"
 
 # PCI bus
 device pci
@@ -58,49 +69,50 @@ device  nvram2env
 optionsIEEE80211_DEBUG
 optionsIEEE80211_SUPPORT_MESH
 optionsIEEE80211_SUPPORT_TDMA
-device wlan# 802.11 support
-device wlan_wep# 802.11 WEP support
-device wlan_ccmp   # 802.11 CCMP support
-device wlan_tkip   # 802.11 TKIP support
-device wlan_xauth  # 802.11 hostap support
+optionsIEEE80211_ALQ
+#devicewlan# 802.11 support
+#devicewlan_wep# 802.11 WEP support
+#devicewlan_ccmp   # 802.11 CCMP support
+#devicewlan_tkip   # 802.11 TKIP support
+#devicewlan_xauth  # 802.11 hostap support
 
-device ath # Atheros pci/cardbus NIC's
-device ath_pci # PCI/PCIe bus glue
+#deviceath # Atheros pci/cardbus NIC's
+#deviceath_pci # PCI/PCIe bus glue
 optionsATH_DEBUG
 optionsATH_ENABLE_11N
 optionsATH_DIAGAPI
 
-device ath_hal
+# device   ath_hal
 optionsAH_SUPPORT_AR5416
 optionsAH_DEBUG
 optionsAH_DEBUG_ALQ
 
-device ath_rate_sample
+# device   ath_rate_sample
 
 device mii
 device arge
 
 # USB devices - PB92 has EHCI only
 
-device usb
+#deviceusb
 optionsUSB_EHCI_BIG_ENDIAN_DESC# handle big-endian 
byte order
 optionsUSB_DEBUG
 optionsUSB_HOST_ALIGN=32
-device ehci
+#deviceehci
 
 # Mass storage
-device scbus
-device umass
-device da
+#devicescbus
+#deviceumass
+#deviceda
 
 # Read MSDOS formatted disks
 optionsGEOM_PART_BSD
 optionsGEOM_PART_MBR
-optionsMSDOSFS
+# options  MSDOSFS
 
 # GPIO Bus
-device gpio
-device gpioled
+#devicegpio
+#devicegpioled
 

svn commit: r232846 - head/sys/dev/hwpmc

2012-03-11 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Mon Mar 12 01:19:41 2012
New Revision: 232846
URL: http://svn.freebsd.org/changeset/base/232846

Log:
  Implement pmc_save_user_callchain and pmc_save_kernel_callchain for MIPS

Modified:
  head/sys/dev/hwpmc/hwpmc_mips.c

Modified: head/sys/dev/hwpmc/hwpmc_mips.c
==
--- head/sys/dev/hwpmc/hwpmc_mips.c Mon Mar 12 01:15:58 2012
(r232845)
+++ head/sys/dev/hwpmc/hwpmc_mips.c Mon Mar 12 01:19:41 2012
(r232846)
@@ -34,6 +34,272 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
+#include 
+
+#if defined(__mips_n64)
+#  define  MIPS_IS_VALID_KERNELADDR(reg)   reg) & 3) == 0) && \
+   ((vm_offset_t)(reg) >= 
MIPS_XKPHYS_START))
+#else
+#  define  MIPS_IS_VALID_KERNELADDR(reg)   reg) & 3) == 0) && \
+   ((vm_offset_t)(reg) >= 
MIPS_KSEG0_START))
+#endif
+
+/*
+ * We need some reasonable default to prevent backtrace code
+ * from wandering too far
+ */
+#defineMAX_FUNCTION_SIZE 0x1
+#defineMAX_PROLOGUE_SIZE 0x100
+
+static int
+pmc_next_frame(register_t *pc, register_t *sp)
+{
+   InstFmt i;
+   uintptr_t va;
+   uint32_t instr, mask;
+   int more, stksize;
+   register_t ra = 0;
+
+   /* Jump here after a nonstandard (interrupt handler) frame */
+   stksize = 0;
+
+   /* check for bad SP: could foul up next frame */
+   if (!MIPS_IS_VALID_KERNELADDR(*sp)) {
+   goto error;
+   }
+
+   /* check for bad PC */
+   if (!MIPS_IS_VALID_KERNELADDR(*pc)) {
+   goto error;
+   }
+
+   /*
+* Find the beginning of the current subroutine by scanning
+* backwards from the current PC for the end of the previous
+* subroutine.
+*/
+   va = *pc - sizeof(int);
+   while (1) {
+   instr = *((uint32_t *)va);
+
+   /* [d]addiu sp,sp,-X */
+   if (((instr & 0x8000) == 0x27bd8000)
+   || ((instr & 0x8000) == 0x67bd8000))
+   break;
+
+   /* jr   ra */
+   if (instr == 0x03e8) {
+   /* skip over branch-delay slot instruction */
+   va += 2 * sizeof(int);
+   break;
+   }
+
+   va -= sizeof(int);
+   }
+
+   /* skip over nulls which might separate .o files */
+   while ((instr = *((uint32_t *)va)) == 0)
+   va += sizeof(int);
+
+   /* scan forwards to find stack size and any saved registers */
+   stksize = 0;
+   more = 3;
+   mask = 0;
+   for (; more; va += sizeof(int),
+   more = (more == 3) ? 3 : more - 1) {
+   /* stop if hit our current position */
+   if (va >= *pc)
+   break;
+   instr = *((uint32_t *)va);
+   i.word = instr;
+   switch (i.JType.op) {
+   case OP_SPECIAL:
+   switch (i.RType.func) {
+   case OP_JR:
+   case OP_JALR:
+   more = 2;   /* stop after next instruction 
*/
+   break;
+
+   case OP_SYSCALL:
+   case OP_BREAK:
+   more = 1;   /* stop now */
+   };
+   break;
+
+   case OP_BCOND:
+   case OP_J:
+   case OP_JAL:
+   case OP_BEQ:
+   case OP_BNE:
+   case OP_BLEZ:
+   case OP_BGTZ:
+   more = 2;   /* stop after next instruction */
+   break;
+
+   case OP_COP0:
+   case OP_COP1:
+   case OP_COP2:
+   case OP_COP3:
+   switch (i.RType.rs) {
+   case OP_BCx:
+   case OP_BCy:
+   more = 2;   /* stop after next instruction 
*/
+   };
+   break;
+
+   case OP_SW:
+   case OP_SD:
+   /* look for saved registers on the stack */
+   if (i.IType.rs != 29)
+   break;
+   /* only restore the first one */
+   if (mask & (1 << i.IType.rt))
+   break;
+   mask |= (1 << i.IType.rt);
+   if (i.IType.rt == 31)
+   ra = *((register_t *)(*sp + 
(short)i.IType.imm));
+   break;
+
+   case OP_ADDI:
+   case OP_ADDIU:
+   case OP_DADDI:
+   case OP_DADDIU:
+   /* look for stack pointer adjustment */
+

svn commit: r232847 - head/sys/mips/atheros

2012-03-11 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Mon Mar 12 01:23:09 2012
New Revision: 232847
URL: http://svn.freebsd.org/changeset/base/232847

Log:
  - Rename apb_intr to apb_filter since it's a filter handler
  - Pass interrupt trapframe for handlers dow the chain
  - Add PMC interrupt handler
  PMC interrupt is a special case, so we want handle it as soon as possible
  with minimum overhead. So we handle it apb filter routine.

Modified:
  head/sys/mips/atheros/apb.c

Modified: head/sys/mips/atheros/apb.c
==
--- head/sys/mips/atheros/apb.c Mon Mar 12 01:19:41 2012(r232846)
+++ head/sys/mips/atheros/apb.c Mon Mar 12 01:23:09 2012(r232847)
@@ -36,6 +36,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -44,6 +48,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#defineAPB_INTR_PMC5
+
 #undef APB_DEBUG
 #ifdef APB_DEBUG
 #define dprintf printf
@@ -63,7 +69,7 @@ static intapb_deactivate_resource(devic
 static struct resource_list *
apb_get_resource_list(device_t, device_t);
 static voidapb_hinted_child(device_t, const char *, int);
-static int apb_intr(void *);
+static int apb_filter(void *);
 static int apb_probe(device_t);
 static int apb_release_resource(device_t, device_t, int, int,
struct resource *);
@@ -132,7 +138,7 @@ apb_attach(device_t dev)
}
 
if ((bus_setup_intr(dev, sc->sc_misc_irq, INTR_TYPE_MISC, 
-   apb_intr, NULL, sc, &sc->sc_misc_ih))) {
+   apb_filter, NULL, sc, &sc->sc_misc_ih))) {
device_printf(dev,
"WARNING: unable to register interrupt handler\n");
return (ENXIO);
@@ -142,6 +148,12 @@ apb_attach(device_t dev)
bus_enumerate_hinted_children(dev);
bus_generic_attach(dev);
 
+   /*
+* Unmask performance counter IRQ
+*/
+   apb_unmask_irq((void*)APB_INTR_PMC);
+   sc->sc_intr_counter[APB_INTR_PMC] = mips_intrcnt_create("apb irq5: 
pmc");
+
return (0);
 }
 
@@ -329,11 +341,12 @@ apb_teardown_intr(device_t dev, device_t
 }
 
 static int
-apb_intr(void *arg)
+apb_filter(void *arg)
 {
struct apb_softc *sc = arg;
struct intr_event *event;
uint32_t reg, irq;
+   struct thread *td;
 
reg = ATH_READ_REG(AR71XX_MISC_INTR_STATUS);
for (irq = 0; irq < APB_NIRQS; irq++) {
@@ -354,14 +367,34 @@ apb_intr(void *arg)
 
event = sc->sc_eventstab[irq];
if (!event || TAILQ_EMPTY(&event->ie_handlers)) {
+   if (irq == APB_INTR_PMC) {
+   register_t s;
+   struct trapframe *tf = 
PCPU_GET(curthread)->td_intr_frame;
+   s = intr_disable();
+   
mips_intrcnt_inc(sc->sc_intr_counter[irq]);
+
+   if (pmc_intr && 
(*pmc_intr)(PCPU_GET(cpuid), tf)) {
+   intr_restore(s);
+   continue;
+   }
+
+   intr_restore(s);
+   td = PCPU_GET(curthread);
+
+   if (pmc_hook && (td->td_pflags & 
TDP_CALLCHAIN))
+   pmc_hook(PCPU_GET(curthread),
+   PMC_FN_USER_CALLCHAIN, 
tf);
+   
+   continue;
+
+   }
/* Ignore timer interrupts */
if (irq != 0)
printf("Stray APB IRQ %d\n", irq);
continue;
}
 
-   /* TODO: frame instead of NULL? */
-   intr_event_handle(event, NULL);
+   intr_event_handle(event, 
PCPU_GET(curthread)->td_intr_frame);
mips_intrcnt_inc(sc->sc_intr_counter[irq]);
}
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r221780 - head/usr.sbin/freebsd-update

2012-03-11 Thread Andrew Thompson
On 12 May 2011 03:23, Colin Percival  wrote:
> Author: cperciva
> Date: Wed May 11 15:23:27 2011
> New Revision: 221780
> URL: http://svn.freebsd.org/changeset/base/221780
>
> Log:
>  Make freebsd-update(8) smarter in how it handles $FreeBSD$ tags in
>  configuration files.
>
>  Nagged by:    pgollucci
>  MFC after:    1 month

This does not appear to have been MFC'd.


Andrew
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r232848 - head/sys/dev/bge

2012-03-11 Thread Pyun YongHyeon
Author: yongari
Date: Mon Mar 12 02:09:47 2012
New Revision: 232848
URL: http://svn.freebsd.org/changeset/base/232848

Log:
  Add workaround for PCI-X BCM5704 controller that live behind
  AMD-8131 PCI-X bridge.  The bridge seems to reorder write access to
  mailbox registers such that it caused watchdog timeouts by
  out-of-order TX completions.
  
  Tested by:Michael L. Squires  siralan dot org >
  Reviewed by:  jhb

Modified:
  head/sys/dev/bge/if_bge.c
  head/sys/dev/bge/if_bgereg.h

Modified: head/sys/dev/bge/if_bge.c
==
--- head/sys/dev/bge/if_bge.c   Mon Mar 12 01:23:09 2012(r232847)
+++ head/sys/dev/bge/if_bge.c   Mon Mar 12 02:09:47 2012(r232848)
@@ -380,6 +380,8 @@ static void bge_dma_free(struct bge_soft
 static int bge_dma_ring_alloc(struct bge_softc *, bus_size_t, bus_size_t,
 bus_dma_tag_t *, uint8_t **, bus_dmamap_t *, bus_addr_t *, const char *);
 
+static int bge_mbox_reorder(struct bge_softc *);
+
 static int bge_get_eaddr_fw(struct bge_softc *sc, uint8_t ether_addr[]);
 static int bge_get_eaddr_mem(struct bge_softc *, uint8_t[]);
 static int bge_get_eaddr_nvram(struct bge_softc *, uint8_t[]);
@@ -635,6 +637,8 @@ bge_writembx(struct bge_softc *sc, int o
off += BGE_LPMBX_IRQ0_HI - BGE_MBX_IRQ0_HI;
 
CSR_WRITE_4(sc, off, val);
+   if ((sc->bge_flags & BGE_FLAG_MBOX_REORDER) != 0)
+   CSR_READ_4(sc, off);
 }
 
 /*
@@ -2584,10 +2588,10 @@ bge_dma_alloc(struct bge_softc *sc)
 * XXX
 * watchdog timeout issue was observed on BCM5704 which
 * lives behind PCI-X bridge(e.g AMD 8131 PCI-X bridge).
-* Limiting DMA address space to 32bits seems to address
-* it.
+* Both limiting DMA address space to 32bits and flushing
+* mailbox write seem to address the issue.
 */
-   if (sc->bge_flags & BGE_FLAG_PCIX)
+   if (sc->bge_pcixcap != 0)
lowaddr = BUS_SPACE_MAXADDR_32BIT;
}
error = bus_dma_tag_create(bus_get_dma_tag(sc->bge_dev), 1, 0, lowaddr,
@@ -2750,6 +2754,56 @@ bge_can_use_msi(struct bge_softc *sc)
 }
 
 static int
+bge_mbox_reorder(struct bge_softc *sc)
+{
+   /* Lists of PCI bridges that are known to reorder mailbox writes. */
+   static const struct mbox_reorder {
+   const uint16_t vendor;
+   const uint16_t device;
+   const char *desc;
+   } const mbox_reorder_lists[] = {
+   { 0x1022, 0x7450, "AMD-8131 PCI-X Bridge" },
+   };
+   devclass_t pci, pcib;
+   device_t bus, dev;
+   int count, i;
+
+   count = sizeof(mbox_reorder_lists) / sizeof(mbox_reorder_lists[0]);
+   pci = devclass_find("pci");
+   pcib = devclass_find("pcib");
+   dev = sc->bge_dev;
+   bus = device_get_parent(dev);
+   for (;;) {
+   dev = device_get_parent(bus);
+   bus = device_get_parent(dev);
+   device_printf(sc->bge_dev, "dev : %s%d, bus : %s%d\n",
+   device_get_name(dev), device_get_unit(dev),
+   device_get_name(bus), device_get_unit(bus));
+   if (device_get_devclass(dev) != pcib)
+   break;
+   for (i = 0; i < count; i++) {
+   device_printf(sc->bge_dev,
+   "probing dev : %s%d, vendor : 0x%04x "
+   "device : 0x%04x\n",
+   device_get_name(dev), device_get_unit(dev),
+   pci_get_vendor(dev), pci_get_device(dev));
+   if (pci_get_vendor(dev) ==
+   mbox_reorder_lists[i].vendor &&
+   pci_get_device(dev) ==
+   mbox_reorder_lists[i].device) {
+   device_printf(sc->bge_dev,
+   "enabling MBOX workaround for %s\n",
+   mbox_reorder_lists[i].desc);
+   return (1);
+   }
+   }
+   if (device_get_devclass(bus) != pci)
+   break;
+   }
+   return (0);
+}
+
+static int
 bge_attach(device_t dev)
 {
struct ifnet *ifp;
@@ -3069,6 +3123,16 @@ bge_attach(device_t dev)
if (BGE_IS_5714_FAMILY(sc) && (sc->bge_flags & BGE_FLAG_PCIX))
sc->bge_flags |= BGE_FLAG_40BIT_BUG;
/*
+* Some PCI-X bridges are known to trigger write reordering to
+* the mailbox registers. Typical phenomena is watchdog timeouts
+* caused by out-of-order TX completions.  Enable workaround for
+* PCI-X devices that live behind these bridges.
+* Note, PCI-X controllers can run in PCI mode so we can't use
+* BGE_FLAG_PCIX flag to detect PCI-X contro

Re: svn commit: r232836 - head/sys/ufs/ffs

2012-03-11 Thread Bruce Evans

On Sun, 11 Mar 2012, Konstantin Belousov wrote:


Log:
 Do schedule delayed writes for async mounts.
 While there, make some style adjustments, like missed () around
 return values.

 Submitted by:  bde
 Reviewed by:   mckusick
 Tested by: pho
 MFC after: 2 weeks


Thanks for all these commits.  I will prepare some more :-).

Bruce
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r232849 - head/sys/dev/bge

2012-03-11 Thread Pyun YongHyeon
Author: yongari
Date: Mon Mar 12 02:42:47 2012
New Revision: 232849
URL: http://svn.freebsd.org/changeset/base/232849

Log:
  Show PCI bus speed and width as well as running mode of PCI-X
  device in device attach.  This would help to narrow down issue to a
  specific controller and operating mode of the controller.
  While I'm here rename BGE_MISCCFG_BOARD_ID with
  BGE_MISCCFG_BOARD_ID_MASK.

Modified:
  head/sys/dev/bge/if_bge.c
  head/sys/dev/bge/if_bgereg.h

Modified: head/sys/dev/bge/if_bge.c
==
--- head/sys/dev/bge/if_bge.c   Mon Mar 12 02:09:47 2012(r232848)
+++ head/sys/dev/bge/if_bge.c   Mon Mar 12 02:42:47 2012(r232849)
@@ -380,6 +380,7 @@ static void bge_dma_free(struct bge_soft
 static int bge_dma_ring_alloc(struct bge_softc *, bus_size_t, bus_size_t,
 bus_dma_tag_t *, uint8_t **, bus_dmamap_t *, bus_addr_t *, const char *);
 
+static void bge_devinfo(struct bge_softc *);
 static int bge_mbox_reorder(struct bge_softc *);
 
 static int bge_get_eaddr_fw(struct bge_softc *sc, uint8_t ether_addr[]);
@@ -2803,6 +2804,59 @@ bge_mbox_reorder(struct bge_softc *sc)
return (0);
 }
 
+static void
+bge_devinfo(struct bge_softc *sc)
+{
+   uint32_t cfg, clk;
+
+   device_printf(sc->bge_dev,
+   "CHIP ID 0x%08x; ASIC REV 0x%02x; CHIP REV 0x%02x; ",
+   sc->bge_chipid, sc->bge_asicrev, sc->bge_chiprev);
+   if (sc->bge_flags & BGE_FLAG_PCIE)
+   printf("PCI-E\n");
+   else if (sc->bge_flags & BGE_FLAG_PCIX) {
+   printf("PCI-X ");
+   cfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID_MASK;
+   if (cfg == BGE_MISCCFG_BOARD_ID_5704CIOBE)
+   clk = 133;
+   else {
+   clk = CSR_READ_4(sc, BGE_PCI_CLKCTL) & 0x1F;
+   switch (clk) {
+   case 0:
+   clk = 33;
+   break;
+   case 2:
+   clk = 50;
+   break;
+   case 4:
+   clk = 66;
+   break;
+   case 6:
+   clk = 100;
+   break;
+   case 7:
+   clk = 133;
+   break;
+   }
+   }
+   printf("%u MHz\n", clk);
+   } else {
+   if (sc->bge_pcixcap != 0)
+   printf("PCI on PCI-X ");
+   else
+   printf("PCI ");
+   cfg = pci_read_config(sc->bge_dev, BGE_PCI_PCISTATE, 4);
+   if (cfg & BGE_PCISTATE_PCI_BUSSPEED)
+   clk = 66;
+   else
+   clk = 33;
+   if (cfg & BGE_PCISTATE_32BIT_BUS)
+   printf("%u MHz; 32bit\n", clk);
+   else
+   printf("%u MHz; 64bit\n", clk);
+   }
+}
+
 static int
 bge_attach(device_t dev)
 {
@@ -3031,7 +3085,7 @@ bge_attach(device_t dev)
if (sc->bge_asicrev == BGE_ASICREV_BCM5719)
sc->bge_flags |= BGE_FLAG_4K_RDMA_BUG;
 
-   misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID;
+   misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID_MASK;
if (sc->bge_asicrev == BGE_ASICREV_BCM5705) {
if (misccfg == BGE_MISCCFG_BOARD_ID_5788 ||
misccfg == BGE_MISCCFG_BOARD_ID_5788M)
@@ -3171,11 +3225,7 @@ bge_attach(device_t dev)
goto fail;
}
 
-   device_printf(dev,
-   "CHIP ID 0x%08x; ASIC REV 0x%02x; CHIP REV 0x%02x; %s\n",
-   sc->bge_chipid, sc->bge_asicrev, sc->bge_chiprev,
-   (sc->bge_flags & BGE_FLAG_PCIX) ? "PCI-X" :
-   ((sc->bge_flags & BGE_FLAG_PCIE) ? "PCI-E" : "PCI"));
+   bge_devinfo(sc);
 
BGE_LOCK_INIT(sc, device_get_nameunit(dev));
 

Modified: head/sys/dev/bge/if_bgereg.h
==
--- head/sys/dev/bge/if_bgereg.hMon Mar 12 02:09:47 2012
(r232848)
+++ head/sys/dev/bge/if_bgereg.hMon Mar 12 02:42:47 2012
(r232849)
@@ -1989,7 +1989,9 @@
 /* Misc. config register */
 #defineBGE_MISCCFG_RESET_CORE_CLOCKS   0x0001
 #defineBGE_MISCCFG_TIMER_PRESCALER 0x00FE
-#defineBGE_MISCCFG_BOARD_ID0x0001E000
+#defineBGE_MISCCFG_BOARD_ID_MASK   0x0001E000
+#defineBGE_MISCCFG_BOARD_ID_5704   0x
+#defineBGE_MISCCFG_BOARD_ID_5704CIOBE  0x4000
 #defineBGE_MISCCFG_BOARD_ID_5788   0x0001
 #defineBGE_MISCCFG_BOARD_ID_5788M  0x00018000
 #defineBGE_MISCCFG_EPHY_IDDQ   0x0020
_

svn commit: r232850 - head/sys/dev/bge

2012-03-11 Thread Pyun YongHyeon
Author: yongari
Date: Mon Mar 12 03:47:30 2012
New Revision: 232850
URL: http://svn.freebsd.org/changeset/base/232850

Log:
  Make if_ierrors updated whenever any of the following counters are
  updated.
   o Number of times NIC ran out of RX buffer descriptors
   o Number of inbound packet errors
   o Number of inbound packets that were chosen to be discarded
  Previously only the discarded packet counter was used to update
  if_ierrors.  This change fixes wrong if_ierrors counter on
  BCM570[0-4] controllers.  For BCM5705 and later controllers bge(4)
  already correctly counted it.
  
  Reported by:  Eugene Grosbein  rdtc dot ru>

Modified:
  head/sys/dev/bge/if_bge.c
  head/sys/dev/bge/if_bgereg.h

Modified: head/sys/dev/bge/if_bge.c
==
--- head/sys/dev/bge/if_bge.c   Mon Mar 12 02:42:47 2012(r232849)
+++ head/sys/dev/bge/if_bge.c   Mon Mar 12 03:47:30 2012(r232850)
@@ -4489,6 +4489,12 @@ bge_stats_update(struct bge_softc *sc)
ifp->if_collisions += (uint32_t)(cnt - sc->bge_tx_collisions);
sc->bge_tx_collisions = cnt;
 
+   cnt = READ_STAT(sc, stats, nicNoMoreRxBDs.bge_addr_lo);
+   ifp->if_ierrors += (uint32_t)(cnt - sc->bge_rx_nobds);
+   sc->bge_rx_nobds = cnt;
+   cnt = READ_STAT(sc, stats, ifInErrors.bge_addr_lo);
+   ifp->if_ierrors += (uint32_t)(cnt - sc->bge_rx_inerrs);
+   sc->bge_rx_inerrs = cnt;
cnt = READ_STAT(sc, stats, ifInDiscards.bge_addr_lo);
ifp->if_ierrors += (uint32_t)(cnt - sc->bge_rx_discards);
sc->bge_rx_discards = cnt;

Modified: head/sys/dev/bge/if_bgereg.h
==
--- head/sys/dev/bge/if_bgereg.hMon Mar 12 02:42:47 2012
(r232849)
+++ head/sys/dev/bge/if_bgereg.hMon Mar 12 03:47:30 2012
(r232850)
@@ -2861,6 +2861,8 @@ struct bge_softc {
int bge_csum_features;
struct callout  bge_stat_ch;
uint32_tbge_rx_discards;
+   uint32_tbge_rx_inerrs;
+   uint32_tbge_rx_nobds;
uint32_tbge_tx_discards;
uint32_tbge_tx_collisions;
 #ifdef DEVICE_POLLING
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r232851 - head/sys/i386/i386

2012-03-11 Thread Alan Cox
Author: alc
Date: Mon Mar 12 05:28:02 2012
New Revision: 232851
URL: http://svn.freebsd.org/changeset/base/232851

Log:
  Simplify the error checking in one branch of trap_pfault() and update
  the nearby comment.
  
  Correct the style of two return statements in trap_pfault().
  
  Merge a comment from amd64's trap_pfault().

Modified:
  head/sys/i386/i386/trap.c

Modified: head/sys/i386/i386/trap.c
==
--- head/sys/i386/i386/trap.c   Mon Mar 12 03:47:30 2012(r232850)
+++ head/sys/i386/i386/trap.c   Mon Mar 12 05:28:02 2012(r232851)
@@ -797,7 +797,7 @@ trap_pfault(frame, usermode, eva)
vm_offset_t eva;
 {
vm_offset_t va;
-   struct vmspace *vm = NULL;
+   struct vmspace *vm;
vm_map_t map;
int rv = 0;
vm_prot_t ftype;
@@ -816,7 +816,7 @@ trap_pfault(frame, usermode, eva)
 */
 #if defined(I586_CPU) && !defined(NO_F00F_HACK)
if ((eva == (unsigned int)&idt[6]) && has_f00f_bug)
-   return -2;
+   return (-2);
 #endif
if (usermode)
goto nogo;
@@ -824,17 +824,21 @@ trap_pfault(frame, usermode, eva)
map = kernel_map;
} else {
/*
-* This is a fault on non-kernel virtual memory.
-* vm is initialized above to NULL. If curproc is NULL
-* or curproc->p_vmspace is NULL the fault is fatal.
+* This is a fault on non-kernel virtual memory.  If either
+* p or p->p_vmspace is NULL, then the fault is fatal.
 */
-   if (p != NULL)
-   vm = p->p_vmspace;
-
-   if (vm == NULL)
+   if (p == NULL || (vm = p->p_vmspace) == NULL)
goto nogo;
 
map = &vm->vm_map;
+
+   /*
+* When accessing a user-space address, kernel must be
+* ready to accept the page fault, and provide a
+* handling routine.  Since accessing the address
+* without the handler is a bug, do not try to handle
+* it normally, and panic immediately.
+*/
if (!usermode && (td->td_intr_nesting_level != 0 ||
PCPU_GET(curpcb)->pcb_onfault == NULL)) {
trap_fatal(frame, eva);
@@ -889,8 +893,7 @@ nogo:
trap_fatal(frame, eva);
return (-1);
}
-
-   return((rv == KERN_PROTECTION_FAILURE) ? SIGBUS : SIGSEGV);
+   return ((rv == KERN_PROTECTION_FAILURE) ? SIGBUS : SIGSEGV);
 }
 
 static void
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"