svn commit: r212285 - head/sys/mips/rmi

2010-09-07 Thread Jayachandran C.
Author: jchandra
Date: Tue Sep  7 07:31:58 2010
New Revision: 212285
URL: http://svn.freebsd.org/changeset/base/212285

Log:
  PCIe updates for XLS.
  
  Fix interrupt routing so that the irq returned is correct for XLR and
  XLS. This also updates the MSI hack we had earlier - we still don't
  really support MSI, but we support some drivers that use MSI, by providing
  support for allocating one MSI per pci link - this MSI is directly
  mapped to the link IRQ.

Modified:
  head/sys/mips/rmi/xlr_pci.c

Modified: head/sys/mips/rmi/xlr_pci.c
==
--- head/sys/mips/rmi/xlr_pci.c Tue Sep  7 06:02:43 2010(r212284)
+++ head/sys/mips/rmi/xlr_pci.c Tue Sep  7 07:31:58 2010(r212285)
@@ -326,51 +326,77 @@ xlr_pcib_identify(driver_t * driver, dev
BUS_ADD_CHILD(parent, 0, "pcib", 0);
 }
 
+/*
+ * XLS PCIe can have upto 4 links, and each link has its on IRQ
+ * Find the link on which the device is on 
+ */
 static int
-xlr_alloc_msi(device_t pcib, device_t dev, int count, int maxcount, int *irqs)
+xls_pcie_link(device_t pcib, device_t dev)
 {
-   int pciirq;
-   int i;
device_t parent, tmp;
 
/* find the lane on which the slot is connected to */
+   printf("xls_pcie_link : bus %s dev %s\n", device_get_nameunit(pcib),
+   device_get_nameunit(dev));
tmp = dev;
while (1) {
parent = device_get_parent(tmp);
if (parent == NULL || parent == pcib) {
device_printf(dev, "Cannot find parent bus\n");
-   return (ENXIO);
+   return (-1);
}
if (strcmp(device_get_nameunit(parent), "pci0") == 0)
break;
tmp = parent;
}
+   return (pci_get_slot(tmp));
+}
+
+/*
+ * Find the IRQ for the link, each link has a different interrupt 
+ * at the XLS pic
+ */
+static int
+xls_pcie_link_irq(int link)
+{
 
-   switch (pci_get_slot(tmp)) {
+   switch (link) {
case 0:
-   pciirq = PIC_PCIE_LINK0_IRQ;
-   break;
+   return (PIC_PCIE_LINK0_IRQ);
case 1:
-   pciirq = PIC_PCIE_LINK1_IRQ;
-   break;
+   return (PIC_PCIE_LINK1_IRQ);
case 2:
-   pciirq = PIC_PCIE_LINK2_IRQ;
-   break;
+   return (PIC_PCIE_LINK2_IRQ);
case 3:
-   pciirq = PIC_PCIE_LINK3_IRQ;
-   break;
-   default:
-   return (ENXIO);
+   return (PIC_PCIE_LINK3_IRQ);
}
+   return (-1);
+}
+
+static int
+xlr_alloc_msi(device_t pcib, device_t dev, int count, int maxcount, int *irqs)
+{
+   int i, link;
 
-   irqs[0] = pciirq;
/*
-* For now put in some fixed values for the other requested MSI,
-* TODO handle multiple messages
+* Each link has 32 MSIs that can be allocated, but for now
+* we only support one device per link.
+* msi_alloc() equivalent is needed when we start supporting 
+* bridges on the PCIe link.
 */
-   for (i = 1; i < count; i++)
-   irqs[i] = pciirq + 64 * i;
+   link = xls_pcie_link(pcib, dev);
+   if (link == -1)
+   return (ENXIO);
+
+   /*
+* encode the irq so that we know it is a MSI interrupt when we
+* setup interrupts
+*/
+   for (i = 0; i < count; i++)
+   irqs[i] = 64 + link * 32 + i;
 
+   device_printf(dev, "Alloc MSI count %d maxcount %d irq %d link %d\n",
+   count, maxcount, i, link);
return (0);
 }
 
@@ -383,20 +409,18 @@ xlr_release_msi(device_t pcib, device_t 
 }
 
 static int
-xlr_map_msi(device_t pcib, device_t dev, int irq, uint64_t * addr,
-uint32_t * data)
+xlr_map_msi(device_t pcib, device_t dev, int irq, uint64_t *addr,
+uint32_t *data)
 {
+   int msi;
 
-   switch (irq) {
-   case PIC_PCIE_LINK0_IRQ:
-   case PIC_PCIE_LINK1_IRQ:
-   case PIC_PCIE_LINK2_IRQ:
-   case PIC_PCIE_LINK3_IRQ:
+   device_printf(dev, "MAP MSI irq %d\n", irq);
+   if (irq >= 64) {
+   msi = irq - 64;
*addr = MIPS_MSI_ADDR(0);
-   *data = MIPS_MSI_DATA(irq);
+   *data = MIPS_MSI_DATA(msi);
return (0);
-
-   default:
+   } else {
device_printf(dev, "%s: map_msi for irq %d  - ignored", 
device_get_nameunit(pcib), irq);
return (ENXIO);
@@ -437,10 +461,8 @@ bridge_pcie_ack(int irq)
 
 static int
 mips_platform_pci_setup_intr(device_t dev, device_t child,
-struct resource *irq, int flags,
-driver_filter_t * filt,
-driver_intr_t * intr, void *arg,
-void **cookiep)
+struct resource *irq, int flags, driver_filter_t *filt,
+driver_intr_t *intr, void *arg, void **cookiep)
 {
  

Re: svn commit: r212177 - in head/sys: amd64/include i386/include

2010-09-07 Thread Bruce Evans

On Fri, 3 Sep 2010, Roman Divacky wrote:


Log:
 Change the parameter passed to the inline assembly to u_short
 as we are dealing with 16bit segment registers. Change mov
 to movw.


u_ints were used intentionally to avoid operand size prefixes here
and extra code for promotions in callers.  Segment registers are
always stored as 32 bits in trap frames, pcbs and regs structs, to
avoid the operand size prefixes in pure assembler code for at least
the trap frames and to avoid packing problems.

Why break this?  This was last broken in 2003, in rev.1.131 for i386,
and last backed out soon after.  Then the reason for breaking it was
stated in the log message -- it was to avoid returning garbage in
the top bits.  The garbage, if any, is due to not wasting time to
remove it.  Instead, we always used 32-bit accesses to segment registers
and depended on the CPU supplying harmless garbage.  This depended on
undocumented features and on avoidance of gas bugs in this area when it
was first used.  Some of the gas bugs seem to be still there:

(1) the original i486 manual only documents mov of a segreg to/from memory
as being 16 bits.  Gas bugs required writing 32-bit mov's to get
16-bit ones.  Now, the operand size can be left for gas to determine,
but gas still produces a spurious operand size prefixs for movw
in 1 case:

%%%
GAS LISTING z.s page 1


   1  8C1D  mov %ds,mem
   1  
   2 0006 8C1D  movl%ds,mem
   2  
   3 000c 668C1D00  movw%ds,mem<--- spurious 66
   3  00
   4 0013 8E1D  mov mem,%ds
   4  
   5 0019 8E1D  movlmem,%ds
   5  
   6 001f 8E1D  movwmem,%ds
   6  
%%%

For loads there is no problem now -- the operand size prefix is never
generated now, and the contents of the upper 16 bits is irrelevant.

There is a problem with stores -- the above spurious 66 has no effect,
at least on an Athlon64, and the upper 16 bits of `mem' are not changed
by the store.  Thus the optimization is broken for the "m" case of rgs()
etc.  I think there is no problem in practice since the "m" case is
never used, except possibly with -O0 (the "r" case is always preferred).

(2) mov of a segreg to a general register is quite different (mov of a
segreg _from_ a general register is unproblematic, as above, so
its details are not given here).  32-bit movs change the top bits,
but the details of this are not documented in the original i486
manual.  Later manuals give the details, and they are CPU-dependent
(IIRC, in general newer CPUs (Athlon64 at least) zero the top bits,
while older CPUs set them to garbage).  Gas bugs in this area seem
to be fixed:

%%%
GAS LISTING z.s page 1


   1  668CD8mov %ds,%ax
   2 0003 668CD8movw%ds,%ax
   3 0006 8CD8  mov %ds,%eax
   4 0008 8CD8  movl%ds,%eax
%%%

Now the operand size prefix is not spurious, and it is generated as
necessary without an explicit `w' in the opcode -- it forces the CPU
to do extra decoding and Icache work (for the prefix) in order for the
instruction to do less (not touch the top bits of the target registers).
This is the main pessimization in this commit -- we do extra work here
so that we can do even more extra work in callers, to promote the
result to the 32-bit one that is needed for storing in the pcb or
similar.

(3) push of a segreg is like mov of a segreg to a general register.  Again,
it is important to write sufficiently secure garbage to the top bits.
FreeBSD has always used pushl for segment registers in the trap frame
and dependent on this to write something harmless, since the registers
in the trap frame are copied without cleaning by ptrace() etc.  You
can also see the "garbage" in the segment registers in the trap frame
using debuggers, and doing extra work to clean it in rgs() etc. won't
even affect it there.

Gas didn't have any problems with push of a segreg AFAIR, but my assembler
does.  My assembler doesn't even know that 32-bit movs of segregs exist,
so it mis-assembles "push %ds" as a 16-bit push in both 16-bit and 32-bit
mode.  I used this in the first 386 protected mode version of Minix to
give bad packing for segment registers in the trap frame.


Modified: head/sys/amd64/include/cpufunc.h
==
--- head/sys/amd64/include/cpufunc.hFri Sep  3 13:54:02 2010
(r212176)
+++ head/sys/amd64/include/cpufunc.hFri Sep  3 14:25:17 2010
(r212177)
@@ -421,40 +421,40 @@ invlpg(u_long addr)
__asm __volatile("invlpg %0" : : "m" (*(char *)addr) : "memory");
}

-static __inline u_int
+static __inline u_short
rfs(void)
{
-   u_int sel;
-   __asm __volatile("mov %%fs,%0" : "=rm" (sel));
+   u_short sel;
+   __asm __volatile("movw %%fs,%0" : "=rm" (sel

Re: svn commit: r212281 - head/sys/vm

2010-09-07 Thread Kostik Belousov
On Tue, Sep 07, 2010 at 12:23:45AM +, Ryan Stone wrote:
> Author: rstone
> Date: Tue Sep  7 00:23:45 2010
> New Revision: 212281
> URL: http://svn.freebsd.org/changeset/base/212281
> 
> Log:
>   In munmap() downgrade the vm_map_lock to a read lock before taking a read
>   lock on the pmc-sx lock.  This prevents a deadlock with
>   pmc_log_process_mappings, which has an exclusive lock on pmc-sx and tries
>   to get a read lock on a vm_map.  Downgrading the vm_map_lock in munmap
>   allows pmc_log_process_mappings to continue, preventing the deadlock.
>   
>   Without this change I could cause a deadlock on a multicore 8.1-RELEASE
>   system by having one thread constantly mmap'ing and then munmap'ing a
>   PROT_EXEC mapping in a loop while I repeatedly invoked and stopped pmcstat
>   in system-wide sampling mode.
>   
>   Reviewed by:fabient
>   Approved by:emaste (mentor)
>   MFC after:  2 weeks
> 
> Modified:
>   head/sys/vm/vm_mmap.c
> 
> Modified: head/sys/vm/vm_mmap.c
> ==
> --- head/sys/vm/vm_mmap.c Mon Sep  6 23:52:04 2010(r212280)
> +++ head/sys/vm/vm_mmap.c Tue Sep  7 00:23:45 2010(r212281)
> @@ -579,6 +579,7 @@ munmap(td, uap)
>* Inform hwpmc if the address range being unmapped contains
>* an executable region.
>*/
> + pkm.pm_address = (uintptr_t) NULL;
>   if (vm_map_lookup_entry(map, addr, &entry)) {
>   for (;
>entry != &map->header && entry->start < addr + size;
> @@ -587,16 +588,23 @@ munmap(td, uap)
>   entry->end, VM_PROT_EXECUTE) == TRUE) {
>   pkm.pm_address = (uintptr_t) addr;
>   pkm.pm_size = (size_t) size;
> - PMC_CALL_HOOK(td, PMC_FN_MUNMAP,
> - (void *) &pkm);
>   break;
>   }
>   }
>   }
>  #endif
> - /* returns nothing but KERN_SUCCESS anyway */
>   vm_map_delete(map, addr, addr + size);
> +
> +#ifdef HWPMC_HOOKS
> + /* downgrade the lock to prevent a LOR with the pmc-sx lock */
> + vm_map_lock_downgrade(map);
> + if (pkm.pm_address != (uintptr) NULL)
> + PMC_CALL_HOOK(td, PMC_FN_MUNMAP, (void *) &pkm);
> + vm_map_unlock_read(map);
> +#else
>   vm_map_unlock(map);
> +#endif
> + /* vm_map_delete returns nothing but KERN_SUCCESS anyway */
>   return (0);
>  }
>  
Note that vm_map_unlock() is more then just dropping the lock on the map.
Due to ordering of the vnode lock before vm map lock, vm_map_unlock()
processes the deferred free entries after map lock is dropped. After your
change, the deferred list might keep entries for some time until next
unlock is performed.

I think the two changes could be done:
- only perform downgrade when hook is indeed going to be called;
- before vm_map_unlock_read, check for deferred_freelist being not
  NULL, and if so, do vm_map_lock()/vm_map_unlock() after unlock_read.


pgpuDvdPeH86F.pgp
Description: PGP signature


svn commit: r212286 - head/gnu/lib/libstdc++

2010-09-07 Thread Tijl Coosemans
Author: tijl
Date: Tue Sep  7 08:33:17 2010
New Revision: 212286
URL: http://svn.freebsd.org/changeset/base/212286

Log:
  GCC defines built-ins for atomic instructions found on i486 and higher.
  Because FreeBSD no longer supports the 80386 cpu all code targeting
  FreeBSD/i386 necessarily runs on i486 or higher so the compiler
  built-ins can be used by default inside libstdc++ and in C++ headers.
  This allows newly compiled C++ code to inline some atomic operations.
  Old binaries continue to use libstdc++ functions.
  
  PR:   148926
  Tested by:Yuri Karaban 
  Reviewed by:  kan
  Approved by:  kib (mentor)
  MFC after:2 weeks

Modified:
  head/gnu/lib/libstdc++/Makefile
  head/gnu/lib/libstdc++/config.h

Modified: head/gnu/lib/libstdc++/Makefile
==
--- head/gnu/lib/libstdc++/Makefile Tue Sep  7 07:31:58 2010
(r212285)
+++ head/gnu/lib/libstdc++/Makefile Tue Sep  7 08:33:17 2010
(r212286)
@@ -83,7 +83,7 @@ ATOMICITY_H=  ${SRCDIR}/config/cpu/${MARC
 ATOMICITY_H=   ${SRCDIR}/config/cpu/generic/atomicity_mutex/atomicity.h
 .endif
 
-.if ${MACHINE_CPUARCH} == "amd64"
+.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
 .if exists(${SRCDIR}/config/cpu/generic/atomicity_builtins/atomicity.h)
 ATOMICITY_H=   ${SRCDIR}/config/cpu/generic/atomicity_builtins/atomicity.h
 .endif

Modified: head/gnu/lib/libstdc++/config.h
==
--- head/gnu/lib/libstdc++/config.h Tue Sep  7 07:31:58 2010
(r212285)
+++ head/gnu/lib/libstdc++/config.h Tue Sep  7 08:33:17 2010
(r212286)
@@ -671,7 +671,7 @@
 /* #undef VERSION */
 
 /* Define if builtin atomic operations are supported on this host. */
-#if defined(__amd64__)
+#if defined(__amd64__) || defined(__i386__)
 #define _GLIBCXX_ATOMIC_BUILTINS 1
 #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: r212292 - head/sys/x86/pci

2010-09-07 Thread John Baldwin
Author: jhb
Date: Tue Sep  7 13:50:02 2010
New Revision: 212292
URL: http://svn.freebsd.org/changeset/base/212292

Log:
  Each processor socket in a QPI system has a special PCI bus for the
  "uncore" devices (such as the memory controller) in that socket.  Stop
  hardcoding support for two busses, but instead start probing buses at
  domain 0, bus 255 and walk down until a bus probe fails.  Also, do not probe
  a bus if it has already been enumerated elsewhere (e.g. if ACPI ever
  enumerates these buses in the future).

Modified:
  head/sys/x86/pci/qpi.c

Modified: head/sys/x86/pci/qpi.c
==
--- head/sys/x86/pci/qpi.c  Tue Sep  7 13:10:46 2010(r212291)
+++ head/sys/x86/pci/qpi.c  Tue Sep  7 13:50:02 2010(r212292)
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include "pcib_if.h"
@@ -84,31 +85,62 @@ qpi_probe(device_t dev)
return (BUS_PROBE_SPECIFIC);
 }
 
+/*
+ * Look for a PCI bus with the specified bus address.  If one is found,
+ * add a pcib device and return 0.  Otherwise, return an error code.
+ */
 static int
-qpi_attach(device_t dev)
+qpi_probe_pcib(device_t dev, int bus)
 {
struct qpi_device *qdev;
device_t child;
+   uint32_t devid;
 
/*
-* Add two Host-PCI bridge devices, one for PCI bus 254 and
-* one for PCI bus 255.
+* If a PCI bus already exists for this bus number, then
+* fail.
 */
-   child = BUS_ADD_CHILD(dev, 0, "pcib", -1);
-   if (child == NULL)
-   panic("%s: failed to add pci bus 254",
-   device_get_nameunit(dev));
-   qdev = malloc(sizeof(struct qpi_device), M_QPI, M_WAITOK);
-   qdev->qd_pcibus = 254;
-   device_set_ivars(child, qdev);
+   if (pci_find_bsf(bus, 0, 0) != NULL)
+   return (EEXIST);
+
+   /*
+* Attempt to read the device id for device 0, function 0 on
+* the bus.  A value of 0x means that the bus is not
+* present.
+*/
+   devid = pci_cfgregread(bus, 0, 0, PCIR_DEVVENDOR, 4);
+   if (devid == 0x)
+   return (ENOENT);
+
+   if ((devid & 0x) != 0x8086) {
+   device_printf(dev,
+   "Device at pci%d.0.0 has non-Intel vendor 0x%x\n", bus,
+   devid & 0x);
+   return (ENXIO);
+   }
 
child = BUS_ADD_CHILD(dev, 0, "pcib", -1);
if (child == NULL)
-   panic("%s: failed to add pci bus 255",
-   device_get_nameunit(dev));
+   panic("%s: failed to add pci bus %d", device_get_nameunit(dev),
+   bus);
qdev = malloc(sizeof(struct qpi_device), M_QPI, M_WAITOK);
-   qdev->qd_pcibus = 255;
+   qdev->qd_pcibus = bus;
device_set_ivars(child, qdev);
+   return (0);
+}
+
+static int
+qpi_attach(device_t dev)
+{
+   int bus;
+
+   /*
+* Each processor socket has a dedicated PCI bus counting down from
+* 255.  We keep probing buses until one fails.
+*/
+   for (bus = 255;; bus--)
+   if (qpi_probe_pcib(dev, bus) != 0)
+   break;
 
return (bus_generic_attach(dev));
 }
___
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: r212293 - in head/sys: fs/nfsclient nfsclient

2010-09-07 Thread John Baldwin
Author: jhb
Date: Tue Sep  7 14:29:45 2010
New Revision: 212293
URL: http://svn.freebsd.org/changeset/base/212293

Log:
  Store the full timestamp when caching timestamps of files and
  directories for purposes of validating name cache entries.  This
  closes races where two updates to a file or directory within the same
  second could result in stale entries in the name cache.  While here,
  remove the 'n_expiry' field as it is no longer used.
  
  Reviewed by:  rmacklem
  MFC after:1 week

Modified:
  head/sys/fs/nfsclient/nfs_clrpcops.c
  head/sys/fs/nfsclient/nfs_clvnops.c
  head/sys/fs/nfsclient/nfsnode.h
  head/sys/nfsclient/nfs_vnops.c
  head/sys/nfsclient/nfsnode.h

Modified: head/sys/fs/nfsclient/nfs_clrpcops.c
==
--- head/sys/fs/nfsclient/nfs_clrpcops.cTue Sep  7 13:50:02 2010
(r212292)
+++ head/sys/fs/nfsclient/nfs_clrpcops.cTue Sep  7 14:29:45 2010
(r212293)
@@ -3293,8 +3293,7 @@ nfsrpc_readdirplus(vnode_t vp, struct ui
ndp->ni_vp = newvp;
NFSCNHASH(cnp, HASHINIT);
if (cnp->cn_namelen <= NCHNAMLEN) {
-   np->n_ctime =
- np->n_vattr.na_ctime.tv_sec;
+   np->n_ctime = np->n_vattr.na_ctime;
cache_enter(ndp->ni_dvp,ndp->ni_vp,cnp);
}
if (unlocknewvp)

Modified: head/sys/fs/nfsclient/nfs_clvnops.c
==
--- head/sys/fs/nfsclient/nfs_clvnops.c Tue Sep  7 13:50:02 2010
(r212292)
+++ head/sys/fs/nfsclient/nfs_clvnops.c Tue Sep  7 14:29:45 2010
(r212293)
@@ -988,7 +988,7 @@ nfs_lookup(struct vop_lookup_args *ap)
struct nfsfh *nfhp;
struct nfsvattr dnfsva, nfsva;
struct vattr vattr;
-   time_t dmtime;
+   struct timespec dmtime;

*vpp = NULLVP;
if ((flags & ISLASTCN) && (mp->mnt_flag & MNT_RDONLY) &&
@@ -1038,7 +1038,7 @@ nfs_lookup(struct vop_lookup_args *ap)
}
if (nfscl_nodeleg(newvp, 0) == 0 ||
(VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 &&
-   vattr.va_ctime.tv_sec == newnp->n_ctime)) {
+   timespeccmp(&vattr.va_ctime, &newnp->n_ctime, ==))) {
NFSINCRGLOBAL(newnfsstats.lookupcache_hits);
if (cnp->cn_nameiop != LOOKUP &&
(flags & ISLASTCN))
@@ -1065,13 +1065,13 @@ nfs_lookup(struct vop_lookup_args *ap)
if ((u_int)(ticks - np->n_dmtime_ticks) <
(nmp->nm_negnametimeo * hz) &&
VOP_GETATTR(dvp, &vattr, cnp->cn_cred) == 0 &&
-   vattr.va_mtime.tv_sec == np->n_dmtime) {
+   timespeccmp(&vattr.va_mtime, &np->n_dmtime, ==)) {
NFSINCRGLOBAL(newnfsstats.lookupcache_hits);
return (ENOENT);
}
cache_purge_negative(dvp);
mtx_lock(&np->n_mtx);
-   np->n_dmtime = 0;
+   timespecclear(&np->n_dmtime);
mtx_unlock(&np->n_mtx);
}
 
@@ -1086,7 +1086,7 @@ nfs_lookup(struct vop_lookup_args *ap)
 * the lookup RPC has been performed on the server but before
 * n_dmtime is set at the end of this function.
 */
-   dmtime = np->n_vattr.na_mtime.tv_sec;
+   dmtime = np->n_vattr.na_mtime;
error = 0;
newvp = NULLVP;
NFSINCRGLOBAL(newnfsstats.lookupcache_misses);
@@ -1139,8 +1139,8 @@ nfs_lookup(struct vop_lookup_args *ap)
 * lookup.
 */
mtx_lock(&np->n_mtx);
-   if (np->n_dmtime <= dmtime) {
-   if (np->n_dmtime == 0) {
+   if (timespeccmp(&np->n_dmtime, &dmtime, <=)) {
+   if (!timespecisset(&np->n_dmtime)) {
np->n_dmtime = dmtime;
np->n_dmtime_ticks = ticks;
}
@@ -1241,7 +1241,7 @@ nfs_lookup(struct vop_lookup_args *ap)
cnp->cn_flags |= SAVENAME;
if ((cnp->cn_flags & MAKEENTRY) &&
(cnp->cn_nameiop != DELETE || !(flags & ISLASTCN))) {
-   np->n_ctime = np->n_vattr.na_vattr.va_ctime.tv_sec;
+   np->n_ctime = np->n_vattr.na_vattr.va_ctime;
cache_enter(dvp, newvp, cnp);
}
*vpp = newvp;

Modified: head/sys/fs/nfsclient/nfsnode.h
==
--- head/sys/fs/nfsclient/nfsnode.h Tue S

svn commit: r212296 - head/usr.sbin/bluetooth/bthidcontrol

2010-09-07 Thread Maksim Yevmenkin
Author: emax
Date: Tue Sep  7 16:36:03 2010
New Revision: 212296
URL: http://svn.freebsd.org/changeset/base/212296

Log:
  Do not request SDP attributes using ranges.
  Apparently some devices do not like it.
  
  MFC after:1 week
  Tested by:Buganini < buganini at gmail dot com >

Modified:
  head/usr.sbin/bluetooth/bthidcontrol/sdp.c

Modified: head/usr.sbin/bluetooth/bthidcontrol/sdp.c
==
--- head/usr.sbin/bluetooth/bthidcontrol/sdp.c  Tue Sep  7 15:23:00 2010
(r212295)
+++ head/usr.sbin/bluetooth/bthidcontrol/sdp.c  Tue Sep  7 16:36:03 2010
(r212296)
@@ -54,7 +54,9 @@ SDP_ATTR_RANGE(   SDP_ATTR_PROTOCOL_DESCRI
 SDP_ATTR_RANGE (SDP_ATTR_ADDITIONAL_PROTOCOL_DESCRIPTOR_LISTS,
SDP_ATTR_ADDITIONAL_PROTOCOL_DESCRIPTOR_LISTS),
 SDP_ATTR_RANGE(0x0205, /* HIDReconnectInitiate */
-   0x0206),/* HIDDescriptorList */
+   0x0205),
+SDP_ATTR_RANGE(0x0206, /* HIDDescriptorList */
+   0x0206),
 SDP_ATTR_RANGE(0x0209, /* HIDBatteryPower */
0x0209),
 SDP_ATTR_RANGE(0x020d, /* HIDNormallyConnectable */
@@ -149,7 +151,7 @@ hid_sdp_query(bdaddr_t const *local, str
}
 
if (control_psm == -1 || interrupt_psm == -1 ||
-   reconnect_initiate == -1 || normally_connectable == -1 ||
+   reconnect_initiate == -1 ||
hid_descriptor == NULL || hid_descriptor_length == -1)
hid_sdp_query_exit(ENOATTR);
 
___
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: r212254 - head/release/doc/share/misc

2010-09-07 Thread Pyun YongHyeon
On Mon, Sep 06, 2010 at 11:02:50AM +, Christian Brueffer wrote:
> Author: brueffer
> Date: Mon Sep  6 11:02:50 2010
> New Revision: 212254
> URL: http://svn.freebsd.org/changeset/base/212254
> 
> Log:
>   sis(4) should work on all architectures now.
> 

Thanks a lot!
___
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: r212302 - head/sys/dev/bge

2010-09-07 Thread Pyun YongHyeon
Author: yongari
Date: Tue Sep  7 18:29:29 2010
New Revision: 212302
URL: http://svn.freebsd.org/changeset/base/212302

Log:
  Make sure to create DMA'able memory for statistics block. This was
  missed in r212061 and it caused crashes for 570x controllers as
  controller DMAed statistics to physical address 0.
  
  Reported by:  kan

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

Modified: head/sys/dev/bge/if_bge.c
==
--- head/sys/dev/bge/if_bge.c   Tue Sep  7 18:14:59 2010(r212301)
+++ head/sys/dev/bge/if_bge.c   Tue Sep  7 18:29:29 2010(r212302)
@@ -2258,6 +2258,15 @@ bge_dma_alloc(struct bge_softc *sc)
if (error)
return (error);
 
+   /* Create tag for statistics block. */
+   error = bge_dma_ring_alloc(sc, PAGE_SIZE, BGE_STATS_SZ,
+   &sc->bge_cdata.bge_stats_tag,
+   (uint8_t **)&sc->bge_ldata.bge_stats,
+   &sc->bge_cdata.bge_stats_map,
+   &sc->bge_ldata.bge_stats_paddr, "statistics block");
+   if (error)
+   return (error);
+
/* Create tag for jumbo RX ring. */
if (BGE_IS_JUMBO_CAPABLE(sc)) {
error = bge_dma_ring_alloc(sc, PAGE_SIZE, BGE_JUMBO_RX_RING_SZ,
___
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: r212061 - head/sys/dev/bge

2010-09-07 Thread Pyun YongHyeon
On Fri, Sep 03, 2010 at 11:27:14PM -0700, Pyun YongHyeon wrote:
> On Fri, Sep 3, 2010 at 9:29 PM, Alexander Kabaev  wrote:
> > On Tue, 31 Aug 2010 17:33:48 + (UTC)
> > Pyun YongHyeon  wrote:
> >
> >> Author: yongari
> >> Date: Tue Aug 31 17:33:48 2010
> >> New Revision: 212061
> >> URL: http://svn.freebsd.org/changeset/base/212061
> >>
> >> Log:
> >> ? Split common parent DMA tag into ring DMA tag and TX/RX mbuf DMA
> >> ? tag. All controllers that are not BCM5755 or higher have 4GB
> >> ? boundary DMA bug. Previously bge(4) used 32bit DMA address to
> >> ? workaround the bug(r199670). However this caused the use of bounce
> >> ? buffers such that it resulted in poor performance for systems which
> >> ? have more than 4GB memory. Because bus_dma(9) honors boundary
> >> ? restriction requirement of DMA tag for dynamic buffers, having a
> >> ? separate TX/RX mbuf DMA tag will greatly reduce the possibility of
> >> ? using bounce buffers. For DMA buffers allocated with
> >> ? bus_dmamem_alloc(9), now bge(4) explicitly checks whether the
> >> ? requested memory region crossed the boundary or not.
> >> ? With this change, only the DMA buffer that crossed the boundary
> >> ? will use 32bit DMA address. Other DMA buffers are not affected as
> >> ? separate DMA tag is created for each DMA buffer.
> >> ? Even if 32bit DMA address space is used for a buffer, the chance to
> >> ? use bounce buffer is still very low as the size of buffer is small.
> >> ? This change should eliminate most usage of bounce buffers on
> >> ? systems that have more than 4GB memory.
> >>
> >> ? More correct fix would be teaching bus_dma(9) to honor boundary
> >> ? restriction for buffers created with bus_dmamem_alloc(9) but it
> >> ? seems that is not easy.
> >>
> >> ? While I'm here cleanup bge_dma_map_addr() and remove unnecessary
> >> ? member variables in bge_dmamap_arg structure.
> >>
> >> ? Tested by: ?marcel
> >>
> >> Modified:
> >> ? head/sys/dev/bge/if_bge.c
> >> ? head/sys/dev/bge/if_bgereg.h
> >>
> >
> > Hi,
> >
> > with this commit my AMD64 machine reliably reboots after several
> > minutes of uptime. Attempting cvs update of ports from repository
> > located on NFS server seems to make it happen sooner.
> >
> >
> > bge0:  > ?0x001002> mem 0xfd8f-0xfd8f irq 24 at device 9.0 on pci2
> > miibus0:  on bge0
> > brgphy0:  PHY 1 on miibus0
> > brgphy0: ?10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT,
> > 1000baseT-FDX, auto
> > bge0: Ethernet address: 00:e0:81:28:24:e7
> > bge0: [ITHREAD]
> >
> > Booting kernel tree from just before this commit makes everything work
> > again.
> 
> Sorry, it seems I forgot allocating statistics block. This may cause
> issues for controllers(e.g. 570x) that support hardware MAC statistics
> counters. This could be the reason why I couldn't see the issue on 5761.
> I'm on vacation so I'll fix it Tuesday. If it's urgent please back out this
> change.
> 

Fix committed in r212302.
___
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: r212303 - head/sys/dev/e1000

2010-09-07 Thread Jack F Vogel
Author: jfv
Date: Tue Sep  7 20:13:08 2010
New Revision: 212303
URL: http://svn.freebsd.org/changeset/base/212303

Log:
  Tighten up the rx mbuf refresh code, there were some
  discrepencies from the igb version which was the target.
  
  Change the message when neither MSI or MSIX are enabled
  and a fallback to Legacy interrupts happen, the existing
  message was confusing.

Modified:
  head/sys/dev/e1000/if_em.c
  head/sys/dev/e1000/if_em.h

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Tue Sep  7 18:29:29 2010(r212302)
+++ head/sys/dev/e1000/if_em.c  Tue Sep  7 20:13:08 2010(r212303)
@@ -93,7 +93,7 @@ int   em_display_debug_stats = 0;
 /*
  *  Driver version:
  */
-char em_driver_version[] = "7.0.5";
+char em_driver_version[] = "7.0.6";
 
 
 /*
@@ -281,6 +281,8 @@ static void em_handle_link(void *context
 static voidem_add_rx_process_limit(struct adapter *, const char *,
const char *, int *, int);
 
+static __inline void em_rx_discard(struct rx_ring *, int);
+
 #ifdef DEVICE_POLLING
 static poll_handler_t em_poll;
 #endif /* POLLING */
@@ -2563,11 +2565,11 @@ msi:
val = pci_msi_count(dev);
if (val == 1 && pci_alloc_msi(dev, &val) == 0) {
adapter->msix = 1;
-   device_printf(adapter->dev,"Using MSI interrupt\n");
+   device_printf(adapter->dev,"Using an MSI interrupt\n");
return (val);
} 
-   /* Should only happen due to manual invention */
-   device_printf(adapter->dev,"Setup MSIX failure\n");
+   /* Should only happen due to manual configuration */
+   device_printf(adapter->dev,"No MSI/MSIX using a Legacy IRQ\n");
return (0);
 }
 
@@ -3681,14 +3683,27 @@ em_refresh_mbufs(struct rx_ring *rxr, in
struct adapter  *adapter = rxr->adapter;
struct mbuf *m;
bus_dma_segment_t   segs[1];
-   bus_dmamap_tmap;
struct em_buffer*rxbuf;
int i, error, nsegs, cleaned;
 
i = rxr->next_to_refresh;
cleaned = -1;
while (i != limit) {
+   rxbuf = &rxr->rx_buffers[i];
+   /*
+   ** Just skip entries with a buffer,
+   ** they can only be due to an error
+   ** and are to be reused.
+   */
+   if (rxbuf->m_head != NULL)
+   continue;
m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
+   /*
+   ** If we have a temporary resource shortage
+   ** that causes a failure, just abort refresh
+   ** for now, we will return to this point when
+   ** reinvoked from em_rxeof.
+   */
if (m == NULL)
goto update;
m->m_len = m->m_pkthdr.len = MCLBYTES;
@@ -3696,11 +3711,8 @@ em_refresh_mbufs(struct rx_ring *rxr, in
if (adapter->max_frame_size <= (MCLBYTES - ETHER_ALIGN))
m_adj(m, ETHER_ALIGN);
 
-   /*
-* Using memory from the mbuf cluster pool, invoke the
-* bus_dma machinery to arrange the memory mapping.
-*/
-   error = bus_dmamap_load_mbuf_sg(rxr->rxtag, rxr->rx_sparemap,
+   /* Use bus_dma machinery to setup the memory mapping  */
+   error = bus_dmamap_load_mbuf_sg(rxr->rxtag, rxbuf->map,
m, segs, &nsegs, BUS_DMA_NOWAIT);
if (error != 0) {
m_free(m);
@@ -3710,13 +3722,6 @@ em_refresh_mbufs(struct rx_ring *rxr, in
/* If nsegs is wrong then the stack is corrupt. */
KASSERT(nsegs == 1, ("Too many segments returned!"));

-   rxbuf = &rxr->rx_buffers[i];
-   if (rxbuf->m_head != NULL)
-   bus_dmamap_unload(rxr->rxtag, rxbuf->map);
-   
-   map = rxbuf->map;
-   rxbuf->map = rxr->rx_sparemap;
-   rxr->rx_sparemap = map;
bus_dmamap_sync(rxr->rxtag,
rxbuf->map, BUS_DMASYNC_PREREAD);
rxbuf->m_head = m;
@@ -3730,8 +3735,10 @@ em_refresh_mbufs(struct rx_ring *rxr, in
rxr->next_to_refresh = i;
}
 update:
-   bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map,
-   BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
+   /*
+   ** Update the tail pointer only if,
+   ** and as far as we have refreshed.
+   */
if (cleaned != -1) /* Update tail index */
E1000_WRIT

svn commit: r212304 - head/sys/dev/e1000

2010-09-07 Thread Jack F Vogel
Author: jfv
Date: Tue Sep  7 21:28:45 2010
New Revision: 212304
URL: http://svn.freebsd.org/changeset/base/212304

Log:
  Code correction in refresh_mbufs, just continuing
  without index recalc was wrong.

Modified:
  head/sys/dev/e1000/if_em.c

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Tue Sep  7 20:13:08 2010(r212303)
+++ head/sys/dev/e1000/if_em.c  Tue Sep  7 21:28:45 2010(r212304)
@@ -3696,7 +3696,7 @@ em_refresh_mbufs(struct rx_ring *rxr, in
** and are to be reused.
*/
if (rxbuf->m_head != NULL)
-   continue;
+   goto reuse;
m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
/*
** If we have a temporary resource shortage
@@ -3726,7 +3726,7 @@ em_refresh_mbufs(struct rx_ring *rxr, in
rxbuf->map, BUS_DMASYNC_PREREAD);
rxbuf->m_head = m;
rxr->rx_base[i].buffer_addr = htole64(segs[0].ds_addr);
-
+reuse:
cleaned = i;
/* Calculate next index */
if (++i == adapter->num_rx_desc)
___
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: r212251 - head/sys/dev/acpi_support

2010-09-07 Thread Jung-uk Kim
On Monday 06 September 2010 11:28 am, John Baldwin wrote:
> On Monday 06 September 2010 03:34:32 am Andriy Gapon wrote:
> > Author: avg
> > Date: Mon Sep  6 07:34:32 2010
> > New Revision: 212251
> > URL: http://svn.freebsd.org/changeset/base/212251
> >
> > Log:
> >   acpi_hp: fix bus attachment code
> >
> >   - add identify method to create driver's own device_t
> >   - successfully probe only driver's own device_t instead of any
> > device_t - (ab)use device order to hopefully be probed/attached
> > after acpi_wmi
>
> Perhaps this should be a child of acpi_wmi0 instead?  That would
> fix the ordering issue as well as remove the need to avoid "real"
> ACPI devices in the attach routine.

+1

Jung-uk Kim
___
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: r212305 - head/sys/fs/tmpfs

2010-09-07 Thread Ivan Voras
Author: ivoras
Date: Tue Sep  7 22:40:45 2010
New Revision: 212305
URL: http://svn.freebsd.org/changeset/base/212305

Log:
  Avoid "Entry can disappear before we lock fdvp" panic.
  
  PR:   150143
  Submitted by: Gleb Kurtsou 
  Pretty sure it won't blow up: mckusick
  MFC after:2 weeks

Modified:
  head/sys/fs/tmpfs/tmpfs_vnops.c

Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==
--- head/sys/fs/tmpfs/tmpfs_vnops.c Tue Sep  7 21:28:45 2010
(r212304)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c Tue Sep  7 22:40:45 2010
(r212305)
@@ -981,10 +981,14 @@ tmpfs_rename(struct vop_rename_args *v)
fnode = VP_TO_TMPFS_NODE(fvp);
de = tmpfs_dir_lookup(fdnode, fnode, fcnp);
 
-   /* Avoid manipulating '.' and '..' entries. */
+   /* Entry can disappear before we lock fdvp,
+* also avoid manipulating '.' and '..' entries. */
if (de == NULL) {
-   MPASS(fvp->v_type == VDIR);
-   error = EINVAL;
+   if ((fcnp->cn_flags & ISDOTDOT) != 0 ||
+   (fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.'))
+   error = EINVAL;
+   else
+   error = ENOENT;
goto out_locked;
}
MPASS(de->td_node == fnode);
___
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: r212306 - head/sys/dev/mii

2010-09-07 Thread Pyun YongHyeon
Author: yongari
Date: Tue Sep  7 22:44:29 2010
New Revision: 212306
URL: http://svn.freebsd.org/changeset/base/212306

Log:
  Remove trailing CR at EOL.

Modified:
  head/sys/dev/mii/brgphyreg.h

Modified: head/sys/dev/mii/brgphyreg.h
==
--- head/sys/dev/mii/brgphyreg.hTue Sep  7 22:40:45 2010
(r212305)
+++ head/sys/dev/mii/brgphyreg.hTue Sep  7 22:44:29 2010
(r212306)
@@ -262,103 +262,103 @@
 #defineBRGPHY_IMR_LNK_CHG  0x0002  /* Link status change */
 #defineBRGPHY_IMR_CRCERR   0x0001  /* CRC error */
 
-/***/
-/* Begin: Shared SerDes PHY register definitions   */
-/***/
-
-/* SerDes autoneg is different from copper */
-#define BRGPHY_SERDES_ANAR 0x04
-#define BRGPHY_SERDES_ANAR_FDX 0x0020
-#define BRGPHY_SERDES_ANAR_HDX 0x0040
-#define BRGPHY_SERDES_ANAR_NO_PAUSE(0x0 << 7)
-#define BRGPHY_SERDES_ANAR_SYM_PAUSE   (0x1 << 7)
-#define BRGPHY_SERDES_ANAR_ASYM_PAUSE  (0x2 << 7)
-#define BRGPHY_SERDES_ANAR_BOTH_PAUSE  (0x3 << 7)
-
-#define BRGPHY_SERDES_ANLPAR   0x05
-#define BRGPHY_SERDES_ANLPAR_FDX   0x0020
-#define BRGPHY_SERDES_ANLPAR_HDX   0x0040
-#define BRGPHY_SERDES_ANLPAR_NO_PAUSE  (0x0 << 7)
-#define BRGPHY_SERDES_ANLPAR_SYM_PAUSE (0x1 << 7)
-#define BRGPHY_SERDES_ANLPAR_ASYM_PAUSE(0x2 << 7)
-#define BRGPHY_SERDES_ANLPAR_BOTH_PAUSE(0x3 << 7)
-
-/***/
-/* End: Shared SerDes PHY register definitions */
-/***/
-
-/***/
-/* Begin: PHY register values for the 5706 PHY */
-/***/
-
-/* 
- * Shadow register 0x1C, bit 15 is write enable,
- * bits 14-10 select function (0x00 to 0x1F).
- */
-#define BRGPHY_MII_SHADOW_1C   0x1C
+/***/
+/* Begin: Shared SerDes PHY register definitions   */
+/***/
+
+/* SerDes autoneg is different from copper */
+#define BRGPHY_SERDES_ANAR 0x04
+#define BRGPHY_SERDES_ANAR_FDX 0x0020
+#define BRGPHY_SERDES_ANAR_HDX 0x0040
+#define BRGPHY_SERDES_ANAR_NO_PAUSE(0x0 << 7)
+#define BRGPHY_SERDES_ANAR_SYM_PAUSE   (0x1 << 7)
+#define BRGPHY_SERDES_ANAR_ASYM_PAUSE  (0x2 << 7)
+#define BRGPHY_SERDES_ANAR_BOTH_PAUSE  (0x3 << 7)
+
+#define BRGPHY_SERDES_ANLPAR   0x05
+#define BRGPHY_SERDES_ANLPAR_FDX   0x0020
+#define BRGPHY_SERDES_ANLPAR_HDX   0x0040
+#define BRGPHY_SERDES_ANLPAR_NO_PAUSE  (0x0 << 7)
+#define BRGPHY_SERDES_ANLPAR_SYM_PAUSE (0x1 << 7)
+#define BRGPHY_SERDES_ANLPAR_ASYM_PAUSE(0x2 << 7)
+#define BRGPHY_SERDES_ANLPAR_BOTH_PAUSE(0x3 << 7)
+
+/***/
+/* End: Shared SerDes PHY register definitions */
+/***/
+
+/***/
+/* Begin: PHY register values for the 5706 PHY */
+/***/
+
+/* 
+ * Shadow register 0x1C, bit 15 is write enable,
+ * bits 14-10 select function (0x00 to 0x1F).
+ */
+#define BRGPHY_MII_SHADOW_1C   0x1C
 #define BRGPHY_SHADOW_1C_WRITE_EN  0x8000
 #define BRGPHY_SHADOW_1C_SELECT_MASK   0x7C00
-
+
 /* Shadow 0x1C Mode Control Register (select value 0x1F) */
 #define BRGPHY_SHADOW_1C_MODE_CTRL (0x1F << 10)
 /* When set, Regs 0-0x0F are 1000X, else 1000T */
-#define BRGPHY_SHADOW_1C_ENA_1000X 0x0001  
+#define BRGPHY_SHADOW_1C_ENA_1000X 0x0001  
 
 #defineBRGPHY_MII_TEST10x1E
 #defineBRGPHY_TEST1_TRIM_EN0x0010
 #defineBRGPHY_TEST1_CRC_EN 0x8000
 
 #define BRGPHY_MII_TEST2   0x1F
-
-/***/
-/* End: PHY register values for the 5706 PHY   */
-/***/
-
-/***/
-/* Begin: PHY register values for the 5708S SerDes PHY */
-/***/
-
-/* Autoneg Next Page Transmit 1 Regiser */
-#define BRGPHY_5708S_ANEG_NXT_PG_XMIT1 0x0B
-#define BRGPHY_5708S_ANEG_NXT_PG_XMIT1_25G 0x0001
-
-/* Use the BLOCK_ADDR register to select the page for registers 0x10 to 0x1E */
-#define BRGPHY_5708S_BLOCK_ADDR0x1f
+
+/***

svn commit: r212307 - head/sys/dev/mii

2010-09-07 Thread Pyun YongHyeon
Author: yongari
Date: Tue Sep  7 23:08:38 2010
New Revision: 212307
URL: http://svn.freebsd.org/changeset/base/212307

Log:
  Consistently use tab characters instead of tab + space characters.
  No functional changes.

Modified:
  head/sys/dev/mii/brgphy.c
  head/sys/dev/mii/brgphyreg.h

Modified: head/sys/dev/mii/brgphy.c
==
--- head/sys/dev/mii/brgphy.c   Tue Sep  7 22:44:29 2010(r212306)
+++ head/sys/dev/mii/brgphy.c   Tue Sep  7 23:08:38 2010(r212307)
@@ -140,7 +140,7 @@ static const struct mii_phydesc brgphys[
MII_PHY_DESC(xxBROADCOM_ALT1, BCM5784),
MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709C),
MII_PHY_DESC(xxBROADCOM_ALT1, BCM5761),
-MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709S),
+   MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709S),
MII_PHY_DESC(BROADCOM2, BCM5906),
MII_PHY_END
 };
@@ -242,11 +242,12 @@ brgphy_attach(device_t dev)
bsc->serdes_flags |= BRGPHY_5708S;
sc->mii_flags |= MIIF_HAVEFIBER;
break;
-case MII_MODEL_xxBROADCOM_ALT1_BCM5709S:
-bsc->serdes_flags |= BRGPHY_5709S;
-sc->mii_flags |= MIIF_HAVEFIBER;
-break;
-   } break;
+   case MII_MODEL_xxBROADCOM_ALT1_BCM5709S:
+   bsc->serdes_flags |= BRGPHY_5709S;
+   sc->mii_flags |= MIIF_HAVEFIBER;
+   break;
+   }
+   break;
default:
device_printf(dev, "Unrecognized OUI for PHY!\n");
}
@@ -637,7 +638,7 @@ brgphy_status(struct mii_softc *sc)
PHY_WRITE(sc, BRGPHY_5708S_BLOCK_ADDR, 
BRGPHY_5708S_DIG_PG0);
xstat = PHY_READ(sc, BRGPHY_5708S_PG0_1000X_STAT1);
 
-/* Check for MRBE auto-negotiated speed results. */
+   /* Check for MRBE auto-negotiated speed results. */
switch (xstat & 
BRGPHY_5708S_PG0_1000X_STAT1_SPEED_MASK) {
case BRGPHY_5708S_PG0_1000X_STAT1_SPEED_10:
mii->mii_media_active |= IFM_10_FL; break;
@@ -649,39 +650,39 @@ brgphy_status(struct mii_softc *sc)
mii->mii_media_active |= IFM_2500_SX; break;
}
 
-/* Check for MRBE auto-negotiated duplex results. */
+   /* Check for MRBE auto-negotiated duplex results. */
if (xstat & BRGPHY_5708S_PG0_1000X_STAT1_FDX)
mii->mii_media_active |= IFM_FDX;
else
mii->mii_media_active |= IFM_HDX;
 
-} else if (bsc->serdes_flags & BRGPHY_5709S) {
+   } else if (bsc->serdes_flags & BRGPHY_5709S) {
 
-/* Select GP Status Block of the AN MMD, get autoneg results. */
-PHY_WRITE(sc, BRGPHY_BLOCK_ADDR, BRGPHY_BLOCK_ADDR_GP_STATUS);
+   /* Select GP Status Block of the AN MMD, get autoneg 
results. */
+   PHY_WRITE(sc, BRGPHY_BLOCK_ADDR, 
BRGPHY_BLOCK_ADDR_GP_STATUS);
xstat = PHY_READ(sc, BRGPHY_GP_STATUS_TOP_ANEG_STATUS);
 
-/* Restore IEEE0 block (assumed in all brgphy(4) code). */
-PHY_WRITE(sc, BRGPHY_BLOCK_ADDR, BRGPHY_BLOCK_ADDR_COMBO_IEEE0);
+   /* Restore IEEE0 block (assumed in all brgphy(4) code). 
*/
+   PHY_WRITE(sc, BRGPHY_BLOCK_ADDR, 
BRGPHY_BLOCK_ADDR_COMBO_IEEE0);
 
-/* Check for MRBE auto-negotiated speed results. */
-switch (xstat & BRGPHY_GP_STATUS_TOP_ANEG_SPEED_MASK) {
-   case BRGPHY_GP_STATUS_TOP_ANEG_SPEED_10:
-   mii->mii_media_active |= IFM_10_FL; break;
-   case BRGPHY_GP_STATUS_TOP_ANEG_SPEED_100:
-   mii->mii_media_active |= IFM_100_FX; break;
-   case BRGPHY_GP_STATUS_TOP_ANEG_SPEED_1G:
-   mii->mii_media_active |= IFM_1000_SX; break;
-   case BRGPHY_GP_STATUS_TOP_ANEG_SPEED_25G:
-   mii->mii_media_active |= IFM_2500_SX; break;
+   /* Check for MRBE auto-negotiated speed results. */
+   switch (xstat & BRGPHY_GP_STATUS_TOP_ANEG_SPEED_MASK) {
+   case BRGPHY_GP_STATUS_TOP_ANEG_SPEED_10:
+   mii->mii_media_active |= IFM_10_FL; 
break;
+   case BRGPHY_GP_STATUS_TOP_ANEG_SPEED_100:
+   mii->mii_media_active |= IFM_100_FX; 
break;
+   case BRGPHY_GP_STATUS_TOP_ANEG_SPEED_1G:
+   mii->mii_media_active |= IFM_1000_SX; 
break;
+   ca

svn commit: r212308 - head/sys/powerpc/aim

2010-09-07 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Tue Sep  7 23:31:48 2010
New Revision: 212308
URL: http://svn.freebsd.org/changeset/base/212308

Log:
  Fix an error made in r209975 related to context ID allocation for 64-bit
  PowerPC CPUs running a 32-bit kernel. This bug could cause in-use VSIDs
  to be allocated again to another process, causing memory space overlaps
  and corruption.
  
  Reported by:  linimon

Modified:
  head/sys/powerpc/aim/mmu_oea64.c

Modified: head/sys/powerpc/aim/mmu_oea64.c
==
--- head/sys/powerpc/aim/mmu_oea64.cTue Sep  7 23:08:38 2010
(r212307)
+++ head/sys/powerpc/aim/mmu_oea64.cTue Sep  7 23:31:48 2010
(r212308)
@@ -2108,7 +2108,7 @@ void
 moea64_pinit(mmu_t mmu, pmap_t pmap)
 {
int i;
-   register_t hash;
+   uint32_t hash;
 
PMAP_LOCK_INIT(pmap);
 
@@ -2125,6 +2125,8 @@ moea64_pinit(mmu_t mmu, pmap_t pmap)
 
for (i = 0; i < 16; i++) 
pmap->pm_sr[i] = VSID_MAKE(i, hash);
+
+   KASSERT(pmap->pm_sr[0] != 0, ("moea64_pinit: pm_sr[0] = 0"));
 }
 #endif
 
@@ -2238,6 +2240,8 @@ moea64_release_vsid(uint64_t vsid)
idx = vsid & (NVSIDS-1);
mask = 1 << (idx % VSID_NBPW);
idx /= VSID_NBPW;
+   KASSERT(moea64_vsid_bitmap[idx] & mask,
+   ("Freeing unallocated VSID %#jx", vsid));
moea64_vsid_bitmap[idx] &= ~mask;
mtx_unlock(&moea64_slb_mutex);
 }
@@ -2254,10 +2258,9 @@ moea64_release(mmu_t mmu, pmap_t pmap)
free_vsids(pmap);
slb_free_user_cache(pmap->pm_slb);
 #else
-if (pmap->pm_sr[0] == 0)
-panic("moea64_release: pm_sr[0] = 0");
+   KASSERT(pmap->pm_sr[0] != 0, ("moea64_release: pm_sr[0] = 0"));
 
-   moea64_release_vsid(pmap->pm_sr[0]);
+   moea64_release_vsid(VSID_TO_HASH(pmap->pm_sr[0]));
 #endif
 
PMAP_LOCK_DESTROY(pmap);
___
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: r212312 - head/lib/libthr/thread

2010-09-07 Thread David Xu
Author: davidxu
Date: Wed Sep  8 02:18:20 2010
New Revision: 212312
URL: http://svn.freebsd.org/changeset/base/212312

Log:
  To avoid possible race condition, SIGCANCEL is always sent except the
  thread is dead.

Modified:
  head/lib/libthr/thread/thr_cancel.c

Modified: head/lib/libthr/thread/thr_cancel.c
==
--- head/lib/libthr/thread/thr_cancel.c Wed Sep  8 01:55:03 2010
(r212311)
+++ head/lib/libthr/thread/thr_cancel.c Wed Sep  8 02:18:20 2010
(r212312)
@@ -67,7 +67,7 @@ _pthread_cancel(pthread_t pthread)
THR_THREAD_LOCK(curthread, pthread);
if (!pthread->cancel_pending) {
pthread->cancel_pending = 1;
-   if (pthread->cancel_enable)
+   if (pthread->state != PS_DEAD)
_thr_send_sig(pthread, SIGCANCEL);
}
THR_THREAD_UNLOCK(curthread, pthread);
___
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: r212251 - head/sys/dev/acpi_support

2010-09-07 Thread Andriy Gapon
on 08/09/2010 00:38 Jung-uk Kim said the following:
> On Monday 06 September 2010 11:28 am, John Baldwin wrote:
>> On Monday 06 September 2010 03:34:32 am Andriy Gapon wrote:
>>> Author: avg
>>> Date: Mon Sep  6 07:34:32 2010
>>> New Revision: 212251
>>> URL: http://svn.freebsd.org/changeset/base/212251
>>>
>>> Log:
>>>   acpi_hp: fix bus attachment code
>>>
>>>   - add identify method to create driver's own device_t
>>>   - successfully probe only driver's own device_t instead of any
>>> device_t - (ab)use device order to hopefully be probed/attached
>>> after acpi_wmi
>>
>> Perhaps this should be a child of acpi_wmi0 instead?  That would
>> fix the ordering issue as well as remove the need to avoid "real"
>> ACPI devices in the attach routine.
> 
> +1

I am working on this.
Thanks to John for guidance.

-- 
Andriy Gapon
___
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"