This commit is contained in:
attilio 2013-02-23 16:01:03 +00:00
commit 1073a36001
36 changed files with 327 additions and 138 deletions

View File

@ -1114,10 +1114,59 @@ void Clang::AddSparcTargetArgs(const ArgList &Args,
}
}
static const char *getX86TargetCPU(const ArgList &Args,
const llvm::Triple &Triple) {
if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
if (StringRef(A->getValue()) != "native")
return A->getValue();
// FIXME: Reject attempts to use -march=native unless the target matches
// the host.
//
// FIXME: We should also incorporate the detected target features for use
// with -native.
std::string CPU = llvm::sys::getHostCPUName();
if (!CPU.empty() && CPU != "generic")
return Args.MakeArgString(CPU);
}
// Select the default CPU if none was given (or detection failed).
if (Triple.getArch() != llvm::Triple::x86_64 &&
Triple.getArch() != llvm::Triple::x86)
return 0; // This routine is only handling x86 targets.
bool Is64Bit = Triple.getArch() == llvm::Triple::x86_64;
// FIXME: Need target hooks.
if (Triple.isOSDarwin())
return Is64Bit ? "core2" : "yonah";
// Everything else goes to x86-64 in 64-bit mode.
if (Is64Bit)
return "x86-64";
if (Triple.getOSName().startswith("haiku"))
return "i586";
if (Triple.getOSName().startswith("openbsd"))
return "i486";
if (Triple.getOSName().startswith("bitrig"))
return "i686";
if (Triple.getOSName().startswith("freebsd"))
return "i486";
if (Triple.getOSName().startswith("netbsd"))
return "i486";
// All x86 devices running Android have core2 as their common
// denominator. This makes a better choice than pentium4.
if (Triple.getEnvironment() == llvm::Triple::Android)
return "core2";
// Fallback to p4.
return "pentium4";
}
void Clang::AddX86TargetArgs(const ArgList &Args,
ArgStringList &CmdArgs) const {
const bool isAndroid =
getToolChain().getTriple().getEnvironment() == llvm::Triple::Android;
if (!Args.hasFlag(options::OPT_mred_zone,
options::OPT_mno_red_zone,
true) ||
@ -1130,65 +1179,7 @@ void Clang::AddX86TargetArgs(const ArgList &Args,
false))
CmdArgs.push_back("-no-implicit-float");
const char *CPUName = 0;
if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
if (StringRef(A->getValue()) == "native") {
// FIXME: Reject attempts to use -march=native unless the target matches
// the host.
//
// FIXME: We should also incorporate the detected target features for use
// with -native.
std::string CPU = llvm::sys::getHostCPUName();
if (!CPU.empty() && CPU != "generic")
CPUName = Args.MakeArgString(CPU);
} else
CPUName = A->getValue();
}
// Select the default CPU if none was given (or detection failed).
if (!CPUName) {
// FIXME: Need target hooks.
if (getToolChain().getTriple().isOSDarwin()) {
if (getToolChain().getArch() == llvm::Triple::x86_64)
CPUName = "core2";
else if (getToolChain().getArch() == llvm::Triple::x86)
CPUName = "yonah";
} else if (getToolChain().getOS().startswith("haiku")) {
if (getToolChain().getArch() == llvm::Triple::x86_64)
CPUName = "x86-64";
else if (getToolChain().getArch() == llvm::Triple::x86)
CPUName = "i586";
} else if (getToolChain().getOS().startswith("openbsd")) {
if (getToolChain().getArch() == llvm::Triple::x86_64)
CPUName = "x86-64";
else if (getToolChain().getArch() == llvm::Triple::x86)
CPUName = "i486";
} else if (getToolChain().getOS().startswith("bitrig")) {
if (getToolChain().getArch() == llvm::Triple::x86_64)
CPUName = "x86-64";
else if (getToolChain().getArch() == llvm::Triple::x86)
CPUName = "i686";
} else if (getToolChain().getOS().startswith("freebsd")) {
if (getToolChain().getArch() == llvm::Triple::x86_64)
CPUName = "x86-64";
else if (getToolChain().getArch() == llvm::Triple::x86)
CPUName = "i486";
} else if (getToolChain().getOS().startswith("netbsd")) {
if (getToolChain().getArch() == llvm::Triple::x86_64)
CPUName = "x86-64";
else if (getToolChain().getArch() == llvm::Triple::x86)
CPUName = "i486";
} else {
if (getToolChain().getArch() == llvm::Triple::x86_64)
CPUName = "x86-64";
else if (getToolChain().getArch() == llvm::Triple::x86)
// All x86 devices running Android have core2 as their common
// denominator. This makes a better choice than pentium4.
CPUName = isAndroid ? "core2" : "pentium4";
}
}
if (CPUName) {
if (const char *CPUName = getX86TargetCPU(Args, getToolChain().getTriple())) {
CmdArgs.push_back("-target-cpu");
CmdArgs.push_back(CPUName);
}
@ -3091,6 +3082,15 @@ void ClangAs::AddARMTargetArgs(const ArgList &Args,
addFPMathArgs(D, A, Args, CmdArgs, getARMTargetCPU(Args, Triple));
}
void ClangAs::AddX86TargetArgs(const ArgList &Args,
ArgStringList &CmdArgs) const {
// Set the CPU based on -march=.
if (const char *CPUName = getX86TargetCPU(Args, getToolChain().getTriple())) {
CmdArgs.push_back("-target-cpu");
CmdArgs.push_back(CPUName);
}
}
/// Add options related to the Objective-C runtime/ABI.
///
/// Returns true if the runtime is non-fragile.
@ -3261,6 +3261,11 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
case llvm::Triple::thumb:
AddARMTargetArgs(Args, CmdArgs);
break;
case llvm::Triple::x86:
case llvm::Triple::x86_64:
AddX86TargetArgs(Args, CmdArgs);
break;
}
// Ignore explicit -force_cpusubtype_ALL option.
@ -6068,8 +6073,27 @@ void linuxtools::Link::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-plugin");
std::string Plugin = ToolChain.getDriver().Dir + "/../lib/LLVMgold.so";
CmdArgs.push_back(Args.MakeArgString(Plugin));
// Try to pass driver level flags relevant to LTO code generation down to
// the plugin.
// Handle architecture-specific flags for selecting CPU variants.
if (ToolChain.getArch() == llvm::Triple::x86 ||
ToolChain.getArch() == llvm::Triple::x86_64)
CmdArgs.push_back(
Args.MakeArgString(Twine("-plugin-opt=mcpu=") +
getX86TargetCPU(Args, ToolChain.getTriple())));
else if (ToolChain.getArch() == llvm::Triple::arm ||
ToolChain.getArch() == llvm::Triple::thumb)
CmdArgs.push_back(
Args.MakeArgString(Twine("-plugin-opt=mcpu=") +
getARMTargetCPU(Args, ToolChain.getTriple())));
// FIXME: Factor out logic for MIPS, PPC, and other targets to support this
// as well.
}
if (Args.hasArg(options::OPT_Z_Xlinker__no_demangle))
CmdArgs.push_back("--no-demangle");

