PERFORCE change 98364 for review
John Birrell
jb at FreeBSD.org
Fri Jun 2 21:08:33 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=98364
Change 98364 by jb at jb_freebsd2 on 2006/06/02 21:06:12
IFC
Affected files ...
.. //depot/projects/dtrace/src/lib/libthr/thread/thr_mutex.c#2 integrate
.. //depot/projects/dtrace/src/lib/libthr/thread/thr_private.h#3 integrate
.. //depot/projects/dtrace/src/sbin/fsdb/fsdb.8#2 integrate
.. //depot/projects/dtrace/src/sbin/fsdb/fsdb.c#3 integrate
.. //depot/projects/dtrace/src/sbin/mount/mount.c#3 integrate
.. //depot/projects/dtrace/src/share/examples/diskless/clone_root#2 integrate
.. //depot/projects/dtrace/src/sys/arm/include/cpuconf.h#3 integrate
.. //depot/projects/dtrace/src/sys/compat/linprocfs/linprocfs.c#3 integrate
.. //depot/projects/dtrace/src/sys/dev/ath/if_ath.c#5 integrate
.. //depot/projects/dtrace/src/sys/dev/ipw/if_ipw.c#3 integrate
.. //depot/projects/dtrace/src/sys/dev/iwi/if_iwi.c#4 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpt.c#6 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpt.h#7 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpt_cam.c#7 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpt_pci.c#5 integrate
.. //depot/projects/dtrace/src/sys/dev/ral/rt2560.c#3 integrate
.. //depot/projects/dtrace/src/sys/dev/ral/rt2661.c#3 integrate
.. //depot/projects/dtrace/src/sys/dev/usb/if_ural.c#3 integrate
.. //depot/projects/dtrace/src/sys/dev/wi/if_wi.c#3 integrate
.. //depot/projects/dtrace/src/sys/kern/kern_event.c#3 integrate
.. //depot/projects/dtrace/src/sys/kern/vfs_aio.c#3 integrate
.. //depot/projects/dtrace/src/sys/kern/vfs_mount.c#4 integrate
.. //depot/projects/dtrace/src/sys/net/bpf.c#4 integrate
.. //depot/projects/dtrace/src/sys/net/bpf.h#2 integrate
.. //depot/projects/dtrace/src/sys/net/bpfdesc.h#2 integrate
.. //depot/projects/dtrace/src/sys/net/if_disc.c#2 integrate
.. //depot/projects/dtrace/src/sys/net/if_gif.c#2 integrate
.. //depot/projects/dtrace/src/sys/net/if_gre.c#3 integrate
.. //depot/projects/dtrace/src/sys/net/if_loop.c#3 integrate
.. //depot/projects/dtrace/src/sys/net/if_sl.c#2 integrate
.. //depot/projects/dtrace/src/sys/net/if_stf.c#2 integrate
.. //depot/projects/dtrace/src/sys/net/if_tun.c#2 integrate
.. //depot/projects/dtrace/src/sys/net/raw_cb.c#2 integrate
.. //depot/projects/dtrace/src/sys/net/raw_usrreq.c#3 integrate
.. //depot/projects/dtrace/src/sys/net80211/ieee80211_input.c#2 integrate
.. //depot/projects/dtrace/src/sys/netgraph/atm/uni/ng_uni_cust.h#2 integrate
.. //depot/projects/dtrace/src/sys/netgraph/ng_base.c#2 integrate
.. //depot/projects/dtrace/src/sys/netinet/ip_carp.c#2 integrate
.. //depot/projects/dtrace/src/sys/netinet/ip_gre.c#3 integrate
.. //depot/projects/dtrace/www/en/developers.sgml#6 integrate
Differences ...
==== //depot/projects/dtrace/src/lib/libthr/thread/thr_mutex.c#2 (text+ko) ====
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libthr/thread/thr_mutex.c,v 1.42 2006/04/08 13:24:44 davidxu Exp $
+ * $FreeBSD: src/lib/libthr/thread/thr_mutex.c,v 1.43 2006/06/02 08:37:01 davidxu Exp $
*/
#include "namespace.h"
@@ -118,7 +118,6 @@
_thr_umtx_init(&pmutex->m_lock);
pmutex->m_type = attr->m_type;
pmutex->m_protocol = attr->m_protocol;
- TAILQ_INIT(&pmutex->m_queue);
pmutex->m_owner = NULL;
pmutex->m_flags = attr->m_flags | MUTEX_FLAGS_INITED;
if (private)
@@ -187,7 +186,6 @@
_mutex_reinit(pthread_mutex_t *mutex)
{
_thr_umtx_init(&(*mutex)->m_lock);
- TAILQ_INIT(&(*mutex)->m_queue);
MUTEX_INIT_LINK(*mutex);
(*mutex)->m_owner = NULL;
(*mutex)->m_count = 0;
@@ -238,9 +236,7 @@
* in use. Mostly for prority mutex types, or there
* are condition variables referencing it.
*/
- if (((*mutex)->m_owner != NULL) ||
- (TAILQ_FIRST(&(*mutex)->m_queue) != NULL) ||
- ((*mutex)->m_refcount != 0)) {
+ if ((*mutex)->m_owner != NULL || (*mutex)->m_refcount != 0) {
THR_UMTX_UNLOCK(curthread, &(*mutex)->m_lock);
ret = EBUSY;
} else {
==== //depot/projects/dtrace/src/lib/libthr/thread/thr_private.h#3 (text+ko) ====
@@ -26,7 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libthr/thread/thr_private.h,v 1.63 2006/04/27 08:25:13 davidxu Exp $
+ * $FreeBSD: src/lib/libthr/thread/thr_private.h,v 1.64 2006/06/02 08:37:01 davidxu Exp $
*/
#ifndef _THR_PRIVATE_H
@@ -115,7 +115,6 @@
volatile umtx_t m_lock;
enum pthread_mutextype m_type;
int m_protocol;
- TAILQ_HEAD(mutex_head, pthread) m_queue;
struct pthread *m_owner;
int m_flags;
int m_count;
==== //depot/projects/dtrace/src/sbin/fsdb/fsdb.8#2 (text+ko) ====
@@ -26,9 +26,9 @@
.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/sbin/fsdb/fsdb.8,v 1.28 2005/02/12 23:23:53 trhodes Exp $
+.\" $FreeBSD: src/sbin/fsdb/fsdb.8,v 1.29 2006/06/02 12:55:26 maxim Exp $
.\"
-.Dd September 14, 1995
+.Dd June 2, 2006
.Dt FSDB 8
.Os
.Sh NAME
@@ -117,6 +117,12 @@
Print out the block list of the active inode.
Note that the printout can become long for large files, since all
indirect block pointers will also be printed.
+.Pp
+.It Cm findblk Ar disk block number ...
+Find the inode(s) owning the specified disk block(s) number(s).
+Note that these are not absolute disk blocks numbers, but offsets from the
+start of the partition.
+.Pp
.It Cm uplink
Increment the active inode's link count.
.Pp
==== //depot/projects/dtrace/src/sbin/fsdb/fsdb.c#3 (text+ko) ====
@@ -30,7 +30,7 @@
#ifndef lint
static const char rcsid[] =
- "$FreeBSD: src/sbin/fsdb/fsdb.c,v 1.32 2006/04/21 20:33:16 maxim Exp $";
+ "$FreeBSD: src/sbin/fsdb/fsdb.c,v 1.33 2006/06/02 12:55:26 maxim Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -52,6 +52,13 @@
static void usage(void) __dead2;
int cmdloop(void);
+static int compare_blk32(uint32_t *wantedblk, uint32_t curblk);
+static int compare_blk64(uint64_t *wantedblk, uint64_t curblk);
+static int founddatablk(uint64_t blk);
+static int find_blks32(uint32_t *buf, int size, uint32_t *blknum);
+static int find_blks64(uint64_t *buf, int size, uint64_t *blknum);
+static int find_indirblks32(uint32_t blk, int ind_level, uint32_t *blknum);
+static int find_indirblks64(uint64_t blk, int ind_level, uint64_t *blknum);
static void
usage(void)
@@ -129,6 +136,7 @@
CMDFUNC(downlink); /* decr link */
CMDFUNC(linkcount); /* set link count */
CMDFUNC(quit); /* quit */
+CMDFUNC(findblk); /* find block */
CMDFUNC(ls); /* list directory */
CMDFUNC(rm); /* remove name */
CMDFUNC(ln); /* add name */
@@ -160,6 +168,7 @@
{ "uplink", "Increment link count", 1, 1, FL_WR, uplink },
{ "downlink", "Decrement link count", 1, 1, FL_WR, downlink },
{ "linkcount", "Set link count to COUNT", 2, 2, FL_WR, linkcount },
+ { "findblk", "Find inode owning disk block(s)", 2, 33, FL_RO, findblk},
{ "ls", "List current inode as directory", 1, 1, FL_RO, ls },
{ "rm", "Remove NAME from current inode directory", 2, 2, FL_WR | FL_ST, rm },
{ "del", "Remove NAME from current inode directory", 2, 2, FL_WR | FL_ST, rm },
@@ -415,6 +424,262 @@
return 0;
}
+static int findblk_numtofind;
+static int wantedblksize;
+
+CMDFUNCSTART(findblk)
+{
+ ino_t inum, inosused;
+ uint32_t *wantedblk32;
+ uint64_t *wantedblk64;
+ struct cg *cgp = &cgrp;
+ int c, i, is_ufs2;
+
+ wantedblksize = (argc - 1);
+ is_ufs2 = sblock.fs_magic == FS_UFS2_MAGIC;
+ ocurrent = curinum;
+
+ if (is_ufs2) {
+ wantedblk64 = calloc(wantedblksize, sizeof(uint64_t));
+ if (wantedblk64 == NULL)
+ err(1, "malloc");
+ for (i = 1; i < argc; i++)
+ wantedblk64[i - 1] = dbtofsb(&sblock, strtoull(argv[i], NULL, 0));
+ } else {
+ wantedblk32 = calloc(wantedblksize, sizeof(uint32_t));
+ if (wantedblk32 == NULL)
+ err(1, "malloc");
+ for (i = 1; i < argc; i++)
+ wantedblk32[i - 1] = dbtofsb(&sblock, strtoull(argv[i], NULL, 0));
+ }
+ findblk_numtofind = wantedblksize;
+ /*
+ * sblock.fs_ncg holds a number of cylinder groups.
+ * Iterate over all cylinder groups.
+ */
+ for (c = 0; c < sblock.fs_ncg; c++) {
+ /*
+ * sblock.fs_ipg holds a number of inodes per cylinder group.
+ * Calculate a highest inode number for a given cylinder group.
+ */
+ inum = c * sblock.fs_ipg;
+ /* Read cylinder group. */
+ getblk(&cgblk, cgtod(&sblock, c), sblock.fs_cgsize);
+ memcpy(cgp, cgblk.b_un.b_cg, sblock.fs_cgsize);
+ /*
+ * Get a highest used inode number for a given cylinder group.
+ * For UFS1 all inodes initialized at the newfs stage.
+ */
+ if (is_ufs2)
+ inosused = cgp->cg_initediblk;
+ else
+ inosused = sblock.fs_ipg;
+
+ for (; inosused > 0; inum++, inosused--) {
+ /* Skip magic inodes: 0, WINO, ROOTINO. */
+ if (inum < ROOTINO)
+ continue;
+ /*
+ * Check if the block we are looking for is just an inode block.
+ *
+ * ino_to_fsba() - get block containing inode from its number.
+ * INOPB() - get a number of inodes in one disk block.
+ */
+ if (is_ufs2 ?
+ compare_blk64(wantedblk64, ino_to_fsba(&sblock, inum)) :
+ compare_blk32(wantedblk32, ino_to_fsba(&sblock, inum))) {
+ printf("block %llu: inode block (%d-%d)\n",
+ (unsigned long long)fsbtodb(&sblock,
+ ino_to_fsba(&sblock, inum)),
+ (inum / INOPB(&sblock)) * INOPB(&sblock),
+ (inum / INOPB(&sblock) + 1) * INOPB(&sblock));
+ findblk_numtofind--;
+ if (findblk_numtofind == 0)
+ goto end;
+ }
+ /* Get on-disk inode aka dinode. */
+ curinum = inum;
+ curinode = ginode(inum);
+ /* Find IFLNK dinode with allocated data blocks. */
+ switch (DIP(curinode, di_mode) & IFMT) {
+ case IFDIR:
+ case IFREG:
+ if (DIP(curinode, di_blocks) == 0)
+ continue;
+ break;
+ case IFLNK:
+ {
+ uint64_t size = DIP(curinode, di_size);
+ if (size > 0 && size < sblock.fs_maxsymlinklen &&
+ DIP(curinode, di_blocks) == 0)
+ continue;
+ else
+ break;
+ }
+ default:
+ continue;
+ }
+ /* Look through direct data blocks. */
+ if (is_ufs2 ?
+ find_blks64(curinode->dp2.di_db, NDADDR, wantedblk64) :
+ find_blks32(curinode->dp1.di_db, NDADDR, wantedblk32))
+ goto end;
+ for (i = 0; i < NIADDR; i++) {
+ /*
+ * Does the block we are looking for belongs to the
+ * indirect blocks?
+ */
+ if (is_ufs2 ?
+ compare_blk64(wantedblk64, curinode->dp2.di_ib[i]) :
+ compare_blk32(wantedblk32, curinode->dp1.di_ib[i]))
+ if (founddatablk(is_ufs2 ? curinode->dp2.di_ib[i] :
+ curinode->dp1.di_ib[i]))
+ goto end;
+ /*
+ * Search through indirect, double and triple indirect
+ * data blocks.
+ */
+ if (is_ufs2 ? (curinode->dp2.di_ib[i] != 0) :
+ (curinode->dp1.di_ib[i] != 0))
+ if (is_ufs2 ?
+ find_indirblks64(curinode->dp2.di_ib[i], i,
+ wantedblk64) :
+ find_indirblks32(curinode->dp1.di_ib[i], i,
+ wantedblk32))
+ goto end;
+ }
+ }
+ }
+end:
+ curinum = ocurrent;
+ curinode = ginode(curinum);
+ return 0;
+}
+
+static int
+compare_blk32(uint32_t *wantedblk, uint32_t curblk)
+{
+ int i;
+
+ for (i = 0; i < wantedblksize; i++) {
+ if (wantedblk[i] != 0 && wantedblk[i] == curblk) {
+ wantedblk[i] = 0;
+ return 1;
+ }
+ }
+ return 0;
+}
+
+static int
+compare_blk64(uint64_t *wantedblk, uint64_t curblk)
+{
+ int i;
+
+ for (i = 0; i < wantedblksize; i++) {
+ if (wantedblk[i] != 0 && wantedblk[i] == curblk) {
+ wantedblk[i] = 0;
+ return 1;
+ }
+ }
+ return 0;
+}
+
+static int
+founddatablk(uint64_t blk)
+{
+
+ printf("%llu: data block of inode %d\n",
+ (unsigned long long)fsbtodb(&sblock, blk), curinum);
+ findblk_numtofind--;
+ if (findblk_numtofind == 0)
+ return 1;
+ return 0;
+}
+
+static int
+find_blks32(uint32_t *buf, int size, uint32_t *wantedblk)
+{
+ int blk;
+ for (blk = 0; blk < size; blk++) {
+ if (buf[blk] == 0)
+ continue;
+ if (compare_blk32(wantedblk, buf[blk])) {
+ if (founddatablk(buf[blk]))
+ return 1;
+ }
+ }
+ return 0;
+}
+
+static int
+find_indirblks32(uint32_t blk, int ind_level, uint32_t *wantedblk)
+{
+#define MAXNINDIR (MAXBSIZE / sizeof(uint32_t))
+ uint32_t idblk[MAXNINDIR];
+ int i;
+
+ bread(fsreadfd, (char *)idblk, fsbtodb(&sblock, blk), (int)sblock.fs_bsize);
+ if (ind_level <= 0) {
+ if (find_blks32(idblk, sblock.fs_bsize / sizeof(uint32_t), wantedblk))
+ return 1;
+ } else {
+ ind_level--;
+ for (i = 0; i < sblock.fs_bsize / sizeof(uint32_t); i++) {
+ if (compare_blk32(wantedblk, idblk[i])) {
+ if (founddatablk(idblk[i]))
+ return 1;
+ }
+ if (idblk[i] != 0)
+ if (find_indirblks32(idblk[i], ind_level, wantedblk))
+ return 1;
+ }
+ }
+#undef MAXNINDIR
+ return 0;
+}
+
+static int
+find_blks64(uint64_t *buf, int size, uint64_t *wantedblk)
+{
+ int blk;
+ for (blk = 0; blk < size; blk++) {
+ if (buf[blk] == 0)
+ continue;
+ if (compare_blk64(wantedblk, buf[blk])) {
+ if (founddatablk(buf[blk]))
+ return 1;
+ }
+ }
+ return 0;
+}
+
+static int
+find_indirblks64(uint64_t blk, int ind_level, uint64_t *wantedblk)
+{
+#define MAXNINDIR (MAXBSIZE / sizeof(uint64_t))
+ uint64_t idblk[MAXNINDIR];
+ int i;
+
+ bread(fsreadfd, (char *)idblk, fsbtodb(&sblock, blk), (int)sblock.fs_bsize);
+ if (ind_level <= 0) {
+ if (find_blks64(idblk, sblock.fs_bsize / sizeof(uint64_t), wantedblk))
+ return 1;
+ } else {
+ ind_level--;
+ for (i = 0; i < sblock.fs_bsize / sizeof(uint64_t); i++) {
+ if (compare_blk64(wantedblk, idblk[i])) {
+ if (founddatablk(idblk[i]))
+ return 1;
+ }
+ if (idblk[i] != 0)
+ if (find_indirblks64(idblk[i], ind_level, wantedblk))
+ return 1;
+ }
+ }
+#undef MAXNINDIR
+ return 0;
+}
+
int findino(struct inodesc *idesc); /* from fsck */
static int dolookup(char *name);
==== //depot/projects/dtrace/src/sbin/mount/mount.c#3 (text+ko) ====
@@ -38,7 +38,7 @@
static char sccsid[] = "@(#)mount.c 8.25 (Berkeley) 5/8/95";
#endif
static const char rcsid[] =
- "$FreeBSD: src/sbin/mount/mount.c,v 1.84 2006/05/10 14:40:40 maxim Exp $";
+ "$FreeBSD: src/sbin/mount/mount.c,v 1.85 2006/06/02 17:53:46 rodrigc Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -184,6 +184,26 @@
return (0);
}
+static
+int specified_ro(const char *arg)
+{
+ char *optbuf, *opt;
+ int ret = 0;
+
+ optbuf = strdup(arg);
+ if (optbuf == NULL)
+ err(1, NULL);
+
+ for (opt = optbuf; (opt = strtok(opt, ",")) != NULL; opt = NULL) {
+ if (strcmp(opt, "ro") == 0) {
+ ret = 1;
+ break;
+ }
+ }
+ free(optbuf);
+ return (ret);
+}
+
int
main(int argc, char *argv[])
{
@@ -215,8 +235,11 @@
init_flags |= MNT_FORCE;
break;
case 'o':
- if (*optarg)
+ if (*optarg) {
options = catopt(options, optarg);
+ if (specified_ro(optarg))
+ ro = 1;
+ }
break;
case 'p':
fstab_style = 1;
==== //depot/projects/dtrace/src/share/examples/diskless/clone_root#2 (text+ko) ====
@@ -4,7 +4,7 @@
# <Standard BSD copyright>
# Revised 2001.04.16
#
-# $FreeBSD: src/share/examples/diskless/clone_root,v 1.3 2004/09/23 21:17:31 brooks Exp $
+# $FreeBSD: src/share/examples/diskless/clone_root,v 1.4 2006/06/02 15:01:11 motoyuki Exp $
#
# clone root filesystem for diskless root stuff
#
@@ -36,7 +36,7 @@
# local startup files will not be used.
#
# create a kernel config file in /sys/i386/conf/DISKLESS with
-# options MFS
+# options MD_ROOT
# options BOOTP
# options BOOTP_NFSROOT
# options BOOTP_COMPAT
==== //depot/projects/dtrace/src/sys/arm/include/cpuconf.h#3 (text+ko) ====
@@ -34,7 +34,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/arm/include/cpuconf.h,v 1.6 2006/05/31 13:06:08 cognet Exp $
+ * $FreeBSD: src/sys/arm/include/cpuconf.h,v 1.7 2006/06/02 09:39:06 cognet Exp $
*
*/
@@ -72,7 +72,7 @@
#endif
#define ARM_NARCH (ARM_ARCH_4 + ARM_ARCH_5)
-#if ARM_NARCH == 0 && !defined(KLD_MODULE)
+#if ARM_NARCH == 0 && !defined(KLD_MODULE) && defined(_KERNEL)
#error ARM_NARCH is 0
#endif
@@ -120,7 +120,7 @@
#define ARM_NMMUS (ARM_MMU_MEMC + ARM_MMU_GENERIC + \
ARM_MMU_SA1 + ARM_MMU_XSCALE)
-#if ARM_NMMUS == 0 && !defined(KLD_MODULE)
+#if ARM_NMMUS == 0 && !defined(KLD_MODULE) && defined(_KERNEL)
#error ARM_NMMUS is 0
#endif
==== //depot/projects/dtrace/src/sys/compat/linprocfs/linprocfs.c#3 (text+ko) ====
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linprocfs/linprocfs.c,v 1.93 2006/05/12 05:04:40 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linprocfs/linprocfs.c,v 1.94 2006/06/02 13:01:25 des Exp $");
#include <sys/param.h>
#include <sys/queue.h>
@@ -222,9 +222,9 @@
default:
class = 0;
break;
-#else
+#else /* __amd64__ */
default:
- class = 6;
+ class = 15;
break;
#endif
}
==== //depot/projects/dtrace/src/sys/dev/ath/if_ath.c#5 (text+ko) ====
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.144 2006/05/08 20:11:09 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.145 2006/06/02 19:59:31 csjp Exp $");
/*
* Driver for the Atheros Wireless LAN controller.
@@ -2905,7 +2905,7 @@
* pass decrypt+mic errors but others may be
* interesting (e.g. crc).
*/
- if (sc->sc_drvbpf != NULL &&
+ if (bpf_peers_present(sc->sc_drvbpf) &&
(ds->ds_rxstat.rs_status & sc->sc_monpass)) {
bus_dmamap_sync(sc->sc_dmat, bf->bf_dmamap,
BUS_DMASYNC_POSTREAD);
@@ -2936,7 +2936,8 @@
sc->sc_stats.ast_ant_rx[ds->ds_rxstat.rs_antenna]++;
- if (sc->sc_drvbpf != NULL && !ath_rx_tap(sc, m, ds, tsf, nf)) {
+ if (bpf_peers_present(sc->sc_drvbpf) &&
+ !ath_rx_tap(sc, m, ds, tsf, nf)) {
m_freem(m); /* XXX reclaim */
goto rx_next;
}
@@ -3636,7 +3637,7 @@
if (ic->ic_rawbpf)
bpf_mtap(ic->ic_rawbpf, m0);
- if (sc->sc_drvbpf) {
+ if (bpf_peers_present(sc->sc_drvbpf)) {
u_int64_t tsf = ath_hal_gettsf64(ah);
sc->sc_tx_th.wt_tsf = htole64(tsf);
==== //depot/projects/dtrace/src/sys/dev/ipw/if_ipw.c#3 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.19 2006/05/16 14:36:27 phk Exp $ */
+/* $FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.20 2006/06/02 19:59:31 csjp Exp $ */
/*-
* Copyright (c) 2004-2006
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.19 2006/05/16 14:36:27 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.20 2006/06/02 19:59:31 csjp Exp $");
/*-
* Intel(R) PRO/Wireless 2100 MiniPCI driver
@@ -1054,7 +1054,7 @@
m->m_pkthdr.rcvif = ifp;
m->m_pkthdr.len = m->m_len = le32toh(status->len);
- if (sc->sc_drvbpf != NULL) {
+ if (bpf_peers_present(sc->sc_drvbpf)) {
struct ipw_rx_radiotap_header *tap = &sc->sc_rxtap;
tap->wr_flags = 0;
@@ -1328,7 +1328,7 @@
wh = mtod(m0, struct ieee80211_frame *);
}
- if (sc->sc_drvbpf != NULL) {
+ if (bpf_peers_present(sc->sc_drvbpf)) {
struct ipw_tx_radiotap_header *tap = &sc->sc_txtap;
tap->wt_flags = 0;
==== //depot/projects/dtrace/src/sys/dev/iwi/if_iwi.c#4 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/iwi/if_iwi.c,v 1.36 2006/05/16 14:36:27 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/iwi/if_iwi.c,v 1.37 2006/06/02 19:59:31 csjp Exp $");
/*-
* Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver
@@ -1300,7 +1300,7 @@
m_adj(m, sizeof (struct iwi_hdr) + sizeof (struct iwi_frame));
- if (sc->sc_drvbpf != NULL) {
+ if (bpf_peers_present(sc->sc_drvbpf)) {
struct iwi_rx_radiotap_header *tap = &sc->sc_rxtap;
tap->wr_flags = 0;
@@ -1829,7 +1829,7 @@
wh = mtod(m0, struct ieee80211_frame *);
}
- if (sc->sc_drvbpf != NULL) {
+ if (bpf_peers_present(sc->sc_drvbpf)) {
struct iwi_tx_radiotap_header *tap = &sc->sc_txtap;
tap->wt_flags = 0;
==== //depot/projects/dtrace/src/sys/dev/mpt/mpt.c#6 (text+ko) ====
@@ -96,7 +96,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/mpt/mpt.c,v 1.30 2006/05/29 20:34:28 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/mpt/mpt.c,v 1.31 2006/06/02 18:50:38 mjacob Exp $");
#include <dev/mpt/mpt.h>
#include <dev/mpt/mpt_cam.h> /* XXX For static handler registration */
@@ -2438,12 +2438,15 @@
if (pfp.PortType == MPI_PORTFACTS_PORTTYPE_FC) {
mpt->is_fc = 1;
mpt->is_sas = 0;
+ mpt->is_spi = 0;
} else if (pfp.PortType == MPI_PORTFACTS_PORTTYPE_SAS) {
mpt->is_fc = 0;
mpt->is_sas = 1;
+ mpt->is_spi = 0;
} else {
mpt->is_fc = 0;
mpt->is_sas = 0;
+ mpt->is_spi = 1;
}
mpt->mpt_ini_id = pfp.PortSCSIID;
mpt->mpt_max_devices = pfp.MaxDevices;
==== //depot/projects/dtrace/src/sys/dev/mpt/mpt.h#7 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/mpt/mpt.h,v 1.22 2006/05/29 20:34:28 mjacob Exp $ */
+/* $FreeBSD: src/sys/dev/mpt/mpt.h,v 1.24 2006/06/02 19:23:12 mjacob Exp $ */
/*-
* Generic defines for LSI '909 FC adapters.
* FreeBSD Version.
@@ -126,6 +126,7 @@
#if __FreeBSD_version < 500000
#include <machine/bus.h>
+#include <machine/clock.h>
#endif
#include <sys/rman.h>
@@ -502,8 +503,8 @@
shutdwn_raid : 1,
shutdwn_recovery: 1,
outofbeer : 1,
- : 1,
disabled : 1,
+ is_spi : 1,
is_sas : 1,
is_fc : 1;
@@ -540,6 +541,10 @@
CONFIG_PAGE_SCSI_DEVICE_1 _dev_page1[16];
uint16_t _tag_enable;
uint16_t _disc_enable;
+ struct {
+ uint8_t inqdata[39];
+ uint8_t state;
+ } _dv[16];
} spi;
#define mpt_port_page0 cfg.spi._port_page0
#define mpt_port_page1 cfg.spi._port_page1
@@ -548,6 +553,10 @@
#define mpt_dev_page1 cfg.spi._dev_page1
#define mpt_tag_enable cfg.spi._tag_enable
#define mpt_disc_enable cfg.spi._disc_enable
+#define mpt_dv cfg.spi._dv
+# define DV_STATE_0 0
+# define DV_STATE_1 1
+# define DV_STATE_DONE 0xff
struct mpi_fc_cfg {
CONFIG_PAGE_FC_PORT_0 _port_page0;
#define mpt_fcport_page0 cfg.fc._port_page0
@@ -665,7 +674,7 @@
uint8_t *fw_image;
bus_dma_tag_t fw_dmat; /* DMA tag for firmware image */
bus_dmamap_t fw_dmap; /* DMA map for firmware image */
- bus_addr_t fw_phys; /* BusAddr of request memory */
+ bus_addr_t fw_phys; /* BusAddr of firmware image */
/* Shutdown Event Handler. */
eventhandler_tag eh;
==== //depot/projects/dtrace/src/sys/dev/mpt/mpt_cam.c#7 (text+ko) ====
@@ -94,7 +94,7 @@
* OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/mpt/mpt_cam.c,v 1.21 2006/05/29 20:34:28 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/mpt/mpt_cam.c,v 1.22 2006/06/02 18:50:38 mjacob Exp $");
#include <dev/mpt/mpt.h>
#include <dev/mpt/mpt_cam.h>
@@ -599,13 +599,13 @@
if (rv) {
mpt_prt(mpt, "failed to read SPI Port Page 2\n");
} else {
- mpt_lprt(mpt, MPT_PRT_DEBUG,
- "SPI Port Page 2: Flags %x Settings %x\n",
+ mpt_lprt(mpt, MPT_PRT_NEGOTIATION,
+ "Port Page 2: Flags %x Settings %x\n",
mpt->mpt_port_page2.PortFlags,
mpt->mpt_port_page2.PortSettings);
for (i = 0; i < 16; i++) {
- mpt_lprt(mpt, MPT_PRT_DEBUG,
- "SPI Port Page 2 Tgt %d: timo %x SF %x Flags %x\n",
+ mpt_lprt(mpt, MPT_PRT_NEGOTIATION,
+ " Port Page 2 Tgt %d: timo %x SF %x Flags %x\n",
i, mpt->mpt_port_page2.DeviceSettings[i].Timeout,
mpt->mpt_port_page2.DeviceSettings[i].SyncFactor,
mpt->mpt_port_page2.DeviceSettings[i].DeviceFlags);
@@ -621,9 +621,9 @@
"cannot read SPI Target %d Device Page 0\n", i);
continue;
}
- mpt_lprt(mpt, MPT_PRT_DEBUG,
- "SPI Tgt %d Page 0: NParms %x Information %x", i,
- mpt->mpt_dev_page0[i].NegotiatedParameters,
+ mpt_lprt(mpt, MPT_PRT_NEGOTIATION,
+ "target %d page 0: Negotiated Params %x Information %x\n",
+ i, mpt->mpt_dev_page0[i].NegotiatedParameters,
mpt->mpt_dev_page0[i].Information);
rv = mpt_read_cur_cfg_page(mpt, i,
@@ -634,9 +634,9 @@
"cannot read SPI Target %d Device Page 1\n", i);
continue;
}
- mpt_lprt(mpt, MPT_PRT_DEBUG,
- "SPI Tgt %d Page 1: RParms %x Configuration %x\n", i,
- mpt->mpt_dev_page1[i].RequestedParameters,
+ mpt_lprt(mpt, MPT_PRT_NEGOTIATION,
+ "target %d page 1: Requested Params %x Configuration %x\n",
+ i, mpt->mpt_dev_page1[i].RequestedParameters,
mpt->mpt_dev_page1[i].Configuration);
}
return (0);
@@ -693,16 +693,20 @@
MPI_SCSIPORTPAGE2_PORT_MASK_NEGO_MASTER_SETTINGS;
j = mpt->mpt_port_page2.PortFlags &
MPI_SCSIPORTPAGE2_PORT_FLAGS_DV_MASK;
- if (i == MPI_SCSIPORTPAGE2_PORT_ALL_MASTER_SETTINGS &&
- j == MPI_SCSIPORTPAGE2_PORT_FLAGS_OFF_DV) {
+ if (i == MPI_SCSIPORTPAGE2_PORT_ALL_MASTER_SETTINGS /* &&
+ j == MPI_SCSIPORTPAGE2_PORT_FLAGS_OFF_DV */) {
mpt_lprt(mpt, MPT_PRT_NEGOTIATION,
"honoring BIOS transfer negotiations\n");
- return (0);
- }
- for (i = 0; i < 16; i++) {
- mpt->mpt_dev_page1[i].RequestedParameters = 0;
- mpt->mpt_dev_page1[i].Configuration = 0;
- (void) mpt_update_spi_config(mpt, i);
+ for (i = 0; i < 16; i++) {
+ mpt->mpt_dv[i].state = DV_STATE_DONE;
+ }
+ } else {
+ for (i = 0; i < 16; i++) {
+ mpt->mpt_dev_page1[i].RequestedParameters = 0;
+ mpt->mpt_dev_page1[i].Configuration = 0;
+ (void) mpt_update_spi_config(mpt, i);
+ mpt->mpt_dv[i].state = DV_STATE_0;
+ }
}
return (0);
}
@@ -724,7 +728,7 @@
if (mpt_set_initial_config_sas(mpt)) {
return (EIO);
}
- } else {
+ } else if (mpt->is_spi) {
if (mpt_read_config_info_spi(mpt)) {
return (EIO);
}
@@ -873,10 +877,17 @@
break;
}
}
+
+ if (error == 0 && ((uint32_t)nseg) >= mpt->max_seg_cnt) {
+ error = EFBIG;
+ mpt_prt(mpt, "segment count %d too large (max %u)\n",
+ nseg, mpt->max_seg_cnt);
+ }
+
bad:
if (error != 0) {
if (error != EFBIG && error != ENOMEM) {
- mpt_prt(mpt, "mpt_execute_req: err %d\n", error);
+ mpt_prt(mpt, "mpt_execute_req_a64: err %d\n", error);
}
if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INPROG) {
cam_status status;
@@ -1275,12 +1286,8 @@
bad:
if (error != 0) {
- if (hdrp->Function == MPI_FUNCTION_TARGET_ASSIST) {
- request_t *cmd_req =
- MPT_TAG_2_REQ(mpt, ccb->csio.tag_id);
- MPT_TGT_STATE(mpt, cmd_req)->state = TGT_STATE_IN_CAM;
- MPT_TGT_STATE(mpt, cmd_req)->ccb = NULL;
- MPT_TGT_STATE(mpt, cmd_req)->req = NULL;
+ if (error != EFBIG && error != ENOMEM) {
+ mpt_prt(mpt, "mpt_execute_req: err %d\n", error);
}
if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INPROG) {
cam_status status;
@@ -1300,6 +1307,13 @@
}
mpt_set_ccb_status(ccb, status);
}
+ if (hdrp->Function == MPI_FUNCTION_TARGET_ASSIST) {
+ request_t *cmd_req =
+ MPT_TAG_2_REQ(mpt, ccb->csio.tag_id);
+ MPT_TGT_STATE(mpt, cmd_req)->state = TGT_STATE_IN_CAM;
+ MPT_TGT_STATE(mpt, cmd_req)->ccb = NULL;
+ MPT_TGT_STATE(mpt, cmd_req)->req = NULL;
+ }
ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d\n", __LINE__));
xpt_done(ccb);
@@ -1329,7 +1343,7 @@
flags = MPI_SGE_FLAGS_SIMPLE_ELEMENT;
- if (istgt) {
+ if (istgt == 0) {
if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) {
flags |= MPI_SGE_FLAGS_HOST_TO_IOC;
}
@@ -1382,6 +1396,9 @@
memset(se, 0,sizeof (*se));
se->Address = dm_segs->ds_addr;
+
+
+
MPI_pSGE_SET_LENGTH(se, dm_segs->ds_len);
tf = flags;
if (seg == first_lim - 1) {
@@ -1452,9 +1469,13 @@
*/
chain_list_addr = trq->req_pbuf;
chain_list_addr += cur_off;
+
+
+
ce->Address = chain_list_addr;
ce->Flags = MPI_SGE_FLAGS_CHAIN_ELEMENT;
+
/*
* If we have more than a frame's worth of segments left,
* set up the chain list to have the last element be another
@@ -1489,6 +1510,10 @@
while (seg < this_seg_lim) {
memset(se, 0, sizeof (*se));
se->Address = dm_segs->ds_addr;
+
+
+
+
MPI_pSGE_SET_LENGTH(se, dm_segs->ds_len);
tf = flags;
if (seg == this_seg_lim - 1) {
@@ -1554,7 +1579,8 @@
MPT_TGT_STATE(mpt, cmd_req)->ccb = NULL;
MPT_TGT_STATE(mpt, cmd_req)->req = NULL;
}
- mpt_prt(mpt, "mpt_execute_req: I/O cancelled (status 0x%x)\n",
+ mpt_prt(mpt,
+ "mpt_execute_req: I/O cancelled (status 0x%x)\n",
ccb->ccb_h.status & CAM_STATUS_MASK);
if (nseg && (ccb->ccb_h.flags & CAM_SG_LIST_PHYS) == 0) {
bus_dmamap_unload(mpt->buffer_dmat, req->dmap);
@@ -1584,6 +1610,7 @@
mpt_dump_sgl(trq->req_vbuf, 0);
}
}
+
if (hdrp->Function == MPI_FUNCTION_TARGET_ASSIST) {
request_t *cmd_req = MPT_TAG_2_REQ(mpt, ccb->csio.tag_id);
mpt_tgt_state_t *tgt = MPT_TGT_STATE(mpt, cmd_req);
@@ -1727,7 +1754,7 @@
}
}
- if (mpt->is_fc == 0 && mpt->is_sas == 0) {
+ if (mpt->is_spi) {
if (ccb->ccb_h.flags & CAM_DIS_DISCONNECT) {
mpt_req->Control |= MPI_SCSIIO_CONTROL_NO_DISCONNECT;
}
@@ -2044,6 +2071,7 @@
{
MSG_SCSI_IO_REQUEST *scsi_req;
union ccb *ccb;
+ target_id_t tgt;
if (req->state == REQ_STATE_FREE) {
mpt_prt(mpt, "mpt_scsi_reply_handler: req already free\n");
@@ -2053,14 +2081,24 @@
scsi_req = (MSG_SCSI_IO_REQUEST *)req->req_vbuf;
ccb = req->ccb;
if (ccb == NULL) {
+ /*
+ * Peel off any 'by hand' commands here
+ */
+ if (req->state & REQ_STATE_NEED_WAKEUP) {
+ req->state &= ~REQ_STATE_QUEUED;
+ req->state |= REQ_STATE_DONE;
+ wakeup(req);
+ return (TRUE);
+ }
mpt_prt(mpt, "req %p:%u without CCB (state %#x "
"func %#x index %u rf %p)\n", req, req->serno, req->state,
scsi_req->Function, req->index, reply_frame);
mpt_print_scsi_io_request(scsi_req);
return (TRUE);
}
-
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list