svn commit: r249083 - in head: rescue/rescue sbin sbin/atacontrol share/man/man4 sys/amd64/conf sys/arm/conf sys/cam/ata sys/conf sys/dev/ata sys/dev/ata/chipsets sys/i386/conf sys/ia64/conf sys/mi...

2013-04-04 Thread Alexander Motin
Author: mav
Date: Thu Apr  4 07:12:24 2013
New Revision: 249083
URL: http://svnweb.freebsd.org/changeset/base/249083

Log:
  Remove all legacy ATA code parts, not used since options ATA_CAM enabled in
  most kernels before FreeBSD 9.0.  Remove such modules and respective kernel
  options: atadisk, ataraid, atapicd, atapifd, atapist, atapicam.  Remove the
  atacontrol utility and some man pages.  Remove useless now options ATA_CAM.
  
  No objections:current@, stable@
  MFC after:never

Deleted:
  head/sbin/atacontrol/
  head/share/man/man4/atapicam.4
  head/share/man/man4/ataraid.4
  head/sys/dev/ata/ata-disk.c
  head/sys/dev/ata/ata-disk.h
  head/sys/dev/ata/ata-raid-ddf.h
  head/sys/dev/ata/ata-raid.c
  head/sys/dev/ata/ata-raid.h
  head/sys/dev/ata/atapi-cam.c
  head/sys/dev/ata/atapi-cd.c
  head/sys/dev/ata/atapi-cd.h
  head/sys/dev/ata/atapi-fd.c
  head/sys/dev/ata/atapi-fd.h
  head/sys/dev/ata/atapi-tape.c
  head/sys/dev/ata/atapi-tape.h
  head/sys/modules/ata/atacam/
  head/sys/modules/ata/atadisk/
  head/sys/modules/ata/atapicam/
  head/sys/modules/ata/atapicd/
  head/sys/modules/ata/atapifd/
  head/sys/modules/ata/atapist/
  head/sys/modules/ata/ataraid/
Modified:
  head/rescue/rescue/Makefile
  head/sbin/Makefile
  head/share/man/man4/Makefile
  head/share/man/man4/ata.4
  head/sys/amd64/conf/GENERIC
  head/sys/arm/conf/AC100
  head/sys/arm/conf/ARMADAXP
  head/sys/arm/conf/AVILA
  head/sys/arm/conf/CAMBRIA
  head/sys/arm/conf/CRB
  head/sys/arm/conf/CUBIEBOARD
  head/sys/arm/conf/EFIKA_MX
  head/sys/arm/conf/EP80219
  head/sys/arm/conf/IQ31244
  head/sys/arm/conf/TS7800
  head/sys/cam/ata/ata_da.c
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/conf/files.sparc64
  head/sys/conf/options
  head/sys/dev/ata/ata-all.c
  head/sys/dev/ata/ata-all.h
  head/sys/dev/ata/ata-cbus.c
  head/sys/dev/ata/ata-dma.c
  head/sys/dev/ata/ata-lowlevel.c
  head/sys/dev/ata/ata-pci.c
  head/sys/dev/ata/ata-pci.h
  head/sys/dev/ata/ata-queue.c
  head/sys/dev/ata/ata-sata.c
  head/sys/dev/ata/ata_if.m
  head/sys/dev/ata/chipsets/ata-acard.c
  head/sys/dev/ata/chipsets/ata-acerlabs.c
  head/sys/dev/ata/chipsets/ata-intel.c
  head/sys/dev/ata/chipsets/ata-ite.c
  head/sys/dev/ata/chipsets/ata-serverworks.c
  head/sys/dev/ata/chipsets/ata-siliconimage.c
  head/sys/i386/conf/GENERIC
  head/sys/i386/conf/XBOX
  head/sys/ia64/conf/GENERIC
  head/sys/mips/conf/OCTEON1
  head/sys/mips/conf/XLR
  head/sys/mips/conf/XLR64
  head/sys/mips/conf/XLRN32
  head/sys/mips/conf/std.SWARM
  head/sys/mips/conf/std.XLP
  head/sys/mips/malta/std.malta
  head/sys/modules/ata/Makefile
  head/sys/pc98/conf/GENERIC
  head/sys/pc98/conf/NOTES
  head/sys/powerpc/conf/GENERIC
  head/sys/powerpc/conf/GENERIC64
  head/sys/powerpc/conf/MPC85XX
  head/sys/sparc64/conf/GENERIC

Modified: head/rescue/rescue/Makefile
==
--- head/rescue/rescue/Makefile Thu Apr  4 05:47:50 2013(r249082)
+++ head/rescue/rescue/Makefile Thu Apr  4 07:12:24 2013(r249083)
@@ -87,7 +87,7 @@ CRUNCH_SUPPRESS_LINK_-tcsh= 1
 # headers in addition to the standard 'paths.h' header.
 #
 CRUNCH_SRCDIRS+= sbin
-CRUNCH_PROGS_sbin= atacontrol badsect  \
+CRUNCH_PROGS_sbin= badsect \
camcontrol ccdconfig clri devfs dmesg dump  \
dumpfs dumpon fsck fsck_ffs fsck_msdosfs fsdb   \
fsirand gbde geom ifconfig init \

Modified: head/sbin/Makefile
==
--- head/sbin/Makefile  Thu Apr  4 05:47:50 2013(r249082)
+++ head/sbin/Makefile  Thu Apr  4 07:12:24 2013(r249083)
@@ -6,7 +6,6 @@
 # XXX MISSING: icheck ncheck
 
 SUBDIR=adjkerntz \
-   atacontrol \
badsect \
camcontrol \
ccdconfig \

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileThu Apr  4 05:47:50 2013
(r249082)
+++ head/share/man/man4/MakefileThu Apr  4 07:12:24 2013
(r249083)
@@ -51,8 +51,6 @@ MAN=  aac.4 \
${_asmc.4} \
asr.4 \
ata.4 \
-   atapicam.4 \
-   ataraid.4 \
ath.4 \
ath_ahb.4 \
ath_hal.4 \

Modified: head/share/man/man4/ata.4
==
--- head/share/man/man4/ata.4   Thu Apr  4 05:47:50 2013(r249082)
+++ head/share/man/man4/ata.4   Thu Apr  4 07:12:24 2013(r249083)
@@ -36,7 +36,6 @@ kernel configuration file:
 .Bd -ragged -offset indent
 .Cd device scbus
 .Cd device ata
-.Cd options ATA_CAM
 .Ed
 .Pp
 Alternatively, to load the driver as set of modules at boot time,
@@ -79,12 +78,6 @@ prerequisite for the other modules.
 The next three lines are generic bus-specific drivers.
 Of the rest, ataahci is 

Re: svn commit: r249035 - head/lib/libc/stdlib

2013-04-04 Thread Andrey Chernov
On 04.04.2013 9:24, Xin Li wrote:
 True, but keep mind that neither random(3) nor rand(3) is intended to
 satisfy cryptographically secure needs, and I don't see a reason why
 kernel arc4 can not be improved.

Danger level here is not to get something cryptographically less secure,
but even much probability to get the same sequence after boot.

 To be honest, I don't personally have access to the archive (nor I'm
 aware there was one, the arc4 change you are talking about may predate
 my membership on secteam@ by the way).
 
 How about sending the patch again and let's see how we can work it out?

Ok, patches are attached, one with atomic, and another one - without.
They try to reseed arc4 immediately after we have enough of entropy.
Only one of them is needed, not both. Atomic version works 100% right
and non-atomic may cause chained arc4 reseed in edge case, which not
harms arc4 itself, just takes time.

--- sys/libkern.h.old   2012-01-16 07:15:12.0 +0400
+++ sys/libkern.h   2012-01-28 08:49:19.0 +0400
@@ -70,6 +70,11 @@ static __inline int abs(int a) { return 
 static __inline long labs(long a) { return (a  0 ? -a : a); }
 static __inline quad_t qabs(quad_t a) { return (a  0 ? -a : a); }
 
+#defineARC4_ENTR_NONE  0   /* Don't have entropy yet. */
+#defineARC4_ENTR_HAVE  1   /* Have entropy. */
+#defineARC4_ENTR_SEED  2   /* Reseeding. */
+extern int arc4rand_iniseed_state;
+
 /* Prototypes for non-quad routines. */
 struct malloc_type;
 uint32_t arc4random(void);
--- dev/random/randomdev_soft.c.old 2011-03-02 01:42:19.0 +0300
+++ dev/random/randomdev_soft.c 2012-01-28 08:48:22.0 +0400
@@ -366,6 +366,8 @@ random_yarrow_unblock(void)
selwakeuppri(random_systat.rsel, PUSER);
wakeup(random_systat);
}
+   (void)atomic_cmpset_int(arc4rand_iniseed_state, ARC4_ENTR_NONE,
+   ARC4_ENTR_HAVE);
 }
 
 static int