View File

@ -68,6 +68,7 @@ namespace tools {
/// \brief Clang integrated assembler tool.
class LLVM_LIBRARY_VISIBILITY ClangAs : public Tool {
void AddARMTargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
void AddX86TargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
public:
ClangAs(const ToolChain &TC) : Tool("clang::as",
"clang integrated assembler", TC) {}

View File

@ -354,7 +354,7 @@ distrib-dirs:
${METALOG.add} ; \
done; true
.endif
${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/
${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys
cd ${DESTDIR}/usr/share/man; \
for mandir in man*; do \
${INSTALL_SYMLINK} ../$$mandir \

View File

@ -32,7 +32,7 @@
.\" @(#)bsearch.3 8.3 (Berkeley) 4/19/94
.\" $FreeBSD$
.\"
.Dd April 19, 1994
.Dd February 22, 2013
.Dt BSEARCH 3
.Os
.Sh NAME
@ -71,6 +71,12 @@ less than, equal to, or greater than zero if the
.Fa key
object is found, respectively, to be less than, to match, or be
greater than the array member.
See the
.Fa int_compare
sample function in
.Xr qsort 3
for a comparison function that is also compatible with
.Fn bsearch .
.Sh RETURN VALUES
The
.Fn bsearch

View File

@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd January 28, 2013
.Dd February 21, 2013
.Dt VFS_SET 9
.Os
.Sh NAME
@ -80,6 +80,9 @@ Supports delegated administration if
.Va vfs.usermount
sysctl is set to
.Dv 1 .
.It Dv VFCF_SBDRY
When in VFS method, the thread suspension is deferred to the user
boundary upon arrival of stop action.
.El
.Sh PSEUDOCODE
.Bd -literal

View File

@ -595,7 +595,9 @@ pmpdone(struct cam_periph *periph, union ccb *done_ccb)
* causes timeouts if external SEP is not connected
* to PMP over I2C.
*/
if (softc->pm_pid == 0x37261095 && softc->pm_ports == 6)
if ((softc->pm_pid == 0x37261095 ||
softc->pm_pid == 0x38261095) &&
softc->pm_ports == 6)
softc->pm_ports = 5;
/*

View File

@ -607,6 +607,10 @@ static struct da_quirk_entry da_quirk_table[] =
{T_DIRECT, SIP_MEDIA_REMOVABLE, "Sony", "Sony DSC", "*"},
/*quirks*/ DA_Q_NO_SYNC_CACHE | DA_Q_NO_PREVENT
},
{
{T_DIRECT, SIP_MEDIA_REMOVABLE, "Kingston", "DataTraveler G3",
"1.00"}, /*quirks*/ DA_Q_NO_PREVENT
},
/* ATA/SATA devices over SAS/USB/... */
{
/* Hitachi Advanced Format (4k) drives */

View File

@ -3045,7 +3045,7 @@ arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, arc_done_func_t *done,
const zbookmark_t *zb)
{
arc_buf_hdr_t *hdr;
arc_buf_t *buf;
arc_buf_t *buf = NULL;
kmutex_t *hash_lock;
zio_t *rzio;
uint64_t guid = spa_load_guid(spa);
@ -3127,7 +3127,7 @@ top:
uint64_t size = BP_GET_LSIZE(bp);
arc_callback_t *acb;
vdev_t *vd = NULL;
uint64_t addr;
uint64_t addr = 0;
boolean_t devw = B_FALSE;
if (hdr == NULL) {
@ -3245,6 +3245,10 @@ top:
cb->l2rcb_zb = *zb;
cb->l2rcb_flags = zio_flags;
ASSERT(addr >= VDEV_LABEL_START_SIZE &&
addr + size < vd->vdev_psize -
VDEV_LABEL_END_SIZE);
/*
* l2arc read. The SCL_L2ARC lock will be
* released by l2arc_read_done().
@ -3440,8 +3444,8 @@ arc_release(arc_buf_t *buf, void *tag)
if (l2hdr) {
mutex_enter(&l2arc_buflist_mtx);
hdr->b_l2hdr = NULL;
buf_size = hdr->b_size;
}
buf_size = hdr->b_size;
/*
* Do we have more than one buf?
@ -4544,7 +4548,7 @@ l2arc_read_done(zio_t *zio)
static list_t *
l2arc_list_locked(int list_num, kmutex_t **lock)
{
list_t *list;
list_t *list = NULL;
int idx;
ASSERT(list_num >= 0 && list_num < 2 * ARC_BUFC_NUMLISTS);

View File

@ -408,8 +408,7 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, uint64_t length,
if (dn->dn_objset->os_dsl_dataset)
dp = dn->dn_objset->os_dsl_dataset->ds_dir->dd_pool;
if (dp && dsl_pool_sync_context(dp))
start = gethrtime();
start = gethrtime();
zio = zio_root(dn->dn_objset->os_spa, NULL, NULL, ZIO_FLAG_CANFAIL);
blkid = dbuf_whichblock(dn, offset);
for (i = 0; i < nblks; i++) {

View File

@ -1323,7 +1323,8 @@ dmu_objset_userquota_get_ids(dnode_t *dn, boolean_t before, dmu_tx_t *tx)
objset_t *os = dn->dn_objset;
void *data = NULL;
dmu_buf_impl_t *db = NULL;
uint64_t *user, *group;
uint64_t *user = NULL;
uint64_t *group = NULL;
int flags = dn->dn_id_flags;
int error;
boolean_t have_spill = B_FALSE;

View File

@ -382,7 +382,7 @@ dsl_dataset_get_ref(dsl_pool_t *dp, uint64_t dsobj, void *tag,
ds = dmu_buf_get_user(dbuf);
if (ds == NULL) {
dsl_dataset_t *winner;
dsl_dataset_t *winner = NULL;
ds = kmem_zalloc(sizeof (dsl_dataset_t), KM_SLEEP);
ds->ds_dbuf = dbuf;
@ -467,11 +467,8 @@ dsl_dataset_get_ref(dsl_pool_t *dp, uint64_t dsobj, void *tag,
ds->ds_reserved = ds->ds_quota = 0;
}
if (err == 0) {
winner = dmu_buf_set_user_ie(dbuf, ds, &ds->ds_phys,
dsl_dataset_evict);
}
if (err || winner) {
if (err != 0 || (winner = dmu_buf_set_user_ie(dbuf, ds,
&ds->ds_phys, dsl_dataset_evict)) != NULL) {
bplist_destroy(&ds->ds_pending_deadlist);
dsl_deadlist_close(&ds->ds_deadlist);
if (ds->ds_prev)

View File

@ -1658,7 +1658,8 @@ dsl_scan_scrub_cb(dsl_pool_t *dp,
zio_priority = ZIO_PRIORITY_SCRUB;
needs_io = B_TRUE;
scan_delay = zfs_scrub_delay;
} else if (scn->scn_phys.scn_func == POOL_SCAN_RESILVER) {
} else {
ASSERT3U(scn->scn_phys.scn_func, ==, POOL_SCAN_RESILVER);
zio_flags |= ZIO_FLAG_RESILVER;
zio_priority = ZIO_PRIORITY_RESILVER;
needs_io = B_FALSE;

View File

@ -38,6 +38,7 @@
#include <sys/zfs_context.h>
#include <sys/types.h>
#include <sys/param.h>
#define MATCH_BITS 6
#define MATCH_MIN 3
@ -51,7 +52,8 @@ lzjb_compress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n)
{
uchar_t *src = s_start;
uchar_t *dst = d_start;
uchar_t *cpy, *copymap;
uchar_t *cpy;
uchar_t *copymap = NULL;
int copymask = 1 << (NBBY - 1);
int mlen, offset, hash;
uint16_t *hp;
@ -100,7 +102,8 @@ lzjb_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n)
uchar_t *src = s_start;
uchar_t *dst = d_start;
uchar_t *d_end = (uchar_t *)d_start + d_len;
uchar_t *cpy, copymap;
uchar_t *cpy;
uchar_t copymap = 0;
int copymask = 1 << (NBBY - 1);
while (dst < d_end) {

View File

@ -110,7 +110,7 @@ refcount_count(refcount_t *rc)
int64_t
refcount_add_many(refcount_t *rc, uint64_t number, void *holder)
{
reference_t *ref;
reference_t *ref = NULL;
int64_t count;
if (reference_tracking_enable) {

View File

@ -660,7 +660,8 @@ sa_build_layouts(sa_handle_t *hdl, sa_bulk_attr_t *attr_desc, int attr_count,
int buf_space;
sa_attr_type_t *attrs, *attrs_start;
int i, lot_count;
int hdrsize, spillhdrsize;
int hdrsize;
int spillhdrsize = 0;
int used;
dmu_object_type_t bonustype;
sa_lot_t *lot;
@ -837,7 +838,7 @@ sa_attr_table_setup(objset_t *os, sa_attr_reg_t *reg_attrs, int count)
{
sa_os_t *sa = os->os_sa;
uint64_t sa_attr_count = 0;
uint64_t sa_reg_count;
uint64_t sa_reg_count = 0;
int error = 0;
uint64_t attr_value;
sa_attr_table_t *tb;
@ -1645,7 +1646,8 @@ sa_modify_attrs(sa_handle_t *hdl, sa_attr_type_t newattr,
sa_bulk_attr_t *attr_desc;
void *old_data[2];
int bonus_attr_count = 0;
int bonus_data_size, spill_data_size;
int bonus_data_size = 0;
int spill_data_size = 0;
int spill_attr_count = 0;
int error;
uint16_t length;

View File

@ -383,7 +383,7 @@ spa_prop_validate(spa_t *spa, nvlist_t *props)
{
nvpair_t *elem;
int error = 0, reset_bootfs = 0;
uint64_t objnum;
uint64_t objnum = 0;
boolean_t has_feature = B_FALSE;
elem = NULL;
@ -1389,6 +1389,7 @@ spa_load_l2cache(spa_t *spa)
newvdevs = kmem_alloc(nl2cache * sizeof (void *), KM_SLEEP);
} else {
nl2cache = 0;
newvdevs = NULL;
}
oldvdevs = sav->sav_vdevs;
@ -4702,7 +4703,7 @@ spa_vdev_detach(spa_t *spa, uint64_t guid, uint64_t pguid, int replace_done)
vdev_t *rvd = spa->spa_root_vdev;
vdev_t *vd, *pvd, *cvd, *tvd;
boolean_t unspare = B_FALSE;
uint64_t unspare_guid;
uint64_t unspare_guid = 0;
char *vdpath;
ASSERT(spa_writeable(spa));

View File

@ -1198,7 +1198,8 @@ vdev_raidz_matrix_reconstruct(raidz_map_t *rm, int n, int nmissing,
uint64_t ccount;
uint8_t *dst[VDEV_RAIDZ_MAXPARITY];
uint64_t dcount[VDEV_RAIDZ_MAXPARITY];
uint8_t log, val;
uint8_t log = 0;
uint8_t val;
int ll;
uint8_t *invlog[VDEV_RAIDZ_MAXPARITY];
uint8_t *p, *pp;

View File

@ -220,7 +220,7 @@ zap_leaf_array_create(zap_leaf_t *l, const char *buf,
uint16_t chunk_head;
uint16_t *chunkp = &chunk_head;
int byten = 0;
uint64_t value;
uint64_t value = 0;
int shift = (integer_size-1)*8;
int len = num_integers;

View File

@ -51,7 +51,7 @@ zfs_ace_byteswap(void *buf, size_t size, boolean_t zfs_layout)
{
caddr_t end;
caddr_t ptr;
zfs_ace_t *zacep;
zfs_ace_t *zacep = NULL;
ace_t *acep;
uint16_t entry_type;
size_t entry_size;

View File

@ -560,9 +560,9 @@ zfs_fuid_create(zfsvfs_t *zfsvfs, uint64_t id, cred_t *cr,
uint32_t fuid_idx = FUID_INDEX(id);
uint32_t rid;
idmap_stat status;
uint64_t idx;
uint64_t idx = 0;
zfs_fuid_t *zfuid = NULL;
zfs_fuid_info_t *fuidp;
zfs_fuid_info_t *fuidp = NULL;
/*
* If POSIX ID, or entry is already a FUID then
@ -587,6 +587,9 @@ zfs_fuid_create(zfsvfs_t *zfsvfs, uint64_t id, cred_t *cr,
if (fuidp == NULL)
return (UID_NOBODY);
VERIFY3U(type, >=, ZFS_OWNER);
VERIFY3U(type, <=, ZFS_ACE_GROUP);
switch (type) {
case ZFS_ACE_USER:
case ZFS_ACE_GROUP:
@ -603,7 +606,7 @@ zfs_fuid_create(zfsvfs_t *zfsvfs, uint64_t id, cred_t *cr,
idx = FUID_INDEX(fuidp->z_fuid_group);
break;
};
domain = fuidp->z_domain_table[idx -1];
domain = fuidp->z_domain_table[idx - 1];
} else {
if (type == ZFS_OWNER || type == ZFS_ACE_USER)
status = kidmap_getsidbyuid(crgetzone(cr), id,

View File

@ -243,7 +243,7 @@ zfs_log_create(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
itx_t *itx;
lr_create_t *lr;
lr_acl_create_t *lracl;
size_t aclsize;
size_t aclsize = (vsecp != NULL) ? vsecp->vsa_aclentsz : 0;
size_t xvatsize = 0;
size_t txsize;
xvattr_t *xvap = (xvattr_t *)vap;
@ -273,7 +273,6 @@ zfs_log_create(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
txsize = sizeof (*lr) + namesize + fuidsz + xvatsize;
lrsize = sizeof (*lr);
} else {
aclsize = (vsecp) ? vsecp->vsa_aclentsz : 0;
txsize =
sizeof (lr_acl_create_t) + namesize + fuidsz +
ZIL_ACE_LENGTH(aclsize) + xvatsize;

View File

@ -463,7 +463,7 @@ static void
zfs_range_unlock_reader(znode_t *zp, rl_t *remove)
{
avl_tree_t *tree = &zp->z_range_avl;
rl_t *rl, *next;
rl_t *rl, *next = NULL;
uint64_t len;
/*

View File

@ -389,11 +389,18 @@ zfs_register_callbacks(vfs_t *vfsp)
objset_t *os = NULL;
zfsvfs_t *zfsvfs = NULL;
uint64_t nbmand;
int readonly, do_readonly = B_FALSE;
int setuid, do_setuid = B_FALSE;
int exec, do_exec = B_FALSE;
int xattr, do_xattr = B_FALSE;
int atime, do_atime = B_FALSE;
boolean_t readonly = B_FALSE;
boolean_t do_readonly = B_FALSE;
boolean_t setuid = B_FALSE;
boolean_t do_setuid = B_FALSE;
boolean_t exec = B_FALSE;
boolean_t do_exec = B_FALSE;
boolean_t devices = B_FALSE;
boolean_t do_devices = B_FALSE;
boolean_t xattr = B_FALSE;
boolean_t do_xattr = B_FALSE;
boolean_t atime = B_FALSE;
boolean_t do_atime = B_FALSE;
int error = 0;
ASSERT(vfsp);

View File

@ -645,7 +645,7 @@ zfs_read(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct)
zfsvfs_t *zfsvfs = zp->z_zfsvfs;
objset_t *os;
ssize_t n, nbytes;
int error;
int error = 0;
rl_t *rl;
xuio_t *xuio = NULL;
@ -805,9 +805,9 @@ zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct)
ssize_t n, nbytes;
rl_t *rl;
int max_blksz = zfsvfs->z_max_blksz;
int error;
int error = 0;
arc_buf_t *abuf;
iovec_t *aiov;
iovec_t *aiov = NULL;
xuio_t *xuio = NULL;
int i_iov = 0;
int iovcnt = uio->uio_iovcnt;
@ -2477,6 +2477,7 @@ zfs_readdir(vnode_t *vp, uio_t *uio, cred_t *cr, int *eofp, int *ncookies, u_lon
odp = (struct dirent64 *)outbuf;
} else {
bufsize = bytes_wanted;
outbuf = NULL;
odp = (struct dirent64 *)iovp->iov_base;
}
eodp = (struct edirent *)odp;
@ -2960,7 +2961,7 @@ zfs_setattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr,
vattr_t oldva;
xvattr_t tmpxvattr;
uint_t mask = vap->va_mask;
uint_t saved_mask;
uint_t saved_mask = 0;
uint64_t saved_mode;
int trim_mask = 0;
uint64_t new_mode;

View File

@ -1532,6 +1532,7 @@ ata_cam_begin_transaction(device_t dev, union ccb *ccb)
request->timeout = (ccb->ccb_h.timeout + 999) / 1000;
callout_init_mtx(&request->callout, &ch->state_mtx, CALLOUT_RETURNUNLOCKED);
request->ccb = ccb;
request->flags |= ATA_R_DATA_IN_CCB;
ch->running = request;
ch->state = ATA_ACTIVE;

View File

@ -398,6 +398,7 @@ struct ata_request {
#define ATA_R_THREAD 0x00000800
#define ATA_R_DIRECT 0x00001000
#define ATA_R_NEEDRESULT 0x00002000
#define ATA_R_DATA_IN_CCB 0x00004000
#define ATA_R_ATAPI16 0x00010000
#define ATA_R_ATAPI_INTR 0x00020000

View File

@ -305,7 +305,7 @@ ata_dmaload(struct ata_request *request, void *addr, int *entries)
dspa.dmatab = request->dma->sg;
#ifdef ATA_CAM
if (request->ccb)
if (request->flags & ATA_R_DATA_IN_CCB)
error = bus_dmamap_load_ccb(request->dma->data_tag,
request->dma->data_map, request->ccb,
ch->dma.setprd, &dspa, BUS_DMA_NOWAIT);

View File

@ -669,6 +669,26 @@ ar5416GetGlobalTxTimeout(struct ath_hal *ah)
return MS(OS_REG_READ(ah, AR_GTXTO), AR_GTXTO_TIMEOUT_LIMIT);
}
#define HT_RC_2_MCS(_rc) ((_rc) & 0x0f)
static const u_int8_t baDurationDelta[] = {
24, // 0: BPSK
12, // 1: QPSK 1/2
12, // 2: QPSK 3/4
4, // 3: 16-QAM 1/2
4, // 4: 16-QAM 3/4
4, // 5: 64-QAM 2/3
4, // 6: 64-QAM 3/4
4, // 7: 64-QAM 5/6
24, // 8: BPSK
12, // 9: QPSK 1/2
12, // 10: QPSK 3/4
4, // 11: 16-QAM 1/2
4, // 12: 16-QAM 3/4
4, // 13: 64-QAM 2/3
4, // 14: 64-QAM 3/4
4, // 15: 64-QAM 5/6
};
void
ar5416Set11nRateScenario(struct ath_hal *ah, struct ath_desc *ds,
u_int durUpdateEn, u_int rtsctsRate,
@ -740,17 +760,44 @@ ar5416Set11nRateScenario(struct ath_hal *ah, struct ath_desc *ds,
| SM(rtsctsRate, AR_RTSCTSRate);
}
/*
* Note: this should be called before calling ar5416SetBurstDuration()
* (if it is indeed called) in order to ensure that the burst duration
* is correctly updated with the BA delta workaround.
*/
void
ar5416Set11nAggrFirst(struct ath_hal *ah, struct ath_desc *ds, u_int aggrLen,
u_int numDelims)
{
struct ar5416_desc *ads = AR5416DESC(ds);
uint32_t flags;
uint32_t burstDur;
uint8_t rate;
ads->ds_ctl1 |= (AR_IsAggr | AR_MoreAggr);
ads->ds_ctl6 &= ~(AR_AggrLen | AR_PadDelim);
ads->ds_ctl6 |= SM(aggrLen, AR_AggrLen);
ads->ds_ctl6 |= SM(numDelims, AR_PadDelim);
if (! AR_SREV_MERLIN_10_OR_LATER(ah)) {
/*
* XXX It'd be nice if I were passed in the rate scenario
* at this point..
*/
rate = MS(ads->ds_ctl3, AR_XmitRate0);
flags = ads->ds_ctl0 & (AR_CTSEnable | AR_RTSEnable);
/*
* WAR - MAC assumes normal ACK time instead of
* block ACK while computing packet duration.
* Add this delta to the burst duration in the descriptor.
*/
if (flags && (ads->ds_ctl1 & AR_IsAggr)) {
burstDur = baDurationDelta[HT_RC_2_MCS(rate)];
ads->ds_ctl2 &= ~(AR_BurstDur);
ads->ds_ctl2 |= SM(burstDur, AR_BurstDur);
}
}
}
void
@ -792,14 +839,36 @@ ar5416Clr11nAggr(struct ath_hal *ah, struct ath_desc *ds)
ads->ds_ctl6 &= ~AR_AggrLen;
}
/*
* Program the burst duration, with the included BA delta if it's
* applicable.
*/
void
ar5416Set11nBurstDuration(struct ath_hal *ah, struct ath_desc *ds,
u_int burstDuration)
{
struct ar5416_desc *ads = AR5416DESC(ds);
uint32_t burstDur = 0;
uint8_t rate;
if (! AR_SREV_MERLIN_10_OR_LATER(ah)) {
/*
* XXX It'd be nice if I were passed in the rate scenario
* at this point..
*/
rate = MS(ads->ds_ctl3, AR_XmitDataTries0);
/*
* WAR - MAC assumes normal ACK time instead of
* block ACK while computing packet duration.
* Add this delta to the burst duration in the descriptor.
*/
if (ads->ds_ctl1 & AR_IsAggr) {
burstDur = baDurationDelta[HT_RC_2_MCS(rate)];
}
}
ads->ds_ctl2 &= ~AR_BurstDur;
ads->ds_ctl2 |= SM(burstDuration, AR_BurstDur);
ads->ds_ctl2 |= SM(burstDur + burstDuration, AR_BurstDur);
}
/*

View File

@ -1,6 +1,6 @@
/******************************************************************************
Copyright (c) 2006-2009, Myricom Inc.
Copyright (c) 2006-2013, Myricom Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -291,11 +291,12 @@ mxge_parse_strings(mxge_softc_t *sc)
#define MXGE_NEXT_STRING(p) while(ptr < limit && *ptr++)
char *ptr, *limit;
int i, found_mac;
int i, found_mac, found_sn2;
ptr = sc->eeprom_strings;
limit = sc->eeprom_strings + MXGE_EEPROM_STRINGS_SIZE;
found_mac = 0;
found_sn2 = 0;
while (ptr < limit && *ptr != '\0') {
if (memcmp(ptr, "MAC=", 4) == 0) {
ptr += 1;
@ -311,10 +312,16 @@ mxge_parse_strings(mxge_softc_t *sc)
ptr += 3;
strncpy(sc->product_code_string, ptr,
sizeof (sc->product_code_string) - 1);
} else if (memcmp(ptr, "SN=", 3) == 0) {
} else if (!found_sn2 && (memcmp(ptr, "SN=", 3) == 0)) {
ptr += 3;
strncpy(sc->serial_number_string, ptr,
sizeof (sc->serial_number_string) - 1);
} else if (memcmp(ptr, "SN2=", 4) == 0) {
/* SN2 takes precedence over SN */
ptr += 4;
found_sn2 = 1;
strncpy(sc->serial_number_string, ptr,
sizeof (sc->serial_number_string) - 1);
}
MXGE_NEXT_STRING(ptr);
}
@ -581,9 +588,10 @@ mxge_firmware_probe(mxge_softc_t *sc)
/*
* Run a DMA test which watches for unaligned completions and
* aborts on the first one seen.
* aborts on the first one seen. Not required on Z8ES or newer.
*/
if (pci_get_revid(sc->dev) >= MXGE_PCI_REV_Z8ES)
return 0;
status = mxge_dma_test(sc, MXGEFW_CMD_UNALIGNED_TEST);
if (status == 0)
return 0; /* keep the aligned firmware */
@ -1887,11 +1895,13 @@ mxge_encap_tso(struct mxge_slice_state *ss, struct mbuf *m,
IPPROTO_TCP, 0);
#endif
} else {
#ifdef INET
m->m_pkthdr.csum_flags |= CSUM_TCP;
sum = in_pseudo(pi->ip->ip_src.s_addr,
pi->ip->ip_dst.s_addr,
htons(IPPROTO_TCP + (m->m_pkthdr.len -
cksum_offset)));
#endif
}
m_copyback(m, offsetof(struct tcphdr, th_sum) +
cksum_offset, sizeof(sum), (caddr_t)&sum);
@ -2538,8 +2548,6 @@ mxge_rx_csum6(void *p, struct mbuf *m, uint32_t csum)
csum = (csum >> 16) + (csum & 0xFFFF);
c = in6_cksum_pseudo(ip6, m->m_pkthdr.len - cksum_offset, nxt,
csum);
// printf("%d %d %x %x %x %x %x\n", m->m_pkthdr.len, cksum_offset, c, csum, ocsum, partial, d);
c ^= 0xffff;
return (c);
}
@ -2560,7 +2568,9 @@ mxge_rx_csum(struct mbuf *m, int csum)
#ifdef INET
struct ip *ip;
#endif
#if defined(INET) || defined(INET6)
int cap = m->m_pkthdr.rcvif->if_capenable;
#endif
uint16_t c, etype;

