svn commit: r227012 - in head/sys: mips/mips vm

2011-11-01 Thread Alan Cox
Author: alc
Date: Wed Nov  2 05:42:51 2011
New Revision: 227012
URL: http://svn.freebsd.org/changeset/base/227012

Log:
  Add support for VM_ALLOC_WIRED and VM_ALLOC_ZERO to vm_page_alloc_freelist()
  and use these new options in the mips pmap.
  
  Wake up the page daemon in vm_page_alloc_freelist() if the number of free
  and cached pages becomes too low.
  
  Tidy up vm_page_alloc_init().  In particular, add a comment about an
  important restriction on its use.
  
  Tested by:jchandra@

Modified:
  head/sys/mips/mips/pmap.c
  head/sys/vm/vm_page.c

Modified: head/sys/mips/mips/pmap.c
==
--- head/sys/mips/mips/pmap.c   Wed Nov  2 04:21:20 2011(r227011)
+++ head/sys/mips/mips/pmap.c   Wed Nov  2 05:42:51 2011(r227012)
@@ -1077,7 +1077,8 @@ pmap_alloc_direct_page(unsigned int inde
 {
vm_page_t m;
 
-   m = vm_page_alloc_freelist(VM_FREELIST_DIRECT, req);
+   m = vm_page_alloc_freelist(VM_FREELIST_DIRECT, req | VM_ALLOC_WIRED |
+   VM_ALLOC_ZERO);
if (m == NULL)
return (NULL);
 
@@ -1085,8 +1086,6 @@ pmap_alloc_direct_page(unsigned int inde
pmap_zero_page(m);
 
m->pindex = index;
-   atomic_add_int(&cnt.v_wire_count, 1);
-   m->wire_count = 1;
return (m);
 }
 

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Wed Nov  2 04:21:20 2011(r227011)
+++ head/sys/vm/vm_page.c   Wed Nov  2 05:42:51 2011(r227012)
@@ -1482,6 +1482,8 @@ vm_page_alloc(vm_object_t object, vm_pin
  * Initialize a page that has been freshly dequeued from a freelist.
  * The caller has to drop the vnode returned, if it is not NULL.
  *
+ * This function may only be used to initialize unmanaged pages.
+ *
  * To be called with vm_page_queue_free_mtx held.
  */
 struct vnode *
@@ -1507,11 +1509,12 @@ vm_page_alloc_init(vm_page_t m)
mtx_assert(&vm_page_queue_free_mtx, MA_OWNED);
drop = NULL;
if ((m->flags & PG_CACHED) != 0) {
+   KASSERT((m->flags & PG_ZERO) == 0,
+   ("vm_page_alloc_init: cached page %p is PG_ZERO", m));
m->valid = 0;
m_object = m->object;
vm_page_cache_remove(m);
-   if (m_object->type == OBJT_VNODE &&
-   m_object->cache == NULL)
+   if (m_object->type == OBJT_VNODE && m_object->cache == NULL)
drop = m_object->handle;
} else {
KASSERT(VM_PAGE_IS_FREE(m),
@@ -1519,9 +1522,9 @@ vm_page_alloc_init(vm_page_t m)
KASSERT(m->valid == 0,
("vm_page_alloc_init: free page %p is valid", m));
cnt.v_free_count--;
+   if ((m->flags & PG_ZERO) != 0)
+   vm_page_zero_count--;
}
-   if (m->flags & PG_ZERO)
-   vm_page_zero_count--;
/* Don't clear the PG_ZERO flag; we'll need it later. */
m->flags &= PG_ZERO;
m->aflags = 0;
@@ -1532,16 +1535,28 @@ vm_page_alloc_init(vm_page_t m)
 
 /*
  * vm_page_alloc_freelist:
- * 
- * Allocate a page from the specified freelist.
- * Only the ALLOC_CLASS values in req are honored, other request flags
- * are ignored.
+ *
+ * Allocate a physical page from the specified free page list.
+ *
+ * The caller must always specify an allocation class.
+ *
+ * allocation classes:
+ * VM_ALLOC_NORMAL normal process request
+ * VM_ALLOC_SYSTEM system *really* needs a page
+ * VM_ALLOC_INTERRUPT  interrupt time request
+ *
+ * optional allocation flags:
+ * VM_ALLOC_WIRED  wire the allocated page
+ * VM_ALLOC_ZERO   prefer a zeroed page
+ *
+ * This routine may not sleep.
  */
 vm_page_t
 vm_page_alloc_freelist(int flind, int req)
 {
struct vnode *drop;
vm_page_t m;
+   u_int flags;
int page_req;
 
m = NULL;
@@ -1563,8 +1578,26 @@ vm_page_alloc_freelist(int flind, int re
}
drop = vm_page_alloc_init(m);
mtx_unlock(&vm_page_queue_free_mtx);
-   if (drop)
+
+   /*
+* Initialize the page.  Only the PG_ZERO flag is inherited.
+*/
+   flags = 0;
+   if ((req & VM_ALLOC_ZERO) != 0)
+   flags = PG_ZERO;
+   m->flags &= flags;
+   if ((req & VM_ALLOC_WIRED) != 0) {
+   /*
+* The page lock is not required for wiring a page that does
+* not belong to an object.
+*/
+   atomic_add_int(&cnt.v_wire_count, 1);
+   m->wire_count = 1;
+   }
+   if (drop != NULL)
vdrop(drop);
+   if (vm_paging_needed())
+   pagedaemon_wakeup();
return (m);
 }
 
___
svn-src-h

svn commit: r227011 - head/usr.sbin/tzsetup

2011-11-01 Thread Doug Barton
Author: dougb
Date: Wed Nov  2 04:21:20 2011
New Revision: 227011
URL: http://svn.freebsd.org/changeset/base/227011

Log:
  If the user is moving from any other time zone to UTC we need
  to delete any old /var/db/zoneinfo file that may exist so that
  tzsetup -r does the right thing.

Modified:
  head/usr.sbin/tzsetup/tzsetup.c

Modified: head/usr.sbin/tzsetup/tzsetup.c
==
--- head/usr.sbin/tzsetup/tzsetup.c Wed Nov  2 00:21:03 2011
(r227010)
+++ head/usr.sbin/tzsetup/tzsetup.c Wed Nov  2 04:21:20 2011
(r227011)
@@ -565,6 +565,18 @@ install_zoneinfo_file(const char *zonein
 
return (DITEM_FAILURE | DITEM_RECREATE);
}
+   if (unlink(path_db) < 0 && errno != ENOENT) {
+   snprintf(title, sizeof(title), "Error");
+   snprintf(prompt, sizeof(prompt),
+"Could not delete %s: %s", path_db,
+strerror(errno));
+   if (usedialog)
+   dialog_mesgbox(title, prompt, 8, 72);
+   else
+   fprintf(stderr, "%s\n", prompt);
+
+   return (DITEM_FAILURE | DITEM_RECREATE);
+   }
return (DITEM_LEAVE_MENU);
}

___
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: r227009 - head/sys/geom

2011-11-01 Thread Alexander Motin
Author: mav
Date: Tue Nov  1 23:12:22 2011
New Revision: 227009
URL: http://svn.freebsd.org/changeset/base/227009

Log:
  Make orphan() method in geom_dev asynchronous using destroy_dev_sched_cb()
  instead of destroy_dev(). It moves device destruction waiting out of the
  topology lock and so fixes dead lock between orphanization and closing.
  Real provider and geom destruction called from swi context after device
  destroyed as callback of the destroy_dev_sched_cb().

Modified:
  head/sys/geom/geom_dev.c

Modified: head/sys/geom/geom_dev.c
==
--- head/sys/geom/geom_dev.cTue Nov  1 22:22:46 2011(r227008)
+++ head/sys/geom/geom_dev.cTue Nov  1 23:12:22 2011(r227009)
@@ -506,6 +506,32 @@ g_dev_strategy(struct bio *bp)
  */
 
 static void
+g_dev_cleanup(void *arg)
+{
+   struct g_geom *gp;
+   struct g_consumer *cp;
+
+   mtx_unlock(&Giant);
+   cp = arg;
+   gp = cp->geom;
+   g_trace(G_T_TOPOLOGY, "g_dev_cleanup(%p(%s))", cp, cp->provider->name);
+
+   /* Wait for the cows to come home */
+   while (cp->nstart != cp->nend)
+   pause("gdevcleanup", hz / 10);
+
+   g_topology_lock();
+   if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0)
+   g_access(cp, -cp->acr, -cp->acw, -cp->ace);
+
+   g_detach(cp);
+   g_destroy_consumer(cp);
+   g_destroy_geom(gp);
+   g_topology_unlock();
+   mtx_lock(&Giant);
+}
+
+static void
 g_dev_orphan(struct g_consumer *cp)
 {
struct g_geom *gp;
@@ -521,18 +547,7 @@ g_dev_orphan(struct g_consumer *cp)
set_dumper(NULL);
 
/* Destroy the struct cdev *so we get no more requests */
-   destroy_dev(dev);
-
-   /* Wait for the cows to come home */
-   while (cp->nstart != cp->nend)
-   pause("gdevorphan", hz / 10);
-
-   if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0)
-   g_access(cp, -cp->acr, -cp->acw, -cp->ace);
-
-   g_detach(cp);
-   g_destroy_consumer(cp);
-   g_destroy_geom(gp);
+   destroy_dev_sched_cb(dev, g_dev_cleanup, cp);
 }
 
 DECLARE_GEOM_CLASS(g_dev_class, g_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: r227006 - in head: . sys/amd64/conf sys/conf sys/dev/esp sys/i386/conf sys/modules sys/modules/esp sys/pc98/conf sys/sparc64/conf

2011-11-01 Thread Marius Strobl
Author: marius
Date: Tue Nov  1 21:26:57 2011
New Revision: 227006
URL: http://svn.freebsd.org/changeset/base/227006

Log:
  Add a PCI front-end to esp(4) allowing it to support AMD Am53C974 and
  replace amd(4) with the former in the amd64, i386 and pc98 GENERIC kernel
  configuration files. Besides duplicating functionality, amd(4), which
  previously also supported the AMD Am53C974, unlike esp(4) is no longer
  maintained and has accumulated enough bit rot over time to always cause
  a panic during boot as long as at least one target is attached to it
  (see PR 124667).
  
  PR:   124667
  Obtained from:NetBSD (based on)
  MFC after:3 days

Added:
  head/sys/dev/esp/am53c974reg.h   (contents, props changed)
  head/sys/dev/esp/esp_pci.c   (contents, props changed)
Modified:
  head/UPDATING
  head/sys/amd64/conf/GENERIC
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/i386/conf/GENERIC
  head/sys/modules/Makefile
  head/sys/modules/esp/Makefile
  head/sys/pc98/conf/GENERIC
  head/sys/sparc64/conf/GENERIC

Modified: head/UPDATING
==
--- head/UPDATING   Tue Nov  1 21:21:36 2011(r227005)
+++ head/UPDATING   Tue Nov  1 21:26:57 2011(r227006)
@@ -22,6 +22,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10
machines to maximize performance.  (To disable malloc debugging, run
ln -s aj /etc/malloc.conf.)
 
+2001:
+   The broken amd(4) driver has been replaced with esp(4) in the amd64,
+   i386 and pc98 GENERIC kernel configuration files.
+
 20110930:
sysinstall has been removed
 

Modified: head/sys/amd64/conf/GENERIC
==
--- head/sys/amd64/conf/GENERIC Tue Nov  1 21:21:36 2011(r227005)
+++ head/sys/amd64/conf/GENERIC Tue Nov  1 21:26:57 2011(r227006)
@@ -107,7 +107,7 @@ options AHC_REG_PRETTY_PRINT# Print re
 device ahd # AHA39320/29320 and onboard AIC79xx devices
 optionsAHD_REG_PRETTY_PRINT# Print register bitfields in debug
# output.  Adds ~215k to driver.
-device amd # AMD 53C974 (Tekram DC-390(T))
+device esp # AMD Am53C974 (Tekram DC-390(T))
 device hptiop  # Highpoint RocketRaid 3xxx series
 device isp # Qlogic family
 #deviceispfw   # Firmware for QLogic HBAs- normally a 
module

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Tue Nov  1 21:21:36 2011(r227005)
+++ head/sys/conf/NOTES Tue Nov  1 21:26:57 2011(r227006)
@@ -1459,7 +1459,9 @@ options   TEKEN_UTF8  # UTF-8 output hand
 #  such as the Tekram DC-390(T).
 # bt:  Most Buslogic controllers: including BT-445, BT-54x, BT-64x, BT-74x,
 #  BT-75x, BT-946, BT-948, BT-956, BT-958, SDC3211B, SDC3211F, SDC3222F
-# esp: NCR53c9x.  Only for SBUS hardware right now.
+# esp: Emulex ESP, NCR 53C9x and QLogic FAS families based controllers
+#  including the AMD Am53C974 (found on devices such as the Tekram
+#  DC-390(T)) and the Sun ESP and FAS families of controllers
 # isp: Qlogic ISP 1020, 1040 and 1040B PCI SCSI host adapters,
 #  ISP 1240 Dual Ultra SCSI, ISP 1080 and 1280 (Dual) Ultra2,
 #  ISP 12160 Ultra3 SCSI,

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Nov  1 21:21:36 2011(r227005)
+++ head/sys/conf/files Tue Nov  1 21:26:57 2011(r227006)
@@ -1064,6 +1064,7 @@ dev/ep/if_ep_eisa.c   optional ep eisa
 dev/ep/if_ep_isa.c optional ep isa
 dev/ep/if_ep_mca.c optional ep mca
 dev/ep/if_ep_pccard.c  optional ep pccard
+dev/esp/esp_pci.c  optional esp pci
 dev/esp/ncr53c9x.c optional esp
 dev/ex/if_ex.c optional ex
 dev/ex/if_ex_isa.c optional ex isa

Added: head/sys/dev/esp/am53c974reg.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/esp/am53c974reg.h  Tue Nov  1 21:26:57 2011
(r227006)
@@ -0,0 +1,72 @@
+/* $NetBSD: pcscpreg.h,v 1.2 2008/04/28 20:23:55 martin Exp $  */
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Izumi Tsutsui.
+ *
+ * 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

svn commit: r227004 - head/sys/geom/concat

2011-11-01 Thread Alexander Motin
Author: mav
Date: Tue Nov  1 20:56:19 2011
New Revision: 227004
URL: http://svn.freebsd.org/changeset/base/227004

Log:
  Refactor disk disconnection and geom destruction handling sequences.
  Do not close/destroy opened consumer directly in case of disconnect. Instead
  keep it existing until it will be closed in regular way in response to
  upstream provider destruction. Delay geom destruction in the same way.
  Previous implementation could destroy consumers still having active
  requests and worked only because of global workaround made on GEOM level.

Modified:
  head/sys/geom/concat/g_concat.c
  head/sys/geom/concat/g_concat.h

Modified: head/sys/geom/concat/g_concat.c
==
--- head/sys/geom/concat/g_concat.c Tue Nov  1 19:29:03 2011
(r227003)
+++ head/sys/geom/concat/g_concat.c Tue Nov  1 20:56:19 2011
(r227004)
@@ -117,25 +117,33 @@ g_concat_remove_disk(struct g_concat_dis
struct g_consumer *cp;
struct g_concat_softc *sc;
 
+   g_topology_assert();
KASSERT(disk->d_consumer != NULL, ("Non-valid disk in %s.", __func__));
sc = disk->d_softc;
cp = disk->d_consumer;
 
-   G_CONCAT_DEBUG(0, "Disk %s removed from %s.", cp->provider->name,
-   sc->sc_name);
+   if (!disk->d_removed) {
+   G_CONCAT_DEBUG(0, "Disk %s removed from %s.",
+   cp->provider->name, sc->sc_name);
+   disk->d_removed = 1;
+   }
 
-   disk->d_consumer = NULL;
if (sc->sc_provider != NULL) {
sc->sc_provider->flags |= G_PF_WITHER;
+   G_CONCAT_DEBUG(0, "Device %s deactivated.",
+   sc->sc_provider->name);
g_orphan_provider(sc->sc_provider, ENXIO);
sc->sc_provider = NULL;
-   G_CONCAT_DEBUG(0, "Device %s removed.", sc->sc_name);
}
 
if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0)
-   g_access(cp, -cp->acr, -cp->acw, -cp->ace);
+   return;
+   disk->d_consumer = NULL;
g_detach(cp);
g_destroy_consumer(cp);
+   /* If there are no valid disks anymore, remove device. */
+   if (LIST_EMPTY(&sc->sc_geom->consumer))
+   g_concat_destroy(sc, 1);
 }
 
 static void
@@ -155,37 +163,18 @@ g_concat_orphan(struct g_consumer *cp)
if (disk == NULL)   /* Possible? */
return;
g_concat_remove_disk(disk);
-
-   /* If there are no valid disks anymore, remove device. */
-   if (g_concat_nvalid(sc) == 0)
-   g_concat_destroy(sc, 1);
 }
 
 static int
 g_concat_access(struct g_provider *pp, int dr, int dw, int de)
 {
-   struct g_consumer *cp1, *cp2;
-   struct g_concat_softc *sc;
+   struct g_consumer *cp1, *cp2, *tmp;
+   struct g_concat_disk *disk;
struct g_geom *gp;
int error;
 
+   g_topology_assert();
gp = pp->geom;
-   sc = gp->softc;
-
-   if (sc == NULL) {
-   /*
-* It looks like geom is being withered.
-* In that case we allow only negative requests.
-*/
-   KASSERT(dr <= 0 && dw <= 0 && de <= 0,
-   ("Positive access request (device=%s).", pp->name));
-   if ((pp->acr + dr) == 0 && (pp->acw + dw) == 0 &&
-   (pp->ace + de) == 0) {
-   G_CONCAT_DEBUG(0, "Device %s definitely destroyed.",
-   gp->name);
-   }
-   return (0);
-   }
 
/* On first open, grab an extra "exclusive" bit */
if (pp->acr == 0 && pp->acw == 0 && pp->ace == 0)
@@ -194,22 +183,24 @@ g_concat_access(struct g_provider *pp, i
if ((pp->acr + dr) == 0 && (pp->acw + dw) == 0 && (pp->ace + de) == 0)
de--;
 
-   error = ENXIO;
-   LIST_FOREACH(cp1, &gp->consumer, consumer) {
+   LIST_FOREACH_SAFE(cp1, &gp->consumer, consumer, tmp) {
error = g_access(cp1, dr, dw, de);
-   if (error == 0)
-   continue;
-   /*
-* If we fail here, backout all previous changes.
-*/
-   LIST_FOREACH(cp2, &gp->consumer, consumer) {
-   if (cp1 == cp2)
-   return (error);
-   g_access(cp2, -dr, -dw, -de);
+   if (error != 0)
+   goto fail;
+   disk = cp1->private;
+   if (cp1->acr == 0 && cp1->acw == 0 && cp1->ace == 0 &&
+   disk->d_removed) {
+   g_concat_remove_disk(disk); /* May destroy geom. */
}
-   /* NOTREACHED */
}
+   return (0);
 
+fail:
+   LIST_FOREACH(cp2, &gp->consumer, consumer) {
+   if (cp1 == cp2)
+   break;
+   g_access(cp2, -dr, -dw, -

svn commit: r227001 - head/sys/dev/mpt

2011-11-01 Thread Marius Strobl
Author: marius
Date: Tue Nov  1 18:28:33 2011
New Revision: 227001
URL: http://svn.freebsd.org/changeset/base/227001

Log:
  Increase the IOC port initialization timeouts by ten times to what the
  corresponding Linux driver uses. This allows mpt(4) to still recognize
  all good SATA devices in presence of a defective one, which takes about
  45 seconds.
  In the long term we probably should implement the logic used by mpt2sas(4)
  allowing IOC port initialization to complete at a later time.
  
  Submitted by: Andrew Boyer
  MFC after:3 days

Modified:
  head/sys/dev/mpt/mpt.c

Modified: head/sys/dev/mpt/mpt.c
==
--- head/sys/dev/mpt/mpt.c  Tue Nov  1 17:57:21 2011(r227000)
+++ head/sys/dev/mpt/mpt.c  Tue Nov  1 18:28:33 2011(r227001)
@@ -2084,7 +2084,7 @@ mpt_send_port_enable(struct mpt_softc *m
 
mpt_send_cmd(mpt, req);
error = mpt_wait_req(mpt, req, REQ_STATE_DONE, REQ_STATE_DONE,
-   FALSE, (mpt->is_sas || mpt->is_fc)? 3 : 3000);
+   FALSE, (mpt->is_sas || mpt->is_fc)? 30 : 3);
if (error != 0) {
mpt_prt(mpt, "port %d enable timed out\n", port);
return (-1);
___
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: r227000 - in head/sys/dev/ata: . chipsets

2011-11-01 Thread Marius Strobl
Author: marius
Date: Tue Nov  1 17:57:21 2011
New Revision: 227000
URL: http://svn.freebsd.org/changeset/base/227000

Log:
  In r225931 I've missed the only other driver using the pointer returned
  by rman_get_virtual(9) to access device registers sparc64 currently cares
  about.
  Ideally ata(4) should just be converted to access these using bus_space(9)
  read/write functions instead as there's really no reason to do it the
  former way. However, this part of ata-siliconimage.c should go away in
  favor of siis(4) sooner or later anyway and I don't have the hardware to
  actually test the SX4 bits of ata-promise.c.
  Also ideally the other architectures should also properly handle the
  BUS_SPACE_MAP_LINEAR flag of bus_space_map(9) so this code wouldn't need
  to be #ifdef'ed.

Modified:
  head/sys/dev/ata/ata-pci.c
  head/sys/dev/ata/chipsets/ata-promise.c
  head/sys/dev/ata/chipsets/ata-siliconimage.c

Modified: head/sys/dev/ata/ata-pci.c
==
--- head/sys/dev/ata/ata-pci.c  Tue Nov  1 17:18:57 2011(r226999)
+++ head/sys/dev/ata/ata-pci.c  Tue Nov  1 17:57:21 2011(r227000)
@@ -153,10 +153,20 @@ ata_pci_detach(device_t dev)
 }
 if (ctlr->chipdeinit != NULL)
ctlr->chipdeinit(dev);
-if (ctlr->r_res2)
+if (ctlr->r_res2) {
+#ifdef __sparc64__
+   bus_space_unmap(rman_get_bustag(ctlr->r_res2),
+   rman_get_bushandle(ctlr->r_res2), rman_get_size(ctlr->r_res2));
+#endif
bus_release_resource(dev, ctlr->r_type2, ctlr->r_rid2, ctlr->r_res2);
-if (ctlr->r_res1)
+}
+if (ctlr->r_res1) {
+#ifdef __sparc64__
+   bus_space_unmap(rman_get_bustag(ctlr->r_res1),
+   rman_get_bushandle(ctlr->r_res1), rman_get_size(ctlr->r_res1));
+#endif
bus_release_resource(dev, ctlr->r_type1, ctlr->r_rid1, ctlr->r_res1);
+}
 
 return 0;
 }
@@ -775,7 +785,6 @@ driver_t ata_pcichannel_driver = {
 
 DRIVER_MODULE(ata, atapci, ata_pcichannel_driver, ata_devclass, 0, 0);
 
-
 /*
  * misc support fucntions
  */
@@ -936,4 +945,3 @@ ata_mode2idx(int mode)
return (mode & ATA_MODE_MASK) + 5;
 return (mode & ATA_MODE_MASK) - ATA_PIO0;
 }
-

Modified: head/sys/dev/ata/chipsets/ata-promise.c
==
--- head/sys/dev/ata/chipsets/ata-promise.c Tue Nov  1 17:18:57 2011
(r226999)
+++ head/sys/dev/ata/chipsets/ata-promise.c Tue Nov  1 17:57:21 2011
(r227000)
@@ -94,7 +94,6 @@ static void ata_promise_next_hpkt(struct
 #define PR_SATA0x40
 #define PR_SATA2   0x80
 
-
 /*
  * Promise chipset support functions
  */
@@ -250,6 +249,14 @@ ata_promise_chipinit(device_t dev)
&ctlr->r_rid1, RF_ACTIVE)))
goto failnfree;
 
+#ifdef __sparc64__
+   if (ctlr->chip->cfg2 == PR_SX4X &&
+   !bus_space_map(rman_get_bustag(ctlr->r_res1),
+   rman_get_bushandle(ctlr->r_res1), rman_get_size(ctlr->r_res1),
+   BUS_SPACE_MAP_LINEAR, NULL))
+   goto failnfree;
+#endif
+
ctlr->r_type2 = SYS_RES_MEMORY;
ctlr->r_rid2 = PCIR_BAR(3);
if (!(ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2,

Modified: head/sys/dev/ata/chipsets/ata-siliconimage.c
==
--- head/sys/dev/ata/chipsets/ata-siliconimage.cTue Nov  1 17:18:57 
2011(r226999)
+++ head/sys/dev/ata/chipsets/ata-siliconimage.cTue Nov  1 17:57:21 
2011(r227000)
@@ -80,7 +80,6 @@ static void ata_siiprb_dmainit(device_t 
 #define SII_BUG0x04
 #define SII_4CH0x08
 
-
 /*
  * Silicon Image Inc. (SiI) (former CMD) chipset support functions
  */
@@ -141,6 +140,17 @@ ata_sii_chipinit(device_t dev)
bus_release_resource(dev, ctlr->r_type1, ctlr->r_rid1,ctlr->r_res1);
return ENXIO;
}
+#ifdef __sparc64__
+   if (!bus_space_map(rman_get_bustag(ctlr->r_res2),
+   rman_get_bushandle(ctlr->r_res2), rman_get_size(ctlr->r_res2),
+   BUS_SPACE_MAP_LINEAR, NULL)) {
+   bus_release_resource(dev, ctlr->r_type1, ctlr->r_rid1,
+   ctlr->r_res1);
+   bus_release_resource(dev, ctlr->r_type2, ctlr->r_rid2,
+   ctlr->r_res2);
+   return (ENXIO);
+   }
+#endif
ctlr->ch_attach = ata_siiprb_ch_attach;
ctlr->ch_detach = ata_siiprb_ch_detach;
ctlr->reset = ata_siiprb_reset;
@@ -432,7 +442,6 @@ ata_sii_setmode(device_t dev, int target
return (mode);
 }
 
-
 struct ata_siiprb_dma_prdentry {
 u_int64_t addr;
 u_int32_t count;
___
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: r226998 - head/sys/geom/stripe

2011-11-01 Thread Alexander Motin
Author: mav
Date: Tue Nov  1 17:04:42 2011
New Revision: 226998
URL: http://svn.freebsd.org/changeset/base/226998

Log:
  Refactor disk disconnection and geom destruction handling sequences.
  Do not close/destroy opened consumer directly in case of disconnect. Instead
  keep it existing until it will be closed in regular way in response to
  upstream provider destruction. Delay geom destruction in the same way.
  Previous implementation could destroy consumers still having active
  requests and worked only because of global workaround made on GEOM level.

Modified:
  head/sys/geom/stripe/g_stripe.c

Modified: head/sys/geom/stripe/g_stripe.c
==
--- head/sys/geom/stripe/g_stripe.c Tue Nov  1 16:56:42 2011
(r226997)
+++ head/sys/geom/stripe/g_stripe.c Tue Nov  1 17:04:42 2011
(r226998)
@@ -160,28 +160,35 @@ static void
 g_stripe_remove_disk(struct g_consumer *cp)
 {
struct g_stripe_softc *sc;
-   u_int no;
 
+   g_topology_assert();
KASSERT(cp != NULL, ("Non-valid disk in %s.", __func__));
-   sc = (struct g_stripe_softc *)cp->private;
+   sc = (struct g_stripe_softc *)cp->geom->softc;
KASSERT(sc != NULL, ("NULL sc in %s.", __func__));
-   no = cp->index;
 
-   G_STRIPE_DEBUG(0, "Disk %s removed from %s.", cp->provider->name,
-   sc->sc_name);
+   if (cp->private == NULL) {
+   G_STRIPE_DEBUG(0, "Disk %s removed from %s.",
+   cp->provider->name, sc->sc_name);
+   cp->private = (void *)(uintptr_t)-1;
+   }
 
-   sc->sc_disks[no] = NULL;
if (sc->sc_provider != NULL) {
sc->sc_provider->flags |= G_PF_WITHER;
+   G_STRIPE_DEBUG(0, "Device %s deactivated.",
+   sc->sc_provider->name);
g_orphan_provider(sc->sc_provider, ENXIO);
sc->sc_provider = NULL;
-   G_STRIPE_DEBUG(0, "Device %s removed.", sc->sc_name);
}
 
if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0)
-   g_access(cp, -cp->acr, -cp->acw, -cp->ace);
+   return;
+   sc->sc_disks[cp->index] = NULL;
+   cp->index = 0;
g_detach(cp);
g_destroy_consumer(cp);
+   /* If there are no valid disks anymore, remove device. */
+   if (LIST_EMPTY(&sc->sc_geom->consumer))
+   g_stripe_destroy(sc, 1);
 }
 
 static void
@@ -197,36 +204,20 @@ g_stripe_orphan(struct g_consumer *cp)
return;
 
g_stripe_remove_disk(cp);
-   /* If there are no valid disks anymore, remove device. */
-   if (g_stripe_nvalid(sc) == 0)
-   g_stripe_destroy(sc, 1);
 }
 
 static int
 g_stripe_access(struct g_provider *pp, int dr, int dw, int de)
 {
-   struct g_consumer *cp1, *cp2;
+   struct g_consumer *cp1, *cp2, *tmp;
struct g_stripe_softc *sc;
struct g_geom *gp;
int error;
 
+   g_topology_assert();
gp = pp->geom;
sc = gp->softc;
-
-   if (sc == NULL) {
-   /*
-* It looks like geom is being withered.
-* In that case we allow only negative requests.
-*/
-   KASSERT(dr <= 0 && dw <= 0 && de <= 0,
-   ("Positive access request (device=%s).", pp->name));
-   if ((pp->acr + dr) == 0 && (pp->acw + dw) == 0 &&
-   (pp->ace + de) == 0) {
-   G_STRIPE_DEBUG(0, "Device %s definitely destroyed.",
-   gp->name);
-   }
-   return (0);
-   }
+   KASSERT(sc != NULL, ("NULL sc in %s.", __func__));
 
/* On first open, grab an extra "exclusive" bit */
if (pp->acr == 0 && pp->acw == 0 && pp->ace == 0)
@@ -235,22 +226,23 @@ g_stripe_access(struct g_provider *pp, i
if ((pp->acr + dr) == 0 && (pp->acw + dw) == 0 && (pp->ace + de) == 0)
de--;
 
-   error = ENXIO;
-   LIST_FOREACH(cp1, &gp->consumer, consumer) {
+   LIST_FOREACH_SAFE(cp1, &gp->consumer, consumer, tmp) {
error = g_access(cp1, dr, dw, de);
-   if (error == 0)
-   continue;
-   /*
-* If we fail here, backout all previous changes.
-*/
-   LIST_FOREACH(cp2, &gp->consumer, consumer) {
-   if (cp1 == cp2)
-   return (error);
-   g_access(cp2, -dr, -dw, -de);
+   if (error != 0)
+   goto fail;
+   if (cp1->acr == 0 && cp1->acw == 0 && cp1->ace == 0 &&
+   cp1->private != NULL) {
+   g_stripe_remove_disk(cp1); /* May destroy geom. */
}
-   /* NOTREACHED */
}
+   return (0);
 
+fail:
+   LIST_FOREACH(cp2, &gp->consumer, consumer) {
+   if (cp1 == 

svn commit: r226995 - in head/sys: arm/conf conf dev/bm dev/dc dev/mii dev/nge dev/sis dev/smc dev/ste dev/stge dev/tl dev/wb dev/xl modules/mii pci

2011-11-01 Thread Marius Strobl
Author: marius
Date: Tue Nov  1 16:13:59 2011
New Revision: 226995
URL: http://svn.freebsd.org/changeset/base/226995

Log:
  - Import the common MII bitbang'ing code from NetBSD and convert drivers to
take advantage of it instead of duplicating it. This reduces the size of
the i386 GENERIC kernel by about 4k. The only potential in-tree user left
unconverted is xe(4), which generally should be changed to use miibus(4)
instead of implementing PHY handling on its own, as otherwise it makes not
much sense to add a dependency on miibus(4)/mii_bitbang(4) to xe(4) just
for the MII bitbang'ing code. The common MII bitbang'ing code also is
useful in the embedded space for using GPIO pins to implement MII access.
  - Based on lessons learnt with dc(4) (see r185750), add bus barriers to the
MII bitbang read and write functions of the other drivers converted in
order to ensure the intended ordering. Given that register access via an
index register as well as register bank/window switching is subject to the
same problem, also add bus barriers to the respective functions of smc(4),
tl(4) and xl(4).
  - Sprinkle some const.
  
  Thanks to the following testers:
  Andrew Bliznak (nge(4)), nwhitehorn@ (bm(4)), yongari@ (sis(4) and ste(4))
  Thanks to Hans-Joerg Sirtl for supplying hardware to test stge(4).
  
  Reviewed by:  yongari (subset of drivers)
  Obtained from:NetBSD (partially)

Added:
  head/sys/dev/mii/mii_bitbang.c   (contents, props changed)
  head/sys/dev/mii/mii_bitbang.h   (contents, props changed)
Modified:
  head/sys/arm/conf/GUMSTIX
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/dev/bm/if_bm.c
  head/sys/dev/bm/if_bmreg.h
  head/sys/dev/bm/if_bmvar.h
  head/sys/dev/dc/if_dc.c
  head/sys/dev/dc/if_dcreg.h
  head/sys/dev/nge/if_nge.c
  head/sys/dev/nge/if_ngereg.h
  head/sys/dev/sis/if_sis.c
  head/sys/dev/sis/if_sisreg.h
  head/sys/dev/smc/if_smc.c
  head/sys/dev/ste/if_ste.c
  head/sys/dev/ste/if_stereg.h
  head/sys/dev/stge/if_stge.c
  head/sys/dev/stge/if_stgereg.h
  head/sys/dev/tl/if_tl.c
  head/sys/dev/tl/if_tlreg.h
  head/sys/dev/wb/if_wb.c
  head/sys/dev/wb/if_wbreg.h
  head/sys/dev/xl/if_xl.c
  head/sys/dev/xl/if_xlreg.h
  head/sys/modules/mii/Makefile
  head/sys/pci/if_rl.c
  head/sys/pci/if_rlreg.h

Modified: head/sys/arm/conf/GUMSTIX
==
--- head/sys/arm/conf/GUMSTIX   Tue Nov  1 16:11:44 2011(r226994)
+++ head/sys/arm/conf/GUMSTIX   Tue Nov  1 16:13:59 2011(r226995)
@@ -70,6 +70,7 @@ options   PREEMPTION
 device loop
 device ether
 device mii
+device mii_bitbang
 device smc
 device smcphy
 device uart

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Tue Nov  1 16:11:44 2011(r226994)
+++ head/sys/conf/NOTES Tue Nov  1 16:13:59 2011(r226995)
@@ -1846,13 +1846,15 @@ device  puc
 # MII bus support is required for many PCI Ethernet NICs,
 # namely those which use MII-compliant transceivers or implement
 # transceiver control interfaces that operate like an MII.  Adding
-# "device miibus" to the kernel config pulls in support for
-# the generic miibus API and all of the PHY drivers, including a
-# generic one for PHYs that aren't specifically handled by an
-# individual driver.  Support for specific PHYs may be built by adding
-# "device mii" then adding the appropriate PHY driver.
-device miibus  # MII support including all PHYs
+# "device miibus" to the kernel config pulls in support for the generic
+# miibus API, the common support for for bit-bang'ing the MII and all
+# of the PHY drivers, including a generic one for PHYs that aren't
+# specifically handled by an individual driver.  Support for specific
+# PHYs may be built by adding "device mii", "device mii_bitbang" if
+# needed by the NIC driver and then adding the appropriate PHY driver.
 device mii # Minimal MII support
+device mii_bitbang # Common module for bit-bang'ing the MII
+device miibus  # MII support w/ bit-bang'ing and all PHYs
 
 device acphy   # Altima Communications AC101
 device amphy   # AMD AM79c873 / Davicom DM910{1,2}

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Nov  1 16:11:44 2011(r226994)
+++ head/sys/conf/files Tue Nov  1 16:13:59 2011(r226995)
@@ -1425,6 +1425,7 @@ dev/mii/ip1000phy.c   optional miibus | i
 dev/mii/jmphy.coptional miibus | jmphy
 dev/mii/lxtphy.c   optional miibus | lxtphy
 dev/mii/mii.c  optional miibus | mii
+dev/mii/mii_bitbang.c  optional miibus | mii_bitbang
 dev/mii/mii_physubr.c  optional miibus 

svn commit: r226987 - head/sys/fs/tmpfs

2011-11-01 Thread Peter Holm
Author: pho
Date: Tue Nov  1 12:33:06 2011
New Revision: 226987
URL: http://svn.freebsd.org/changeset/base/226987

Log:
  Added missing cache purge of from argument for rename().
  
  Reported by:  Anton Yuzhaninov 
  In collaboration with:kib
  MFC after:1 week

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

Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==
--- head/sys/fs/tmpfs/tmpfs_vnops.c Tue Nov  1 09:28:47 2011
(r226986)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c Tue Nov  1 12:33:06 2011
(r226987)
@@ -1138,6 +1138,7 @@ tmpfs_rename(struct vop_rename_args *v)
 * really reclaimed. */
tmpfs_free_dirent(VFS_TO_TMPFS(tvp->v_mount), de, TRUE);
}
+   cache_purge(fvp);
 
error = 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: r226986 - head/usr.sbin/pmcstat

2011-11-01 Thread Fabien Thomas
Author: fabient
Date: Tue Nov  1 09:28:47 2011
New Revision: 226986
URL: http://svn.freebsd.org/changeset/base/226986

Log:
  Two bugs fixed:
  - Do not close stdout or stderr when redirecting to file.
  - Correctly handle error code to detect when no buffer available.
  
  MFC after:1 month

Modified:
  head/usr.sbin/pmcstat/pmcstat.c

Modified: head/usr.sbin/pmcstat/pmcstat.c
==
--- head/usr.sbin/pmcstat/pmcstat.c Tue Nov  1 08:57:49 2011
(r226985)
+++ head/usr.sbin/pmcstat/pmcstat.c Tue Nov  1 09:28:47 2011
(r226986)
@@ -796,7 +796,9 @@ main(int argc, char **argv)
break;
 
case 'o':   /* outputfile */
-   if (args.pa_printfile != NULL)
+   if (args.pa_printfile != NULL &&
+   args.pa_printfile != stdout &&
+   args.pa_printfile != stderr)
(void) fclose(args.pa_printfile);
if ((args.pa_printfile = fopen(optarg, "w")) == NULL)
errx(EX_OSERR, "ERROR: cannot open \"%s\" for "
@@ -1394,7 +1396,7 @@ main(int argc, char **argv)
 
case EVFILT_TIMER: /* print out counting PMCs */
if ((args.pa_flags & FLAG_DO_TOP) &&
-pmc_flush_logfile() != ENOBUFS)
+pmc_flush_logfile() == 0)
do_read = 1;
do_print = 1;
break;
___
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: r226985 - head/sys/geom

2011-11-01 Thread Alexander Motin
Author: mav
Date: Tue Nov  1 08:57:49 2011
New Revision: 226985
URL: http://svn.freebsd.org/changeset/base/226985

Log:
  Workaround the problem introduced by combination of r162200 and r215687.
  r162200 delays provider orphanization until all running requests complete,
  to workaround broken orphan() method implementation in some classes.
  r215687 removes persistent periodic (10Hz) event thread wake ups.
  Together these changes can indefinitely delay orphanization until some
  other event wake up the event thread. One consequence of this is inability
  of CAM to destroy device disconnected when busy and, as consequence, create
  new one after reconnection.
  
  While the best solution would be to revert r162200, it is not easy, as
  some classes still look broken in that way. Instead conditionally wake up
  event thread if there are some providers waiting for orphanization.
  
  MFC after:1 week

Modified:
  head/sys/geom/geom_event.c

Modified: head/sys/geom/geom_event.c
==
--- head/sys/geom/geom_event.c  Tue Nov  1 08:24:01 2011(r226984)
+++ head/sys/geom/geom_event.c  Tue Nov  1 08:57:49 2011(r226985)
@@ -294,7 +294,7 @@ g_run_events()
} else {
g_topology_unlock();
msleep(&g_wait_event, &g_eventlock, PRIBIO | PDROP,
-   "-", 0);
+   "-", TAILQ_EMPTY(&g_doorstep) ? 0 : hz / 10);
}
}
/* NOTREACHED */
___
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"