--- libkern/arc4random.c.old2008-08-08 01:51:09.0 +0400
+++ libkern/arc4random.c2012-01-28 08:51:12.0 +0400
@@ -24,6 +24,8 @@ __FBSDID($FreeBSD: src/sys/libkern/arc4
 #defineARC4_RESEED_SECONDS 300
 #defineARC4_KEYBYTES (256 / 8)
 
+int arc4rand_iniseed_state = ARC4_ENTR_NONE;
+
 static u_int8_t arc4_i, arc4_j;
 static int arc4_numruns = 0;
 static u_int8_t arc4_sbox[256];
@@ -130,7 +132,8 @@ arc4rand(void *ptr, u_int len, int resee
struct timeval tv;
 
getmicrouptime(tv);
-   if (reseed || 
+   if (atomic_cmpset_int(arc4rand_iniseed_state, ARC4_ENTR_HAVE,
+   ARC4_ENTR_SEED) || reseed ||
   (arc4_numruns  ARC4_RESEED_BYTES) ||
   (tv.tv_sec  arc4_t_reseed))
arc4_randomstir();

--- sys/libkern.h.bak   2012-01-16 07:15:12.0 +0400
+++ sys/libkern.h   2012-01-25 17:31:49.0 +0400
@@ -72,6 +72,7 @@ static __inline quad_t qabs(quad_t a) { 
 
 /* Prototypes for non-quad routines. */
 struct malloc_type;
+extern int arc4rand_iniseed_state;
 uint32_t arc4random(void);
 voidarc4rand(void *ptr, u_int len, int reseed);
 int bcmp(const void *, const void *, size_t);
--- dev/random/randomdev_soft.c.bak 2011-03-02 01:42:19.0 +0300
+++ dev/random/randomdev_soft.c 2012-01-25 17:28:19.0 +0400
@@ -366,6 +366,8 @@ random_yarrow_unblock(void)
selwakeuppri(random_systat.rsel, PUSER);
wakeup(random_systat);
}
+   if (arc4rand_iniseed_state == 0)
+   arc4rand_iniseed_state = 1;
 }
 
 static int
--- libkern/arc4random.c.bak2008-08-08 01:51:09.0 +0400
+++ libkern/arc4random.c2012-01-25 17:30:30.0 +0400
@@ -24,6 +24,8 @@ __FBSDID($FreeBSD: src/sys/libkern/arc4
 #defineARC4_RESEED_SECONDS 300
 #defineARC4_KEYBYTES (256 / 8)
 
+int arc4rand_iniseed_state = 0;
+
 static u_int8_t arc4_i, arc4_j;
 static int arc4_numruns = 0;
 static u_int8_t arc4_sbox[256];
@@ -74,6 +76,8 @@ arc4_randomstir (void)
/* Reset for next reseed cycle. */
arc4_t_reseed = tv_now.tv_sec + ARC4_RESEED_SECONDS;
arc4_numruns = 0;
+   if (arc4rand_iniseed_state == 1)
+   arc4rand_iniseed_state = -1;
 
/*
 * Throw away the first N words of output, as suggested in the
@@ -130,7 +134,7 @@ arc4rand(void *ptr, u_int len, int resee
struct timeval tv;
 
getmicrouptime(tv);
-   if (reseed || 
+   if (reseed || arc4rand_iniseed_state == 1 ||
   (arc4_numruns  ARC4_RESEED_BYTES) ||
   (tv.tv_sec  arc4_t_reseed))
arc4_randomstir();



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r249083 - in head: rescue/rescue sbin sbin/atacontrol share/man/man4 sys/amd64/conf sys/arm/conf sys/cam/ata sys/conf sys/dev/ata sys/dev/ata/chipsets sys/i386/conf sys/ia64/conf sys/m

2013-04-04 Thread Niclas Zeising
On 2013-04-04 09:12, Alexander Motin wrote:
 
 Deleted:
   head/sbin/atacontrol/
   head/share/man/man4/atapicam.4
   head/share/man/man4/ataraid.4

Those three should probably be added to ObsoleteFiles.inc as well.
Regards!
-- 
Niclas
___
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: r249084 - head

2013-04-04 Thread Alexander Motin
Author: mav
Date: Thu Apr  4 07:57:32 2013
New Revision: 249084
URL: http://svnweb.freebsd.org/changeset/base/249084

Log:
  Remove obsolete files of the legacy ATA stack.

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Thu Apr  4 07:12:24 2013(r249083)
+++ head/ObsoleteFiles.inc  Thu Apr  4 07:57:32 2013(r249084)
@@ -38,6 +38,11 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20130404: legacy ATA stack removed
+OLD_FILES+=sbin/atacontrol
+OLD_FILES+=usr/share/man/man8/atacontrol.8.gz
+OLD_FILES+=usr/share/man/man4/atapicam.4.gz
+OLD_FILES+=usr/share/man/man4/ataraid.4.gz
 # 20130316: vinum.4 removed
 OLD_FILES+=usr/share/man/man4/vinum.4.gz
 # 20130312: fortunes-o removed
___
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: r249085 - head/sys/dev/ath

2013-04-04 Thread Adrian Chadd
Author: adrian
Date: Thu Apr  4 08:21:56 2013
New Revision: 249085
URL: http://svnweb.freebsd.org/changeset/base/249085

Log:
  Fix the busdma logic to work with EDMA chipsets when using bounce
  buffers (ie, 4GB on amd64.)
  
  The underlying problem was that PREREAD doesn't sync the mbuf
  with the DMA memory (ie, bounce buffer), so the bounce buffer may
  have had stale information.  Thus it was always considering the
  buffer completed and things just went off the rails.
  
  This change does the following:
  
  * Make ath_rx_pkt() always consume the mbuf somehow; it no longer
passes error mbufs (eg CRC errors, crypt errors, etc) back up
to the RX path to recycle.  This means that a new mbuf is always
allocated each time, but it's cleaner.
  
  * Push the RX buffer map/unmap to occur in the RX path, not
ath_rx_pkt().  Thus, ath_rx_pkt() now assumes (a) it has to consume
the mbuf somehow, and (b) that it's already been unmapped and
synced.
  
  * For the legacy path, the descriptor isn't mapped, it comes out of
coherent, DMA memory anyway.  So leave it there.
  
  * For the EDMA path, the RX descriptor has to be cleared before
its passed to the hardware, so that when we check with
a POSTREAD sync, we actually get either a blank (not finished)
or a filled out descriptor (finished.)  Otherwise we get stale
data in the DMA memory.
  
  * .. so, for EDMA RX path, we need PREREAD|PREWRITE to sync the
data - DMA memory, then POSTREAD|POSTWRITE to finish syncing
the DMA memory - data.
  
  * Whilst we're here, make sure that in EDMA buffer setup (ie,
bzero'ing the descriptor part) is done before the mbuf is
map/synched.
  
  NOTE: there's been a lot of commits besides this one with regards to
  tidying up the busdma handling in ath(4).  Please check the recent
  commit history.
  
  Discussed with and thanks to: scottl
  
  Tested:
  
  * AR5416 (non-EDMA) on i386, with the DMA tag for the driver
set to 2^^30, not 2^^32, STA
  
  * AR9580 (EDMA) on i386, as above, STA
  
  * User - tested AR9380 on amd64 with 32GB RAM.
  
  PR:   kern/177530

Modified:
  head/sys/dev/ath/if_ath_rx.c
  head/sys/dev/ath/if_ath_rx.h
  head/sys/dev/ath/if_ath_rx_edma.c

Modified: head/sys/dev/ath/if_ath_rx.c
==
--- head/sys/dev/ath/if_ath_rx.cThu Apr  4 07:57:32 2013
(r249084)
+++ head/sys/dev/ath/if_ath_rx.cThu Apr  4 08:21:56 2013
(r249085)
@@ -502,12 +502,21 @@ ath_handle_micerror(struct ieee80211com 
}
 }
 
+/*
+ * Process a single packet.
+ *
+ * The mbuf must already be synced, unmapped and removed from bf-bf_m
+ * by this stage.
+ *
+ * The mbuf must be consumed by this routine - either passed up the
+ * net80211 stack, put on the holding queue, or freed.
+ */
 int
 ath_rx_pkt(struct ath_softc *sc, struct ath_rx_status *rs, HAL_STATUS status,
-uint64_t tsf, int nf, HAL_RX_QUEUE qtype, struct ath_buf *bf)
+uint64_t tsf, int nf, HAL_RX_QUEUE qtype, struct ath_buf *bf,
+struct mbuf *m)
 {
struct ath_hal *ah = sc-sc_ah;
-   struct mbuf *m = bf-bf_m;
uint64_t rstamp;
int len, type;
struct ifnet *ifp = sc-sc_ifp;
@@ -548,10 +557,6 @@ ath_rx_pkt(struct ath_softc *sc, struct 
/* Process DFS radar events */
if ((rs-rs_phyerr == HAL_PHYERR_RADAR) ||
(rs-rs_phyerr == HAL_PHYERR_FALSE_RADAR_EXT)) {
-   /* Since we're touching the frame data, sync it 
*/
-   bus_dmamap_sync(sc-sc_dmat,
-   bf-bf_dmamap,
-   BUS_DMASYNC_POSTREAD);
/* Now pass it to the radar processing code */
ath_dfs_process_phy_err(sc, m, rstamp, rs);
}
@@ -593,9 +598,6 @@ ath_rx_pkt(struct ath_softc *sc, struct 
/* XXX frag's and qos frames */
len = rs-rs_datalen;
if (len = sizeof (struct ieee80211_frame)) {
-   bus_dmamap_sync(sc-sc_dmat,
-   bf-bf_dmamap,
-   BUS_DMASYNC_POSTREAD);
ath_handle_micerror(ic,
mtod(m, struct ieee80211_frame *),
sc-sc_splitmic ?
@@ -619,35 +621,20 @@ rx_error:
 */
if (ieee80211_radiotap_active(ic) 
(rs-rs_status  sc-sc_monpass)) {
-   bus_dmamap_sync(sc-sc_dmat, bf-bf_dmamap,
-   BUS_DMASYNC_POSTREAD);
-   bus_dmamap_unload(sc-sc_dmat, bf-bf_dmamap);
/* NB: bpf needs the mbuf length setup */
len = 

svn commit: r249086 - head/share/man/man5

2013-04-04 Thread Joel Dahl
Author: joel (doc committer)
Date: Thu Apr  4 08:30:04 2013
New Revision: 249086
URL: http://svnweb.freebsd.org/changeset/base/249086

Log:
  Remove atapicam(4) reference.

Modified:
  head/share/man/man5/devfs.conf.5

Modified: head/share/man/man5/devfs.conf.5
==
--- head/share/man/man5/devfs.conf.5Thu Apr  4 08:21:56 2013
(r249085)
+++ head/share/man/man5/devfs.conf.5Thu Apr  4 08:30:04 2013
(r249086)
@@ -100,8 +100,6 @@ To create a
 .Pa /dev/cdrom
 link that points to the first
 .Xr SCSI 4
-or
-.Xr atapicam 4
 CD-ROM,
 the following may be added to
 .Nm :
___
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: r249087 - in head: sbin/geom/class/raid sbin/geom/class/stripe share/man/man5

2013-04-04 Thread Joel Dahl
Author: joel (doc committer)
Date: Thu Apr  4 08:45:37 2013
New Revision: 249087
URL: http://svnweb.freebsd.org/changeset/base/249087

Log:
  Remove references to ataraid(4) and atacontrol(8).

Modified:
  head/sbin/geom/class/raid/graid.8
  head/sbin/geom/class/stripe/gstripe.8
  head/share/man/man5/periodic.conf.5

Modified: head/sbin/geom/class/raid/graid.8
==
--- head/sbin/geom/class/raid/graid.8   Thu Apr  4 08:30:04 2013
(r249086)
+++ head/sbin/geom/class/raid/graid.8   Thu Apr  4 08:45:37 2013
(r249087)
@@ -242,8 +242,7 @@ RAID5 (3+ disks), RAID10 (4+ disks), SIN
 Configurations not supported by NVIDIA MediaShield RAID BIOS, but enforceable
 on your own risk: RAID1 (3+ disks).
 .It Promise
-The format used by Promise and AMD/ATI RAID BIOSes and FreeBSD ataraid(4)
-driver.
+The format used by Promise and AMD/ATI RAID BIOSes.
 Supports multiple volumes per array.
 Each disk can be split to be used by up to two arbitrary volumes.
 Supports configurations: RAID0 (2+ disks), RAID1 (2 disks),

Modified: head/sbin/geom/class/stripe/gstripe.8
==
--- head/sbin/geom/class/stripe/gstripe.8   Thu Apr  4 08:30:04 2013
(r249086)
+++ head/sbin/geom/class/stripe/gstripe.8   Thu Apr  4 08:45:37 2013
(r249087)
@@ -213,8 +213,6 @@ The
 interleave is in number of bytes,
 unlike
 .Xr ccdconfig 8
-and
-.Xr atacontrol 8
 which use the number of sectors.
 A
 .Xr ccdconfig 8
@@ -229,7 +227,6 @@ for
 .Sh SEE ALSO
 .Xr geom 4 ,
 .Xr loader.conf 5 ,
-.Xr atacontrol 8 ,
 .Xr ccdconfig 8 ,
 .Xr geom 8 ,
 .Xr gvinum 8 ,

Modified: head/share/man/man5/periodic.conf.5
==
--- head/share/man/man5/periodic.conf.5 Thu Apr  4 08:30:04 2013
(r249086)
+++ head/share/man/man5/periodic.conf.5 Thu Apr  4 08:45:37 2013
(r249087)
@@ -357,15 +357,6 @@ Requires
 .Va daily_status_zfs_enable
 to be set to
 .Li YES .
-.It Va daily_status_ata_raid_enable
-.Pq Vt bool
-Set to
-.Dq Li YES
-if you want to run
-.Nm atacontrol Cm status
-on your
-.Xr ataraid 4
-arrays.
 .It Va daily_status_gmirror_enable
 .Pq Vt bool
 Set to
___
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: r249088 - head/sys/dev/ath

2013-04-04 Thread Adrian Chadd
Author: adrian
Date: Thu Apr  4 08:57:29 2013
New Revision: 249088
URL: http://svnweb.freebsd.org/changeset/base/249088

Log:
  Update comments!

Modified:
  head/sys/dev/ath/if_ath_rx_edma.c

Modified: head/sys/dev/ath/if_ath_rx_edma.c
==
--- head/sys/dev/ath/if_ath_rx_edma.c   Thu Apr  4 08:45:37 2013
(r249087)
+++ head/sys/dev/ath/if_ath_rx_edma.c   Thu Apr  4 08:57:29 2013
(r249088)
@@ -571,10 +571,6 @@ ath_edma_recv_tasklet(void *arg, int npe
  *
  * + Allocate a 4KB mbuf;
  * + Setup the DMA map for the given buffer;
- * + Keep a pointer to the start of the mbuf - that's where the
- *   descriptor lies;
- * + Take a pointer to the start of the RX buffer, set the
- *   mbuf start to be there;
  * + Return that.
  */
 static int
___
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: r249089 - head/sys/dev/ahci

2013-04-04 Thread Alexander Motin
Author: mav
Date: Thu Apr  4 09:15:19 2013
New Revision: 249089
URL: http://svnweb.freebsd.org/changeset/base/249089

Log:
  Check status of ahci_em_reset() on attach and abort if reset failed.
  For now it is just a hypothetical case.
  
  Submitted by: Dmitry Luhtionov dmitryluhtio...@gmail.com

Modified:
  head/sys/dev/ahci/ahciem.c

Modified: head/sys/dev/ahci/ahciem.c
==
--- head/sys/dev/ahci/ahciem.c  Thu Apr  4 08:57:29 2013(r249088)
+++ head/sys/dev/ahci/ahciem.c  Thu Apr  4 09:15:19 2013(r249089)
@@ -104,7 +104,10 @@ ahci_em_attach(device_t dev)
} else
enc-r_memr = NULL;
mtx_lock(enc-mtx);
-   ahci_em_reset(dev);
+   if (ahci_em_reset(dev) != 0) {
+   error = ENXIO;
+   goto err1;
+   }
rid = ATA_IRQ_RID;
/* Create the device queue for our SIM. */
devq = cam_simq_alloc(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: r249090 - in head: . usr.sbin usr.sbin/burncd

2013-04-04 Thread Alexander Motin
Author: mav
Date: Thu Apr  4 09:21:24 2013
New Revision: 249090
URL: http://svnweb.freebsd.org/changeset/base/249090

Log:
  Remove usr.sbin/burncd, useless after legacy ATA stack removal.

Deleted:
  head/usr.sbin/burncd/
Modified:
  head/ObsoleteFiles.inc
  head/usr.sbin/Makefile

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Thu Apr  4 09:15:19 2013(r249089)
+++ head/ObsoleteFiles.inc  Thu Apr  4 09:21:24 2013(r249090)
@@ -43,6 +43,8 @@ OLD_FILES+=sbin/atacontrol
 OLD_FILES+=usr/share/man/man8/atacontrol.8.gz
 OLD_FILES+=usr/share/man/man4/atapicam.4.gz
 OLD_FILES+=usr/share/man/man4/ataraid.4.gz
+OLD_FILES+=usr.sbin/burncd
+OLD_FILES+=usr/share/man/man8/burncd.8.gz
 # 20130316: vinum.4 removed
 OLD_FILES+=usr/share/man/man4/vinum.4.gz
 # 20130312: fortunes-o removed

Modified: head/usr.sbin/Makefile
==
--- head/usr.sbin/Makefile  Thu Apr  4 09:15:19 2013(r249089)
+++ head/usr.sbin/Makefile  Thu Apr  4 09:21:24 2013(r249090)
@@ -6,7 +6,6 @@
 SUBDIR=adduser \
arp \
bootparamd \
-   burncd \
bsdinstall \
cdcontrol \
chkgrp \
___
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: r249091 - head/sys/cam

2013-04-04 Thread Alexander Motin
Author: mav
Date: Thu Apr  4 10:19:05 2013
New Revision: 249091
URL: http://svnweb.freebsd.org/changeset/base/249091

Log:
  Use xpt_lock_buses() instead of equivalent mtx_lock(xsoftc.xpt_topo_lock)
  to unify the code.

Modified:
  head/sys/cam/cam_xpt.c

Modified: head/sys/cam/cam_xpt.c
==
--- head/sys/cam/cam_xpt.c  Thu Apr  4 09:21:24 2013(r249090)
+++ head/sys/cam/cam_xpt.c  Thu Apr  4 10:19:05 2013(r249091)
@@ -654,7 +654,7 @@ xptioctl(struct cdev *dev, u_long cmd, c
}
 
/* Keep the list from changing while we traverse it */
-   mtx_lock(xsoftc.xpt_topo_lock);
+   xpt_lock_buses();
 ptstartover:
cur_generation = xsoftc.xpt_generation;
 
@@ -664,7 +664,7 @@ ptstartover:
break;
 
if (*p_drv == NULL) {
-   mtx_unlock(xsoftc.xpt_topo_lock);
+   xpt_unlock_buses();
ccb-ccb_h.status = CAM_REQ_CMP_ERR;
ccb-cgdl.status = CAM_GDEVLIST_ERROR;
*ccb-cgdl.periph_name = '\0';
@@ -686,8 +686,8 @@ ptstartover:
if (periph-unit_number == unit) {
break;
} else if (--splbreaknum == 0) {
-   mtx_unlock(xsoftc.xpt_topo_lock);
-   mtx_lock(xsoftc.xpt_topo_lock);
+   xpt_unlock_buses();
+   xpt_lock_buses();
splbreaknum = 100;
if (cur_generation != xsoftc.xpt_generation)
   goto ptstartover;
@@ -776,7 +776,7 @@ ptstartover:
   your kernel config file\n);
}
}
-   mtx_unlock(xsoftc.xpt_topo_lock);
+   xpt_unlock_buses();
break;
}
default:
@@ -1024,9 +1024,9 @@ xpt_add_periph(struct cam_periph *periph
SLIST_INSERT_HEAD(periph_head, periph, periph_links);
}
 
-   mtx_lock(xsoftc.xpt_topo_lock);
+   xpt_lock_buses();
xsoftc.xpt_generation++;
-   mtx_unlock(xsoftc.xpt_topo_lock);
+   xpt_unlock_buses();
 
return (status);
 }
@@ -1054,12 +1054,12 @@ xpt_remove_periph(struct cam_periph *per
}
 
if (topology_lock_held == 0)
-   mtx_lock(xsoftc.xpt_topo_lock);
+   xpt_lock_buses();
 
xsoftc.xpt_generation++;
 
if (topology_lock_held == 0)
-   mtx_unlock(xsoftc.xpt_topo_lock);
+   xpt_unlock_buses();
 }
 
 
@@ -2031,7 +2031,7 @@ xptbustraverse(struct cam_eb *start_bus,
 
retval = 1;
 
-   mtx_lock(xsoftc.xpt_topo_lock);
+   xpt_lock_buses();
for (bus = (start_bus ? start_bus : TAILQ_FIRST(xsoftc.xpt_busses));
 bus != NULL;
 bus = next_bus) {
@@ -2042,22 +2042,22 @@ xptbustraverse(struct cam_eb *start_bus,
 * XXX The locking here is obviously very complex.  We
 * should work to simplify it.
 */
-   mtx_unlock(xsoftc.xpt_topo_lock);
+   xpt_unlock_buses();
CAM_SIM_LOCK(bus-sim);
retval = tr_func(bus, arg);
CAM_SIM_UNLOCK(bus-sim);
 
-   mtx_lock(xsoftc.xpt_topo_lock);
+   xpt_lock_buses();
next_bus = TAILQ_NEXT(bus, links);
-   mtx_unlock(xsoftc.xpt_topo_lock);
+   xpt_unlock_buses();
 
xpt_release_bus(bus);
 
if (retval == 0)
return(retval);
-   mtx_lock(xsoftc.xpt_topo_lock);
+   xpt_lock_buses();
}
-   mtx_unlock(xsoftc.xpt_topo_lock);
+   xpt_unlock_buses();
 
return(retval);
 }
@@ -2073,7 +2073,7 @@ xpt_sim_opened(struct cam_sim *sim)
KASSERT(sim-refcount = 1, (sim-refcount = 1));
mtx_assert(sim-mtx, MA_OWNED);
 
-   mtx_lock(xsoftc.xpt_topo_lock);
+   xpt_lock_buses();
TAILQ_FOREACH(bus, xsoftc.xpt_busses, links) {
if (bus-sim != sim)
continue;
@@ -2083,7 +2083,7 @@ xpt_sim_opened(struct cam_sim *sim)
SLIST_FOREACH(periph, device-periphs,
periph_links) {
if (periph-refcount  0) {
-   
mtx_unlock(xsoftc.xpt_topo_lock);
+   xpt_unlock_buses();
return (1);
}
}
@@ -2091,7 +2091,7 @@ xpt_sim_opened(struct cam_sim *sim)
}
  

svn commit: r249092 - head/sbin/geom/class/raid

2013-04-04 Thread Joel Dahl
Author: joel (doc committer)
Date: Thu Apr  4 10:26:09 2013
New Revision: 249092
URL: http://svnweb.freebsd.org/changeset/base/249092

Log:
  Minor rewording.
  
  Discussed with:   mav

Modified:
  head/sbin/geom/class/raid/graid.8

Modified: head/sbin/geom/class/raid/graid.8
==
--- head/sbin/geom/class/raid/graid.8   Thu Apr  4 10:19:05 2013
(r249091)
+++ head/sbin/geom/class/raid/graid.8   Thu Apr  4 10:26:09 2013
(r249092)
@@ -24,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd January 16, 2013
+.Dd April 4, 2013
 .Dt GRAID 8
 .Os
 .Sh NAME
@@ -305,7 +305,7 @@ Time to wait for missing array component
 .It Va kern.geom.raid. Ns Ar X Ns Va .enable : No 1
 Enable taste for specific metadata or transformation module.
 .It Va kern.geom.raid.legacy_aliases : No 0
-Enable geom raid emulation of /dev/ar%d devices from ataraid(4)
+Enable geom raid emulation of legacy /dev/ar%d devices.
 This should aid the upgrade of systems from legacy to modern releases.
 .El
 .Sh EXIT STATUS
___
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: r249094 - in head/usr.sbin: bsdconfig/share pc-sysinstall/backend-query

2013-04-04 Thread Alexander Motin
Author: mav
Date: Thu Apr  4 12:03:30 2013
New Revision: 249094
URL: http://svnweb.freebsd.org/changeset/base/249094

Log:
  Remove some more references to legacy ATA.
  
  Submitted by: Dmitry Luhtionov dmitryluhtio...@gmail.com

Modified:
  head/usr.sbin/bsdconfig/share/device.subr
  head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh

Modified: head/usr.sbin/bsdconfig/share/device.subr
==
--- head/usr.sbin/bsdconfig/share/device.subr   Thu Apr  4 10:46:33 2013
(r249093)
+++ head/usr.sbin/bsdconfig/share/device.subr   Thu Apr  4 12:03:30 2013
(r249094)
@@ -663,16 +663,12 @@ f_network() {  f_device_name_set $DEVICE
  MAIN
 
 # CDROM, Disk, Floppy, Serial, and USB devices/names
-f_cdrom  acd%d  ATAPI/IDE CDROM   4
 f_cdrom  cd%d   SCSI CDROM drive  4
 f_cdrom  mcd%d  Mitsumi (old model) CDROM drive   4
 f_cdrom  scd%d  Sony CDROM drive - CDU31/33A type 4
 f_disk   aacd%d Adaptec FSA RAID array4
-f_disk   ad%d   ATA/IDE disk device   16
-f_disk   ada%d  SATA disk device  16
-f_disk   afd%d  ATAPI/IDE floppy device   4
+f_disk   ada%d  ATA/SATA disk device  16
 f_disk   amrd%d AMI MegaRAID drive4
-f_disk   ar%d   ATA/IDE RAID device   16
 f_disk   da%d   SCSI disk device  16
 f_disk   idad%d Compaq RAID array 4
 f_disk   ipsd%d IBM ServeRAID RAID array  4

Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh
==
--- head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh  Thu Apr  4 
10:46:33 2013(r249093)
+++ head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh  Thu Apr  4 
12:03:30 2013(r249094)
@@ -82,15 +82,10 @@ do
 esac
   fi
 
-  # Try and find some identification information with camcontrol or atacontrol
+  # Try and find some identification information with camcontrol
   NEWLINE=$(camcontrol identify $DEV 2/dev/null | sed -ne 's/^device model 
*//p')
   if [ -z $NEWLINE ]; then
-   # Now try atacontrol
-   NEWLINE=$(atacontrol list 2/dev/null | sed -n s|^.*$DEV 
\(.*\).*|\1|p)
-   
-   if [ -z $NEWLINE ]; then
-   NEWLINE= Unknown Device
-   fi
+   NEWLINE= Unknown Device
   fi
 
   if [ -n ${FLAGS_MD} ]  echo ${DEV} | grep -E '^md[0-9]+' /dev/null 
2/dev/null
___
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: r248571 - in head: . cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zhack cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cm

2013-04-04 Thread Andriy Gapon
on 01/04/2013 11:37 Jaakko Heinonen said the following:
 
 Hi,
 
 On 2013-03-21, Martin Matuska wrote:
   Merge libzfs_core branch:
 includes MFV 238590, 238592, 247580
 
 I am getting the following error after this commit:
 
 # zpool list
 failed to read pool configuration: bad address
 no pools available
 # zfs list
 failed to read pool configuration: bad address
 
 Reverting sys/cddl to r248570 makes it work again.
 
From dmesg:
 
 ZFS filesystem version: 5
 ZFS storage pool version: features support (5000)
 

Any followups on this?
I haven't experienced this problem, but always keep kernel and userland in sync.

-- 
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


svn commit: r249095 - in head/etc: defaults periodic/daily

2013-04-04 Thread Alexander Motin
Author: mav
Date: Thu Apr  4 15:03:12 2013
New Revision: 249095
URL: http://svnweb.freebsd.org/changeset/base/249095

Log:
  Remove periodic script for ataraid(4) and add instead script for graid(8).

Added:
  head/etc/periodic/daily/401.status-graid   (contents, props changed)
Deleted:
  head/etc/periodic/daily/405.status-ata-raid
Modified:
  head/etc/defaults/periodic.conf
  head/etc/periodic/daily/Makefile

Modified: head/etc/defaults/periodic.conf
==
--- head/etc/defaults/periodic.conf Thu Apr  4 12:03:30 2013
(r249094)
+++ head/etc/defaults/periodic.conf Thu Apr  4 15:03:12 2013
(r249095)
@@ -95,13 +95,13 @@ daily_news_expire_enable=YES  
# Run 
 daily_status_disks_enable=YES# Check disk 
status
 daily_status_disks_df_flags=-l -h# df(1) flags for check
 
+# 401.status-graid
+daily_status_graid_enable=NO # Check graid(8)
+
 # 404.status-zfs
 daily_status_zfs_enable=NO   # Check ZFS
 daily_status_zfs_zpool_list_enable=YES   # List ZFS pools
 
-# 405.status-ata_raid
-daily_status_ata_raid_enable=NO  # Check ATA raid status
-
 # 406.status-gmirror
 daily_status_gmirror_enable=NO   # Check gmirror(8)
 

Added: head/etc/periodic/daily/401.status-graid
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/etc/periodic/daily/401.status-graidThu Apr  4 15:03:12 2013
(r249095)
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+. /etc/defaults/periodic.conf
+source_periodic_confs
+fi
+
+case $daily_status_graid_enable in
+[Yy][Ee][Ss])
+   echo
+   echo 'Checking status of graid(8) devices:'
+
+   if graid status; then
+   components=$(graid status -s | fgrep -v OPTIMAL)
+   if [ ${components} ]; then
+   rc=3
+   else
+   rc=0
+   fi
+   else
+   rc=2
+   fi
+   ;;
+
+*)  rc=0;;
+esac
+
+exit $rc

Modified: head/etc/periodic/daily/Makefile
==
--- head/etc/periodic/daily/MakefileThu Apr  4 12:03:30 2013
(r249094)
+++ head/etc/periodic/daily/MakefileThu Apr  4 15:03:12 2013
(r249095)
@@ -8,7 +8,7 @@ FILES=  100.clean-disks \
200.backup-passwd \
330.news \
400.status-disks \
-   405.status-ata-raid \
+   401.status-graid \
406.status-gmirror \
407.status-graid3 \
408.status-gstripe \
___
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: r249096 - head/sys/rpc/rpcsec_gss

2013-04-04 Thread George V. Neville-Neil
Author: gnn
Date: Thu Apr  4 15:16:53 2013
New Revision: 249096
URL: http://svnweb.freebsd.org/changeset/base/249096

Log:
  Improve error handling when unwrapping received data.
  
  Submitted by: Rick Macklem
  MFC after:1 week

Modified:
  head/sys/rpc/rpcsec_gss/rpcsec_gss_prot.c

Modified: head/sys/rpc/rpcsec_gss/rpcsec_gss_prot.c
==
--- head/sys/rpc/rpcsec_gss/rpcsec_gss_prot.c   Thu Apr  4 15:03:12 2013
(r249095)
+++ head/sys/rpc/rpcsec_gss/rpcsec_gss_prot.c   Thu Apr  4 15:16:53 2013
(r249096)
@@ -208,6 +208,8 @@ m_trim(struct mbuf *m, int len)
struct mbuf *n;
int off;
 
+   if (m == NULL)
+   return;
n = m_getptr(m, len, off);
if (n) {
n-m_len = off;
@@ -251,10 +253,19 @@ xdr_rpc_gss_unwrap_data(struct mbuf **re
 * Extract the MIC and make it contiguous.
 */
cklen = get_uint32(results);
+   if (!results) {
+   m_freem(message);
+   return (FALSE);
+   }
KASSERT(cklen = MHLEN, (unexpected large GSS-API checksum));
mic = results;
-   if (cklen  mic-m_len)
+   if (cklen  mic-m_len) {
mic = m_pullup(mic, cklen);
+   if (!mic) {
+   m_freem(message);
+   return (FALSE);
+   }
+   }
if (cklen != RNDUP(cklen))
m_trim(mic, cklen);
 
@@ -272,6 +283,8 @@ xdr_rpc_gss_unwrap_data(struct mbuf **re
} else if (svc == rpc_gss_svc_privacy) {
/* Decode databody_priv. */
len = get_uint32(results);
+   if (!results)
+   return (FALSE);
 
/* Decrypt databody. */
message = results;
@@ -294,6 +307,8 @@ xdr_rpc_gss_unwrap_data(struct mbuf **re
 
/* Decode rpc_gss_data_t (sequence number + arguments). */
seq_num = get_uint32(message);
+   if (!message)
+   return (FALSE);

/* Verify sequence number. */
if (seq_num != seq) {
___
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: r249096 - head/sys/rpc/rpcsec_gss

2013-04-04 Thread Gleb Smirnoff
  George, Rick,

On Thu, Apr 04, 2013 at 03:16:54PM +, George V. Neville-Neil wrote:
G Modified: head/sys/rpc/rpcsec_gss/rpcsec_gss_prot.c
G 
==
G --- head/sys/rpc/rpcsec_gss/rpcsec_gss_prot.cThu Apr  4 15:03:12 
2013(r249095)
G +++ head/sys/rpc/rpcsec_gss/rpcsec_gss_prot.cThu Apr  4 15:16:53 
2013(r249096)
G @@ -208,6 +208,8 @@ m_trim(struct mbuf *m, int len)
G  struct mbuf *n;
G  int off;
G  
G +if (m == NULL)
G +return;
G  n = m_getptr(m, len, off);
G  if (n) {
G  n-m_len = off;

I think the code will be much more rocksolid, if the function won't be
called with NULL argument.

-- 
Totus tuus, Glebius.
___
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: r248571 - in head: . cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zhack cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cm

2013-04-04 Thread Martin Matuska
This has been fixed in r249004

On 4. 4. 2013 16:57, Andriy Gapon wrote:
 on 01/04/2013 11:37 Jaakko Heinonen said the following:
 Hi,

 On 2013-03-21, Martin Matuska wrote:
   Merge libzfs_core branch:
 includes MFV 238590, 238592, 247580
 I am getting the following error after this commit:

 # zpool list
 failed to read pool configuration: bad address
 no pools available
 # zfs list
 failed to read pool configuration: bad address

 Reverting sys/cddl to r248570 makes it work again.

 From dmesg:

 ZFS filesystem version: 5
 ZFS storage pool version: features support (5000)

 Any followups on this?
 I haven't experienced this problem, but always keep kernel and userland in 
 sync.



-- 
Martin Matuska
FreeBSD committer
http://blog.vx.sk

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

2013-04-04 Thread Rui Paulo
Author: rpaulo
Date: Thu Apr  4 15:40:19 2013
New Revision: 249097
URL: http://svnweb.freebsd.org/changeset/base/249097

Log:
  Remove a comment about devices being able to specify multiple interrupt
  types. This is no longer the case because interrupt types now have to map to
  an ithread priority (c.f. intr_priority()).

Modified:
  head/sys/sys/bus.h

Modified: head/sys/sys/bus.h
==
--- head/sys/sys/bus.h  Thu Apr  4 15:16:53 2013(r249096)
+++ head/sys/sys/bus.h  Thu Apr  4 15:40:19 2013(r249097)
@@ -178,11 +178,8 @@ typedef void driver_intr_t(void*);
  * spls implicit in names like INTR_TYPE_TTY. In the meantime, don't
  * confuse things by renaming them (Grog, 18 July 2000).
  *
- * We define this in terms of bits because some devices may belong
- * to multiple classes (and therefore need to be included in
- * multiple interrupt masks, which is what this really serves to
- * indicate. Buses which do interrupt remapping will want to
- * change their type to reflect what sort of devices are underneath.
+ * Buses which do interrupt remapping will want to change their type
+ * to reflect what sort of devices are underneath.
  */
 enum intr_type {
INTR_TYPE_TTY = 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: r249099 - head/sys/cam

2013-04-04 Thread Alexander Motin
Author: mav
Date: Thu Apr  4 17:08:49 2013
New Revision: 249099
URL: http://svnweb.freebsd.org/changeset/base/249099

Log:
  Remove xpt_sim_opened(), the only consumer of which was atapicam, which is
  now gone.

Modified:
  head/sys/cam/cam_xpt.c
  head/sys/cam/cam_xpt_sim.h

Modified: head/sys/cam/cam_xpt.c
==
--- head/sys/cam/cam_xpt.c  Thu Apr  4 16:02:21 2013(r249098)
+++ head/sys/cam/cam_xpt.c  Thu Apr  4 17:08:49 2013(r249099)
@@ -2062,39 +2062,6 @@ xptbustraverse(struct cam_eb *start_bus,
return(retval);
 }
 
-int
-xpt_sim_opened(struct cam_sim *sim)
-{
-   struct cam_eb *bus;
-   struct cam_et *target;
-   struct cam_ed *device;
-   struct cam_periph *periph;
-
-   KASSERT(sim-refcount = 1, (sim-refcount = 1));
-   mtx_assert(sim-mtx, MA_OWNED);
-
-   xpt_lock_buses();
-   TAILQ_FOREACH(bus, xsoftc.xpt_busses, links) {
-   if (bus-sim != sim)
-   continue;
-
-   TAILQ_FOREACH(target, bus-et_entries, links) {
-   TAILQ_FOREACH(device, target-ed_entries, links) {
-   SLIST_FOREACH(periph, device-periphs,
-   periph_links) {
-   if (periph-refcount  0) {
-   xpt_unlock_buses();
-   return (1);
-   }
-   }
-   }
-   }
-   }
-
-   xpt_unlock_buses();
-   return (0);
-}
-
 static int
 xpttargettraverse(struct cam_eb *bus, struct cam_et *start_target,
  xpt_targetfunc_t *tr_func, void *arg)

Modified: head/sys/cam/cam_xpt_sim.h
==
--- head/sys/cam/cam_xpt_sim.h  Thu Apr  4 16:02:21 2013(r249098)
+++ head/sys/cam/cam_xpt_sim.h  Thu Apr  4 17:08:49 2013(r249099)
@@ -49,7 +49,6 @@ void  xpt_release_devq(struct cam_path *
u_int count, int run_queue);
 void   xpt_release_devq_rl(struct cam_path *path, cam_rl rl,
u_int count, int run_queue);
-intxpt_sim_opened(struct cam_sim *sim);
 void   xpt_done(union ccb *done_ccb);
 void   xpt_batch_start(struct cam_sim *sim);
 void   xpt_batch_done(struct cam_sim *sim);
___
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: r249102 - head/sys/cam/ctl

2013-04-04 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Apr  4 18:00:18 2013
New Revision: 249102
URL: http://svnweb.freebsd.org/changeset/base/249102

Log:
  Since the CTL version in FreeBSD does not support High Availability,
  ctl_is_single should always be set to 1.  Make it so.  Previously
  it was always 0, because ctl_isc_start() never got to run.
  
  Suggested by: ken

Modified:
  head/sys/cam/ctl/ctl.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Thu Apr  4 17:10:44 2013(r249101)
+++ head/sys/cam/ctl/ctl.c  Thu Apr  4 18:00:18 2013(r249102)
@@ -318,7 +318,7 @@ static struct scsi_control_page control_
 static int rcv_sync_msg;
 static int persis_offset;
 static uint8_t ctl_pause_rtr;
-static int ctl_is_single;
+static int ctl_is_single = 1;
 static int index_to_aps_page;
 #ifdef CTL_DISABLE
 int   ctl_disable = 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: r249104 - head/sys/cam

2013-04-04 Thread Alexander Motin
Author: mav
Date: Thu Apr  4 18:59:29 2013
New Revision: 249104
URL: http://svnweb.freebsd.org/changeset/base/249104

Log:
  MFprojects/camlock r248928:
  Move CAM_DEBUG_CDB messages from the point of queuing to the point of
  sending to SIM.  That allows to inspect real requests execution order,
  respecting priorities, freezing, etc.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/cam_xpt.c

Modified: head/sys/cam/cam_xpt.c
==
--- head/sys/cam/cam_xpt.c  Thu Apr  4 18:42:23 2013(r249103)
+++ head/sys/cam/cam_xpt.c  Thu Apr  4 18:59:29 2013(r249104)
@@ -2430,7 +2430,6 @@ xpt_action(union ccb *start_ccb)
 void
 xpt_action_default(union ccb *start_ccb)
 {
-   char cdb_str[(SCSI_MAX_CDBLEN * 3) + 1];
struct cam_path *path;
 
path = start_ccb-ccb_h.path;
@@ -2466,11 +2465,6 @@ xpt_action_default(union ccb *start_ccb)
start_ccb-ccb_h.target_lun  5;
}
start_ccb-csio.scsi_status = SCSI_STATUS_OK;
-   CAM_DEBUG(path, CAM_DEBUG_CDB,(%s. CDB: %s\n,
- scsi_op_desc(start_ccb-csio.cdb_io.cdb_bytes[0],
-  path-device-inq_data),
- scsi_cdb_string(start_ccb-csio.cdb_io.cdb_bytes,
- cdb_str, sizeof(cdb_str;
}
/* FALLTHROUGH */
case XPT_TARGET_IO:
@@ -2479,13 +2473,8 @@ xpt_action_default(union ccb *start_ccb)
start_ccb-csio.resid = 0;
/* FALLTHROUGH */
case XPT_ATA_IO:
-   if (start_ccb-ccb_h.func_code == XPT_ATA_IO) {
+   if (start_ccb-ccb_h.func_code == XPT_ATA_IO)
start_ccb-ataio.resid = 0;
-   CAM_DEBUG(path, CAM_DEBUG_CDB,(%s. ACB: %s\n,
-   ata_op_string(start_ccb-ataio.cmd),
-   ata_cmd_string(start_ccb-ataio.cmd,
- cdb_str, sizeof(cdb_str;
-   }
/* FALLTHROUGH */
case XPT_RESET_DEV:
case XPT_ENG_EXEC:
@@ -3228,6 +3217,7 @@ static void
 xpt_run_dev_sendq(struct cam_eb *bus)
 {
struct  cam_devq *devq;
+   char cdb_str[(SCSI_MAX_CDBLEN * 3) + 1];
 
CAM_DEBUG_PRINT(CAM_DEBUG_XPT, (xpt_run_dev_sendq\n));
 
@@ -3309,6 +3299,26 @@ xpt_run_dev_sendq(struct cam_eb *bus)
work_ccb-ccb_h.flags = ~CAM_TAG_ACTION_VALID;
}
 
+   switch (work_ccb-ccb_h.func_code) {
+   case XPT_SCSI_IO:
+   CAM_DEBUG(work_ccb-ccb_h.path,
+   CAM_DEBUG_CDB,(%s. CDB: %s\n,
+scsi_op_desc(work_ccb-csio.cdb_io.cdb_bytes[0],
+ device-inq_data),
+scsi_cdb_string(work_ccb-csio.cdb_io.cdb_bytes,
+cdb_str, sizeof(cdb_str;
+   break;
+   case XPT_ATA_IO:
+   CAM_DEBUG(work_ccb-ccb_h.path,
+   CAM_DEBUG_CDB,(%s. ACB: %s\n,
+ata_op_string(work_ccb-ataio.cmd),
+ata_cmd_string(work_ccb-ataio.cmd,
+   cdb_str, sizeof(cdb_str;
+   break;
+   default:
+   break;
+   }
+
/*
 * Device queues can be shared among multiple sim instances
 * that reside on different busses.  Use the SIM in the queue
___
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: r249105 - in head/sys/cam: ata scsi

2013-04-04 Thread Alexander Motin
Author: mav
Date: Thu Apr  4 19:04:15 2013
New Revision: 249105
URL: http://svnweb.freebsd.org/changeset/base/249105

Log:
  MFprojects/camlock r248930:
  Remove extra NULL checks. d_drv1 can never be NULL during periph life cycle.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ata/ata_da.c
  head/sys/cam/scsi/scsi_cd.c
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Thu Apr  4 18:59:29 2013(r249104)
+++ head/sys/cam/ata/ata_da.c   Thu Apr  4 19:04:15 2013(r249105)
@@ -527,10 +527,6 @@ adaopen(struct disk *dp)
int error;
 
periph = (struct cam_periph *)dp-d_drv1;
-   if (periph == NULL) {
-   return (ENXIO); 
-   }
-
if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
return(ENXIO);
}
@@ -566,9 +562,6 @@ adaclose(struct disk *dp)
union ccb *ccb;
 
periph = (struct cam_periph *)dp-d_drv1;
-   if (periph == NULL)
-   return (ENXIO); 
-
cam_periph_lock(periph);
if (cam_periph_hold(periph, PRIBIO) != 0) {
cam_periph_unlock(periph);
@@ -646,10 +639,6 @@ adastrategy(struct bio *bp)
struct ada_softc *softc;

periph = (struct cam_periph *)bp-bio_disk-d_drv1;
-   if (periph == NULL) {
-   biofinish(bp, NULL, ENXIO);
-   return;
-   }
softc = (struct ada_softc *)periph-softc;
 
cam_periph_lock(periph);
@@ -704,8 +693,6 @@ adadump(void *arg, void *virtual, vm_off
 
dp = arg;
periph = dp-d_drv1;
-   if (periph == NULL)
-   return (ENXIO);
softc = (struct ada_softc *)periph-softc;
cam_periph_lock(periph);
secsize = softc-params.secsize;
@@ -1038,9 +1025,6 @@ adagetattr(struct bio *bp)
struct cam_periph *periph;
 
periph = (struct cam_periph *)bp-bio_disk-d_drv1;
-   if (periph == NULL)
-   return (ENXIO);
-
cam_periph_lock(periph);
ret = xpt_getattr(bp-bio_data, bp-bio_length, bp-bio_attribute,
periph-path);

Modified: head/sys/cam/scsi/scsi_cd.c
==
--- head/sys/cam/scsi/scsi_cd.c Thu Apr  4 18:59:29 2013(r249104)
+++ head/sys/cam/scsi/scsi_cd.c Thu Apr  4 19:04:15 2013(r249105)
@@ -386,7 +386,6 @@ cddiskgonecb(struct disk *dp)
struct cam_periph *periph;
 
periph = (struct cam_periph *)dp-d_drv1;
-
cam_periph_release(periph);
 }
 
@@ -1073,9 +1072,6 @@ cdopen(struct disk *dp)
int error;
 
periph = (struct cam_periph *)dp-d_drv1;
-   if (periph == NULL)
-   return (ENXIO);
-
softc = (struct cd_softc *)periph-softc;
 
if (cam_periph_acquire(periph) != CAM_REQ_CMP)
@@ -1120,9 +1116,6 @@ cdclose(struct disk *dp)
struct  cd_softc *softc;
 
periph = (struct cam_periph *)dp-d_drv1;
-   if (periph == NULL)
-   return (ENXIO); 
-
softc = (struct cd_softc *)periph-softc;
 
cam_periph_lock(periph);
@@ -1473,11 +1466,6 @@ cdstrategy(struct bio *bp)
struct cd_softc *softc;
 
periph = (struct cam_periph *)bp-bio_disk-d_drv1;
-   if (periph == NULL) {
-   biofinish(bp, NULL, ENXIO);
-   return;
-   }
-
cam_periph_lock(periph);
CAM_DEBUG(periph-path, CAM_DEBUG_TRACE,
(cdstrategy(%p)\n, bp));
@@ -1972,9 +1960,6 @@ cdioctl(struct disk *dp, u_long cmd, voi
int nocopyout, error = 0;
 
periph = (struct cam_periph *)dp-d_drv1;
-   if (periph == NULL)
-   return(ENXIO);  
-
cam_periph_lock(periph);
 
softc = (struct cd_softc *)periph-softc;

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Thu Apr  4 18:59:29 2013(r249104)
+++ head/sys/cam/scsi/scsi_da.c Thu Apr  4 19:04:15 2013(r249105)
@@ -962,10 +962,6 @@ daopen(struct disk *dp)
int error;
 
periph = (struct cam_periph *)dp-d_drv1;
-   if (periph == NULL) {
-   return (ENXIO); 
-   }
-
if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
return (ENXIO);
}
@@ -1027,9 +1023,6 @@ daclose(struct disk *dp)
struct  da_softc *softc;
 
periph = (struct cam_periph *)dp-d_drv1;
-   if (periph == NULL)
-   return (0); 
-
cam_periph_lock(periph);
if (cam_periph_hold(periph, PRIBIO) != 0) {
cam_periph_unlock(periph);
@@ -1118,10 +,6 @@ dastrategy(struct bio *bp)
struct da_softc *softc;

periph = (struct cam_periph *)bp-bio_disk-d_drv1;
-   if (periph == NULL) {
-   biofinish(bp, NULL, ENXIO);
-   return;
-

svn commit: r249106 - in head/sys/cam: ata scsi

2013-04-04 Thread Alexander Motin
Author: mav
Date: Thu Apr  4 19:07:37 2013
New Revision: 249106
URL: http://svnweb.freebsd.org/changeset/base/249106

Log:
  MFprojects/camlock r248931:
  Replace some direct mutex operations with wrappers.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ata/ata_da.c
  head/sys/cam/scsi/scsi_cd.c
  head/sys/cam/scsi/scsi_da.c
  head/sys/cam/scsi/scsi_pass.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Thu Apr  4 19:04:15 2013(r249105)
+++ head/sys/cam/ata/ata_da.c   Thu Apr  4 19:07:37 2013(r249106)
@@ -1114,7 +1114,7 @@ adaregister(struct cam_periph *periph, v
 * Register this media as a disk
 */
(void)cam_periph_hold(periph, PRIBIO);
-   mtx_unlock(periph-sim-mtx);
+   cam_periph_unlock(periph);
snprintf(announce_buf, sizeof(announce_buf),
kern.cam.ada.%d.quirks, periph-unit_number);
quirks = softc-quirks;
@@ -1208,7 +1208,7 @@ adaregister(struct cam_periph *periph, v
} else
legacy_id = -1;
disk_create(softc-disk, DISK_VERSION);
-   mtx_lock(periph-sim-mtx);
+   cam_periph_lock(periph);
cam_periph_unhold(periph);
 
dp = softc-params;

Modified: head/sys/cam/scsi/scsi_cd.c
==
--- head/sys/cam/scsi/scsi_cd.c Thu Apr  4 19:04:15 2013(r249105)
+++ head/sys/cam/scsi/scsi_cd.c Thu Apr  4 19:07:37 2013(r249106)
@@ -1446,7 +1446,7 @@ cdgetccb(struct cam_periph *periph, u_in
softc-changer-flags |= CHANGER_MANUAL_CALL;
cdrunchangerqueue(softc-changer);
} else
-   msleep(softc-changer, periph-sim-mtx,
+   cam_periph_sleep(periph, softc-changer,
PRIBIO, cgticb, 0);
}
}

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Thu Apr  4 19:04:15 2013(r249105)
+++ head/sys/cam/scsi/scsi_da.c Thu Apr  4 19:07:37 2013(r249106)
@@ -988,7 +988,7 @@ daopen(struct disk *dp)
dareprobe(periph);
 
/* Wait for the disk size update.  */
-   error = msleep(softc-disk-d_mediasize, periph-sim-mtx, PRIBIO,
+   error = cam_periph_sleep(periph, softc-disk-d_mediasize, PRIBIO,
dareprobe, 0);
if (error != 0)
xpt_print(periph-path, unable to retrieve capacity data);
@@ -1688,7 +1688,7 @@ daregister(struct cam_periph *periph, vo
(da_default_timeout * hz) / DA_ORDEREDTAG_INTERVAL,
dasendorderedtag, softc);
 
-   mtx_unlock(periph-sim-mtx);
+   cam_periph_unlock(periph);
/*
 * RBC devices don't have to support READ(6), only READ(10).
 */
@@ -1773,12 +1773,12 @@ daregister(struct cam_periph *periph, vo
if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
xpt_print(periph-path, %s: lost periph during 
  registration!\n, __func__);
-   mtx_lock(periph-sim-mtx);
+   cam_periph_lock(periph);
return (CAM_REQ_CMP_ERR);
}
 
disk_create(softc-disk, DISK_VERSION);
-   mtx_lock(periph-sim-mtx);
+   cam_periph_lock(periph);
 
/*
 * Add async callbacks for events of interest.

Modified: head/sys/cam/scsi/scsi_pass.c
==
--- head/sys/cam/scsi/scsi_pass.c   Thu Apr  4 19:04:15 2013
(r249105)
+++ head/sys/cam/scsi/scsi_pass.c   Thu Apr  4 19:07:37 2013
(r249106)
@@ -381,7 +381,7 @@ passregister(struct cam_periph *periph, 
 * know what the blocksize of this device is, if 
 * it even has a blocksize.
 */
-   mtx_unlock(periph-sim-mtx);
+   cam_periph_unlock(periph);
no_tags = (cgd-inq_data.flags  SID_CmdQue) == 0;
softc-device_stats = devstat_new_entry(pass,
  periph-unit_number, 0,
@@ -417,7 +417,7 @@ passregister(struct cam_periph *periph, 
 */
dev_ref(softc-dev);
 
-   mtx_lock(periph-sim-mtx);
+   cam_periph_lock(periph);
softc-dev-si_drv1 = periph;
 
TASK_INIT(softc-add_physpath_task, /*priority*/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: r249108 - in head/sys/cam: . ata scsi

2013-04-04 Thread Alexander Motin
Author: mav
Date: Thu Apr  4 20:31:40 2013
New Revision: 249108
URL: http://svnweb.freebsd.org/changeset/base/249108

Log:
  MFprojects/camlock:
  r249017:
  Some cosmetic things:
   - Unify device to target insertion inside xpt_alloc_device() instead of
  duplicating it three times.
   - Remove extra checks for empty lists of devices and targets on release
  since zero refcount check also implies it.
   - Reformat code to reduce indentation.
  
  r249103:
   - Add lock assertions to every point where reference counters are modified.
   - When reference counters are reaching zero, add assertions that there are
  no children items left.
   - Add a bit more locking to the xptpdperiphtraverse().

Modified:
  head/sys/cam/ata/ata_xpt.c
  head/sys/cam/cam_periph.c
  head/sys/cam/cam_sim.c
  head/sys/cam/cam_xpt.c
  head/sys/cam/scsi/scsi_xpt.c

Modified: head/sys/cam/ata/ata_xpt.c
==
--- head/sys/cam/ata/ata_xpt.c  Thu Apr  4 19:31:19 2013(r249107)
+++ head/sys/cam/ata/ata_xpt.c  Thu Apr  4 20:31:40 2013(r249108)
@@ -1534,7 +1534,6 @@ ata_alloc_device(struct cam_eb *bus, str
struct cam_path path;
struct ata_quirk_entry *quirk;
struct cam_ed *device;
-   struct cam_ed *cur_device;
 
device = xpt_alloc_device(bus, target, lun_id);
if (device == NULL)
@@ -1559,16 +1558,6 @@ ata_alloc_device(struct cam_eb *bus, str
 * do.
 */
bus-sim-max_ccbs += device-ccbq.devq_openings;
-   /* Insertion sort into our target's device list */
-   cur_device = TAILQ_FIRST(target-ed_entries);
-   while (cur_device != NULL  cur_device-lun_id  lun_id)
-   cur_device = TAILQ_NEXT(cur_device, links);
-   if (cur_device != NULL) {
-   TAILQ_INSERT_BEFORE(cur_device, device, links);
-   } else {
-   TAILQ_INSERT_TAIL(target-ed_entries, device, links);
-   }
-   target-generation++;
if (lun_id != CAM_LUN_WILDCARD) {
xpt_compile_path(path,
 NULL,

Modified: head/sys/cam/cam_periph.c
==
--- head/sys/cam/cam_periph.c   Thu Apr  4 19:31:19 2013(r249107)
+++ head/sys/cam/cam_periph.c   Thu Apr  4 20:31:40 2013(r249108)
@@ -378,13 +378,10 @@ cam_periph_acquire(struct cam_periph *pe
 void
 cam_periph_release_locked_buses(struct cam_periph *periph)
 {
-   if (periph-refcount != 0) {
-   periph-refcount--;
-   } else {
-   panic(%s: release of %p when refcount is zero\n , __func__,
- periph);
-   }
-   if (periph-refcount == 0
+
+   mtx_assert(periph-sim-mtx, MA_OWNED);
+   KASSERT(periph-refcount = 1, (periph-refcount = 1));
+   if (--periph-refcount == 0
 (periph-flags  CAM_PERIPH_INVALID)) {
camperiphfree(periph);
}
@@ -583,6 +580,7 @@ cam_periph_invalidate(struct cam_periph 
 {
 
CAM_DEBUG(periph-path, CAM_DEBUG_INFO, (Periph invalidated\n));
+   mtx_assert(periph-sim-mtx, MA_OWNED);
/*
 * We only call this routine the first time a peripheral is
 * invalidated.
@@ -605,6 +603,7 @@ camperiphfree(struct cam_periph *periph)
 {
struct periph_driver **p_drv;
 
+   mtx_assert(periph-sim-mtx, MA_OWNED);
for (p_drv = periph_drivers; *p_drv != NULL; p_drv++) {
if (strcmp((*p_drv)-driver_name, periph-periph_name) == 0)
break;

Modified: head/sys/cam/cam_sim.c
==
--- head/sys/cam/cam_sim.c  Thu Apr  4 19:31:19 2013(r249107)
+++ head/sys/cam/cam_sim.c  Thu Apr  4 20:31:40 2013(r249108)
@@ -109,6 +109,7 @@ cam_sim_free(struct cam_sim *sim, int fr
union ccb *ccb;
int error;
 
+   mtx_assert(sim-mtx, MA_OWNED);
sim-refcount--;
if (sim-refcount  0) {
error = msleep(sim, sim-mtx, PRIBIO, simfree, 0);

Modified: head/sys/cam/cam_xpt.c
==
--- head/sys/cam/cam_xpt.c  Thu Apr  4 19:31:19 2013(r249107)
+++ head/sys/cam/cam_xpt.c  Thu Apr  4 20:31:40 2013(r249108)
@@ -2069,6 +2069,7 @@ xpttargettraverse(struct cam_eb *bus, st
struct cam_et *target, *next_target;
int retval;
 
+   mtx_assert(bus-sim-mtx, MA_OWNED);
retval = 1;
for (target = (start_target ? start_target :
   TAILQ_FIRST(bus-et_entries));
@@ -2096,6 +2097,7 @@ xptdevicetraverse(struct cam_et *target,
struct cam_ed *device, *next_device;
int retval;
 
+   mtx_assert(target-bus-sim-mtx, MA_OWNED);
retval = 1;
for (device = (start_device ? start_device :
   

Re: svn commit: r249105 - in head/sys/cam: ata scsi

2013-04-04 Thread Adrian Chadd
Hi,

Isn't this a prime candidate to replace with KASSERT()?

Thanks,


Adrian

On 4 April 2013 12:04, Alexander Motin m...@freebsd.org wrote:
 Author: mav
 Date: Thu Apr  4 19:04:15 2013
 New Revision: 249105
 URL: http://svnweb.freebsd.org/changeset/base/249105

 Log:
   MFprojects/camlock r248930:
   Remove extra NULL checks. d_drv1 can never be NULL during periph life cycle.

   MFC after:2 weeks

 Modified:
   head/sys/cam/ata/ata_da.c
   head/sys/cam/scsi/scsi_cd.c
   head/sys/cam/scsi/scsi_da.c

 Modified: head/sys/cam/ata/ata_da.c
 ==
 --- head/sys/cam/ata/ata_da.c   Thu Apr  4 18:59:29 2013(r249104)
 +++ head/sys/cam/ata/ata_da.c   Thu Apr  4 19:04:15 2013(r249105)
 @@ -527,10 +527,6 @@ adaopen(struct disk *dp)
 int error;

 periph = (struct cam_periph *)dp-d_drv1;
 -   if (periph == NULL) {
 -   return (ENXIO);
 -   }
 -
 if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
 return(ENXIO);
 }
 @@ -566,9 +562,6 @@ adaclose(struct disk *dp)
 union ccb *ccb;

 periph = (struct cam_periph *)dp-d_drv1;
 -   if (periph == NULL)
 -   return (ENXIO);
 -
 cam_periph_lock(periph);
 if (cam_periph_hold(periph, PRIBIO) != 0) {
 cam_periph_unlock(periph);
 @@ -646,10 +639,6 @@ adastrategy(struct bio *bp)
 struct ada_softc *softc;

 periph = (struct cam_periph *)bp-bio_disk-d_drv1;
 -   if (periph == NULL) {
 -   biofinish(bp, NULL, ENXIO);
 -   return;
 -   }
 softc = (struct ada_softc *)periph-softc;

 cam_periph_lock(periph);
 @@ -704,8 +693,6 @@ adadump(void *arg, void *virtual, vm_off

 dp = arg;
 periph = dp-d_drv1;
 -   if (periph == NULL)
 -   return (ENXIO);
 softc = (struct ada_softc *)periph-softc;
 cam_periph_lock(periph);
 secsize = softc-params.secsize;
 @@ -1038,9 +1025,6 @@ adagetattr(struct bio *bp)
 struct cam_periph *periph;

 periph = (struct cam_periph *)bp-bio_disk-d_drv1;
 -   if (periph == NULL)
 -   return (ENXIO);
 -
 cam_periph_lock(periph);
 ret = xpt_getattr(bp-bio_data, bp-bio_length, bp-bio_attribute,
 periph-path);

 Modified: head/sys/cam/scsi/scsi_cd.c
 ==
 --- head/sys/cam/scsi/scsi_cd.c Thu Apr  4 18:59:29 2013(r249104)
 +++ head/sys/cam/scsi/scsi_cd.c Thu Apr  4 19:04:15 2013(r249105)
 @@ -386,7 +386,6 @@ cddiskgonecb(struct disk *dp)
 struct cam_periph *periph;

 periph = (struct cam_periph *)dp-d_drv1;
 -
 cam_periph_release(periph);
  }

 @@ -1073,9 +1072,6 @@ cdopen(struct disk *dp)
 int error;

 periph = (struct cam_periph *)dp-d_drv1;
 -   if (periph == NULL)
 -   return (ENXIO);
 -
 softc = (struct cd_softc *)periph-softc;

 if (cam_periph_acquire(periph) != CAM_REQ_CMP)
 @@ -1120,9 +1116,6 @@ cdclose(struct disk *dp)
 struct  cd_softc *softc;

 periph = (struct cam_periph *)dp-d_drv1;
 -   if (periph == NULL)
 -   return (ENXIO);
 -
 softc = (struct cd_softc *)periph-softc;

 cam_periph_lock(periph);
 @@ -1473,11 +1466,6 @@ cdstrategy(struct bio *bp)
 struct cd_softc *softc;

 periph = (struct cam_periph *)bp-bio_disk-d_drv1;
 -   if (periph == NULL) {
 -   biofinish(bp, NULL, ENXIO);
 -   return;
 -   }
 -
 cam_periph_lock(periph);
 CAM_DEBUG(periph-path, CAM_DEBUG_TRACE,
 (cdstrategy(%p)\n, bp));
 @@ -1972,9 +1960,6 @@ cdioctl(struct disk *dp, u_long cmd, voi
 int nocopyout, error = 0;

 periph = (struct cam_periph *)dp-d_drv1;
 -   if (periph == NULL)
 -   return(ENXIO);
 -
 cam_periph_lock(periph);

 softc = (struct cd_softc *)periph-softc;

 Modified: head/sys/cam/scsi/scsi_da.c
 ==
 --- head/sys/cam/scsi/scsi_da.c Thu Apr  4 18:59:29 2013(r249104)
 +++ head/sys/cam/scsi/scsi_da.c Thu Apr  4 19:04:15 2013(r249105)
 @@ -962,10 +962,6 @@ daopen(struct disk *dp)
 int error;

 periph = (struct cam_periph *)dp-d_drv1;
 -   if (periph == NULL) {
 -   return (ENXIO);
 -   }
 -
 if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
 return (ENXIO);
 }
 @@ -1027,9 +1023,6 @@ daclose(struct disk *dp)
 struct  da_softc *softc;

 periph = (struct cam_periph *)dp-d_drv1;
 -   if (periph == NULL)
 -   return (0);
 -
 cam_periph_lock(periph);
 if (cam_periph_hold(periph, PRIBIO) != 0) {
 cam_periph_unlock(periph);
 @@ -1118,10 

Re: svn commit: r249105 - in head/sys/cam: ata scsi

2013-04-04 Thread Alexander Motin

On 04.04.2013 23:53, Adrian Chadd wrote:

Hi,

Isn't this a prime candidate to replace with KASSERT()?


It could be, but NULL dereference attempt will crash system no less 
reliably then KASSERT.



On 4 April 2013 12:04, Alexander Motin m...@freebsd.org wrote:

Author: mav
Date: Thu Apr  4 19:04:15 2013
New Revision: 249105
URL: http://svnweb.freebsd.org/changeset/base/249105

Log:
   MFprojects/camlock r248930:
   Remove extra NULL checks. d_drv1 can never be NULL during periph life cycle.

   MFC after:2 weeks

Modified:
   head/sys/cam/ata/ata_da.c
   head/sys/cam/scsi/scsi_cd.c
   head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Thu Apr  4 18:59:29 2013(r249104)
+++ head/sys/cam/ata/ata_da.c   Thu Apr  4 19:04:15 2013(r249105)
@@ -527,10 +527,6 @@ adaopen(struct disk *dp)
 int error;

 periph = (struct cam_periph *)dp-d_drv1;
-   if (periph == NULL) {
-   return (ENXIO);
-   }
-
 if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
 return(ENXIO);
 }
@@ -566,9 +562,6 @@ adaclose(struct disk *dp)
 union ccb *ccb;

 periph = (struct cam_periph *)dp-d_drv1;
-   if (periph == NULL)
-   return (ENXIO);
-
 cam_periph_lock(periph);
 if (cam_periph_hold(periph, PRIBIO) != 0) {
 cam_periph_unlock(periph);
@@ -646,10 +639,6 @@ adastrategy(struct bio *bp)
 struct ada_softc *softc;

 periph = (struct cam_periph *)bp-bio_disk-d_drv1;
-   if (periph == NULL) {
-   biofinish(bp, NULL, ENXIO);
-   return;
-   }
 softc = (struct ada_softc *)periph-softc;

 cam_periph_lock(periph);
@@ -704,8 +693,6 @@ adadump(void *arg, void *virtual, vm_off

 dp = arg;
 periph = dp-d_drv1;
-   if (periph == NULL)
-   return (ENXIO);
 softc = (struct ada_softc *)periph-softc;
 cam_periph_lock(periph);
 secsize = softc-params.secsize;
@@ -1038,9 +1025,6 @@ adagetattr(struct bio *bp)
 struct cam_periph *periph;

 periph = (struct cam_periph *)bp-bio_disk-d_drv1;
-   if (periph == NULL)
-   return (ENXIO);
-
 cam_periph_lock(periph);
 ret = xpt_getattr(bp-bio_data, bp-bio_length, bp-bio_attribute,
 periph-path);

Modified: head/sys/cam/scsi/scsi_cd.c
==
--- head/sys/cam/scsi/scsi_cd.c Thu Apr  4 18:59:29 2013(r249104)
+++ head/sys/cam/scsi/scsi_cd.c Thu Apr  4 19:04:15 2013(r249105)
@@ -386,7 +386,6 @@ cddiskgonecb(struct disk *dp)
 struct cam_periph *periph;

 periph = (struct cam_periph *)dp-d_drv1;
-
 cam_periph_release(periph);
  }

@@ -1073,9 +1072,6 @@ cdopen(struct disk *dp)
 int error;

 periph = (struct cam_periph *)dp-d_drv1;
-   if (periph == NULL)
-   return (ENXIO);
-
 softc = (struct cd_softc *)periph-softc;

 if (cam_periph_acquire(periph) != CAM_REQ_CMP)
@@ -1120,9 +1116,6 @@ cdclose(struct disk *dp)
 struct  cd_softc *softc;

 periph = (struct cam_periph *)dp-d_drv1;
-   if (periph == NULL)
-   return (ENXIO);
-
 softc = (struct cd_softc *)periph-softc;

 cam_periph_lock(periph);
@@ -1473,11 +1466,6 @@ cdstrategy(struct bio *bp)
 struct cd_softc *softc;

 periph = (struct cam_periph *)bp-bio_disk-d_drv1;
-   if (periph == NULL) {
-   biofinish(bp, NULL, ENXIO);
-   return;
-   }
-
 cam_periph_lock(periph);
 CAM_DEBUG(periph-path, CAM_DEBUG_TRACE,
 (cdstrategy(%p)\n, bp));
@@ -1972,9 +1960,6 @@ cdioctl(struct disk *dp, u_long cmd, voi
 int nocopyout, error = 0;

 periph = (struct cam_periph *)dp-d_drv1;
-   if (periph == NULL)
-   return(ENXIO);
-
 cam_periph_lock(periph);

 softc = (struct cd_softc *)periph-softc;

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Thu Apr  4 18:59:29 2013(r249104)
+++ head/sys/cam/scsi/scsi_da.c Thu Apr  4 19:04:15 2013(r249105)
@@ -962,10 +962,6 @@ daopen(struct disk *dp)
 int error;

 periph = (struct cam_periph *)dp-d_drv1;
-   if (periph == NULL) {
-   return (ENXIO);
-   }
-
 if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
 return (ENXIO);
 }
@@ -1027,9 +1023,6 @@ daclose(struct disk *dp)
 struct  da_softc *softc;

 periph = (struct cam_periph *)dp-d_drv1;
-   if (periph == NULL)
-   return (0);
-
 cam_periph_lock(periph);
 if (cam_periph_hold(periph, PRIBIO) != 0) {
   

Re: svn commit: r249035 - head/lib/libc/stdlib

2013-04-04 Thread Jilles Tjoelker
On Wed, Apr 03, 2013 at 06:04:37PM +1100, Bruce Evans wrote:
  Modified: head/lib/libc/stdlib/rand.c
  ==
  --- head/lib/libc/stdlib/rand.c Tue Apr  2 21:34:38 2013
  (r249034)
  +++ head/lib/libc/stdlib/rand.c Tue Apr  2 23:41:20 2013
  (r249035)
  ...
  @@ -112,28 +111,20 @@ u_int seed;
   * sranddev:
   *
   * Many programs choose the seed value in a totally predictable manner.
  - * This often causes problems.  We seed the generator using the much more
  - * secure random(4) interface.
  + * This often causes problems.  We seed the generator using pseudo-random
  + * data from the kernel.
   */
  void
  sranddev()
  {
  -   int fd, done;
  +   int mib[2];
  +   size_t len;
 
  -   done = 0;
  -   fd = _open(/dev/random, O_RDONLY | O_CLOEXEC, 0);
  -   if (fd = 0) {
  -   if (_read(fd, (void *) next, sizeof(next)) == sizeof(next))
  -   done = 1;
  -   _close(fd);
  -   }
  -
  -   if (!done) {
  -   struct timeval tv;
  -
  -   gettimeofday(tv, NULL);
  -   srand((getpid()  16) ^ tv.tv_sec ^ tv.tv_usec);
  -   }

 _open() and _read() are unlikely to fail, but there was error checking and
 handling for them.  There was no error checking for the gettimeofday()
 call in the error handling.  The man page's documentaion of the
 implementation details was wrong if the error handling was used.

In some sense, omitting the error handling wires down that capability
mode must continue to permit KERN_ARND.

 This is part of the implementation of the STANDARD library, so it
 cannot use POSIX extensions directly.  It was careful about this for
 _open() and _close(), but not for gettimeofday() or getpid().  This
 is completely backwards.  _open and _read are in namespace.h so there
 is no need to spell them with an underscore, while gettimeofday and
 getpid is not in namespace.h so they do need to be spelled with an
 underscore.

The purpose of namespace.h and un-namespace.h is to declare the
underscore versions using the normal headers. Therefore, all functions
in namespace.h must be called from libc as their underscore versions.

The functions in namespace.h are basically all functions that have or
had to be overridden by a threading library, such as for cancellation
points, avoiding interference with SIGTHR and libc_r's file descriptor
trickery.

 This file has massive other (link-time) namespace pollution which makes
 the above namespace errors moot.  The STANDARD functions that it
 implements are rand() and srand().  It implements the extensions
 rand_r() and sranddev().  These are not hidden in any way, so they
 break public symbols of the same name in the application namespace.
 They are not used by rand() or srand(), so they don't break calls to
 these functions.  They should break linkage to the standard function
 if the application has public symbols of the same name.  Such breakage
 is good for detecting the error, but it only works with static linkage.

With dynamic linking there is no error at all for functions defined by
the main executable, as long as libc itself does not call the functions
by their unadorned names. For example, if the application defines a
public symbol rand_r, it completely hides libc's version. If the symbol
is in a library belonging to the application, ld may be confused about
which version to use.

  +   len = sizeof(next);
  +
  +   mib[0] = CTL_KERN;
  +   mib[1] = KERN_ARND;
  +   sysctl(mib, 2, (void *)next, len, NULL, 0);
  }

 The sysctl() is certain to fail on old kernels (like open of /dev/random
 on even older kernels), but there is no longer any error checking or
 handling.  The contents of `next' on error is indeterminate (not documented
 in the man page), but is probably unchanged.  Applications can actually
 detect this error although though the API doesn't support this, by
 using the documented implementation details and assuming that errno
 is properly left changed if the syscall fails (set errno to 0 before
 the call here and check it after).

 sysctl() is not even in any version POSIX.1, so it is further from being
 directly usable than _open() and _read().  It is like gettimeofday()
 above -- not in namespace.h.

It may indeed be useful to add more to namespace.h to avoid interference
from the application. Where the functions need not be interposed or used
by libthr, they should be removed from Symbol.map so they are called
directly instead of via the PLT in libc.so. The fact that libthr is a
separate library makes the latter part harder.

 Style bugs:
 - blank line that separates the initialization of `len' from its use
 - unsorted initializations (`len' is a secondary part of the sysctl data
so it might as well be initialized after 'mib'
 - use of sysctl() instead of sysctlbyname()
 - existence of KERN_ARND so that use of sysctl() is possible.  KERN_ARND
is much newer than sysctlbyname(), so it 

Re: svn commit: r249096 - head/sys/rpc/rpcsec_gss

2013-04-04 Thread Rick Macklem
Glebius wrote:
 George, Rick,
 
 On Thu, Apr 04, 2013 at 03:16:54PM +, George V. Neville-Neil
 wrote:
 G Modified: head/sys/rpc/rpcsec_gss/rpcsec_gss_prot.c
 G
 ==
 G --- head/sys/rpc/rpcsec_gss/rpcsec_gss_prot.c Thu Apr 4 15:03:12
 2013 (r249095)
 G +++ head/sys/rpc/rpcsec_gss/rpcsec_gss_prot.c Thu Apr 4 15:16:53
 2013 (r249096)
 G @@ -208,6 +208,8 @@ m_trim(struct mbuf *m, int len)
 G struct mbuf *n;
 G int off;
 G
 G + if (m == NULL)
 G + return;
Yep. If I recall correctly, my patch checked for a non-NULL argument
before calling m_trim(), but adding this sanity check seems like a
good idea to me, if only to avoid problems caused by modified calls
to m_trim() in the future.

I'd think you could just commit this without so@'s involvement? rick

 G n = m_getptr(m, len, off);
 G if (n) {
 G n-m_len = off;
 
 I think the code will be much more rocksolid, if the function won't be
 called with NULL argument.
 
 --
 Totus tuus, Glebius.
___
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: r249096 - head/sys/rpc/rpcsec_gss

2013-04-04 Thread Rick Macklem
Glebius wrote:
 George, Rick,
 
 On Thu, Apr 04, 2013 at 03:16:54PM +, George V. Neville-Neil
 wrote:
 G Modified: head/sys/rpc/rpcsec_gss/rpcsec_gss_prot.c
 G
 ==
 G --- head/sys/rpc/rpcsec_gss/rpcsec_gss_prot.c Thu Apr 4 15:03:12
 2013 (r249095)
 G +++ head/sys/rpc/rpcsec_gss/rpcsec_gss_prot.c Thu Apr 4 15:16:53
 2013 (r249096)
 G @@ -208,6 +208,8 @@ m_trim(struct mbuf *m, int len)
 G struct mbuf *n;
 G int off;
 G
 G + if (m == NULL)
 G + return;
 G n = m_getptr(m, len, off);
 G if (n) {
 G n-m_len = off;
 
 I think the code will be much more rocksolid, if the function won't be
 called with NULL argument.
 
Oops, my confusion. I thought you were suggesting the above change. I
suppose the callers should be fixed as well, but having the check here
seems like a good idea?

Feel free to add code to the callers to check for a NULL m arguement, rick

 --
 Totus tuus, Glebius.
___
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: r249112 - in head: sys/conf sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/contrib/dev/acpica/compon...

2013-04-04 Thread Jung-uk Kim
Author: jkim
Date: Thu Apr  4 22:11:30 2013
New Revision: 249112
URL: http://svnweb.freebsd.org/changeset/base/249112

Log:
  Merge ACPICA 20130328.

Added:
  head/sys/contrib/dev/acpica/compiler/asllistsup.c
 - copied, changed from r249110, 
vendor-sys/acpica/dist/source/compiler/asllistsup.c
  head/sys/contrib/dev/acpica/compiler/asloffset.c
 - copied, changed from r249110, 
vendor-sys/acpica/dist/source/compiler/asloffset.c
  head/sys/contrib/dev/acpica/components/utilities/utpredef.c
 - copied, changed from r249110, 
vendor-sys/acpica/dist/source/components/utilities/utpredef.c
Modified:
  head/sys/conf/files
  head/sys/contrib/dev/acpica/changes.txt   (contents, props changed)
  head/sys/contrib/dev/acpica/common/ahpredef.c
  head/sys/contrib/dev/acpica/compiler/aslcompile.c
  head/sys/contrib/dev/acpica/compiler/aslcompiler.h
  head/sys/contrib/dev/acpica/compiler/asldefine.h
  head/sys/contrib/dev/acpica/compiler/aslerror.c
  head/sys/contrib/dev/acpica/compiler/aslfiles.c
  head/sys/contrib/dev/acpica/compiler/aslglobal.h
  head/sys/contrib/dev/acpica/compiler/asllisting.c
  head/sys/contrib/dev/acpica/compiler/aslmain.c
  head/sys/contrib/dev/acpica/compiler/aslpredef.c
  head/sys/contrib/dev/acpica/compiler/aslprepkg.c
  head/sys/contrib/dev/acpica/compiler/aslresource.c
  head/sys/contrib/dev/acpica/compiler/asltypes.h
  head/sys/contrib/dev/acpica/compiler/aslwalks.c
  head/sys/contrib/dev/acpica/components/debugger/dbmethod.c
  head/sys/contrib/dev/acpica/components/debugger/dbnames.c
  head/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c
  head/sys/contrib/dev/acpica/components/dispatcher/dswexec.c
  head/sys/contrib/dev/acpica/components/events/evevent.c
  head/sys/contrib/dev/acpica/components/executer/exoparg2.c
  head/sys/contrib/dev/acpica/components/namespace/nseval.c
  head/sys/contrib/dev/acpica/components/namespace/nspredef.c
  head/sys/contrib/dev/acpica/components/tables/tbfadt.c
  head/sys/contrib/dev/acpica/components/tables/tbxface.c
  head/sys/contrib/dev/acpica/components/utilities/utdelete.c
  head/sys/contrib/dev/acpica/components/utilities/utmutex.c
  head/sys/contrib/dev/acpica/components/utilities/utosi.c
  head/sys/contrib/dev/acpica/components/utilities/utxface.c
  head/sys/contrib/dev/acpica/include/acglobal.h
  head/sys/contrib/dev/acpica/include/aclocal.h
  head/sys/contrib/dev/acpica/include/acnamesp.h
  head/sys/contrib/dev/acpica/include/acpixf.h
  head/sys/contrib/dev/acpica/include/acpredef.h
  head/sys/contrib/dev/acpica/include/acutils.h
  head/usr.sbin/acpi/acpidb/Makefile
  head/usr.sbin/acpi/iasl/Makefile
Directory Properties:
  head/sys/contrib/dev/acpica/   (props changed)
  head/sys/contrib/dev/acpica/common/   (props changed)
  head/sys/contrib/dev/acpica/compiler/   (props changed)
  head/sys/contrib/dev/acpica/components/debugger/   (props changed)
  head/sys/contrib/dev/acpica/components/dispatcher/   (props changed)
  head/sys/contrib/dev/acpica/components/events/   (props changed)
  head/sys/contrib/dev/acpica/components/executer/   (props changed)
  head/sys/contrib/dev/acpica/components/namespace/   (props changed)
  head/sys/contrib/dev/acpica/components/tables/   (props changed)
  head/sys/contrib/dev/acpica/components/utilities/   (props changed)
  head/sys/contrib/dev/acpica/include/   (props changed)

Modified: head/sys/conf/files
==
--- head/sys/conf/files Thu Apr  4 21:34:22 2013(r249111)
+++ head/sys/conf/files Thu Apr  4 22:11:30 2013(r249112)
@@ -443,6 +443,7 @@ contrib/dev/acpica/components/utilities/
 contrib/dev/acpica/components/utilities/utobject.c optional acpi
 contrib/dev/acpica/components/utilities/utosi.coptional acpi
 contrib/dev/acpica/components/utilities/utownerid.coptional acpi
+contrib/dev/acpica/components/utilities/utpredef.c optional acpi
 contrib/dev/acpica/components/utilities/utresrc.c  optional acpi
 contrib/dev/acpica/components/utilities/utstate.c  optional acpi
 contrib/dev/acpica/components/utilities/utstring.c optional acpi

Modified: head/sys/contrib/dev/acpica/changes.txt
==
--- head/sys/contrib/dev/acpica/changes.txt Thu Apr  4 21:34:22 2013
(r249111)
+++ head/sys/contrib/dev/acpica/changes.txt Thu Apr  4 22:11:30 2013
(r249112)
@@ -1,4 +1,79 @@
 
+28 March 2013. Summary of changes for version 20130328:
+
+1) ACPICA kernel-resident subsystem:
+
+Fixed several possible race conditions with the internal object reference 
+counting mechanism. Some of the external ACPICA interfaces update object 
+reference counts without holding the interpreter or namespace lock. This 
+change adds a spinlock to protect reference count updates on the internal 
+ACPICA objects. Reported by and with assistance from Andriy Gapon 

svn commit: r249113 - in head: share/misc usr.bin/calendar/calendars

2013-04-04 Thread William Grzybowski
Author: wg (ports committer)
Date: Thu Apr  4 23:11:56 2013
New Revision: 249113
URL: http://svnweb.freebsd.org/changeset/base/249113

Log:
  Add myself as a ports committer and my mentor relationship.
  
  While in the repository, add myself to calendar.freebsd.
  
  Approved by:  jpaetzel (mentor)

Modified:
  head/share/misc/committers-ports.dot
  head/usr.bin/calendar/calendars/calendar.freebsd

Modified: head/share/misc/committers-ports.dot
==
--- head/share/misc/committers-ports.dotThu Apr  4 22:11:30 2013
(r249112)
+++ head/share/misc/committers-ports.dotThu Apr  4 23:11:56 2013
(r249113)
@@ -204,6 +204,7 @@ trhodes [label=Tom Rhodes\ntrhodes@Free
 uqs [label=Ulrich Spoerlein\n...@freebsd.org\n2012/01/19]
 vd [label=Vasil Dimov\n...@freebsd.org\n2006/01/19]
 wen [label=Wen Heping\n...@freebsd.org\n2010/12/13]
+wg [label=William Grzybowski\n...@freebsd.org\n2013/04/01]
 wxs [label=Wesley Shields\n...@freebsd.org\n2008/01/03]
 xride [label=Soeren Straarup\nxr...@freebsd.org\n2006/09/27]
 yzlin [label=Yi-Jheng Lin\nyz...@freebsd.org\n2009/07/19]
@@ -270,6 +271,7 @@ crees - gblach
 crees - tijl
 
 culot - jase
+culot - wg
 
 db - tj
 
@@ -317,6 +319,8 @@ flz - johans
 flz - laszlof
 flz - romain
 
+jpaetzel - wg
+
 gabor - lippe
 gabor - pgj
 gabor - stephen

Modified: head/usr.bin/calendar/calendars/calendar.freebsd
==
--- head/usr.bin/calendar/calendars/calendar.freebsdThu Apr  4 22:11:30 
2013(r249112)
+++ head/usr.bin/calendar/calendars/calendar.freebsdThu Apr  4 23:11:56 
2013(r249113)
@@ -270,6 +270,7 @@
 08/29  Thomas Gellekum t...@freebsd.org born in Moenchengladbach, 
Nordrhein-Westfalen, Germany, 1967
 08/29  Max Laier mla...@freebsd.org born in Karlsruhe, Germany, 1981
 09/01  Pyun YongHyeon yong...@freebsd.org born in Kimcheon, Korea, 1968
+09/01  William Grzybowski w...@freebsd.org born in Parana, Brazil, 1988
 09/03  Max Khon f...@freebsd.org born in Novosibirsk, USSR, 1976
 09/03  Cheng-Lung Sung cls...@freebsd.org born in Taipei, Taiwan, Republic 
of China, 1977
 09/05  Mark Robert Vaughan Murray ma...@freebsd.org born in Harare, 
Mashonaland, Zimbabwe, 1961
___
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: r249115 - in head: sbin/camcontrol sys/sys

2013-04-04 Thread Steven Hartland
Author: smh
Date: Thu Apr  4 23:19:51 2013
New Revision: 249115
URL: http://svnweb.freebsd.org/changeset/base/249115

Log:
  Adds security options to camcontrol this includes the ability to secure erase
  disks such as SSD's
  
  Adds the ability to run ATA commands via the SCSI ATA Pass-Through(16) comand
  
  Reviewed by:  mav
  Approved by:  pjd (mentor)
  MFC after:2 weeks

Modified:
  head/sbin/camcontrol/camcontrol.8
  head/sbin/camcontrol/camcontrol.c
  head/sys/sys/ata.h

Modified: head/sbin/camcontrol/camcontrol.8
==
--- head/sbin/camcontrol/camcontrol.8   Thu Apr  4 23:14:14 2013
(r249114)
+++ head/sbin/camcontrol/camcontrol.8   Thu Apr  4 23:19:51 2013
(r249115)
@@ -228,6 +228,21 @@
 .Op Fl y
 .Op Fl s
 .Nm
+.Ic security
+.Op device id
+.Op generic args
+.Op Fl d Ar pwd
+.Op Fl e Ar pwd
+.Op Fl f
+.Op Fl h Ar pwd
+.Op Fl k Ar pwd
+.Op Fl l Ar high|maximum
+.Op Fl q
+.Op Fl s Ar pwd
+.Op Fl T Ar timeout
+.Op Fl U Ar user|master
+.Op Fl y
+.Nm
 .Ic help
 .Sh DESCRIPTION
 The
@@ -1072,6 +1087,123 @@ specifies automatic standby timer value 
 .It Ic sleep
 Put ATA device into SLEEP state. Note that the only way get device out of
 this state may be reset.
+.It Ic security
+Update or report security settings, using an ATA identify command (0xec).
+By default,
+.Nm
+will print out the security support and associated settings of the device.
+The
+.Ic security
+command takes several arguments:
+.Bl -tag -width 0n
+.It Fl d Ar pwd
+.Pp
+Disable device security using the given password for the selected user 
according
+to the devices configured security level.
+.It Fl e Ar pwd
+.Pp
+Erase the device using the given password for the selected user.
+.Pp
+.Em WARNING! WARNING! WARNING!
+.Pp
+Issuing a secure erase will
+.Em ERASE ALL
+user data on the device and may take several hours to complete.
+.Pp
+When this command is used against an SSD drive all its cells will be marked as
+empty, restoring it to factory default write performance. For SSD's this action
+usually takes just a few seconds.
+.It Fl f
+.Pp
+Freeze the security configuration of the specified device.
+.Pp
+After command completion any other commands that update the device lock mode
+shall be command aborted. Frozen mode is disabled by power-off or hardware 
reset. 
+.It Fl h Ar pwd
+.Pp
+Enhanced erase the device using the given password for the selected user.
+.Pp
+.Em WARNING! WARNING! WARNING!
+.Pp
+Issuing an enhanced secure erase will 
+.Em ERASE ALL
+user data on the device and may take several hours to complete.
+.Pp
+An enhanced erase writes predetermined data patterns to all user data areas,
+all previously written user data shall be overwritten, including sectors that
+are no longer in use due to reallocation.
+.It Fl k Ar pwd
+.Pp
+Unlock the device using the given password for the selected user according to
+the devices configured security level.
+.It Fl l Ar high|maximum
+.Pp
+Specifies which security level to set when issuing a
+.Fl s Ar pwd
+command. The security level determines device behavior when the master
+password is used to unlock the device. When the security level is set to high
+the device requires the unlock command and the master password to unlock.
+When the security level is set to maximum the device requires a secure erase
+with the master password to unlock.
+.Pp
+This option must be used in conjunction with one of the security action 
commands.
+.Pp
+Defaults to
+.Em high
+.It Fl q
+.Pp
+Be quiet, do not print any status messages.
+This option will not disable the questions, however.
+To disable questions, use the
+.Fl y
+argument, below.
+.It Fl s Ar pwd
+.Pp
+Password the device (enable security) using the given password for the selected
+user. This option can be combined with other options such as
+.Fl e Em pwd
+.Pp
+A master password may be set in a addition to the user password. The purpose of
+the master password is to allow an administrator to establish a password that
+is kept secret from the user, and which may be used to unlock the device if the
+user password is lost.
+.Pp
+.Em Note:
+Setting the master password does not enable device security.
+.Pp
+If the master password is set and the drive supports a Master Revision Code
+feature the Master Password Revision Code will be decremented.
+.It Fl T Ar timeout
+.Pp
+Overrides the default timeout, specified in seconds, used for both
+.Fl e
+and
+.Fl h
+this is useful if your system has problems processing long timeouts correctly.
+.Pp
+Usually the timeout is calculated from the information stored on the drive if
+present, otherwise it defaults to 2 hours.
+.It Fl U Ar user|master
+.Pp
+Specifies which user to set / use for the running action command, valid values
+are user or master and defaults to master if not set.
+.Pp
+This option must be used in conjunction with one of the security action 
commands.
+.Pp
+Defaults to
+.Em master
+.It Fl y
+.Pp
+Confirm 

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

2013-04-04 Thread Adrian Chadd
Author: adrian
Date: Fri Apr  5 00:22:17 2013
New Revision: 249118
URL: http://svnweb.freebsd.org/changeset/base/249118

Log:
  * Add AR9330/AR9331 to the soc identifier enum;
  * Set it when probing the CPU type.

Modified:
  head/sys/mips/atheros/ar71xx_setup.c
  head/sys/mips/atheros/ar71xx_setup.h

Modified: head/sys/mips/atheros/ar71xx_setup.c
==
--- head/sys/mips/atheros/ar71xx_setup.cFri Apr  5 00:21:17 2013
(r249117)
+++ head/sys/mips/atheros/ar71xx_setup.cFri Apr  5 00:22:17 2013
(r249118)
@@ -148,11 +148,13 @@ ar71xx_detect_sys_type(void)
rev = (id  AR933X_REV_ID_REVISION_MASK);
chip = 9330;
ar71xx_cpu_ops = ar933x_chip_def;
+   ar71xx_soc = AR71XX_SOC_AR9330;
break;
case REV_ID_MAJOR_AR9331:
minor = 1;
rev = (id  AR933X_REV_ID_REVISION_MASK);
chip = 9331;
+   ar71xx_soc = AR71XX_SOC_AR9331;
ar71xx_cpu_ops = ar933x_chip_def;
break;
 

Modified: head/sys/mips/atheros/ar71xx_setup.h
==
--- head/sys/mips/atheros/ar71xx_setup.hFri Apr  5 00:21:17 2013
(r249117)
+++ head/sys/mips/atheros/ar71xx_setup.hFri Apr  5 00:22:17 2013
(r249118)
@@ -38,7 +38,9 @@ enum ar71xx_soc_type {
AR71XX_SOC_AR7241,
AR71XX_SOC_AR7242,
AR71XX_SOC_AR9130,
-   AR71XX_SOC_AR9132
+   AR71XX_SOC_AR9132,
+   AR71XX_SOC_AR9330,
+   AR71XX_SOC_AR9331,
 };
 extern enum ar71xx_soc_type ar71xx_soc;   
 
___
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: r249119 - head/sys/mips/atheros

2013-04-04 Thread Adrian Chadd
Author: adrian
Date: Fri Apr  5 00:22:53 2013
New Revision: 249119
URL: http://svnweb.freebsd.org/changeset/base/249119

Log:
  AR9330/AR9331 also needs to ACK the APB interrupt register, same as
  AR724x.
  
  This fixes 'stuck interrupt' problems I was having when writing the
  uart interrupt code.

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

Modified: head/sys/mips/atheros/apb.c
==
--- head/sys/mips/atheros/apb.c Fri Apr  5 00:22:17 2013(r249118)
+++ head/sys/mips/atheros/apb.c Fri Apr  5 00:22:53 2013(r249119)
@@ -357,6 +357,8 @@ apb_filter(void *arg)
case AR71XX_SOC_AR7240:
case AR71XX_SOC_AR7241:
case AR71XX_SOC_AR7242:
+   case AR71XX_SOC_AR9330:
+   case AR71XX_SOC_AR9331:
/* Ack/clear the irq on status register for 
AR724x */
ATH_WRITE_REG(AR71XX_MISC_INTR_STATUS,
reg  ~(1  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


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

2013-04-04 Thread Adrian Chadd
Author: adrian
Date: Fri Apr  5 00:26:06 2013
New Revision: 249120
URL: http://svnweb.freebsd.org/changeset/base/249120

Log:
  Implement the AR933x interrupt driven UART code.
  
  * Enable RX and host interrupts during bus probe/attach
  * Disable all interrupts (+ host ISR) during bus detach
  * Enable TX DONE interrupt only when we start transmitting; clear it when
we're done.
  * The RX/TX FIFO depth is still conjecture on my part.  I'll fix this
shortly.
  * The TX FIFO interrupt isn't an empty interrupt, it's an almost empty
interrupt.  Sigh.  So..
  * .. in ar933x_bus_transmit(), wait for the FIFO to drain before
continuing.
  
  I dislike having to wait for the FIFO to drain, alas.
  
  Tested:
  
  * Atheros AP121 board, AR9331 SoC.
  
  TODO:
  
  * RX/TX overflow, RX error, BREAK support, etc.
  * Figure out the true RX/TX FIFO depth.

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

Modified: head/sys/mips/atheros/uart_dev_ar933x.c
==
--- head/sys/mips/atheros/uart_dev_ar933x.c Fri Apr  5 00:22:53 2013
(r249119)
+++ head/sys/mips/atheros/uart_dev_ar933x.c Fri Apr  5 00:26:06 2013
(r249120)
@@ -53,32 +53,6 @@ __FBSDID($FreeBSD$);
bus_space_write_4((bas)-bst, (bas)-bsh, reg, value)
 
 
-#if 0
-/*
- * Clear pending interrupts. THRE is cleared by reading IIR. Data
- * that may have been received gets lost here.
- */
-static void
-ar933x_clrint(struct uart_bas *bas)
-{
-   uint8_t iir, lsr;
-
-   iir = uart_getreg(bas, REG_IIR);
-   while ((iir  IIR_NOPEND) == 0) {
-   iir = IIR_IMASK;
-   if (iir == IIR_RLS) {
-   lsr = uart_getreg(bas, REG_LSR);
-   if (lsr  (LSR_BI|LSR_FE|LSR_PE))
-   (void)uart_getreg(bas, REG_DATA);
-   } else if (iir == IIR_RXRDY || iir == IIR_RXTOUT)
-   (void)uart_getreg(bas, REG_DATA);
-   else if (iir == IIR_MLSC)
-   (void)uart_getreg(bas, REG_MSR);
-   uart_barrier(bas);
-   iir = uart_getreg(bas, REG_IIR);
-   }
-}
-#endif
 
 static int
 ar933x_drain(struct uart_bas *bas, int what)
@@ -386,11 +360,28 @@ struct uart_class uart_ar933x_class = {
 static int
 ar933x_bus_attach(struct uart_softc *sc)
 {
+   struct ar933x_softc *u = (struct ar933x_softc *)sc;
+   struct uart_bas *bas = sc-sc_bas;
+   uint32_t reg;
+
/* XXX TODO: flush transmitter */
 
-   /* XXX TODO: enable RX interrupts to kick-start things */
+   /*
+* Setup initial interrupt notifications.
+*
+* XXX for now, just RX FIFO valid.
+* Later on (when they're handled), also handle
+* RX errors/overflow.
+*/
+   u-u_ier = AR933X_UART_INT_RX_VALID;
+
+   /* Enable RX interrupts to kick-start things */
+   ar933x_setreg(bas, AR933X_UART_INT_EN_REG, u-u_ier);
 
-   /* XXX TODO: enable the host interrupt now */
+   /* Enable the host interrupt now */
+   reg = ar933x_getreg(bas, AR933X_UART_CS_REG);
+   reg |= AR933X_UART_CS_HOST_INT_EN;
+   ar933x_setreg(bas, AR933X_UART_CS_REG, reg);
 
return (0);
 }
@@ -398,21 +389,17 @@ ar933x_bus_attach(struct uart_softc *sc)
 static int
 ar933x_bus_detach(struct uart_softc *sc)
 {
-#if 0
-   struct ar933x_softc *ns8250;
-   struct uart_bas *bas;
-   u_char ier;
+   struct uart_bas *bas = sc-sc_bas;
+   uint32_t reg;
 
-   ns8250 = (struct ar933x_softc *)sc;
-   bas = sc-sc_bas;
-   ier = uart_getreg(bas, REG_IER)  ns8250-ier_mask;
-   uart_setreg(bas, REG_IER, ier);
-   uart_barrier(bas);
-   ar933x_clrint(bas);
-#endif
+   /* Disable all interrupts */
+   ar933x_setreg(bas, AR933X_UART_INT_EN_REG, 0x);
 
-   /* XXX TODO: Disable all interrupts */
-   /* XXX TODO: Disable the host interrupt */
+   /* Disable the host interrupt */
+   reg = ar933x_getreg(bas, AR933X_UART_CS_REG);
+   reg = ~AR933X_UART_CS_HOST_INT_EN;
+   ar933x_setreg(bas, AR933X_UART_CS_REG, reg);
+   uart_barrier(bas);
 
return (0);
 }
@@ -536,23 +523,63 @@ ar933x_bus_ioctl(struct uart_softc *sc, 
 static int
 ar933x_bus_ipend(struct uart_softc *sc)
 {
+   struct ar933x_softc *u = (struct ar933x_softc *)sc;
struct uart_bas *bas = sc-sc_bas;
int ipend = 0;
+   uint32_t isr;
 
uart_lock(sc-sc_hwmtx);
 
/*
-* Always notify the upper layer if RX is ready.
+* Fetch/ACK the ISR status.
+*/
+   isr = ar933x_getreg(bas, AR933X_UART_INT_REG);
+   ar933x_setreg(bas, AR933X_UART_INT_REG, isr);
+   uart_barrier(bas);
+
+   /*
+* RX ready - notify upper layer.
 */
-   if (ar933x_rxready(bas)) {
+   if (isr  AR933X_UART_INT_RX_VALID) {
ipend |= SER_INT_RXREADY;
}
+
+   

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

2013-04-04 Thread Adrian Chadd
Author: adrian
Date: Fri Apr  5 00:26:29 2013
New Revision: 249121
URL: http://svnweb.freebsd.org/changeset/base/249121

Log:
  Now that interrupt driven uart IO is working, flip this back on.

Modified:
  head/sys/mips/conf/AR933X_BASE.hints

Modified: head/sys/mips/conf/AR933X_BASE.hints
==
--- head/sys/mips/conf/AR933X_BASE.hintsFri Apr  5 00:26:06 2013
(r249120)
+++ head/sys/mips/conf/AR933X_BASE.hintsFri Apr  5 00:26:29 2013
(r249121)
@@ -14,7 +14,7 @@ hint.uart.0.at=apb0
 # NB: This isn't an ns8250 UART
 hint.uart.0.maddr=0x1802
 hint.uart.0.msize=0x18
-# hint.uart.0.irq=3
+hint.uart.0.irq=3
 
 #ehci - note the 0x100 offset for the AR913x/AR724x
 hint.ehci.0.at=nexus0
___
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: r249123 - head/sys/mips/atheros

2013-04-04 Thread Adrian Chadd
Author: adrian
Date: Fri Apr  5 01:35:59 2013
New Revision: 249123
URL: http://svnweb.freebsd.org/changeset/base/249123

Log:
  Implement the AR933x ethernet support.
  
  Obtained from:OpenWRT

Modified:
  head/sys/mips/atheros/ar933x_chip.c
  head/sys/mips/atheros/ar933xreg.h
  head/sys/mips/atheros/if_arge.c

Modified: head/sys/mips/atheros/ar933x_chip.c
==
--- head/sys/mips/atheros/ar933x_chip.c Fri Apr  5 00:57:10 2013
(r249122)
+++ head/sys/mips/atheros/ar933x_chip.c Fri Apr  5 01:35:59 2013
(r249123)
@@ -200,8 +200,23 @@ ar933x_chip_ddr_flush_ip2(void)
 static uint32_t
 ar933x_chip_get_eth_pll(unsigned int mac, int speed)
 {
+   uint32_t pll;
 
-   return (0);
+   switch (speed) {
+   case 10:
+   pll = AR933X_PLL_VAL_10;
+   break;
+   case 100:
+   pll = AR933X_PLL_VAL_100;
+   break;
+   case 1000:
+   pll = AR933X_PLL_VAL_1000;
+   break;
+   default:
+   printf(%s%d: invalid speed %d\n, __func__, mac, speed);
+   pll = 0;
+   }
+   return (pll);
 }
 
 static void

Modified: head/sys/mips/atheros/ar933xreg.h
==
--- head/sys/mips/atheros/ar933xreg.h   Fri Apr  5 00:57:10 2013
(r249122)
+++ head/sys/mips/atheros/ar933xreg.h   Fri Apr  5 01:35:59 2013
(r249123)
@@ -75,4 +75,8 @@
 
 #defineAR933X_BOOTSTRAP_REF_CLK_40 (1  0)
 
+#defineAR933X_PLL_VAL_1000 0x0011
+#defineAR933X_PLL_VAL_100  0x1099
+#defineAR933X_PLL_VAL_10   0x00991099
+
 #endif /* __AR93XX_REG_H__ */

Modified: head/sys/mips/atheros/if_arge.c
==
--- head/sys/mips/atheros/if_arge.c Fri Apr  5 00:57:10 2013
(r249122)
+++ head/sys/mips/atheros/if_arge.c Fri Apr  5 01:35:59 2013
(r249123)
@@ -572,6 +572,8 @@ arge_attach(device_t dev)
case AR71XX_SOC_AR7240:
case AR71XX_SOC_AR7241:
case AR71XX_SOC_AR7242:
+   case AR71XX_SOC_AR9330:
+   case AR71XX_SOC_AR9331:
ARGE_WRITE(sc, AR71XX_MAC_FIFO_CFG1, 0x0010);
ARGE_WRITE(sc, AR71XX_MAC_FIFO_CFG2, 0x015500aa);
break;
@@ -899,6 +901,8 @@ arge_set_pll(struct arge_softc *sc, int 
case AR71XX_SOC_AR7240:
case AR71XX_SOC_AR7241:
case AR71XX_SOC_AR7242:
+   case AR71XX_SOC_AR9330:
+   case AR71XX_SOC_AR9331:
fifo_tx = 0x01f00140;
break;
case AR71XX_SOC_AR9130:
___
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: r249124 - head/sys/mips/conf

2013-04-04 Thread Adrian Chadd
Author: adrian
Date: Fri Apr  5 01:38:13 2013
New Revision: 249124
URL: http://svnweb.freebsd.org/changeset/base/249124

Log:
  Add AP121 ethernet / switch PHY support.
  
  * arge0 is MII
  * arge1 is GMII
  * the MDIO bus is on arge1, not arge0
  * the default switch config is to have ports 0-3 as the switch group,
with port 4 being an external PHY dedicated to arge0 (ie, 'cpu' port.)
  
  Whilst I'm here, remove unused bits and pieces from the config.
  
  Tested:
  
  * AP121, ping on both arge0 and arge1
  * Tested switch port detection using etherswitchcfg

Modified:
  head/sys/mips/conf/AP121
  head/sys/mips/conf/AP121.hints

Modified: head/sys/mips/conf/AP121
==
--- head/sys/mips/conf/AP121Fri Apr  5 01:35:59 2013(r249123)
+++ head/sys/mips/conf/AP121Fri Apr  5 01:38:13 2013(r249124)
@@ -18,7 +18,7 @@ ident   AP121
 hints   AP121.hints
 
 # Force the board memory - the base AP121 only has 16MB RAM
-options AR71XX_REALMEM=16*1024*1024
+options AR71XX_REALMEM=(16*1024*1024)
 
 # i2c GPIO bus
 #devicegpioiic
@@ -26,11 +26,12 @@ options AR71XX_REALMEM=16*1024*1
 #deviceiicbus
 #deviceiic
 
-# ethernet switch device
-#deviceetherswitch
+# Options required for miiproxy and mdiobus
+optionsARGE_MDIO   # Export an MDIO bus separate from arge
+device miiproxy# MDIO bus - MII PHY rendezvous
 
-# RTL8366RB support
-#devicertl8366rb
+device etherswitch
+device arswitch
 
 # read MSDOS formatted disks - USB
 #options   MSDOSFS

Modified: head/sys/mips/conf/AP121.hints
==
--- head/sys/mips/conf/AP121.hints  Fri Apr  5 01:35:59 2013
(r249123)
+++ head/sys/mips/conf/AP121.hints  Fri Apr  5 01:38:13 2013
(r249124)
@@ -3,21 +3,28 @@
 #
 # $FreeBSD$
 
-# Hard-code the PHY for now, until there's switch phy support.
-# hint.arge.0.phymask=0x000c
-hint.arge.0.phymask=0x
-hint.arge.0.media=1000
-hint.arge.0.fduplex=1
-# Where is the MAC address stored in flash for this particular unit.
-hint.arge.0.eeprommac=0x1f01fc00
-
-# This isn't used, but configure it anyway.
-# This should eventually just not be configured, but the if then
-# needs to be properly disabled or spurious interrupts occur.
-hint.arge.1.phymask=0x0
-
-# Where the ART is
-# hint.ath.0.eepromaddr=0x1fff1000
+# mdiobus on arge1
+hint.argemdio.0.at=nexus0
+hint.argemdio.0.maddr=0x1a00
+hint.argemdio.0.msize=0x1000
+hint.argemdio.0.order=0
+
+# Embedded Atheros Switch
+hint.arswitch.0.at=mdio0
+hint.arswitch.0.is_7240=1
+hint.arswitch.0.numphys=4
+hint.arswitch.0.phy4cpu=1  # phy 4 is a CPU separate PHY
+hint.arswitch.0.is_rgmii=0
+hint.arswitch.0.is_gmii=1  # arge1 - switch PHY is GMII
+
+# arge0 - MII, autoneg, phy(4)
+hint.arge.0.phymask=0x10   # PHY4
+hint.arge.0.mdio=mdioproxy1# .. off of the switch mdiobus
+
+# arge1 - GMII, 1000/full
+hint.arge.1.phymask=0x0# No directly mapped PHYs
+hint.arge.1.media=1000
+hint.arge.1.fduplex=1
 
 # The AP121 4MB flash layout:
 #
@@ -114,17 +121,3 @@ hint.gpio.0.pinmask=0x0
 #hint.gpioled.3.at=gpiobus0
 #hint.gpioled.3.name=wlan
 #hint.gpioled.3.pins=0x0200
-
-# GPIO I2C bus
-#hint.gpioiic.0.at=gpiobus0
-#hint.gpioiic.0.pins=0xc
-#hint.gpioiic.0.scl=1
-#hint.gpioiic.0.sda=0
-
-# I2C bus
-# Don't be strict about I2C protocol - the relaxed semantics are required
-# by the realtek switch PHY.
-# hint.iicbus.0.strict=0
-
-# Bit bang bus - override default delay
-#hint.iicbb.0.udelay=3
___
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: r249125 - head/sys/mips/atheros

2013-04-04 Thread Adrian Chadd
Author: adrian
Date: Fri Apr  5 02:01:05 2013
New Revision: 249125
URL: http://svnweb.freebsd.org/changeset/base/249125

Log:
  Fix AR933x USB support - this needs the same controller initialisation
  as the AR7242.
  
  Tested:
  
  * Atheros AP121, AR9331
  * ZyDas wifi device, and 64MB (yes, ew) USB flash storage

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

Modified: head/sys/mips/atheros/ar71xx_ehci.c
==
--- head/sys/mips/atheros/ar71xx_ehci.c Fri Apr  5 01:38:13 2013
(r249124)
+++ head/sys/mips/atheros/ar71xx_ehci.c Fri Apr  5 02:01:05 2013
(r249125)
@@ -157,6 +157,8 @@ ar71xx_ehci_attach(device_t self)
case AR71XX_SOC_AR7242:
case AR71XX_SOC_AR9130:
case AR71XX_SOC_AR9132:
+   case AR71XX_SOC_AR9330:
+   case AR71XX_SOC_AR9331:
sc-sc_flags |= EHCI_SCFLG_TT | EHCI_SCFLG_NORESTERM;
break;
default:
___
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: r249126 - head/sys/mips/atheros

2013-04-04 Thread Adrian Chadd
Author: adrian
Date: Fri Apr  5 02:02:37 2013
New Revision: 249126
URL: http://svnweb.freebsd.org/changeset/base/249126

Log:
  Implement USB device reset and poweron.
  
  Tested:
  
  * Atheros AP131, AR9331 SoC

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

Modified: head/sys/mips/atheros/ar933x_chip.c
==
--- head/sys/mips/atheros/ar933x_chip.c Fri Apr  5 02:01:05 2013
(r249125)
+++ head/sys/mips/atheros/ar933x_chip.c Fri Apr  5 02:02:37 2013
(r249126)
@@ -222,43 +222,14 @@ ar933x_chip_get_eth_pll(unsigned int mac
 static void
 ar933x_chip_init_usb_peripheral(void)
 {
-#if 0
-   switch (ar71xx_soc) {
-   case AR71XX_SOC_AR7240:
-   ar71xx_device_stop(AR724X_RESET_MODULE_USB_OHCI_DLL |
-   AR724X_RESET_USB_HOST);
-   DELAY(1000);
+   ar71xx_device_stop(AR933X_RESET_USBSUS_OVERRIDE);
+   DELAY(100);
 
-   ar71xx_device_start(AR724X_RESET_MODULE_USB_OHCI_DLL |
-   AR724X_RESET_USB_HOST);
-   DELAY(1000);
+   ar71xx_device_start(AR933X_RESET_USB_HOST);
+   DELAY(100);
 
-   /*
-* WAR for HW bug. Here it adjusts the duration
-* between two SOFS.
-*/
-   ATH_WRITE_REG(AR71XX_USB_CTRL_FLADJ,
-   (3  USB_CTRL_FLADJ_A0_SHIFT));
-
-   break;
-
-   case AR71XX_SOC_AR7241:
-   case AR71XX_SOC_AR7242:
-   ar71xx_device_start(AR724X_RESET_MODULE_USB_OHCI_DLL);
-   DELAY(100);
-
-   ar71xx_device_start(AR724X_RESET_USB_HOST);
-   DELAY(100);
-
-   ar71xx_device_start(AR724X_RESET_USB_PHY);
-   DELAY(100);
-
-   break;
-
-   default:
-   break;
-   }
-#endif
+   ar71xx_device_start(AR933X_RESET_USB_PHY);
+   DELAY(100);
 }
 
 struct ar71xx_cpu_def ar933x_chip_def = {
___
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: r249127 - head/sys/mips/conf

2013-04-04 Thread Adrian Chadd
Author: adrian
Date: Fri Apr  5 02:15:10 2013
New Revision: 249127
URL: http://svnweb.freebsd.org/changeset/base/249127

Log:
  Add the basic GPIO pin mapping to the hints file.
  
  Tested:
  
  * AP121 board, tested USB/jumpstart LEDs

Modified:
  head/sys/mips/conf/AP121.hints

Modified: head/sys/mips/conf/AP121.hints
==
--- head/sys/mips/conf/AP121.hints  Fri Apr  5 02:02:37 2013
(r249126)
+++ head/sys/mips/conf/AP121.hints  Fri Apr  5 02:15:10 2013
(r249127)
@@ -85,39 +85,23 @@ hint.map.5.readonly=1
 # Don't flip on anything that isn't already enabled.
 # This includes leaving the SPI CS1/CS2 pins as GPIO pins as they're
 # not used here.
-hint.gpio.0.function_set=0x2000
+hint.gpio.0.function_set=0x
 hint.gpio.0.function_clear=0x
 
 # These are the GPIO LEDs and buttons which can be software controlled.
 #hint.gpio.0.pinmask=0x001c02ae
-hint.gpio.0.pinmask=0x0
+hint.gpio.0.pinmask=0x1803
 
-# pin 1 - USB (LED)
-# pin 2 - System (LED)
-# Pin 3 - Reset (input)
-# Pin 5 - QSS (LED)
-# Pin 7 - QSS Button (input)
-# Pin 8 - wired into the chip reset line
-# Pin 9 - WLAN
-# Pin 10 - UART TX (not GPIO)
-# Pin 13 - UART RX (not GPIO)
-# Pin 18 - RTL8366RB switch data line
-# Pin 19 - RTL8366RB switch clock line
-# Pin 20 - GPIO20
+# gpio0 - WLAN LED
+# gpio1 - USB LED
+# gpio11 - Jumpstart button
+# gpio12 - Reset button
 
 # LEDs are configured separately and driven by the LED device
-#hint.gpioled.0.at=gpiobus0
-#hint.gpioled.0.name=usb
-#hint.gpioled.0.pins=0x0002
-
-#hint.gpioled.1.at=gpiobus0
-#hint.gpioled.1.name=system
-#hint.gpioled.1.pins=0x0004
-
-#hint.gpioled.2.at=gpiobus0
-#hint.gpioled.2.name=qss
-#hint.gpioled.2.pins=0x0020
-
-#hint.gpioled.3.at=gpiobus0
-#hint.gpioled.3.name=wlan
-#hint.gpioled.3.pins=0x0200
+hint.gpioled.0.at=gpiobus0
+hint.gpioled.0.name=wlan
+hint.gpioled.0.pins=0x0001
+
+hint.gpioled.1.at=gpiobus0
+hint.gpioled.1.name=usb
+hint.gpioled.1.pins=0x0002
___
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: r249129 - head/sys/powerpc/aim

2013-04-04 Thread Justin Hibbits
Author: jhibbits
Date: Fri Apr  5 04:53:43 2013
New Revision: 249129
URL: http://svnweb.freebsd.org/changeset/base/249129

Log:
  Print out DSISR in a fatal DSI trap.
  
  Sponsored by:

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

Modified: head/sys/powerpc/aim/trap.c
==
--- head/sys/powerpc/aim/trap.c Fri Apr  5 04:08:03 2013(r249128)
+++ head/sys/powerpc/aim/trap.c Fri Apr  5 04:53:43 2013(r249129)
@@ -385,6 +385,8 @@ printtrap(u_int vector, struct trapframe
case EXC_DSI:
printf(   virtual address = 0x% PRIxPTR \n,
frame-cpu.aim.dar);
+   printf(   dsisr   = 0x% PRIxPTR \n,
+   frame-cpu.aim.dsisr);
break;
case EXC_ISE:
case EXC_ISI:
___
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: r249129 - head/sys/powerpc/aim

2013-04-04 Thread Justin Hibbits
Interesting, I never touched the Sponsored by: line.
On Apr 4, 2013 9:53 PM, Justin Hibbits jhibb...@freebsd.org wrote:

 Author: jhibbits
 Date: Fri Apr  5 04:53:43 2013
 New Revision: 249129
 URL: http://svnweb.freebsd.org/changeset/base/249129

 Log:
   Print out DSISR in a fatal DSI trap.

   Sponsored by:

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

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

 ==
 --- head/sys/powerpc/aim/trap.c Fri Apr  5 04:08:03 2013(r249128)
 +++ head/sys/powerpc/aim/trap.c Fri Apr  5 04:53:43 2013(r249129)
 @@ -385,6 +385,8 @@ printtrap(u_int vector, struct trapframe
 case EXC_DSI:
 printf(   virtual address = 0x% PRIxPTR \n,
 frame-cpu.aim.dar);
 +   printf(   dsisr   = 0x% PRIxPTR \n,
 +   frame-cpu.aim.dsisr);
 break;
 case EXC_ISE:
 case EXC_ISI:

___
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: r249129 - head/sys/powerpc/aim

2013-04-04 Thread Eitan Adler
On 5 April 2013 01:01, Justin Hibbits jr...@alumni.cwru.edu wrote:
 Interesting, I never touched the Sponsored by: line.

Did you recently rebuild Subversion (after r314983 in ports?)

Rui added a patch that may have affected this, but I don't think it
should magically add a sponsored by line.

Do you have ORGANIZATION set in make.conf?



-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
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: r249129 - head/sys/powerpc/aim

2013-04-04 Thread Justin Hibbits
On Apr 4, 2013 10:06 PM, Eitan Adler ead...@freebsd.org wrote:

 On 5 April 2013 01:01, Justin Hibbits jr...@alumni.cwru.edu wrote:
  Interesting, I never touched the Sponsored by: line.

 Did you recently rebuild Subversion (after r314983 in ports?)

 Rui added a patch that may have affected this, but I don't think it
 should magically add a sponsored by line.

 Do you have ORGANIZATION set in make.conf?



 --
 Eitan Adler
 Source, Ports, Doc committer
 Bugmeister, Ports Security teams

I rebuilt all ports just the other day, don't know what ports revision it
corresponds to, but I did a portsnap on Monday. And I don't have
ORGANIZATION set in make.conf.

- Justin
___
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: r249129 - head/sys/powerpc/aim

2013-04-04 Thread Rui Paulo
On 2013/04/04, at 22:13, Justin Hibbits jr...@alumni.cwru.edu wrote:
 I rebuilt all ports just the other day, don't know what ports revision it 
 corresponds to, but I did a portsnap on Monday. And I don't have ORGANIZATION 
 set in make.conf.

How did you commit it? It's impossible for it not to appear on your editor 
session. Are you sure you didn't miss it?

Regards,
--
Rui Paulo

___
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