View File

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright (c) 2006-2009, Myricom Inc.
Copyright (c) 2006-2013, Myricom Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -121,11 +121,6 @@
#endif /* AIM/E500 */
/* XXX max. amount of KVM to be used by buffers. */
#ifndef VM_MAX_KERNEL_BUF
#define VM_MAX_KERNEL_BUF (SEGMENT_LENGTH * 7 / 10)
#endif
#if !defined(LOCORE)
struct pmap_physseg {
struct pv_entry *pvent;

View File

@ -0,0 +1,5 @@
# $FreeBSD$
: | read x
r=$?
[ "$r" = 1 ]

View File

@ -62,7 +62,7 @@ struct mmio_rb_range {
struct mmio_rb_tree;
RB_PROTOTYPE(mmio_rb_tree, mmio_rb_range, mr_link, mmio_rb_range_compare);
RB_HEAD(mmio_rb_tree, mmio_rb_range) mmio_rbroot;
RB_HEAD(mmio_rb_tree, mmio_rb_range) mmio_rb_root, mmio_rb_fallback;
/*
* Per-vCPU cache. Since most accesses from a vCPU will be to
@ -82,13 +82,14 @@ mmio_rb_range_compare(struct mmio_rb_range *a, struct mmio_rb_range *b)
}
static int
mmio_rb_lookup(uint64_t addr, struct mmio_rb_range **entry)
mmio_rb_lookup(struct mmio_rb_tree *rbt, uint64_t addr,
struct mmio_rb_range **entry)
{
struct mmio_rb_range find, *res;
find.mr_base = find.mr_end = addr;
res = RB_FIND(mmio_rb_tree, &mmio_rbroot, &find);
res = RB_FIND(mmio_rb_tree, rbt, &find);
if (res != NULL) {
*entry = res;
@ -99,11 +100,11 @@ mmio_rb_lookup(uint64_t addr, struct mmio_rb_range **entry)
}
static int
mmio_rb_add(struct mmio_rb_range *new)
mmio_rb_add(struct mmio_rb_tree *rbt, struct mmio_rb_range *new)
{
struct mmio_rb_range *overlap;
overlap = RB_INSERT(mmio_rb_tree, &mmio_rbroot, new);
overlap = RB_INSERT(mmio_rb_tree, rbt, new);
if (overlap != NULL) {
#ifdef RB_DEBUG
@ -120,11 +121,11 @@ mmio_rb_add(struct mmio_rb_range *new)
#if 0
static void
mmio_rb_dump(void)
mmio_rb_dump(struct mmio_rb_tree *rbt)
{
struct mmio_rb_range *np;
RB_FOREACH(np, mmio_rb_tree, &mmio_rbroot) {
RB_FOREACH(np, mmio_rb_tree, rbt) {
printf(" %lx:%lx, %s\n", np->mr_base, np->mr_end,
np->mr_param.name);
}
@ -172,22 +173,22 @@ emulate_mem(struct vmctx *ctx, int vcpu, uint64_t paddr, struct vie *vie)
entry = NULL;
if (entry == NULL) {
if (mmio_rb_lookup(paddr, &entry))
if (!mmio_rb_lookup(&mmio_rb_root, paddr, &entry)) {
/* Update the per-vCPU cache */
mmio_hint[vcpu] = entry;
} else if (mmio_rb_lookup(&mmio_rb_fallback, paddr, &entry)) {
return (ESRCH);
/* Update the per-vCPU cache */
mmio_hint[vcpu] = entry;
}
}
assert(entry != NULL && entry == mmio_hint[vcpu]);
assert(entry != NULL);
err = vmm_emulate_instruction(ctx, vcpu, paddr, vie,
mem_read, mem_write, &entry->mr_param);
return (err);
}
int
register_mem(struct mem_range *memp)
static int
register_mem_int(struct mmio_rb_tree *rbt, struct mem_range *memp)
{
struct mmio_rb_range *mrp;
int err;
@ -201,7 +202,7 @@ register_mem(struct mem_range *memp)
mrp->mr_base = memp->base;
mrp->mr_end = memp->base + memp->size - 1;
err = mmio_rb_add(mrp);
err = mmio_rb_add(rbt, mrp);
if (err)
free(mrp);
} else
@ -210,9 +211,24 @@ register_mem(struct mem_range *memp)
return (err);
}
int
register_mem(struct mem_range *memp)
{
return (register_mem_int(&mmio_rb_root, memp));
}
int
register_mem_fallback(struct mem_range *memp)
{
return (register_mem_int(&mmio_rb_fallback, memp));
}
void
init_mem(void)
{
RB_INIT(&mmio_rbroot);
RB_INIT(&mmio_rb_root);
RB_INIT(&mmio_rb_fallback);
}

View File

@ -53,5 +53,6 @@ void init_mem(void);
int emulate_mem(struct vmctx *, int vcpu, uint64_t paddr, struct vie *vie);
int register_mem(struct mem_range *memp);
int register_mem_fallback(struct mem_range *memp);
#endif /* _MEM_H_ */

View File

@ -846,12 +846,29 @@ pci_emul_iscap(struct pci_devinst *pi, int offset)
return (found);
}
static int
pci_emul_fallback_handler(struct vmctx *ctx, int vcpu, int dir, uint64_t addr,
int size, uint64_t *val, void *arg1, long arg2)
{
/*
* Ignore writes; return 0xff's for reads. The mem read code
* will take care of truncating to the correct size.
*/
if (dir == MEM_F_READ) {
*val = 0xffffffffffffffff;
}
return (0);
}
void
init_pci(struct vmctx *ctx)
{
struct mem_range memp;
struct pci_devemu *pde;
struct slotinfo *si;
int slot, func;
int error;
pci_emul_iobase = PCI_EMUL_IOBASE;
pci_emul_membase32 = PCI_EMUL_MEMBASE32;
@ -879,6 +896,20 @@ init_pci(struct vmctx *ctx)
lirq[11].li_generic = 1;
lirq[12].li_generic = 1;
lirq[15].li_generic = 1;
/*
* Setup the PCI hole to return 0xff's when accessed in a region
* with no devices
*/
memset(&memp, 0, sizeof(struct mem_range));
memp.name = "PCI hole";
memp.flags = MEM_F_RW;
memp.base = lomem_sz;
memp.size = (4ULL * 1024 * 1024 * 1024) - lomem_sz;
memp.handler = pci_emul_fallback_handler;
error = register_mem_fallback(&memp);
assert(error == 0);
}
int

View File

@ -237,7 +237,8 @@ main(int argc, char *argv[])
printf("%s%*.*s", i ? "\t" : "",
ch, ch, buf + i + 1);
}
printf("\n");
if (!flag_quiet || error > 0)
printf("\n");
continue;
case EAGET:
if (flag_nofollow)