PS3 system bus add_uevent_var() fallout
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b9090071a57185707c27b9d61b81bf941dbdf122 Commit: b9090071a57185707c27b9d61b81bf941dbdf122 Parent: 57d292bd7e6e72898e533687af481603597b1ca7 Author: Geert Uytterhoeven <[EMAIL PROTECTED]> AuthorDate: Mon Oct 15 11:51:03 2007 +0200 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Mon Oct 15 08:16:26 2007 -0700 PS3 system bus add_uevent_var() fallout Kill unused variables Signed-off-by: Geert Uytterhoeven <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- arch/powerpc/platforms/ps3/system-bus.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c index ea0b2c7..190ff4b 100644 --- a/arch/powerpc/platforms/ps3/system-bus.c +++ b/arch/powerpc/platforms/ps3/system-bus.c @@ -440,7 +440,6 @@ static void ps3_system_bus_shutdown(struct device *_dev) static int ps3_system_bus_uevent(struct device *_dev, struct kobj_uevent_env *env) { struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); - int i = 0, length = 0; if (add_uevent_var(env, "MODALIAS=ps3:%d", dev->match_id)) return -ENOMEM; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
HID: fix HIDIOCGRDESC memory access in hidraw
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=57d292bd7e6e72898e533687af481603597b1ca7 Commit: 57d292bd7e6e72898e533687af481603597b1ca7 Parent: 23fd50450a34f2558070ceabb0bfebc1c9604af5 Author: Jiri Kosina <[EMAIL PROTECTED]> AuthorDate: Mon Oct 15 15:17:41 2007 +0200 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Mon Oct 15 08:12:00 2007 -0700 HID: fix HIDIOCGRDESC memory access in hidraw Fix bogus copying of data into userspace when HIDIOCGRDESC is issued. HID-transport layer makes sure that dev->hid->rdesc is not larger than HID_MAX_DESCRIPTOR_SIZE. Noticed-by: Al Viro <[EMAIL PROTECTED]> Signed-off-by: Jiri Kosina <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/hid/hidraw.c | 12 +--- include/linux/hid.h| 20 include/linux/hidraw.h |6 +++--- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 8503197..a702e2f 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c @@ -229,9 +229,15 @@ static int hidraw_ioctl(struct inode *inode, struct file *file, unsigned int cmd if (get_user(len, (int __user *)arg)) return -EFAULT; - if (copy_to_user(*((__u8 **)(user_arg + - sizeof(__u32))), - dev->hid->rdesc, len)) + + if (len > HID_MAX_DESCRIPTOR_SIZE - 1) + return -EINVAL; + + if (copy_to_user(user_arg + offsetof( + struct hidraw_report_descriptor, + value[0]), + dev->hid->rdesc, + min(dev->hid->rsize, len))) return -EFAULT; return 0; } diff --git a/include/linux/hid.h b/include/linux/hid.h index 55e51f9..edb8024 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -29,13 +29,6 @@ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic */ -#include -#include -#include -#include -#include -#include - /* * USB HID (Human Interface Device) interface class code */ @@ -69,6 +62,17 @@ #define HID_DT_REPORT (USB_TYPE_CLASS | 0x02) #define HID_DT_PHYSICAL(USB_TYPE_CLASS | 0x03) +#define HID_MAX_DESCRIPTOR_SIZE4096 + +#ifdef __KERNEL__ + +#include +#include +#include +#include +#include +#include + /* * We parse each description item into this structure. Short items data * values are expanded to 32-bit signed int, long items contain a pointer @@ -311,7 +315,6 @@ struct hid_global { * This is the local environment. It is persistent up the next main-item. */ -#define HID_MAX_DESCRIPTOR_SIZE4096 #define HID_MAX_USAGES 8192 #define HID_DEFAULT_NUM_COLLECTIONS16 @@ -560,4 +563,5 @@ static inline int hid_ff_init(struct hid_device *hid) { return -1; } #define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ __FILE__ , ## arg) #endif +#endif diff --git a/include/linux/hidraw.h b/include/linux/hidraw.h index 6676cd5..0536f29 100644 --- a/include/linux/hidraw.h +++ b/include/linux/hidraw.h @@ -15,9 +15,11 @@ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. */ +#include + struct hidraw_report_descriptor { __u32 size; - __u8 *value; + __u8 value[HID_MAX_DESCRIPTOR_SIZE]; }; struct hidraw_devinfo { @@ -40,8 +42,6 @@ struct hidraw_devinfo { /* kernel-only API declarations */ #ifdef __KERNEL__ -#include - struct hidraw { unsigned int minor; int exist; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
nfsd: tone down inaccurate dprintk
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=45457e0916f8253691a44d3574949b6d3d5872b1 Commit: 45457e0916f8253691a44d3574949b6d3d5872b1 Parent: bbf25010f1a6b761914430f5fca081ec8c7accd1 Author: J. Bruce Fields <[EMAIL PROTECTED]> AuthorDate: Fri Jun 22 17:26:32 2007 -0400 Committer: J. Bruce Fields <[EMAIL PROTECTED]> CommitDate: Tue Oct 9 18:31:54 2007 -0400 nfsd: tone down inaccurate dprintk The nfserr_dropit happens routinely on upcalls (so a kmalloc failure is almost never the actual cause), but I occasionally get a complant from some tester that's worried because they ran across this message after turning on debugging to research some unrelated problem. Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]> Acked-by: Neil Brown <[EMAIL PROTECTED]> --- fs/nfsd/nfssvc.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index a8c89ae..221eeaa 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c @@ -549,7 +549,7 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp) if (nfserr == nfserr_jukebox && rqstp->rq_vers == 2) nfserr = nfserr_dropit; if (nfserr == nfserr_dropit) { - dprintk("nfsd: Dropping request due to malloc failure!\n"); + dprintk("nfsd: Dropping request; may be revisited later\n"); nfsd_cache_update(rqstp, RC_NOCACHE, NULL); return 0; } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
nfsd: remove unused cache_for_each macro
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=dca1dd30ce0a6234acc751bb90efba1b49079669 Commit: dca1dd30ce0a6234acc751bb90efba1b49079669 Parent: 45457e0916f8253691a44d3574949b6d3d5872b1 Author: J. Bruce Fields <[EMAIL PROTECTED]> AuthorDate: Thu Jul 12 15:30:32 2007 -0400 Committer: J. Bruce Fields <[EMAIL PROTECTED]> CommitDate: Tue Oct 9 18:31:55 2007 -0400 nfsd: remove unused cache_for_each macro This macro is unused. Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]> Acked-by: Neil Brown <[EMAIL PROTECTED]> --- include/linux/sunrpc/cache.h | 10 -- 1 files changed, 0 insertions(+), 10 deletions(-) diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h index 3699dff..bd7a6b0 100644 --- a/include/linux/sunrpc/cache.h +++ b/include/linux/sunrpc/cache.h @@ -136,16 +136,6 @@ sunrpc_cache_update(struct cache_detail *detail, struct cache_head *new, struct cache_head *old, int hash); -#define cache_for_each(pos, detail, index, member) \ - for (({read_lock(&(detail)->hash_lock); index = (detail)->hash_size;}) ;\ -({if (index==0)read_unlock(&(detail)->hash_lock); index--;}); \ - ) \ - for (pos = container_of((detail)->hash_table[index], typeof(*pos), member); \ -&pos->member; \ -pos = container_of(pos->member.next, typeof(*pos), member)) - - - extern void cache_clean_deferred(void *owner); static inline struct cache_head *cache_get(struct cache_head *h) - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
knfsd: delete code made redundant by map_new_errors
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3b398f0ef8db6a9bb431474afd871f4295203d2d Commit: 3b398f0ef8db6a9bb431474afd871f4295203d2d Parent: 9c85fca56b569dfba1f10ae12ce425c0e678df83 Author: J. Bruce Fields <[EMAIL PROTECTED]> AuthorDate: Tue Jul 24 21:38:18 2007 -0400 Committer: J. Bruce Fields <[EMAIL PROTECTED]> CommitDate: Tue Oct 9 18:31:56 2007 -0400 knfsd: delete code made redundant by map_new_errors I moved this check into map_new_errors, but forgot to delete the original. Oops. Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]> Acked-by: Neil Brown <[EMAIL PROTECTED]> --- fs/nfsd/nfssvc.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 221eeaa..ef46f32 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c @@ -546,8 +546,6 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp) /* Now call the procedure handler, and encode NFS status. */ nfserr = proc->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp); nfserr = map_new_errors(rqstp->rq_vers, nfserr); - if (nfserr == nfserr_jukebox && rqstp->rq_vers == 2) - nfserr = nfserr_dropit; if (nfserr == nfserr_dropit) { dprintk("nfsd: Dropping request; may be revisited later\n"); nfsd_cache_update(rqstp, RC_NOCACHE, NULL); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
knfsd: cleanup of nfsd4 cmp_* functions
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=599e0a2290b22d959c7748bda83da3614187a299 Commit: 599e0a2290b22d959c7748bda83da3614187a299 Parent: 3b398f0ef8db6a9bb431474afd871f4295203d2d Author: J. Bruce Fields <[EMAIL PROTECTED]> AuthorDate: Thu Jul 26 17:04:54 2007 -0400 Committer: J. Bruce Fields <[EMAIL PROTECTED]> CommitDate: Tue Oct 9 18:31:56 2007 -0400 knfsd: cleanup of nfsd4 cmp_* functions Benny Halevy suggested renaming cmp_* to same_* to make the meaning of the return value clearer. Fix some nearby style deviations while we're at it, including a small swath of creative indentation in nfs4_preprocess_seqid_op(). Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]> Acked-by: Neil Brown <[EMAIL PROTECTED]> --- fs/nfsd/nfs4state.c | 91 ++ 1 files changed, 47 insertions(+), 44 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 3f55970..578d809 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -462,26 +462,28 @@ copy_cred(struct svc_cred *target, struct svc_cred *source) { } static inline int -same_name(const char *n1, const char *n2) { +same_name(const char *n1, const char *n2) +{ return 0 == memcmp(n1, n2, HEXDIR_LEN); } static int -cmp_verf(nfs4_verifier *v1, nfs4_verifier *v2) { - return(!memcmp(v1->data,v2->data,sizeof(v1->data))); +same_verf(nfs4_verifier *v1, nfs4_verifier *v2) +{ + return 0 == memcmp(v1->data, v2->data, sizeof(v1->data)); } static int -cmp_clid(clientid_t * cl1, clientid_t * cl2) { - return((cl1->cl_boot == cl2->cl_boot) && - (cl1->cl_id == cl2->cl_id)); +same_clid(clientid_t *cl1, clientid_t *cl2) +{ + return (cl1->cl_boot == cl2->cl_boot) && (cl1->cl_id == cl2->cl_id); } /* XXX what about NGROUP */ static int -cmp_creds(struct svc_cred *cr1, struct svc_cred *cr2){ - return(cr1->cr_uid == cr2->cr_uid); - +same_creds(struct svc_cred *cr1, struct svc_cred *cr2) +{ + return cr1->cr_uid == cr2->cr_uid; } static void @@ -546,7 +548,7 @@ find_confirmed_client(clientid_t *clid) unsigned int idhashval = clientid_hashval(clid->cl_id); list_for_each_entry(clp, &conf_id_hashtbl[idhashval], cl_idhash) { - if (cmp_clid(&clp->cl_clientid, clid)) + if (same_clid(&clp->cl_clientid, clid)) return clp; } return NULL; @@ -559,7 +561,7 @@ find_unconfirmed_client(clientid_t *clid) unsigned int idhashval = clientid_hashval(clid->cl_id); list_for_each_entry(clp, &unconf_id_hashtbl[idhashval], cl_idhash) { - if (cmp_clid(&clp->cl_clientid, clid)) + if (same_clid(&clp->cl_clientid, clid)) return clp; } return NULL; @@ -753,7 +755,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, * or different ip_address */ status = nfserr_clid_inuse; - if (!cmp_creds(&conf->cl_cred, &rqstp->rq_cred) + if (!same_creds(&conf->cl_cred, &rqstp->rq_cred) || conf->cl_addr != sin->sin_addr.s_addr) { dprintk("NFSD: setclientid: string in use by client" "at %u.%u.%u.%u\n", NIPQUAD(conf->cl_addr)); @@ -779,7 +781,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, gen_confirm(new); gen_callback(new, setclid); add_to_unconfirmed(new, strhashval); - } else if (cmp_verf(&conf->cl_verifier, &clverifier)) { + } else if (same_verf(&conf->cl_verifier, &clverifier)) { /* * CASE 1: * cl_name match, confirmed, principal match @@ -830,7 +832,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, gen_confirm(new); gen_callback(new, setclid); add_to_unconfirmed(new, strhashval); - } else if (!cmp_verf(&conf->cl_confirm, &unconf->cl_confirm)) { + } else if (!same_verf(&conf->cl_confirm, &unconf->cl_confirm)) { /* * CASE3: * confirmed found (name, principal match) @@ -910,16 +912,16 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, goto out; if ((conf && unconf) && - (cmp_verf(&unconf->cl_confirm, &confirm)) && - (cmp_verf(&conf->cl_verifier, &unconf->cl_verifier)) && + (same_verf(&unconf->cl_confirm, &confirm)) && + (same_verf(&conf->cl_verifier, &unconf->cl_verifier)) && (same_name(conf->cl_recdir,unconf->cl_recdir)) && - (!cmp_verf(&conf->cl_confirm, &unconf->cl_confirm))) { + (!same_verf(&conf->cl_confirm, &unconf->cl_c
knfsd: nfs4 name->id mapping not correctly parsing negative downcall
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c9b6cbe56d3ac471e6cd72a59ec9e324b3417016 Commit: c9b6cbe56d3ac471e6cd72a59ec9e324b3417016 Parent: 2fdada03b3876ab9f84ede160f187e888cafefb4 Author: J. Bruce Fields <[EMAIL PROTECTED]> AuthorDate: Fri Jul 27 16:36:45 2007 -0400 Committer: J. Bruce Fields <[EMAIL PROTECTED]> CommitDate: Tue Oct 9 18:31:56 2007 -0400 knfsd: nfs4 name->id mapping not correctly parsing negative downcall Note that qword_get() returns length or -1, not an -ERROR. Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]> Acked-by: Neil Brown <[EMAIL PROTECTED]> --- fs/nfsd/nfs4idmap.c |8 +--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c index 2ccffde..4c0c683 100644 --- a/fs/nfsd/nfs4idmap.c +++ b/fs/nfsd/nfs4idmap.c @@ -207,6 +207,7 @@ idtoname_parse(struct cache_detail *cd, char *buf, int buflen) { struct ent ent, *res; char *buf1, *bp; + int len; int error = -EINVAL; if (buf[buflen - 1] != '\n') @@ -248,10 +249,11 @@ idtoname_parse(struct cache_detail *cd, char *buf, int buflen) goto out; /* Name */ - error = qword_get(&buf, buf1, PAGE_SIZE); - if (error == -EINVAL) + error = -EINVAL; + len = qword_get(&buf, buf1, PAGE_SIZE); + if (len < 0) goto out; - if (error == -ENOENT) + if (len == 0) set_bit(CACHE_NEGATIVE, &ent.h.flags); else { if (error >= IDMAP_NAMESZ) { - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
knfsd: spawn kernel thread to probe callback channel
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2b47eece1fa519a81c8b802af77a8b8aa44baa10 Commit: 2b47eece1fa519a81c8b802af77a8b8aa44baa10 Parent: c9b6cbe56d3ac471e6cd72a59ec9e324b3417016 Author: J. Bruce Fields <[EMAIL PROTECTED]> AuthorDate: Fri Jul 27 18:06:50 2007 -0400 Committer: J. Bruce Fields <[EMAIL PROTECTED]> CommitDate: Tue Oct 9 18:31:56 2007 -0400 knfsd: spawn kernel thread to probe callback channel We want to allow gss on the callback channel, so people using krb5 can still get the benefits of delegations. But looking up the rpc credential can take some time in that case. And we shouldn't delay the response to setclientid_confirm while we wait. It may be inefficient, but for now the simplest solution is just to spawn a new thread as necessary for the purpose. (Thanks to Adrian Bunk for catching a missing static here.) Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]> Cc: Adrian Bunk <[EMAIL PROTECTED]> --- fs/nfsd/nfs4callback.c | 71 +++- 1 files changed, 34 insertions(+), 37 deletions(-) diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index 31d6633..c17a520 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -365,6 +366,35 @@ nfsd4_lookupcred(struct nfs4_client *clp, int taskflags) return ret; } +/* Reference counting, callback cleanup, etc., all look racy as heck. + * And why is cb_set an atomic? */ + +static int do_probe_callback(void *data) +{ + struct nfs4_client *clp = data; + struct nfs4_callback *cb = &clp->cl_callback; + struct rpc_message msg = { + .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL], + .rpc_argp = clp, + }; + int status; + + msg.rpc_cred = nfsd4_lookupcred(clp, 0); + if (IS_ERR(msg.rpc_cred)) + goto out; + status = rpc_call_sync(cb->cb_client, &msg, RPC_TASK_SOFT); + put_rpccred(msg.rpc_cred); + + if (status) { + rpc_shutdown_client(cb->cb_client); + cb->cb_client = NULL; + } else + atomic_set(&cb->cb_set, 1); +out: + put_nfs4_client(clp); + return 0; +} + /* * Set up the callback client and put a NFSPROC4_CB_NULL on the wire... */ @@ -390,11 +420,7 @@ nfsd4_probe_callback(struct nfs4_client *clp) .authflavor = RPC_AUTH_UNIX,/* XXX: need AUTH_GSS... */ .flags = (RPC_CLNT_CREATE_NOPING), }; - struct rpc_message msg = { - .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL], - .rpc_argp = clp, - }; - int status; + struct task_struct *t; if (atomic_read(&cb->cb_set)) return; @@ -426,16 +452,11 @@ nfsd4_probe_callback(struct nfs4_client *clp) /* the task holds a reference to the nfs4_client struct */ atomic_inc(&clp->cl_count); - msg.rpc_cred = nfsd4_lookupcred(clp,0); - if (IS_ERR(msg.rpc_cred)) - goto out_release_clp; - status = rpc_call_async(cb->cb_client, &msg, RPC_TASK_ASYNC, &nfs4_cb_null_ops, NULL); - put_rpccred(msg.rpc_cred); + t = kthread_run(do_probe_callback, clp, "nfs4_cb_probe"); - if (status != 0) { - dprintk("NFSD: asynchronous NFSPROC4_CB_NULL failed!\n"); + if (IS_ERR(t)) goto out_release_clp; - } + return; out_release_clp: @@ -447,30 +468,6 @@ out_err: (int)clp->cl_name.len, clp->cl_name.data); } -static void -nfs4_cb_null(struct rpc_task *task, void *dummy) -{ - struct nfs4_client *clp = (struct nfs4_client *)task->tk_msg.rpc_argp; - struct nfs4_callback *cb = &clp->cl_callback; - __be32 addr = htonl(cb->cb_addr); - - dprintk("NFSD: nfs4_cb_null task->tk_status %d\n", task->tk_status); - - if (task->tk_status < 0) { - dprintk("NFSD: callback establishment to client %.*s failed\n", - (int)clp->cl_name.len, clp->cl_name.data); - goto out; - } - atomic_set(&cb->cb_set, 1); - dprintk("NFSD: callback set to client %u.%u.%u.%u\n", NIPQUAD(addr)); -out: - put_nfs4_client(clp); -} - -static const struct rpc_call_ops nfs4_cb_null_ops = { - .rpc_call_done = nfs4_cb_null, -}; - /* * called with dp->dl_count inc'ed. * nfs4_lock_state() may or may not have been called. - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
knfsd: move nfsv4 slab creation/destruction to module init/exit
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e8ff2a8453cedf38d6d7a0528cb9c308066a3e3e Commit: e8ff2a8453cedf38d6d7a0528cb9c308066a3e3e Parent: 2b47eece1fa519a81c8b802af77a8b8aa44baa10 Author: J. Bruce Fields <[EMAIL PROTECTED]> AuthorDate: Wed Aug 1 15:30:59 2007 -0400 Committer: J. Bruce Fields <[EMAIL PROTECTED]> CommitDate: Tue Oct 9 18:31:56 2007 -0400 knfsd: move nfsv4 slab creation/destruction to module init/exit We have some slabs that the nfs4 server uses to store state objects. We're currently creating and destroying those slabs whenever the server is brought up or down. That seems excessive; may as well just do that in module initialization and exit. Also add some minor header cleanup. (Thanks to Andrew Morton for that and a compile fix.) Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]> Acked-by: Neil Brown <[EMAIL PROTECTED]> --- fs/nfsd/nfs4state.c | 22 ++ fs/nfsd/nfsctl.c |5 - fs/nfsd/nfssvc.c |4 +--- include/linux/nfsd/nfsd.h | 18 ++ 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 2b20eb8..09573b9 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1021,7 +1021,7 @@ nfsd4_free_slab(struct kmem_cache **slab) *slab = NULL; } -static void +void nfsd4_free_slabs(void) { nfsd4_free_slab(&stateowner_slab); @@ -3152,11 +3152,14 @@ nfs4_check_open_reclaim(clientid_t *clid) /* initialization to perform at module load time: */ -void +int nfs4_state_init(void) { - int i; + int i, status; + status = nfsd4_init_slabs(); + if (status) + return status; for (i = 0; i < CLIENT_HASH_SIZE; i++) { INIT_LIST_HEAD(&conf_id_hashtbl[i]); INIT_LIST_HEAD(&conf_str_hashtbl[i]); @@ -3185,6 +3188,7 @@ nfs4_state_init(void) for (i = 0; i < CLIENT_HASH_SIZE; i++) INIT_LIST_HEAD(&reclaim_str_hashtbl[i]); reclaim_str_hashtbl_size = 0; + return 0; } static void @@ -3245,20 +3249,15 @@ __nfs4_state_start(void) set_max_delegations(); } -int +void nfs4_state_start(void) { - int status; - if (nfs4_init) - return 0; - status = nfsd4_init_slabs(); - if (status) - return status; + return; nfsd4_load_reboot_recovery_data(); __nfs4_state_start(); nfs4_init = 1; - return 0; + return; } int @@ -3316,7 +3315,6 @@ nfs4_state_shutdown(void) nfs4_lock_state(); nfs4_release_reclaim(); __nfs4_state_shutdown(); - nfsd4_free_slabs(); nfs4_unlock_state(); } diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index baac89d..d135f5f 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -679,11 +679,13 @@ static int __init init_nfsd(void) int retval; printk(KERN_INFO "Installing knfsd (copyright (C) 1996 [EMAIL PROTECTED]).\n"); + retval = nfs4_state_init(); /* nfs4 locking state */ + if (retval) + return retval; nfsd_stat_init(); /* Statistics */ nfsd_cache_init(); /* RPC reply cache */ nfsd_export_init(); /* Exports table */ nfsd_lockd_init(); /* lockd->nfsd callbacks */ - nfs4_state_init(); /* NFSv4 locking state */ nfsd_idmap_init(); /* Name to ID mapping */ if (proc_mkdir("fs/nfs", NULL)) { struct proc_dir_entry *entry; @@ -712,6 +714,7 @@ static void __exit exit_nfsd(void) nfsd_stat_shutdown(); nfsd_lockd_shutdown(); nfsd_idmap_shutdown(); + nfsd4_free_slabs(); unregister_filesystem(&nfsd_fs_type); } diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index ef46f32..1190aea 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c @@ -349,9 +349,7 @@ nfsd_svc(unsigned short port, int nrservs) error = nfsd_racache_init(2*nrservs); if (error<0) goto out; - error = nfs4_state_start(); - if (error<0) - goto out; + nfs4_state_start(); nfsd_reset_versions(); diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h index e452256..604a0d7 100644 --- a/include/linux/nfsd/nfsd.h +++ b/include/linux/nfsd/nfsd.h @@ -153,19 +153,21 @@ extern int nfsd_max_blksize; */ #ifdef CONFIG_NFSD_V4 extern unsigned int max_delegations; -void nfs4_state_init(void); -int nfs4_state_start(void); +int nfs4_state_init(void); +void nfsd4_free_slabs(void); +void nfs4_state_start(void); void nfs4_state_shutdown(void); time_t nfs4_lease_time(void); void nfs4_reset_lease(time_t leasetime); int nfs4_reset_recoverydir(char *recdir); #else -static inline void nfs4_state_init(void){}; -static inline int nfs4_state_start(void){return 0;}
knfsd: fix callback rpc cred
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=dd4877bfb6f09cb4a294b459b354c8fc8fa66904 Commit: dd4877bfb6f09cb4a294b459b354c8fc8fa66904 Parent: e8ff2a8453cedf38d6d7a0528cb9c308066a3e3e Author: J. Bruce Fields <[EMAIL PROTECTED]> AuthorDate: Tue Oct 24 18:33:17 2006 -0400 Committer: J. Bruce Fields <[EMAIL PROTECTED]> CommitDate: Tue Oct 9 18:31:57 2007 -0400 knfsd: fix callback rpc cred It doesn't make sense to make the callback with credentials that the client made the setclientid with. Instead the spec requires that the callback occur with the credentials the client authenticated *to*. It probably doesn't matter what we use for auth_unix, and some more infrastructure will be needed for auth_gss, so let's just remove the cred lookup for now. Signed-off-by: J. Bruce Fields <[EMAIL PROTECTED]> Acked-by: Neil Brown <[EMAIL PROTECTED]> --- fs/nfsd/nfs4callback.c | 33 - 1 files changed, 0 insertions(+), 33 deletions(-) diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index c17a520..c1cb7e0 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c @@ -344,28 +344,6 @@ static struct rpc_version *nfs_cb_version[] = { &nfs_cb_version4, }; -/* - * Use the SETCLIENTID credential - */ -static struct rpc_cred * -nfsd4_lookupcred(struct nfs4_client *clp, int taskflags) -{ -struct auth_cred acred; - struct rpc_clnt *clnt = clp->cl_callback.cb_client; - struct rpc_cred *ret; - -get_group_info(clp->cl_cred.cr_group_info); -acred.uid = clp->cl_cred.cr_uid; -acred.gid = clp->cl_cred.cr_gid; -acred.group_info = clp->cl_cred.cr_group_info; - -dprintk("NFSD: looking up %s cred\n", -clnt->cl_auth->au_ops->au_name); -ret = rpcauth_lookup_credcache(clnt->cl_auth, &acred, taskflags); -put_group_info(clp->cl_cred.cr_group_info); -return ret; -} - /* Reference counting, callback cleanup, etc., all look racy as heck. * And why is cb_set an atomic? */ @@ -379,18 +357,13 @@ static int do_probe_callback(void *data) }; int status; - msg.rpc_cred = nfsd4_lookupcred(clp, 0); - if (IS_ERR(msg.rpc_cred)) - goto out; status = rpc_call_sync(cb->cb_client, &msg, RPC_TASK_SOFT); - put_rpccred(msg.rpc_cred); if (status) { rpc_shutdown_client(cb->cb_client); cb->cb_client = NULL; } else atomic_set(&cb->cb_set, 1); -out: put_nfs4_client(clp); return 0; } @@ -488,10 +461,6 @@ nfsd4_cb_recall(struct nfs4_delegation *dp) if ((!atomic_read(&clp->cl_callback.cb_set)) || !clnt) return; - msg.rpc_cred = nfsd4_lookupcred(clp, 0); - if (IS_ERR(msg.rpc_cred)) - goto out; - cbr->cbr_trunc = 0; /* XXX need to implement truncate optimization */ cbr->cbr_dp = dp; @@ -512,8 +481,6 @@ nfsd4_cb_recall(struct nfs4_delegation *dp) status = rpc_call_sync(clnt, &msg, RPC_TASK_SOFT); } out_put_cred: - put_rpccred(msg.rpc_cred); -out: if (status == -EIO) atomic_set(&clp->cl_callback.cb_set, 0); /* Success or failure, now we're either waiting for lease expiration - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
nfsd warning fix
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=246d95ba051101e515670a1cbe2907a88d360b88 Commit: 246d95ba051101e515670a1cbe2907a88d360b88 Parent: dd4877bfb6f09cb4a294b459b354c8fc8fa66904 Author: Andrew Morton <[EMAIL PROTECTED]> AuthorDate: Thu Aug 9 00:53:50 2007 -0700 Committer: J. Bruce Fields <[EMAIL PROTECTED]> CommitDate: Tue Oct 9 18:31:57 2007 -0400 nfsd warning fix fs/nfsd/nfsctl.c: In function 'write_filehandle': fs/nfsd/nfsctl.c:301: warning: 'maxsize' may be used uninitialized in this function Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]> Acked-by: Neil Brown <[EMAIL PROTECTED]> --- fs/nfsd/nfsctl.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index d135f5f..77dc989 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -298,7 +298,7 @@ static ssize_t write_filehandle(struct file *file, char *buf, size_t size) * qword quoting is used, so filehandle will be \x */ char *dname, *path; - int maxsize; + int uninitialized_var(maxsize); char *mesg = buf; int len; struct auth_domain *dom; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
knfsd: remove code duplication in nfsd4_setclientid()
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c175b83c4c4be72535c5c12abc155e29a08323a0 Commit: c175b83c4c4be72535c5c12abc155e29a08323a0 Parent: 246d95ba051101e515670a1cbe2907a88d360b88 Author: J. Bruce Fields <[EMAIL PROTECTED]> AuthorDate: Thu Aug 9 18:34:32 2007 -0400 Committer: J. Bruce Fields <[EMAIL PROTECTED]> CommitDate: Tue Oct 9 18:31:57 2007 -0400 knfsd: remove code duplication in nfsd4_setclientid() Each branch of this if-then-else has a bunch of duplicated code that we could just put at the end. Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]> Acked-by: Neil Brown <[EMAIL PROTECTED]> --- fs/nfsd/nfs4state.c | 30 ++ 1 files changed, 6 insertions(+), 24 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 09573b9..6256492 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -774,13 +774,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, new = create_client(clname, dname); if (new == NULL) goto out; - copy_verf(new, &clverifier); - new->cl_addr = sin->sin_addr.s_addr; - copy_cred(&new->cl_cred,&rqstp->rq_cred); gen_clid(new); - gen_confirm(new); - gen_callback(new, setclid); - add_to_unconfirmed(new, strhashval); } else if (same_verf(&conf->cl_verifier, &clverifier)) { /* * CASE 1: @@ -806,13 +800,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, new = create_client(clname, dname); if (new == NULL) goto out; - copy_verf(new,&conf->cl_verifier); - new->cl_addr = sin->sin_addr.s_addr; - copy_cred(&new->cl_cred,&rqstp->rq_cred); copy_clid(new, conf); - gen_confirm(new); - gen_callback(new, setclid); - add_to_unconfirmed(new,strhashval); } else if (!unconf) { /* * CASE 2: @@ -825,13 +813,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, new = create_client(clname, dname); if (new == NULL) goto out; - copy_verf(new,&clverifier); - new->cl_addr = sin->sin_addr.s_addr; - copy_cred(&new->cl_cred,&rqstp->rq_cred); gen_clid(new); - gen_confirm(new); - gen_callback(new, setclid); - add_to_unconfirmed(new, strhashval); } else if (!same_verf(&conf->cl_confirm, &unconf->cl_confirm)) { /* * CASE3: @@ -852,19 +834,19 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, new = create_client(clname, dname); if (new == NULL) goto out; - copy_verf(new,&clverifier); - new->cl_addr = sin->sin_addr.s_addr; - copy_cred(&new->cl_cred,&rqstp->rq_cred); gen_clid(new); - gen_confirm(new); - gen_callback(new, setclid); - add_to_unconfirmed(new, strhashval); } else { /* No cases hit !!! */ status = nfserr_inval; goto out; } + copy_verf(new, &clverifier); + new->cl_addr = sin->sin_addr.s_addr; + copy_cred(&new->cl_cred, &rqstp->rq_cred); + gen_confirm(new); + gen_callback(new, setclid); + add_to_unconfirmed(new, strhashval); setclid->se_clientid.cl_boot = new->cl_clientid.cl_boot; setclid->se_clientid.cl_id = new->cl_clientid.cl_id; memcpy(setclid->se_confirm.data, new->cl_confirm.data, sizeof(setclid->se_confirm.data)); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
knfsd: demote some printk()s to dprintk()s
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2fdada03b3876ab9f84ede160f187e888cafefb4 Commit: 2fdada03b3876ab9f84ede160f187e888cafefb4 Parent: 599e0a2290b22d959c7748bda83da3614187a299 Author: J. Bruce Fields <[EMAIL PROTECTED]> AuthorDate: Fri Jul 27 16:10:37 2007 -0400 Committer: J. Bruce Fields <[EMAIL PROTECTED]> CommitDate: Tue Oct 9 18:31:56 2007 -0400 knfsd: demote some printk()s to dprintk()s To quote a recent mail from Andrew Morton: Look: if there's a way in which an unprivileged user can trigger a printk we fix it, end of story. OK. I assume that goes double for printk()s that might be triggered by random hosts on the internet. So, disable some printk()s that look like they could be triggered by malfunctioning or malicious clients. For now, just downgrade them to dprintk()s. Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]> Acked-by: Neil Brown <[EMAIL PROTECTED]> --- fs/nfsd/nfs4proc.c |4 ++-- fs/nfsd/nfs4state.c | 20 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 29b7e63..18ead17 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -238,12 +238,12 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, break; case NFS4_OPEN_CLAIM_DELEGATE_PREV: open->op_stateowner->so_confirmed = 1; - printk("NFSD: unsupported OPEN claim type %d\n", + dprintk("NFSD: unsupported OPEN claim type %d\n", open->op_claim_type); status = nfserr_notsupp; goto out; default: - printk("NFSD: Invalid OPEN claim type %d\n", + dprintk("NFSD: Invalid OPEN claim type %d\n", open->op_claim_type); status = nfserr_inval; goto out; diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 578d809..2b20eb8 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -509,7 +509,7 @@ check_name(struct xdr_netobj name) { if (name.len == 0) return 0; if (name.len > NFS4_OPAQUE_LIMIT) { - printk("NFSD: check_name: name too long(%d)!\n", name.len); + dprintk("NFSD: check_name: name too long(%d)!\n", name.len); return 0; } return 1; @@ -1742,7 +1742,7 @@ out: if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS && flag == NFS4_OPEN_DELEGATE_NONE && open->op_delegate_type != NFS4_OPEN_DELEGATE_NONE) - printk("NFSD: WARNING: refusing delegation reclaim\n"); + dprintk("NFSD: WARNING: refusing delegation reclaim\n"); open->op_delegate_type = flag; } @@ -2151,7 +2151,7 @@ nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *statei *sopp = NULL; if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) { - printk("NFSD: preprocess_seqid_op: magic stateid!\n"); + dprintk("NFSD: preprocess_seqid_op: magic stateid!\n"); return nfserr_bad_stateid; } @@ -2202,7 +2202,7 @@ nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *statei } if ((flags & CHECK_FH) && nfs4_check_fh(current_fh, stp)) { - printk("NFSD: preprocess_seqid_op: fh-stateid mismatch!\n"); + dprintk("NFSD: preprocess_seqid_op: fh-stateid mismatch!\n"); return nfserr_bad_stateid; } @@ -2218,22 +2218,22 @@ nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *statei goto check_replay; if (sop->so_confirmed && flags & CONFIRM) { - printk("NFSD: preprocess_seqid_op: expected" + dprintk("NFSD: preprocess_seqid_op: expected" " unconfirmed stateowner!\n"); return nfserr_bad_stateid; } if (!sop->so_confirmed && !(flags & CONFIRM)) { - printk("NFSD: preprocess_seqid_op: stateowner not" + dprintk("NFSD: preprocess_seqid_op: stateowner not" " confirmed yet!\n"); return nfserr_bad_stateid; } if (stateid->si_generation > stp->st_stateid.si_generation) { - printk("NFSD: preprocess_seqid_op: future stateid?!\n"); + dprintk("NFSD: preprocess_seqid_op: future stateid?!\n"); return nfserr_bad_stateid; } if (stateid->si_generation < stp->st_stateid.si_generation) { - printk("NFSD: preprocess_seqid_op: old stateid!\n"); + dprintk("NFSD: preprocess_s
svcgss: move init code into separate function
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=21fcd02be34f73bbc94db267b4db6ccd7332923d Commit: 21fcd02be34f73bbc94db267b4db6ccd7332923d Parent: c175b83c4c4be72535c5c12abc155e29a08323a0 Author: J. Bruce Fields <[EMAIL PROTECTED]> AuthorDate: Thu Aug 9 20:16:22 2007 -0400 Committer: J. Bruce Fields <[EMAIL PROTECTED]> CommitDate: Tue Oct 9 18:31:57 2007 -0400 svcgss: move init code into separate function We've let svcauth_gss_accept() get much too long and hairy. The RPC_GSS_PROC_INIT and RPC_GSS_PROC_CONTINUE_INIT cases share very little with the other cases, so it's very natural to split them off into a separate function. This will also nicely isolate the piece of code we need to parametrize to authenticating gss-protected NFSv4 callbacks on behalf of the NFS client. Signed-off-by: J. Bruce Fields <[EMAIL PROTECTED]> Acked-by: Neil Brown <[EMAIL PROTECTED]> --- net/sunrpc/auth_gss/svcauth_gss.c | 144 - 1 files changed, 77 insertions(+), 67 deletions(-) diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index 7da7050..73940df 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c @@ -631,7 +631,8 @@ svc_safe_putnetobj(struct kvec *resv, struct xdr_netobj *o) return 0; } -/* Verify the checksum on the header and return SVC_OK on success. +/* + * Verify the checksum on the header and return SVC_OK on success. * Otherwise, return SVC_DROP (in the case of a bad sequence number) * or return SVC_DENIED and indicate error in authp. */ @@ -961,6 +962,78 @@ gss_write_init_verf(struct svc_rqst *rqstp, struct rsi *rsip) } /* + * Having read the cred already and found we're in the context + * initiation case, read the verifier and initiate (or check the results + * of) upcalls to userspace for help with context initiation. If + * the upcall results are available, write the verifier and result. + * Otherwise, drop the request pending an answer to the upcall. + */ +static int svcauth_gss_handle_init(struct svc_rqst *rqstp, + struct rpc_gss_wire_cred *gc, __be32 *authp) +{ + struct kvec *argv = &rqstp->rq_arg.head[0]; + struct kvec *resv = &rqstp->rq_res.head[0]; + struct xdr_netobj tmpobj; + struct rsi *rsip, rsikey; + + /* Read the verifier; should be NULL: */ + *authp = rpc_autherr_badverf; + if (argv->iov_len < 2 * 4) + return SVC_DENIED; + if (svc_getnl(argv) != RPC_AUTH_NULL) + return SVC_DENIED; + if (svc_getnl(argv) != 0) + return SVC_DENIED; + + /* Martial context handle and token for upcall: */ + *authp = rpc_autherr_badcred; + if (gc->gc_proc == RPC_GSS_PROC_INIT && gc->gc_ctx.len != 0) + return SVC_DENIED; + memset(&rsikey, 0, sizeof(rsikey)); + if (dup_netobj(&rsikey.in_handle, &gc->gc_ctx)) + return SVC_DROP; + *authp = rpc_autherr_badverf; + if (svc_safe_getnetobj(argv, &tmpobj)) { + kfree(rsikey.in_handle.data); + return SVC_DENIED; + } + if (dup_netobj(&rsikey.in_token, &tmpobj)) { + kfree(rsikey.in_handle.data); + return SVC_DROP; + } + + /* Perform upcall, or find upcall result: */ + rsip = rsi_lookup(&rsikey); + rsi_free(&rsikey); + if (!rsip) + return SVC_DROP; + switch (cache_check(&rsi_cache, &rsip->h, &rqstp->rq_chandle)) { + case -EAGAIN: + case -ETIMEDOUT: + case -ENOENT: + /* No upcall result: */ + return SVC_DROP; + case 0: + /* Got an answer to the upcall; use it: */ + if (gss_write_init_verf(rqstp, rsip)) + return SVC_DROP; + if (resv->iov_len + 4 > PAGE_SIZE) + return SVC_DROP; + svc_putnl(resv, RPC_SUCCESS); + if (svc_safe_putnetobj(resv, &rsip->out_handle)) + return SVC_DROP; + if (resv->iov_len + 3 * 4 > PAGE_SIZE) + return SVC_DROP; + svc_putnl(resv, rsip->major_status); + svc_putnl(resv, rsip->minor_status); + svc_putnl(resv, GSS_SEQ_WIN); + if (svc_safe_putnetobj(resv, &rsip->out_token)) + return SVC_DROP; + } + return SVC_COMPLETE; +} + +/* * Accept an rpcsec packet. * If context establishment, punt to user space * If data exchange, verify/decrypt @@ -974,11 +1047,9 @@ svcauth_gss_accept(struct svc_rqst *rqstp, __be32 *authp) struct kvec *argv = &rqstp->rq_arg.head[0]; struct kvec *resv = &rqstp->rq_res.head[0]; u32 crlen; - struct xdr_netobj tmpobj; struct gss_svc_data *sv
knfsd: 64 bit ino support for NFS server
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=40ee5dc6af351c1b3de245abed4bd8e6a4a5646a Commit: 40ee5dc6af351c1b3de245abed4bd8e6a4a5646a Parent: 21fcd02be34f73bbc94db267b4db6ccd7332923d Author: Peter Staubach <[EMAIL PROTECTED]> AuthorDate: Thu Aug 16 12:10:07 2007 -0400 Committer: J. Bruce Fields <[EMAIL PROTECTED]> CommitDate: Tue Oct 9 18:31:57 2007 -0400 knfsd: 64 bit ino support for NFS server Modify the NFS server code to support 64 bit ino's, as appropriate for the system and the NFS protocol version. The gist of the changes is to query the underlying file system for attributes and not just to use the cached attributes in the inode. For this specific purpose, the inode only contains an ino field which unsigned long, which is large enough on 64 bit platforms, but is not large enough on 32 bit platforms. I haven't been able to find any reason why ->getattr can't be called while i_mutex. The specification indicates that i_mutex is not required to be held in order to invoke ->getattr, but it doesn't say that i_mutex can't be held while invoking ->getattr. I also haven't come to any conclusions regarding the value of lease_get_mtime() and whether it should or should not be invoked by fill_post_wcc() too. I chose not to change this because I thought that it was safer to leave well enough alone. If we decide to make a change, it can be done separately. Signed-off-by: Peter Staubach <[EMAIL PROTECTED]> Signed-off-by: J. Bruce Fields <[EMAIL PROTECTED]> Acked-by: Neil Brown <[EMAIL PROTECTED]> --- fs/nfsd/nfs3xdr.c | 59 --- fs/nfsd/nfs4xdr.c | 17 ++-- fs/nfsd/nfsxdr.c |4 +++ include/linux/nfsd/nfsfh.h | 42 +++ include/linux/nfsd/xdr4.h |4 +- 5 files changed, 45 insertions(+), 81 deletions(-) diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c index 10f6e7d..2d116d2 100644 --- a/fs/nfsd/nfs3xdr.c +++ b/fs/nfsd/nfs3xdr.c @@ -174,9 +174,6 @@ static __be32 * encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, struct kstat *stat) { - struct dentry *dentry = fhp->fh_dentry; - struct timespec time; - *p++ = htonl(nfs3_ftypes[(stat->mode & S_IFMT) >> 12]); *p++ = htonl((u32) stat->mode); *p++ = htonl((u32) stat->nlink); @@ -191,10 +188,9 @@ encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, *p++ = htonl((u32) MAJOR(stat->rdev)); *p++ = htonl((u32) MINOR(stat->rdev)); p = encode_fsid(p, fhp); - p = xdr_encode_hyper(p, (u64) stat->ino); + p = xdr_encode_hyper(p, stat->ino); p = encode_time3(p, &stat->atime); - lease_get_mtime(dentry->d_inode, &time); - p = encode_time3(p, &time); + p = encode_time3(p, &stat->mtime); p = encode_time3(p, &stat->ctime); return p; @@ -203,31 +199,9 @@ encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, static __be32 * encode_saved_post_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) { - struct inode*inode = fhp->fh_dentry->d_inode; - /* Attributes to follow */ *p++ = xdr_one; - - *p++ = htonl(nfs3_ftypes[(fhp->fh_post_mode & S_IFMT) >> 12]); - *p++ = htonl((u32) fhp->fh_post_mode); - *p++ = htonl((u32) fhp->fh_post_nlink); - *p++ = htonl((u32) nfsd_ruid(rqstp, fhp->fh_post_uid)); - *p++ = htonl((u32) nfsd_rgid(rqstp, fhp->fh_post_gid)); - if (S_ISLNK(fhp->fh_post_mode) && fhp->fh_post_size > NFS3_MAXPATHLEN) { - p = xdr_encode_hyper(p, (u64) NFS3_MAXPATHLEN); - } else { - p = xdr_encode_hyper(p, (u64) fhp->fh_post_size); - } - p = xdr_encode_hyper(p, ((u64)fhp->fh_post_blocks) << 9); - *p++ = fhp->fh_post_rdev[0]; - *p++ = fhp->fh_post_rdev[1]; - p = encode_fsid(p, fhp); - p = xdr_encode_hyper(p, (u64) inode->i_ino); - p = encode_time3(p, &fhp->fh_post_atime); - p = encode_time3(p, &fhp->fh_post_mtime); - p = encode_time3(p, &fhp->fh_post_ctime); - - return p; + return encode_fattr3(rqstp, p, fhp, &fhp->fh_post_attr); } /* @@ -246,6 +220,7 @@ encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) err = vfs_getattr(fhp->fh_export->ex_mnt, dentry, &stat); if (!err) { *p++ = xdr_one; /* attributes follow */ + lease_get_mtime(dentry->d_inode, &stat.mtime); return encode_fattr3(rqstp, p, fhp, &stat); } } @@ -284,6 +259,23 @@ encode_wcc_data(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) return encode_post_op_attr(rqstp, p, fhp); } +/* + * Fill in the post_op attr for the
nfsd: fix horrible indentation in nfsd_setattr
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9c85fca56b569dfba1f10ae12ce425c0e678df83 Commit: 9c85fca56b569dfba1f10ae12ce425c0e678df83 Parent: dca1dd30ce0a6234acc751bb90efba1b49079669 Author: Christoph Hellwig <[EMAIL PROTECTED]> AuthorDate: Wed Mar 7 15:26:25 2007 + Committer: J. Bruce Fields <[EMAIL PROTECTED]> CommitDate: Tue Oct 9 18:31:56 2007 -0400 nfsd: fix horrible indentation in nfsd_setattr Signed-off-by: Christoph Hellwig <[EMAIL PROTECTED]> Signed-off-by: J. Bruce Fields <[EMAIL PROTECTED]> Acked-by: Neil Brown <[EMAIL PROTECTED]> --- fs/nfsd/vfs.c | 43 ++- 1 files changed, 26 insertions(+), 17 deletions(-) diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 7867151..cec78c8 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -295,7 +295,8 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, if (!iap->ia_valid) goto out; - /* NFSv2 does not differentiate between "set-[ac]time-to-now" + /* +* NFSv2 does not differentiate between "set-[ac]time-to-now" * which only requires access, and "set-[ac]time-to-X" which * requires ownership. * So if it looks like it might be "set both to the same time which @@ -308,25 +309,33 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, */ #define BOTH_TIME_SET (ATTR_ATIME_SET | ATTR_MTIME_SET) #defineMAX_TOUCH_TIME_ERROR (30*60) - if ((iap->ia_valid & BOTH_TIME_SET) == BOTH_TIME_SET - && iap->ia_mtime.tv_sec == iap->ia_atime.tv_sec - ) { - /* Looks probable. Now just make sure time is in the right ballpark. -* Solaris, at least, doesn't seem to care what the time request is. -* We require it be within 30 minutes of now. -*/ - time_t delta = iap->ia_atime.tv_sec - get_seconds(); - if (delta<0) delta = -delta; - if (delta < MAX_TOUCH_TIME_ERROR && - inode_change_ok(inode, iap) != 0) { - /* turn off ATTR_[AM]TIME_SET but leave ATTR_[AM]TIME -* this will cause notify_change to set these times to "now" + if ((iap->ia_valid & BOTH_TIME_SET) == BOTH_TIME_SET && + iap->ia_mtime.tv_sec == iap->ia_atime.tv_sec) { + /* +* Looks probable. +* +* Now just make sure time is in the right ballpark. +* Solaris, at least, doesn't seem to care what the time +* request is. We require it be within 30 minutes of now. */ - iap->ia_valid &= ~BOTH_TIME_SET; - } + time_t delta = iap->ia_atime.tv_sec - get_seconds(); + if (delta < 0) + delta = -delta; + if (delta < MAX_TOUCH_TIME_ERROR && + inode_change_ok(inode, iap) != 0) { + /* +* Turn off ATTR_[AM]TIME_SET but leave ATTR_[AM]TIME. +* This will cause notify_change to set these times +* to "now" +*/ + iap->ia_valid &= ~BOTH_TIME_SET; + } } - /* The size case is special. It changes the file as well as the attributes. */ + /* +* The size case is special. +* It changes the file as well as the attributes. +*/ if (iap->ia_valid & ATTR_SIZE) { if (iap->ia_size < inode->i_size) { err = nfsd_permission(rqstp, fhp->fh_export, dentry, MAY_TRUNC|MAY_OWNER_OVERRIDE); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
knfsd: Add source address to sunrpc svc errors
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=354ecbb9dd89c21708b319da8c4ffd3dd6e6811d Commit: 354ecbb9dd89c21708b319da8c4ffd3dd6e6811d Parent: 40ee5dc6af351c1b3de245abed4bd8e6a4a5646a Author: Dr. David Alan Gilbert <[EMAIL PROTECTED]> AuthorDate: Sat Aug 25 16:09:27 2007 +0100 Committer: J. Bruce Fields <[EMAIL PROTECTED]> CommitDate: Tue Oct 9 18:31:57 2007 -0400 knfsd: Add source address to sunrpc svc errors This patch adds the address of the client that caused an error in sunrpc/svc.c so that you get errors that look like: svc: 192.168.66.28, port=709: unknown version (3 for prog 13, nfsd) I've seen machines which get bunches of unknown version or similar errors from time to time, and while the recent patch to add the service helps to find which service has the wrong version it doesn't help find the potentially bad client. The patch is against a checkout of Linus's git tree made on 2007-08-24. One observation is that the svc_print_addr function prints to a buffer which in this case makes life a little more complex; it just feels as if there must be lots of places that print a connection address - is there a better function to use anywhere? I think actually there are a few places with semi duplicated code; e.g. one_sock_name switches on the address family but only currently has IPV4; I wonder how many other places are similar. Signed-off-by: Dave Gilbert <[EMAIL PROTECTED]> Cc: Randy Dunlap <[EMAIL PROTECTED]> Signed-off-by: J. Bruce Fields <[EMAIL PROTECTED]> Acked-by: Neil Brown <[EMAIL PROTECTED]> --- net/sunrpc/svc.c | 40 ++-- 1 files changed, 30 insertions(+), 10 deletions(-) diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 55ea6df..a4a6bf7 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -777,6 +777,30 @@ svc_register(struct svc_serv *serv, int proto, unsigned short port) } /* + * Printk the given error with the address of the client that caused it. + */ +static int +__attribute__ ((format (printf, 2, 3))) +svc_printk(struct svc_rqst *rqstp, const char *fmt, ...) +{ + va_list args; + int r; + charbuf[RPC_MAX_ADDRBUFLEN]; + + if (!net_ratelimit()) + return 0; + + printk(KERN_WARNING "svc: %s: ", + svc_print_addr(rqstp, buf, sizeof(buf))); + + va_start(args, fmt); + r = vprintk(fmt, args); + va_end(args); + + return r; +} + +/* * Process the RPC request. */ int @@ -963,14 +987,13 @@ svc_process(struct svc_rqst *rqstp) return 0; err_short_len: - if (net_ratelimit()) - printk("svc: short len %Zd, dropping request\n", argv->iov_len); + svc_printk(rqstp, "short len %Zd, dropping request\n", + argv->iov_len); goto dropit;/* drop request */ err_bad_dir: - if (net_ratelimit()) - printk("svc: bad direction %d, dropping request\n", dir); + svc_printk(rqstp, "bad direction %d, dropping request\n", dir); serv->sv_stats->rpcbadfmt++; goto dropit;/* drop request */ @@ -1000,8 +1023,7 @@ err_bad_prog: goto sendit; err_bad_vers: - if (net_ratelimit()) - printk("svc: unknown version (%d for prog %d, %s)\n", + svc_printk(rqstp, "unknown version (%d for prog %d, %s)\n", vers, prog, progp->pg_name); serv->sv_stats->rpcbadfmt++; @@ -1011,16 +1033,14 @@ err_bad_vers: goto sendit; err_bad_proc: - if (net_ratelimit()) - printk("svc: unknown procedure (%d)\n", proc); + svc_printk(rqstp, "unknown procedure (%d)\n", proc); serv->sv_stats->rpcbadfmt++; svc_putnl(resv, RPC_PROC_UNAVAIL); goto sendit; err_garbage: - if (net_ratelimit()) - printk("svc: failed to decode args\n"); + svc_printk(rqstp, "failed to decode args\n"); rpc_stat = rpc_garbage_args; err_bad: - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
knfsd: let nfsd manage timing out its own leases
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0272e1fd9f4fa8a43357c168e081744f99e67195 Commit: 0272e1fd9f4fa8a43357c168e081744f99e67195 Parent: 354ecbb9dd89c21708b319da8c4ffd3dd6e6811d Author: J. Bruce Fields <[EMAIL PROTECTED]> AuthorDate: Wed Sep 12 18:56:12 2007 -0400 Committer: J. Bruce Fields <[EMAIL PROTECTED]> CommitDate: Tue Oct 9 18:31:57 2007 -0400 knfsd: let nfsd manage timing out its own leases Currently there's a race that can cause an oops in generic_setlease. (In detail: nfsd, when it removes a lease, does so by calling vfs_setlease() with F_UNLCK and a pointer to the fl_flock field, which in turn points to nfsd's existing lease; but the first thing the setlease code does is call time_out_leases(). If the lease happens to already be beyond the lease break time, that will free the lease and (in nfsd's release_private callback) set fl_flock to NULL, leading to a NULL deference soon after in vfs_setlease().) There are probably other things to fix here too, but it seems inherently racy to allow either locks.c or nfsd to time out this lease. Instead just set the fl_break_time to 0 (preventing locks.c from ever timing out this lock) and leave it up to nfsd's laundromat thread to deal with it. Signed-off-by: J. Bruce Fields <[EMAIL PROTECTED]> --- fs/nfsd/nfs4state.c |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 6256492..48fbdac 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1354,8 +1354,12 @@ void nfsd_break_deleg_cb(struct file_lock *fl) /* only place dl_time is set. protected by lock_kernel*/ dp->dl_time = get_seconds(); - /* XXX need to merge NFSD_LEASE_TIME with fs/locks.c:lease_break_time */ - fl->fl_break_time = jiffies + NFSD_LEASE_TIME * HZ; + /* +* We don't want the locks code to timeout the lease for us; +* we'll remove it ourself if the delegation isn't returned +* in time. +*/ + fl->fl_break_time = 0; t = kthread_run(do_recall, dp, "%s", "nfs4_cb_recall"); if (IS_ERR(t)) { - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
knfsd: don't shutdown callbacks until nfsv4 client is freed
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1b1a9b3163a83f52ea2ac333846d4dfd2c4edd90 Commit: 1b1a9b3163a83f52ea2ac333846d4dfd2c4edd90 Parent: 0272e1fd9f4fa8a43357c168e081744f99e67195 Author: J. Bruce Fields <[EMAIL PROTECTED]> AuthorDate: Wed Sep 12 08:43:59 2007 -0400 Committer: J. Bruce Fields <[EMAIL PROTECTED]> CommitDate: Tue Oct 9 18:31:57 2007 -0400 knfsd: don't shutdown callbacks until nfsv4 client is freed If a callback still holds a reference on the client, then it may be about to perform an rpc call, so it isn't safe to call rpc_shutdown(). (Though rpc_shutdown() does wait for any outstanding rpc's, it can't know if a new rpc is about to be issued with that client.) So, wait to shutdown the rpc_client until the reference count on the client has gone to zero. Signed-off-by: J. Bruce Fields <[EMAIL PROTECTED]> --- fs/nfsd/nfs4state.c | 27 +-- 1 files changed, 13 insertions(+), 14 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 48fbdac..e706c69 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -358,9 +358,22 @@ alloc_client(struct xdr_netobj name) return clp; } +static void +shutdown_callback_client(struct nfs4_client *clp) +{ + struct rpc_clnt *clnt = clp->cl_callback.cb_client; + + /* shutdown rpc client, ending any outstanding recall rpcs */ + if (clnt) { + clp->cl_callback.cb_client = NULL; + rpc_shutdown_client(clnt); + } +} + static inline void free_client(struct nfs4_client *clp) { + shutdown_callback_client(clp); if (clp->cl_cred.cr_group_info) put_group_info(clp->cl_cred.cr_group_info); kfree(clp->cl_name.data); @@ -375,18 +388,6 @@ put_nfs4_client(struct nfs4_client *clp) } static void -shutdown_callback_client(struct nfs4_client *clp) -{ - struct rpc_clnt *clnt = clp->cl_callback.cb_client; - - /* shutdown rpc client, ending any outstanding recall rpcs */ - if (clnt) { - clp->cl_callback.cb_client = NULL; - rpc_shutdown_client(clnt); - } -} - -static void expire_client(struct nfs4_client *clp) { struct nfs4_stateowner *sop; @@ -396,8 +397,6 @@ expire_client(struct nfs4_client *clp) dprintk("NFSD: expire_client cl_count %d\n", atomic_read(&clp->cl_count)); - shutdown_callback_client(clp); - INIT_LIST_HEAD(&reaplist); spin_lock(&recall_lock); while (!list_empty(&clp->cl_delegations)) { - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
knfsd: nfsv4 delegation recall should take reference on client
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cfdcad4da1903720b9b8c1f176e46a0ebf546be3 Commit: cfdcad4da1903720b9b8c1f176e46a0ebf546be3 Parent: 1b1a9b3163a83f52ea2ac333846d4dfd2c4edd90 Author: J. Bruce Fields <[EMAIL PROTECTED]> AuthorDate: Wed Sep 12 20:35:15 2007 -0400 Committer: J. Bruce Fields <[EMAIL PROTECTED]> CommitDate: Tue Oct 9 18:31:57 2007 -0400 knfsd: nfsv4 delegation recall should take reference on client It's not enough to take a reference on the delegation object itself; we need to ensure that the rpc_client won't go away just as we're about to make an rpc call. Signed-off-by: J. Bruce Fields <[EMAIL PROTECTED]> --- fs/nfsd/nfs4callback.c |1 + fs/nfsd/nfs4state.c|2 ++ 2 files changed, 3 insertions(+), 0 deletions(-) diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index c1cb7e0..9d536a8 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c @@ -486,6 +486,7 @@ out_put_cred: /* Success or failure, now we're either waiting for lease expiration * or deleg_return. */ dprintk("NFSD: nfs4_cb_recall: dp %p dl_flock %p dl_count %d\n",dp, dp->dl_flock, atomic_read(&dp->dl_count)); + put_nfs4_client(clp); nfs4_put_delegation(dp); return; } diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index e706c69..6f182d2 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1345,6 +1345,7 @@ void nfsd_break_deleg_cb(struct file_lock *fl) * lock) we know the server hasn't removed the lease yet, we know * it's safe to take a reference: */ atomic_inc(&dp->dl_count); + atomic_inc(&dp->dl_client->cl_count); spin_lock(&recall_lock); list_add_tail(&dp->dl_recall_lru, &del_recall_lru); @@ -1367,6 +1368,7 @@ void nfsd_break_deleg_cb(struct file_lock *fl) printk(KERN_INFO "NFSD: Callback thread failed for " "for client (clientid %08x/%08x)\n", clp->cl_clientid.cl_boot, clp->cl_clientid.cl_id); + put_nfs4_client(dp->dl_client); nfs4_put_delegation(dp); } } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
knfsd: query filesystem for NFSv4 getattr of FATTR4_MAXNAME
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a16e92edcd0a2846455a30823e1bac964e743baa Commit: a16e92edcd0a2846455a30823e1bac964e743baa Parent: cfdcad4da1903720b9b8c1f176e46a0ebf546be3 Author: J. Bruce Fields <[EMAIL PROTECTED]> AuthorDate: Fri Sep 28 16:45:51 2007 -0400 Committer: J. Bruce Fields <[EMAIL PROTECTED]> CommitDate: Tue Oct 9 18:31:57 2007 -0400 knfsd: query filesystem for NFSv4 getattr of FATTR4_MAXNAME Without this we always return 2^32-1 as the the maximum namelength. Thanks to Andreas Gruenbacher for bug report and testing. Signed-off-by: J. Bruce Fields <[EMAIL PROTECTED]> Cc: Andreas Gruenbacher <[EMAIL PROTECTED]> --- fs/nfsd/nfs4xdr.c |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 9cf9007..e15f2cf 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -1475,7 +1475,8 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, err = vfs_getattr(exp->ex_mnt, dentry, &stat); if (err) goto out_nfserr; - if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL)) || + if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL | + FATTR4_WORD0_MAXNAME)) || (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | FATTR4_WORD1_SPACE_TOTAL))) { err = vfs_statfs(dentry, &statfs); @@ -1721,7 +1722,7 @@ out_acl: if (bmval0 & FATTR4_WORD0_MAXNAME) { if ((buflen -= 4) < 0) goto out_resource; - WRITE32(~(u32) 0); + WRITE32(statfs.f_namelen); } if (bmval0 & FATTR4_WORD0_MAXREAD) { if ((buflen -= 8) < 0) - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
drm: remove XFREE86_VERSION macros.
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b589ee5943a9610ebaea6e4e3433f2ae4d812b0b Commit: b589ee5943a9610ebaea6e4e3433f2ae4d812b0b Parent: 6c340eac0285f3d62406d2d902d0e96fbf2a5dc0 Author: Dave Airlie <[EMAIL PROTECTED]> AuthorDate: Tue Aug 28 15:16:47 2007 +1000 Committer: Dave Airlie <[EMAIL PROTECTED](none)> CommitDate: Mon Oct 15 10:38:20 2007 +1000 drm: remove XFREE86_VERSION macros. These are no longer needed or being used. Signed-off-by: Dave Airlie <[EMAIL PROTECTED]> --- drivers/char/drm/drm.h | 20 +--- drivers/char/drm/i810_drm.h |5 - drivers/char/drm/r128_drm.h | 18 -- 3 files changed, 1 insertions(+), 42 deletions(-) diff --git a/drivers/char/drm/drm.h b/drivers/char/drm/drm.h index 2d6f2d0..82fb3d0 100644 --- a/drivers/char/drm/drm.h +++ b/drivers/char/drm/drm.h @@ -63,27 +63,9 @@ #define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size) #endif -#define XFREE86_VERSION(major,minor,patch,snap) \ - ((major << 16) | (minor << 8) | patch) - -#ifndef CONFIG_XFREE86_VERSION -#define CONFIG_XFREE86_VERSION XFREE86_VERSION(4,1,0,0) -#endif - -#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0) -#define DRM_PROC_DEVICES "/proc/devices" -#define DRM_PROC_MISC "/proc/misc" -#define DRM_PROC_DRM"/proc/drm" -#define DRM_DEV_DRM "/dev/drm" -#define DRM_DEV_MODE(S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) -#define DRM_DEV_UID 0 -#define DRM_DEV_GID 0 -#endif - -#if CONFIG_XFREE86_VERSION >= XFREE86_VERSION(4,1,0,0) #define DRM_MAJOR 226 #define DRM_MAX_MINOR 15 -#endif + #define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */ #define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */ #define DRM_MAX_ORDER 22/**< Up to 2^22 bytes = 4MB */ diff --git a/drivers/char/drm/i810_drm.h b/drivers/char/drm/i810_drm.h index 614977d..7a10bb6 100644 --- a/drivers/char/drm/i810_drm.h +++ b/drivers/char/drm/i810_drm.h @@ -102,13 +102,8 @@ typedef enum _drm_i810_init_func { /* This is the init structure after v1.2 */ typedef struct _drm_i810_init { drm_i810_init_func_t func; -#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0) - int ring_map_idx; - int buffer_map_idx; -#else unsigned int mmio_offset; unsigned int buffers_offset; -#endif int sarea_priv_offset; unsigned int ring_start; unsigned int ring_end; diff --git a/drivers/char/drm/r128_drm.h b/drivers/char/drm/r128_drm.h index e94a39c..8d8878b 100644 --- a/drivers/char/drm/r128_drm.h +++ b/drivers/char/drm/r128_drm.h @@ -222,11 +222,7 @@ typedef struct drm_r128_init { R128_INIT_CCE = 0x01, R128_CLEANUP_CCE = 0x02 } func; -#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0) - int sarea_priv_offset; -#else unsigned long sarea_priv_offset; -#endif int is_pci; int cce_mode; int cce_secure; @@ -240,21 +236,12 @@ typedef struct drm_r128_init { unsigned int depth_offset, depth_pitch; unsigned int span_offset; -#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0) - unsigned int fb_offset; - unsigned int mmio_offset; - unsigned int ring_offset; - unsigned int ring_rptr_offset; - unsigned int buffers_offset; - unsigned int agp_textures_offset; -#else unsigned long fb_offset; unsigned long mmio_offset; unsigned long ring_offset; unsigned long ring_rptr_offset; unsigned long buffers_offset; unsigned long agp_textures_offset; -#endif } drm_r128_init_t; typedef struct drm_r128_cce_stop { @@ -264,15 +251,10 @@ typedef struct drm_r128_cce_stop { typedef struct drm_r128_clear { unsigned int flags; -#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0) - int x, y, w, h; -#endif unsigned int clear_color; unsigned int clear_depth; -#if CONFIG_XFREE86_VERSION >= XFREE86_VERSION(4,1,0,0) unsigned int color_mask; unsigned int depth_mask; -#endif } drm_r128_clear_t; typedef struct drm_r128_vertex { - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
i915: fix vbl swap allocation size.
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=54583bf4efda79388fc13163e35c016c8bc5de81 Commit: 54583bf4efda79388fc13163e35c016c8bc5de81 Parent: c153f45f9b7e30289157bba3ff5682291df16caa Author: Dave Airlie <[EMAIL PROTECTED]> AuthorDate: Sun Oct 14 21:21:30 2007 +1000 Committer: Dave Airlie <[EMAIL PROTECTED](none)> CommitDate: Mon Oct 15 10:42:27 2007 +1000 i915: fix vbl swap allocation size. Oops... Signed-off-by: Dave Airlie <[EMAIL PROTECTED]> --- drivers/char/drm/i915_irq.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/char/drm/i915_irq.c b/drivers/char/drm/i915_irq.c index 380c3f3..a443f4a 100644 --- a/drivers/char/drm/i915_irq.c +++ b/drivers/char/drm/i915_irq.c @@ -540,7 +540,7 @@ int i915_vblank_swap(struct drm_device *dev, void *data, return -EBUSY; } - vbl_swap = drm_calloc(1, sizeof(vbl_swap), DRM_MEM_DRIVER); + vbl_swap = drm_calloc(1, sizeof(*vbl_swap), DRM_MEM_DRIVER); if (!vbl_swap) { DRM_ERROR("Failed to allocate memory to queue swap\n"); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
radeon: Commit the ring after each partial texture upload blit.
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=eed0f722b3fccb1eb2706b5f484cb511d46f70b8 Commit: eed0f722b3fccb1eb2706b5f484cb511d46f70b8 Parent: 54583bf4efda79388fc13163e35c016c8bc5de81 Author: chaohong guo <[EMAIL PROTECTED]> AuthorDate: Mon Oct 15 10:45:49 2007 +1000 Committer: Dave Airlie <[EMAIL PROTECTED]> CommitDate: Mon Oct 15 10:45:49 2007 +1000 radeon: Commit the ring after each partial texture upload blit. This makes sure each blit starts as early as possible, which may improve texture upload performance in some cases. Signed-off-by: Dave Airlie <[EMAIL PROTECTED]> --- drivers/char/drm/radeon_state.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/char/drm/radeon_state.c b/drivers/char/drm/radeon_state.c index ada8207..69c9f2f 100644 --- a/drivers/char/drm/radeon_state.c +++ b/drivers/char/drm/radeon_state.c @@ -1861,6 +1861,7 @@ static int radeon_cp_dispatch_texture(struct drm_device * dev, OUT_RING((image->width << 16) | height); RADEON_WAIT_UNTIL_2D_IDLE(); ADVANCE_RING(); + COMMIT_RING(); radeon_cp_discard_buffer(dev, buf); @@ -1878,6 +1879,8 @@ static int radeon_cp_dispatch_texture(struct drm_device * dev, RADEON_FLUSH_CACHE(); RADEON_WAIT_UNTIL_2D_IDLE(); ADVANCE_RING(); + COMMIT_RING(); + return 0; } @@ -2378,7 +2381,6 @@ static int radeon_cp_texture(struct drm_device *dev, void *data, struct drm_file ret = radeon_cp_dispatch_texture(dev, file_priv, tex, &image); - COMMIT_RING(); return ret; } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
via invalid device ids removal
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ace3dff5b7f0bf5a647e60dcd0c0a7d46792f5d9 Commit: ace3dff5b7f0bf5a647e60dcd0c0a7d46792f5d9 Parent: eed0f722b3fccb1eb2706b5f484cb511d46f70b8 Author: Xavier Bachelot <[EMAIL PROTECTED]> AuthorDate: Mon Oct 15 11:09:35 2007 +1000 Committer: Dave Airlie <[EMAIL PROTECTED]> CommitDate: Mon Oct 15 11:09:35 2007 +1000 via invalid device ids removal 0x1106, 0x7204 is unknown and thus is not an IGP/GPU. 0x1106, 0x3304 is K8M800 hostbridge, not an IGP/GPU. None of them are in drm git tree. Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Dave Airlie <[EMAIL PROTECTED]> --- drivers/char/drm/drm_pciids.h |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/drivers/char/drm/drm_pciids.h b/drivers/char/drm/drm_pciids.h index 30b200b..f359397 100644 --- a/drivers/char/drm/drm_pciids.h +++ b/drivers/char/drm/drm_pciids.h @@ -236,10 +236,8 @@ {0x1106, 0x3022, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ {0x1106, 0x3118, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VIA_PRO_GROUP_A}, \ {0x1106, 0x3122, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ - {0x1106, 0x7204, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ {0x1106, 0x7205, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ {0x1106, 0x3108, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ - {0x1106, 0x3304, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ {0x1106, 0x3344, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ {0x1106, 0x3343, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ {0x1106, 0x3230, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VIA_DX9_0}, \ - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
AGP fix race condition between unmapping and freeing pages
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a2721e998ede079db10f65e4b42310f79dc8f135 Commit: a2721e998ede079db10f65e4b42310f79dc8f135 Parent: 23fd50450a34f2558070ceabb0bfebc1c9604af5 Author: Dave Airlie <[EMAIL PROTECTED]> AuthorDate: Mon Oct 15 10:19:16 2007 +1000 Committer: Dave Airlie <[EMAIL PROTECTED](none)> CommitDate: Mon Oct 15 10:32:15 2007 +1000 AGP fix race condition between unmapping and freeing pages With Andi's clflush fixup, we were getting hangs on server exit, flushing the mappings after freeing each page helped. This showed up a race condition where the pages after being freed could be reused before the agp mappings had been flushed. Flushing after each single page is a bad thing for future drm work, so make the page destroy a two pass unmapping all the pages, flushing the mappings, and then destroying the pages. Signed-off-by: Dave Airlie <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> --- drivers/char/agp/agp.h |7 +-- drivers/char/agp/ali-agp.c | 27 --- drivers/char/agp/backend.c | 12 drivers/char/agp/generic.c | 19 +-- drivers/char/agp/i460-agp.c |4 ++-- drivers/char/agp/intel-agp.c |6 -- 6 files changed, 48 insertions(+), 27 deletions(-) diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h index 8955e7f..b83824c 100644 --- a/drivers/char/agp/agp.h +++ b/drivers/char/agp/agp.h @@ -58,6 +58,9 @@ struct gatt_mask { * devices this will probably be ignored */ }; +#define AGP_PAGE_DESTROY_UNMAP 1 +#define AGP_PAGE_DESTROY_FREE 2 + struct aper_size_info_8 { int size; int num_entries; @@ -113,7 +116,7 @@ struct agp_bridge_driver { struct agp_memory *(*alloc_by_type) (size_t, int); void (*free_by_type)(struct agp_memory *); void *(*agp_alloc_page)(struct agp_bridge_data *); - void (*agp_destroy_page)(void *); + void (*agp_destroy_page)(void *, int flags); int (*agp_type_to_mask_type) (struct agp_bridge_data *, int); }; @@ -267,7 +270,7 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type); struct agp_memory *agp_generic_alloc_by_type(size_t page_count, int type); void agp_generic_free_by_type(struct agp_memory *curr); void *agp_generic_alloc_page(struct agp_bridge_data *bridge); -void agp_generic_destroy_page(void *addr); +void agp_generic_destroy_page(void *addr, int flags); void agp_free_key(int key); int agp_num_entries(void); u32 agp_collect_device_status(struct agp_bridge_data *bridge, u32 mode, u32 command); diff --git a/drivers/char/agp/ali-agp.c b/drivers/char/agp/ali-agp.c index 4941ddb..aa5ddb7 100644 --- a/drivers/char/agp/ali-agp.c +++ b/drivers/char/agp/ali-agp.c @@ -156,29 +156,34 @@ static void *m1541_alloc_page(struct agp_bridge_data *bridge) return addr; } -static void ali_destroy_page(void * addr) +static void ali_destroy_page(void * addr, int flags) { if (addr) { - global_cache_flush(); /* is this really needed? --hch */ - agp_generic_destroy_page(addr); - global_flush_tlb(); + if (flags & AGP_PAGE_DESTROY_UNMAP) { + global_cache_flush(); /* is this really needed? --hch */ + agp_generic_destroy_page(addr, flags); + global_flush_tlb(); + } else + agp_generic_destroy_page(addr, flags); } } -static void m1541_destroy_page(void * addr) +static void m1541_destroy_page(void * addr, int flags) { u32 temp; if (addr == NULL) return; - global_cache_flush(); + if (flags & AGP_PAGE_DESTROY_UNMAP) { + global_cache_flush(); - pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp); - pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, - (((temp & ALI_CACHE_FLUSH_ADDR_MASK) | - virt_to_gart(addr)) | ALI_CACHE_FLUSH_EN)); - agp_generic_destroy_page(addr); + pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp); + pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, + (((temp & ALI_CACHE_FLUSH_ADDR_MASK) | +virt_to_gart(addr)) | ALI_CACHE_FLUSH_EN)); + } + agp_generic_destroy_page(addr, flags); } diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c index 1b47c89..832ded2 100644 --- a/drivers/char/agp/backend.c +++ b/drivers/char/agp/backend.c @@ -189,9 +189,11 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge) err_out: if (bridge->driver->needs_scratch_page) { - bridge->driver->agp_destroy_page
fix use after free in amd create gatt pages
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bdc3e603cda3433c2ccc2069d28f7f3cd319cfc6 Commit: bdc3e603cda3433c2ccc2069d28f7f3cd319cfc6 Parent: a2721e998ede079db10f65e4b42310f79dc8f135 Author: Jesper Juhl <[EMAIL PROTECTED]> AuthorDate: Mon Oct 15 10:24:05 2007 +1000 Committer: Dave Airlie <[EMAIL PROTECTED](none)> CommitDate: Mon Oct 15 10:32:15 2007 +1000 fix use after free in amd create gatt pages Coverity spotted a "use after free" bug in drivers/char/agp/amd-k7-agp.c::amd_create_gatt_pages(). The problem is this: If "entry = kzalloc(sizeof(struct amd_page_map), GFP_KERNEL);" fails, then there's a loop in the function to free all entries allocated so far and break out of the allocation loop. That in itself is pretty sane, but then the (now freed) 'tables' is assigned to amd_irongate_private.gatt_pages and 'retval' is set to -ENOMEM which causes amd_free_gatt_pages(); to be called at the end of the function. The problem with this is that amd_free_gatt_pages() will then loop 'amd_irongate_private.num_tables' times and try to free each entry in tables[] - this is bad since tables has already been freed and furthermore it will call kfree(tables) at the end - a double free. This patch removes the freeing loop in amd_create_gatt_pages() and instead relies entirely on the call to amd_free_gatt_pages() to free everything we allocated in case of an error. It also sets amd_irongate_private.num_tables to the actual number of entries allocated instead of just using the value passed in from the caller - this ensures that amd_free_gatt_pages() will only attempt to free stuff that was actually allocated. Signed-off-by: Jesper Juhl <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Dave Airlie <[EMAIL PROTECTED]> --- drivers/char/agp/amd-k7-agp.c |9 ++--- 1 files changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c index f60bca7..1405a42 100644 --- a/drivers/char/agp/amd-k7-agp.c +++ b/drivers/char/agp/amd-k7-agp.c @@ -100,21 +100,16 @@ static int amd_create_gatt_pages(int nr_tables) for (i = 0; i < nr_tables; i++) { entry = kzalloc(sizeof(struct amd_page_map), GFP_KERNEL); + tables[i] = entry; if (entry == NULL) { - while (i > 0) { - kfree(tables[i-1]); - i--; - } - kfree(tables); retval = -ENOMEM; break; } - tables[i] = entry; retval = amd_create_page_map(entry); if (retval != 0) break; } - amd_irongate_private.num_tables = nr_tables; + amd_irongate_private.num_tables = i; amd_irongate_private.gatt_pages = tables; if (retval != 0) - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] add srp transport class
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=09345f65058bb927f3b3f4c33421f83ba8eeb5f8 Commit: 09345f65058bb927f3b3f4c33421f83ba8eeb5f8 Parent: 604cd794de3094ccf8a9c149f299237a642ba9b5 Author: FUJITA Tomonori <[EMAIL PROTECTED]> AuthorDate: Wed Jun 27 16:32:39 2007 +0900 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:37:35 2007 -0400 [SCSI] add srp transport class This adds srp transport class that works with ib_srp and ibmvscsi. It creates only /sys/class/{srp_host,srp_remote_ports} and srp_remote_ports has only "port_id" attribute. viola:/sys/class/srp_remote_ports/port-0:1# ls device port_id subsystem uevent viola:/sys/class/srp_remote_ports/port-0:1# cat port_id 4c:49:4e:55:58:20:56:49:4f:00:00:00:00:00:00:00 Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/Kconfig |7 + drivers/scsi/Makefile |1 + drivers/scsi/scsi_transport_srp.c | 320 + include/scsi/scsi_transport_srp.h | 32 4 files changed, 360 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index d2b3898..50d3062 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -289,6 +289,13 @@ config SCSI_SAS_ATTRS source "drivers/scsi/libsas/Kconfig" +config SCSI_SRP_ATTRS + tristate "SRP Transport Attributes" + depends on SCSI + help + If you wish to export transport-specific information about + each attached SRP device to sysfs, say Y. + endmenu menuconfig SCSI_LOWLEVEL diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index 86a7ba7..6141389 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile @@ -34,6 +34,7 @@ obj-$(CONFIG_SCSI_FC_ATTRS) += scsi_transport_fc.o obj-$(CONFIG_SCSI_ISCSI_ATTRS) += scsi_transport_iscsi.o obj-$(CONFIG_SCSI_SAS_ATTRS) += scsi_transport_sas.o obj-$(CONFIG_SCSI_SAS_LIBSAS) += libsas/ +obj-$(CONFIG_SCSI_SRP_ATTRS) += scsi_transport_srp.o obj-$(CONFIG_ISCSI_TCP)+= libiscsi.o iscsi_tcp.o obj-$(CONFIG_INFINIBAND_ISER) += libiscsi.o diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c new file mode 100644 index 000..dcb3d2a --- /dev/null +++ b/drivers/scsi/scsi_transport_srp.c @@ -0,0 +1,320 @@ +/* + * SCSI RDMA (SRP) transport class + * + * Copyright (C) 2007 FUJITA Tomonori <[EMAIL PROTECTED]> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation, version 2 of the + * License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +struct srp_host_attrs { + atomic_t next_port_id; +}; +#define to_srp_host_attrs(host)((struct srp_host_attrs *)(host)->shost_data) + +#define SRP_HOST_ATTRS 0 +#define SRP_RPORT_ATTRS 3 + +struct srp_internal { + struct scsi_transport_template t; + struct srp_function_template *f; + + struct class_device_attribute *host_attrs[SRP_HOST_ATTRS + 1]; + + struct class_device_attribute *rport_attrs[SRP_RPORT_ATTRS + 1]; + struct class_device_attribute private_rport_attrs[SRP_RPORT_ATTRS]; + struct transport_container rport_attr_cont; +}; + +#define to_srp_internal(tmpl) container_of(tmpl, struct srp_internal, t) + +#definedev_to_rport(d) container_of(d, struct srp_rport, dev) +#define transport_class_to_srp_rport(cdev) dev_to_rport((cdev)->dev) + +static int srp_host_setup(struct transport_container *tc, struct device *dev, + struct class_device *cdev) +{ + struct Scsi_Host *shost = dev_to_shost(dev); + struct srp_host_attrs *srp_host = to_srp_host_attrs(shost); + + atomic_set(&srp_host->next_port_id, 0); + return 0; +} + +static DECLARE_TRANSPORT_CLASS(srp_host_class, "srp_host", srp_host_setup, + NULL, NULL); + +static DECLARE_TRANSPORT_CLASS(srp_rport_class, "srp_remote_ports", + NULL, NULL, NULL); + +#define SETUP_TEMPLATE(attrb, field, perm, test, ro_test, ro_perm) \ + i->private_##attrb[count] = class_device_attr_##field; \ + i->private_##attrb[count].attr.mode = perm; \ +
[SCSI] ibmvscsi: convert to use the srp transport class
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4d68041907b150b07640b607c6c626391cf3fe8b Commit: 4d68041907b150b07640b607c6c626391cf3fe8b Parent: 09345f65058bb927f3b3f4c33421f83ba8eeb5f8 Author: FUJITA Tomonori <[EMAIL PROTECTED]> AuthorDate: Wed Jun 27 16:32:50 2007 +0900 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:37:39 2007 -0400 [SCSI] ibmvscsi: convert to use the srp transport class This converts ibmvscsi to use the srp transport class. Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]> Acked-by: Brian King <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/Kconfig |1 + drivers/scsi/ibmvscsi/ibmvscsi.c | 34 -- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 50d3062..778dc0f 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -839,6 +839,7 @@ config SCSI_IPS config SCSI_IBMVSCSI tristate "IBM Virtual SCSI support" depends on PPC_PSERIES || PPC_ISERIES + select SCSI_SRP_ATTRS help This is the IBM POWER Virtual SCSI Client diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 5ecc63d..e6f937e 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c @@ -75,6 +75,7 @@ #include #include #include +#include #include "ibmvscsi.h" /* The values below are somewhat arbitrary default values, but @@ -87,6 +88,8 @@ static int max_channel = 3; static int init_timeout = 5; static int max_requests = IBMVSCSI_MAX_REQUESTS_DEFAULT; +static struct scsi_transport_template *ibmvscsi_transport_template; + #define IBMVSCSI_VERSION "1.5.8" MODULE_DESCRIPTION("IBM Virtual SCSI"); @@ -1553,6 +1556,8 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id) struct ibmvscsi_host_data *hostdata; struct Scsi_Host *host; struct device *dev = &vdev->dev; + struct srp_rport_identifiers ids; + struct srp_rport *rport; unsigned long wait_switch = 0; int rc; @@ -1565,6 +1570,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id) goto scsi_host_alloc_failed; } + host->transportt = ibmvscsi_transport_template; hostdata = shost_priv(host); memset(hostdata, 0x00, sizeof(*hostdata)); INIT_LIST_HEAD(&hostdata->sent); @@ -1590,6 +1596,13 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id) if (scsi_add_host(hostdata->host, hostdata->dev)) goto add_host_failed; + /* we don't have a proper target_port_id so let's use the fake one */ + memcpy(ids.port_id, hostdata->madapter_info.partition_name, + sizeof(ids.port_id)); + rport = srp_rport_add(host, &ids); + if (IS_ERR(rport)) + goto add_srp_port_failed; + /* Try to send an initialization message. Note that this is allowed * to fail if the other end is not acive. In that case we don't * want to scan @@ -1617,6 +1630,8 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id) vdev->dev.driver_data = hostdata; return 0; + add_srp_port_failed: + scsi_remove_host(hostdata->host); add_host_failed: release_event_pool(&hostdata->pool, hostdata); init_pool_failed: @@ -1633,7 +1648,8 @@ static int ibmvscsi_remove(struct vio_dev *vdev) release_event_pool(&hostdata->pool, hostdata); ibmvscsi_release_crq_queue(&hostdata->queue, hostdata, max_requests); - + + srp_remove_host(hostdata->host); scsi_remove_host(hostdata->host); scsi_host_put(hostdata->host); @@ -1660,14 +1676,28 @@ static struct vio_driver ibmvscsi_driver = { } }; +static struct srp_function_template ibmvscsi_transport_functions = { +}; + int __init ibmvscsi_module_init(void) { - return vio_register_driver(&ibmvscsi_driver); + int ret; + + ibmvscsi_transport_template = + srp_attach_transport(&ibmvscsi_transport_functions); + if (!ibmvscsi_transport_template) + return -ENOMEM; + + ret = vio_register_driver(&ibmvscsi_driver); + if (ret) + srp_release_transport(ibmvscsi_transport_template); + return ret; } void __exit ibmvscsi_module_exit(void) { vio_unregister_driver(&ibmvscsi_driver); + srp_release_transport(ibmvscsi_transport_template); } module_init(ibmvscsi_module_init); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] ib_srp: convert to use the srp transport class
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3236822b1c9b67ad10745d965515b528818f1120 Commit: 3236822b1c9b67ad10745d965515b528818f1120 Parent: 4d68041907b150b07640b607c6c626391cf3fe8b Author: FUJITA Tomonori <[EMAIL PROTECTED]> AuthorDate: Wed Jun 27 16:33:12 2007 +0900 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:37:42 2007 -0400 [SCSI] ib_srp: convert to use the srp transport class This converts ib_srp to use the srp transport class. I don't have ib hardware so I've not tested this patch. Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]> Cc: Roland Dreier <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/infiniband/ulp/srp/Kconfig |1 + drivers/infiniband/ulp/srp/ib_srp.c | 27 +++ 2 files changed, 28 insertions(+), 0 deletions(-) diff --git a/drivers/infiniband/ulp/srp/Kconfig b/drivers/infiniband/ulp/srp/Kconfig index 3432dce..c74ee96 100644 --- a/drivers/infiniband/ulp/srp/Kconfig +++ b/drivers/infiniband/ulp/srp/Kconfig @@ -1,6 +1,7 @@ config INFINIBAND_SRP tristate "InfiniBand SCSI RDMA Protocol" depends on SCSI + select SCSI_SRP_ATTRS ---help--- Support for the SCSI RDMA Protocol over InfiniBand. This allows you to access storage devices that speak SRP over diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index f01ca18..d8d056e 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -47,6 +47,7 @@ #include #include #include +#include #include @@ -90,6 +91,8 @@ static void srp_remove_one(struct ib_device *device); static void srp_completion(struct ib_cq *cq, void *target_ptr); static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event); +static struct scsi_transport_template *ib_srp_transport_template; + static struct ib_client srp_client = { .name = "srp", .add= srp_add_one, @@ -405,6 +408,7 @@ static void srp_remove_work(struct work_struct *work) list_del(&target->list); spin_unlock(&target->srp_host->target_lock); + srp_remove_host(target->scsi_host); scsi_remove_host(target->scsi_host); ib_destroy_cm_id(target->cm_id); srp_free_target_ib(target); @@ -1530,12 +1534,23 @@ static struct scsi_host_template srp_template = { static int srp_add_target(struct srp_host *host, struct srp_target_port *target) { + struct srp_rport_identifiers ids; + struct srp_rport *rport; + sprintf(target->target_name, "SRP.T10:%016llX", (unsigned long long) be64_to_cpu(target->id_ext)); if (scsi_add_host(target->scsi_host, host->dev->dev->dma_device)) return -ENODEV; + memcpy(ids.port_id, &target->id_ext, 8); + memcpy(ids.port_id + 8, &target->ioc_guid, 8); + rport = srp_rport_add(target->scsi_host, &ids); + if (IS_ERR(rport)) { + scsi_remove_host(target->scsi_host); + return PTR_ERR(rport); + } + spin_lock(&host->target_lock); list_add_tail(&target->list, &host->target_list); spin_unlock(&host->target_lock); @@ -1760,6 +1775,7 @@ static ssize_t srp_create_target(struct class_device *class_dev, if (!target_host) return -ENOMEM; + target_host->transportt = ib_srp_transport_template; target_host->max_lun = SRP_MAX_LUN; target_host->max_cmd_len = sizeof ((struct srp_cmd *) (void *) 0L)->cdb; @@ -2039,10 +2055,18 @@ static void srp_remove_one(struct ib_device *device) kfree(srp_dev); } +static struct srp_function_template ib_srp_transport_functions = { +}; + static int __init srp_init_module(void) { int ret; + ib_srp_transport_template = + srp_attach_transport(&ib_srp_transport_functions); + if (!ib_srp_transport_template) + return -ENOMEM; + srp_template.sg_tablesize = srp_sg_tablesize; srp_max_iu_len = (sizeof (struct srp_cmd) + sizeof (struct srp_indirect_buf) + @@ -2051,6 +2075,7 @@ static int __init srp_init_module(void) ret = class_register(&srp_class); if (ret) { printk(KERN_ERR PFX "couldn't register class infiniband_srp\n"); + srp_release_transport(ib_srp_transport_template); return ret; } @@ -2059,6 +2084,7 @@ static int __init srp_init_module(void) ret = ib_register_client(&srp_client); if (ret) { printk(KERN_ERR PFX "couldn't register IB client\n"); + srp_release_transport(ib_srp_transport_template); ib_sa_unregister_client(&srp_sa_client); class_unregister(&srp_class); return ret; @@ -2072,6 +2098,7 @@ static void __exit
[SCSI] transport_srp: add rport roles attribute
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=aebd5e476ecc8ceb53577b20f2a352ff4ceffd8d Commit: aebd5e476ecc8ceb53577b20f2a352ff4ceffd8d Parent: 3236822b1c9b67ad10745d965515b528818f1120 Author: FUJITA Tomonori <[EMAIL PROTECTED]> AuthorDate: Wed Jul 11 15:08:15 2007 +0900 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:37:46 2007 -0400 [SCSI] transport_srp: add rport roles attribute This adds a 'roles' attribute to rport like transport_fc. The role can be initiator or target. That is, the initiator driver creates target remote ports and the target driver creates initiator remote ports. Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]> Signed-off-by: Mike Christie <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/infiniband/ulp/srp/ib_srp.c |1 + drivers/scsi/ibmvscsi/ibmvscsi.c|1 + drivers/scsi/scsi_transport_srp.c | 29 - include/scsi/scsi_transport_srp.h |5 + 4 files changed, 35 insertions(+), 1 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index d8d056e..e616c4f 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -1545,6 +1545,7 @@ static int srp_add_target(struct srp_host *host, struct srp_target_port *target) memcpy(ids.port_id, &target->id_ext, 8); memcpy(ids.port_id + 8, &target->ioc_guid, 8); + ids.roles = SRP_RPORT_ROLE_TARGET; rport = srp_rport_add(target->scsi_host, &ids); if (IS_ERR(rport)) { scsi_remove_host(target->scsi_host); diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index e6f937e..93bd01b 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c @@ -1599,6 +1599,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id) /* we don't have a proper target_port_id so let's use the fake one */ memcpy(ids.port_id, hostdata->madapter_info.partition_name, sizeof(ids.port_id)); + ids.roles = SRP_RPORT_ROLE_TARGET; rport = srp_rport_add(host, &ids); if (IS_ERR(rport)) goto add_srp_port_failed; diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c index dcb3d2a..608abd8 100644 --- a/drivers/scsi/scsi_transport_srp.c +++ b/drivers/scsi/scsi_transport_srp.c @@ -37,7 +37,7 @@ struct srp_host_attrs { #define to_srp_host_attrs(host)((struct srp_host_attrs *)(host)->shost_data) #define SRP_HOST_ATTRS 0 -#define SRP_RPORT_ATTRS 3 +#define SRP_RPORT_ATTRS 2 struct srp_internal { struct scsi_transport_template t; @@ -107,6 +107,31 @@ show_srp_rport_id(struct class_device *cdev, char *buf) static CLASS_DEVICE_ATTR(port_id, S_IRUGO, show_srp_rport_id, NULL); +static const struct { + u32 value; + char *name; +} srp_rport_role_names[] = { + {SRP_RPORT_ROLE_INITIATOR, "SRP Initiator"}, + {SRP_RPORT_ROLE_TARGET, "SRP Target"}, +}; + +static ssize_t +show_srp_rport_roles(struct class_device *cdev, char *buf) +{ + struct srp_rport *rport = transport_class_to_srp_rport(cdev); + int i; + char *name = NULL; + + for (i = 0; i < ARRAY_SIZE(srp_rport_role_names); i++) + if (srp_rport_role_names[i].value == rport->roles) { + name = srp_rport_role_names[i].name; + break; + } + return sprintf(buf, "%s\n", name ? : "unknown"); +} + +static CLASS_DEVICE_ATTR(roles, S_IRUGO, show_srp_rport_roles, NULL); + static void srp_rport_release(struct device *dev) { struct srp_rport *rport = dev_to_rport(dev); @@ -182,6 +207,7 @@ struct srp_rport *srp_rport_add(struct Scsi_Host *shost, rport->dev.release = srp_rport_release; memcpy(rport->port_id, ids->port_id, sizeof(rport->port_id)); + rport->roles = ids->roles; id = atomic_inc_return(&to_srp_host_attrs(shost)->next_port_id); sprintf(rport->dev.bus_id, "port-%d:%d", shost->host_no, id); @@ -266,6 +292,7 @@ srp_attach_transport(struct srp_function_template *ft) count = 0; SETUP_RPORT_ATTRIBUTE_RD(port_id); + SETUP_RPORT_ATTRIBUTE_RD(roles); i->rport_attrs[count] = NULL; i->f = ft; diff --git a/include/scsi/scsi_transport_srp.h b/include/scsi/scsi_transport_srp.h index adbfca4..08b4a28 100644 --- a/include/scsi/scsi_transport_srp.h +++ b/include/scsi/scsi_transport_srp.h @@ -5,14 +5,19 @@ #include #include +#define SRP_RPORT_ROLE_INITIATOR 0 +#define SRP_RPORT_ROLE_TARGET 1 + struct srp_rport_identifiers { u8 port_id[16]; + u8 roles; }; struct srp_rport { struct device dev; u8 port_id[16]; + u8 roles; }; struct srp_function_template { - To un
[SCSI] tgt: add I_T nexus support
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2c47f9efbedbe5749b6bb16e59bc11d6e460855f Commit: 2c47f9efbedbe5749b6bb16e59bc11d6e460855f Parent: aebd5e476ecc8ceb53577b20f2a352ff4ceffd8d Author: FUJITA Tomonori <[EMAIL PROTECTED]> AuthorDate: Wed Jul 11 15:08:17 2007 +0900 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:37:50 2007 -0400 [SCSI] tgt: add I_T nexus support tgt uses scsi_host as I_T nexus. This works for ibmvstgt because it creates one scsi_host for one initiator. However, other target drivers don't work like that. This adds I_T nexus support, which enable one scsi_host to handle multiple initiators. New scsi_tgt_it_nexus_create/destroy functions are expected be called transport classes. For example, ibmvstgt creates an initiator remote port, then the srp transport calls tgt_it_nexus_create. tgt doesn't manages I_T nexus, instead it tells tgtd, user-space daemon, to create a new I_T nexus. On the receiving the response from tgtd, tgt calls shost->transportt->it_nexus_response. transports should notify a lld. The srp transport uses it_nexus_response callback in srp_function_template to do that. Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]> Signed-off-by: Mike Christie <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/scsi_tgt_if.c| 42 +++-- drivers/scsi/scsi_tgt_lib.c | 83 ++-- drivers/scsi/scsi_tgt_priv.h | 22 +++ include/scsi/scsi_host.h |2 +- include/scsi/scsi_tgt.h |8 ++- include/scsi/scsi_tgt_if.h| 35 + include/scsi/scsi_transport.h |6 +++ 7 files changed, 161 insertions(+), 37 deletions(-) diff --git a/drivers/scsi/scsi_tgt_if.c b/drivers/scsi/scsi_tgt_if.c index ca22ddf..9815a1a 100644 --- a/drivers/scsi/scsi_tgt_if.c +++ b/drivers/scsi/scsi_tgt_if.c @@ -102,7 +102,8 @@ static int tgt_uspace_send_event(u32 type, struct tgt_event *p) return 0; } -int scsi_tgt_uspace_send_cmd(struct scsi_cmnd *cmd, struct scsi_lun *lun, u64 tag) +int scsi_tgt_uspace_send_cmd(struct scsi_cmnd *cmd, u64 itn_id, +struct scsi_lun *lun, u64 tag) { struct Scsi_Host *shost = scsi_tgt_cmd_to_host(cmd); struct tgt_event ev; @@ -110,6 +111,7 @@ int scsi_tgt_uspace_send_cmd(struct scsi_cmnd *cmd, struct scsi_lun *lun, u64 ta memset(&ev, 0, sizeof(ev)); ev.p.cmd_req.host_no = shost->host_no; + ev.p.cmd_req.itn_id = itn_id; ev.p.cmd_req.data_len = cmd->request_bufflen; memcpy(ev.p.cmd_req.scb, cmd->cmnd, sizeof(ev.p.cmd_req.scb)); memcpy(ev.p.cmd_req.lun, lun, sizeof(ev.p.cmd_req.lun)); @@ -127,7 +129,7 @@ int scsi_tgt_uspace_send_cmd(struct scsi_cmnd *cmd, struct scsi_lun *lun, u64 ta return err; } -int scsi_tgt_uspace_send_status(struct scsi_cmnd *cmd, u64 tag) +int scsi_tgt_uspace_send_status(struct scsi_cmnd *cmd, u64 itn_id, u64 tag) { struct Scsi_Host *shost = scsi_tgt_cmd_to_host(cmd); struct tgt_event ev; @@ -135,6 +137,7 @@ int scsi_tgt_uspace_send_status(struct scsi_cmnd *cmd, u64 tag) memset(&ev, 0, sizeof(ev)); ev.p.cmd_done.host_no = shost->host_no; + ev.p.cmd_done.itn_id = itn_id; ev.p.cmd_done.tag = tag; ev.p.cmd_done.result = cmd->result; @@ -149,14 +152,15 @@ int scsi_tgt_uspace_send_status(struct scsi_cmnd *cmd, u64 tag) return err; } -int scsi_tgt_uspace_send_tsk_mgmt(int host_no, int function, u64 tag, - struct scsi_lun *scsilun, void *data) +int scsi_tgt_uspace_send_tsk_mgmt(int host_no, u64 itn_id, int function, + u64 tag, struct scsi_lun *scsilun, void *data) { struct tgt_event ev; int err; memset(&ev, 0, sizeof(ev)); ev.p.tsk_mgmt_req.host_no = host_no; + ev.p.tsk_mgmt_req.itn_id = itn_id; ev.p.tsk_mgmt_req.function = function; ev.p.tsk_mgmt_req.tag = tag; memcpy(ev.p.tsk_mgmt_req.lun, scsilun, sizeof(ev.p.tsk_mgmt_req.lun)); @@ -172,6 +176,29 @@ int scsi_tgt_uspace_send_tsk_mgmt(int host_no, int function, u64 tag, return err; } +int scsi_tgt_uspace_send_it_nexus_request(int host_no, u64 itn_id, + int function, char *initiator_id) +{ + struct tgt_event ev; + int err; + + memset(&ev, 0, sizeof(ev)); + ev.p.it_nexus_req.host_no = host_no; + ev.p.it_nexus_req.function = function; + ev.p.it_nexus_req.itn_id = itn_id; + if (initiator_id) + strncpy(ev.p.it_nexus_req.initiator_id, initiator_id, + sizeof(ev.p.it_nexus_req.initiator_id)); + + dprintk("%d %x %llx\n", host_no, function, (unsigned long long)itn_id); + +
[SCSI] srp_transport: add target driver support
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=62fe88261b9d865264d85cf58a0335513151 Commit: 62fe88261b9d865264d85cf58a0335513151 Parent: 2c47f9efbedbe5749b6bb16e59bc11d6e460855f Author: FUJITA Tomonori <[EMAIL PROTECTED]> AuthorDate: Wed Jul 11 15:08:19 2007 +0900 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:37:53 2007 -0400 [SCSI] srp_transport: add target driver support This adds minimum target driver support: - srp_rport_{add,del} calls scsi_tgt_it_nexus_{create,destroy} for target drivers. - add a callback to notify target drivers of the nexus operation results to srp_function_template. Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]> Signed-off-by: Mike Christie <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/Kconfig |2 +- drivers/scsi/scsi_transport_srp.c | 24 include/scsi/scsi_transport_srp.h |3 ++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 778dc0f..8d4057e 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -291,7 +291,7 @@ source "drivers/scsi/libsas/Kconfig" config SCSI_SRP_ATTRS tristate "SRP Transport Attributes" - depends on SCSI + depends on SCSI && SCSI_TGT help If you wish to export transport-specific information about each attached SRP device to sysfs, say Y. diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c index 608abd8..8e5b41c 100644 --- a/drivers/scsi/scsi_transport_srp.c +++ b/drivers/scsi/scsi_transport_srp.c @@ -30,6 +30,7 @@ #include #include #include +#include struct srp_host_attrs { atomic_t next_port_id; @@ -221,6 +222,17 @@ struct srp_rport *srp_rport_add(struct Scsi_Host *shost, return ERR_PTR(ret); } + if (ids->roles == SRP_RPORT_ROLE_INITIATOR) { + ret = scsi_tgt_it_nexus_create(shost, (unsigned long)rport, + rport->port_id); + if (ret) { + device_del(&rport->dev); + transport_destroy_device(&rport->dev); + put_device(&rport->dev); + return ERR_PTR(ret); + } + } + transport_add_device(&rport->dev); transport_configure_device(&rport->dev); @@ -238,6 +250,10 @@ void srp_rport_del(struct srp_rport *rport) { struct device *dev = &rport->dev; + if (rport->roles == SRP_RPORT_ROLE_INITIATOR) + scsi_tgt_it_nexus_destroy(dev_to_shost(dev->parent), + (unsigned long)rport); + transport_remove_device(dev); device_del(dev); transport_destroy_device(dev); @@ -264,6 +280,12 @@ void srp_remove_host(struct Scsi_Host *shost) } EXPORT_SYMBOL_GPL(srp_remove_host); +static int srp_it_nexus_response(struct Scsi_Host *shost, u64 id, int result) +{ + struct srp_internal *i = to_srp_internal(shost->transportt); + return i->f->it_nexus_response(shost, id, result); +} + /** * srp_attach_transport -- instantiate SRP transport template * @ft:SRP transport class function template @@ -278,6 +300,8 @@ srp_attach_transport(struct srp_function_template *ft) if (!i) return NULL; + i->t.it_nexus_response = srp_it_nexus_response; + i->t.host_size = sizeof(struct srp_host_attrs); i->t.host_attrs.ac.attrs = &i->host_attrs[0]; i->t.host_attrs.ac.class = &srp_host_class.class; diff --git a/include/scsi/scsi_transport_srp.h b/include/scsi/scsi_transport_srp.h index 08b4a28..a705dbc 100644 --- a/include/scsi/scsi_transport_srp.h +++ b/include/scsi/scsi_transport_srp.h @@ -21,7 +21,8 @@ struct srp_rport { }; struct srp_function_template { - /* later */ + /* for target drivers */ + int (* it_nexus_response)(struct Scsi_Host *, u64, int); }; extern struct scsi_transport_template * - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] tgt: convert libsrp and ibmvstgt to use srp_transport
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=17b0bcfad795913b1f2a3926cd238fa2ad5522a2 Commit: 17b0bcfad795913b1f2a3926cd238fa2ad5522a2 Parent: 62fe88261b9d865264d85cf58a0335513151 Author: FUJITA Tomonori <[EMAIL PROTECTED]> AuthorDate: Wed Jul 11 15:08:21 2007 +0900 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:37:57 2007 -0400 [SCSI] tgt: convert libsrp and ibmvstgt to use srp_transport This converts libsrp and ibmvstgt to use srp transport. Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]> Signed-off-by: Mike Christie <[EMAIL PROTECTED]> Acked-by: Brian King <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/Kconfig |2 +- drivers/scsi/ibmvscsi/ibmvstgt.c | 58 ++ drivers/scsi/libsrp.c|5 ++- include/scsi/libsrp.h|2 +- 4 files changed, 57 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 8d4057e..4562273 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -848,7 +848,7 @@ config SCSI_IBMVSCSI config SCSI_IBMVSCSIS tristate "IBM Virtual SCSI Server support" - depends on PPC_PSERIES && SCSI_TGT && SCSI_SRP + depends on PPC_PSERIES && SCSI_TGT && SCSI_SRP && SCSI_SRP_ATTRS help This is the SRP target driver for IBM pSeries virtual environments. diff --git a/drivers/scsi/ibmvscsi/ibmvstgt.c b/drivers/scsi/ibmvscsi/ibmvstgt.c index 8ba7dd0..4ee6e41 100644 --- a/drivers/scsi/ibmvscsi/ibmvstgt.c +++ b/drivers/scsi/ibmvscsi/ibmvstgt.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -68,9 +69,12 @@ struct vio_port { unsigned long liobn; unsigned long riobn; struct srp_target *target; + + struct srp_rport *rport; }; static struct workqueue_struct *vtgtd; +static struct scsi_transport_template *ibmvstgt_transport_template; /* * These are fixed for the system and come from the Open Firmware device tree. @@ -188,6 +192,7 @@ static int send_rsp(struct iu_entry *iue, struct scsi_cmnd *sc, static void handle_cmd_queue(struct srp_target *target) { struct Scsi_Host *shost = target->shost; + struct srp_rport *rport = target_to_port(target)->rport; struct iu_entry *iue; struct srp_cmd *cmd; unsigned long flags; @@ -200,7 +205,8 @@ retry: if (!test_and_set_bit(V_FLYING, &iue->flags)) { spin_unlock_irqrestore(&target->lock, flags); cmd = iue->sbuf->buf; - err = srp_cmd_queue(shost, cmd, iue, 0); + err = srp_cmd_queue(shost, cmd, iue, + (unsigned long)rport, 0); if (err) { eprintk("cannot queue cmd %p %d\n", cmd, err); srp_iu_put(iue); @@ -359,6 +365,16 @@ static void process_login(struct iu_entry *iue) union viosrp_iu *iu = vio_iu(iue); struct srp_login_rsp *rsp = &iu->srp.login_rsp; uint64_t tag = iu->srp.rsp.tag; + struct Scsi_Host *shost = iue->target->shost; + struct srp_target *target = host_to_srp_target(shost); + struct vio_port *vport = target_to_port(target); + struct srp_rport_identifiers ids; + + memset(&ids, 0, sizeof(ids)); + sprintf(ids.port_id, "%x", vport->dma_dev->unit_address); + ids.roles = SRP_RPORT_ROLE_INITIATOR; + if (!vport->rport) + vport->rport = srp_rport_add(shost, &ids); /* TODO handle case that requested size is wrong and * buffer format is wrong @@ -412,7 +428,9 @@ static int process_tsk_mgmt(struct iu_entry *iue) fn = 0; } if (fn) - scsi_tgt_tsk_mgmt_request(iue->target->shost, fn, + scsi_tgt_tsk_mgmt_request(iue->target->shost, + (unsigned long)iue->target->shost, + fn, iu->srp.tsk_mgmt.task_tag, (struct scsi_lun *) &iu->srp.tsk_mgmt.lun, iue); @@ -721,7 +739,8 @@ static int ibmvstgt_eh_abort_handler(struct scsi_cmnd *sc) return 0; } -static int ibmvstgt_tsk_mgmt_response(u64 mid, int result) +static int ibmvstgt_tsk_mgmt_response(struct Scsi_Host *shost, + u64 itn_id, u64 mid, int result) { struct iu_entry *iue = (struct iu_entry *) ((void *) mid); union viosrp_iu *iu = vio_iu(iue); @@ -747,6 +766,20 @@ static int ibmvstgt_tsk_mgmt_response(u64 mid, int result) return 0; } +static int ibmvstgt_it_nexus_response(struct Scsi_Host *shost, u64 itn_id,
[SCSI] tgt: move tsk_mgmt_response callback to transport class
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bfb743740e1598d3030c4972a8808f2bb5b95b6b Commit: bfb743740e1598d3030c4972a8808f2bb5b95b6b Parent: 17b0bcfad795913b1f2a3926cd238fa2ad5522a2 Author: FUJITA Tomonori <[EMAIL PROTECTED]> AuthorDate: Wed Jul 11 15:08:22 2007 +0900 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:38:01 2007 -0400 [SCSI] tgt: move tsk_mgmt_response callback to transport class This moves tsk_mgmt_response callback in struct scsi_host_template to struct scsi_transport_template since struct scsi_transport_template is more suitable for the task management stuff. Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]> Signed-off-by: Mike Christie <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/scsi_tgt_lib.c |2 +- drivers/scsi/scsi_transport_srp.c | 12 ++-- include/scsi/scsi_host.h |3 --- include/scsi/scsi_transport.h |6 ++ include/scsi/scsi_transport_srp.h |1 + 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/scsi_tgt_lib.c b/drivers/scsi/scsi_tgt_lib.c index fa79e54..5851c8e 100644 --- a/drivers/scsi/scsi_tgt_lib.c +++ b/drivers/scsi/scsi_tgt_lib.c @@ -577,7 +577,7 @@ int scsi_tgt_kspace_tsk_mgmt(int host_no, u64 itn_id, u64 mid, int result) goto done; } - err = shost->hostt->tsk_mgmt_response(shost, itn_id, mid, result); + err = shost->transportt->tsk_mgmt_response(shost, itn_id, mid, result); done: scsi_host_put(shost); return err; diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c index 8e5b41c..cdd001a 100644 --- a/drivers/scsi/scsi_transport_srp.c +++ b/drivers/scsi/scsi_transport_srp.c @@ -280,10 +280,17 @@ void srp_remove_host(struct Scsi_Host *shost) } EXPORT_SYMBOL_GPL(srp_remove_host); -static int srp_it_nexus_response(struct Scsi_Host *shost, u64 id, int result) +static int srp_tsk_mgmt_response(struct Scsi_Host *shost, u64 nexus, u64 tm_id, +int result) { struct srp_internal *i = to_srp_internal(shost->transportt); - return i->f->it_nexus_response(shost, id, result); + return i->f->tsk_mgmt_response(shost, nexus, tm_id, result); +} + +static int srp_it_nexus_response(struct Scsi_Host *shost, u64 nexus, int result) +{ + struct srp_internal *i = to_srp_internal(shost->transportt); + return i->f->it_nexus_response(shost, nexus, result); } /** @@ -300,6 +307,7 @@ srp_attach_transport(struct srp_function_template *ft) if (!i) return NULL; + i->t.tsk_mgmt_response = srp_tsk_mgmt_response; i->t.it_nexus_response = srp_it_nexus_response; i->t.host_size = sizeof(struct srp_host_attrs); diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 89c40c4..88f6871 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -145,9 +145,6 @@ struct scsi_host_template { int (* transfer_response)(struct scsi_cmnd *, void (*done)(struct scsi_cmnd *)); - /* Used as callback for the completion of task management request. */ - int (* tsk_mgmt_response)(struct Scsi_Host *, u64, u64 mid, int result); - /* * This is an error handling strategy routine. You don't need to * define one of these if you don't want to - there is a default diff --git a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h index af5b3e1..0dfef75 100644 --- a/include/scsi/scsi_transport.h +++ b/include/scsi/scsi_transport.h @@ -71,6 +71,12 @@ struct scsi_transport_template { * for target drivers. */ int (* it_nexus_response)(struct Scsi_Host *, u64, int); + + /* +* Used as callback for the completion of task management +* request for target drivers. +*/ + int (* tsk_mgmt_response)(struct Scsi_Host *, u64, u64, int); }; #define transport_class_to_shost(tc) \ diff --git a/include/scsi/scsi_transport_srp.h b/include/scsi/scsi_transport_srp.h index a705dbc..9c60ca1 100644 --- a/include/scsi/scsi_transport_srp.h +++ b/include/scsi/scsi_transport_srp.h @@ -22,6 +22,7 @@ struct srp_rport { struct srp_function_template { /* for target drivers */ + int (* tsk_mgmt_response)(struct Scsi_Host *, u64, u64, int); int (* it_nexus_response)(struct Scsi_Host *, u64, int); }; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] tgt: convert ibmvstgt to use transport tsk_mgmt_response callback
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e9906fe8c6e8d004635753b7c4189692df281b70 Commit: e9906fe8c6e8d004635753b7c4189692df281b70 Parent: bfb743740e1598d3030c4972a8808f2bb5b95b6b Author: FUJITA Tomonori <[EMAIL PROTECTED]> AuthorDate: Wed Jul 11 15:08:24 2007 +0900 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:38:04 2007 -0400 [SCSI] tgt: convert ibmvstgt to use transport tsk_mgmt_response callback This converts ibmvstgt to use transport tsk_mgmt_response callback. Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]> Signed-off-by: Mike Christie <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/ibmvscsi/ibmvstgt.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvstgt.c b/drivers/scsi/ibmvscsi/ibmvstgt.c index 4ee6e41..3db03dd 100644 --- a/drivers/scsi/ibmvscsi/ibmvstgt.c +++ b/drivers/scsi/ibmvscsi/ibmvstgt.c @@ -818,7 +818,6 @@ static struct scsi_host_template ibmvstgt_sht = { .max_sectors= DEFAULT_MAX_SECTORS, .transfer_response = ibmvstgt_cmd_done, .eh_abort_handler = ibmvstgt_eh_abort_handler, - .tsk_mgmt_response = ibmvstgt_tsk_mgmt_response, .shost_attrs= ibmvstgt_attrs, .proc_name = TGT_NAME, }; @@ -945,6 +944,7 @@ static int get_system_info(void) } static struct srp_function_template ibmvstgt_transport_functions = { + .tsk_mgmt_response = ibmvstgt_tsk_mgmt_response, .it_nexus_response = ibmvstgt_it_nexus_response, }; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] scsi_transport_srp: remove tgt dependencies
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0012fdf986c9b9c7fe8d0842a0ad8dd981a06c06 Commit: 0012fdf986c9b9c7fe8d0842a0ad8dd981a06c06 Parent: e9906fe8c6e8d004635753b7c4189692df281b70 Author: FUJITA Tomonori <[EMAIL PROTECTED]> AuthorDate: Thu Aug 2 00:20:34 2007 +0900 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:38:09 2007 -0400 [SCSI] scsi_transport_srp: remove tgt dependencies it's better to remove tgt dependencies in srp transport class since most people want only initiator support. Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/Kconfig | 11 +-- drivers/scsi/scsi_transport_srp.c | 10 +- drivers/scsi/scsi_transport_srp_internal.h | 25 + 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 4562273..7877dfd 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -291,11 +291,18 @@ source "drivers/scsi/libsas/Kconfig" config SCSI_SRP_ATTRS tristate "SRP Transport Attributes" - depends on SCSI && SCSI_TGT + depends on SCSI help If you wish to export transport-specific information about each attached SRP device to sysfs, say Y. +config SCSI_SRP_TGT_ATTRS + bool "SCSI target support for SRP Transport Attributes" + depends on SCSI_SRP_ATTRS + depends on SCSI_TGT = y || SCSI_TGT = SCSI_SRP_ATTRS + help + If you want to use SCSI target mode drivers enable this option. + endmenu menuconfig SCSI_LOWLEVEL @@ -848,7 +855,7 @@ config SCSI_IBMVSCSI config SCSI_IBMVSCSIS tristate "IBM Virtual SCSI Server support" - depends on PPC_PSERIES && SCSI_TGT && SCSI_SRP && SCSI_SRP_ATTRS + depends on PPC_PSERIES && SCSI_SRP && SCSI_SRP_TGT_ATTRS help This is the SRP target driver for IBM pSeries virtual environments. diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c index cdd001a..430501e 100644 --- a/drivers/scsi/scsi_transport_srp.c +++ b/drivers/scsi/scsi_transport_srp.c @@ -30,7 +30,7 @@ #include #include #include -#include +#include "scsi_transport_srp_internal.h" struct srp_host_attrs { atomic_t next_port_id; @@ -223,8 +223,8 @@ struct srp_rport *srp_rport_add(struct Scsi_Host *shost, } if (ids->roles == SRP_RPORT_ROLE_INITIATOR) { - ret = scsi_tgt_it_nexus_create(shost, (unsigned long)rport, - rport->port_id); + ret = srp_tgt_it_nexus_create(shost, (unsigned long)rport, + rport->port_id); if (ret) { device_del(&rport->dev); transport_destroy_device(&rport->dev); @@ -251,8 +251,8 @@ void srp_rport_del(struct srp_rport *rport) struct device *dev = &rport->dev; if (rport->roles == SRP_RPORT_ROLE_INITIATOR) - scsi_tgt_it_nexus_destroy(dev_to_shost(dev->parent), - (unsigned long)rport); + srp_tgt_it_nexus_destroy(dev_to_shost(dev->parent), +(unsigned long)rport); transport_remove_device(dev); device_del(dev); diff --git a/drivers/scsi/scsi_transport_srp_internal.h b/drivers/scsi/scsi_transport_srp_internal.h new file mode 100644 index 000..8a79747 --- /dev/null +++ b/drivers/scsi/scsi_transport_srp_internal.h @@ -0,0 +1,25 @@ +#include + +#ifdef CONFIG_SCSI_SRP_TGT_ATTRS +static inline int srp_tgt_it_nexus_create(struct Scsi_Host *shost, u64 itn_id, + char *initiator) +{ + return scsi_tgt_it_nexus_create(shost, itn_id, initiator); +} + +static inline int srp_tgt_it_nexus_destroy(struct Scsi_Host *shost, u64 itn_id) +{ + return scsi_tgt_it_nexus_destroy(shost, itn_id); +} + +#else +static inline int srp_tgt_it_nexus_create(struct Scsi_Host *shost, u64 itn_id, + char *initiator) +{ + return 0; +} +static inline int srp_tgt_it_nexus_destroy(struct Scsi_Host *shost, u64 itn_id) +{ + return 0; +} +#endif - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] ps3rom: convert to use the data buffer accessors
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=358147403d1506ee43335c152fa3864d90f5ef6e Commit: 358147403d1506ee43335c152fa3864d90f5ef6e Parent: 0012fdf986c9b9c7fe8d0842a0ad8dd981a06c06 Author: FUJITA Tomonori <[EMAIL PROTECTED]> AuthorDate: Mon Jul 23 09:42:32 2007 +0900 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:38:13 2007 -0400 [SCSI] ps3rom: convert to use the data buffer accessors This converts ps3rom driver to use the new accessors for the sg lists and the parameters. Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]> Acked-by: Geert Uytterhoeven <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/ps3rom.c | 24 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/ps3rom.c b/drivers/scsi/ps3rom.c index b50f1e1..0f43d1d 100644 --- a/drivers/scsi/ps3rom.c +++ b/drivers/scsi/ps3rom.c @@ -100,16 +100,16 @@ static int fill_from_dev_buffer(struct scsi_cmnd *cmd, const void *buf) struct scatterlist *sgpnt; unsigned int buflen; - buflen = cmd->request_bufflen; + buflen = scsi_bufflen(cmd); if (!buflen) return 0; - if (!cmd->request_buffer) + if (!scsi_sglist(cmd)) return -1; - sgpnt = cmd->request_buffer; active = 1; - for (k = 0, req_len = 0, act_len = 0; k < cmd->use_sg; ++k, ++sgpnt) { + req_len = act_len = 0; + scsi_for_each_sg(cmd, sgpnt, scsi_sg_count(cmd), k) { if (active) { kaddr = kmap_atomic(sgpnt->page, KM_IRQ0); len = sgpnt->length; @@ -124,7 +124,7 @@ static int fill_from_dev_buffer(struct scsi_cmnd *cmd, const void *buf) } req_len += sgpnt->length; } - cmd->resid = req_len - act_len; + scsi_set_resid(cmd, req_len - act_len); return 0; } @@ -138,15 +138,15 @@ static int fetch_to_dev_buffer(struct scsi_cmnd *cmd, void *buf) struct scatterlist *sgpnt; unsigned int buflen; - buflen = cmd->request_bufflen; + buflen = scsi_bufflen(cmd); if (!buflen) return 0; - if (!cmd->request_buffer) + if (!scsi_sglist(cmd)) return -1; - sgpnt = cmd->request_buffer; - for (k = 0, req_len = 0, fin = 0; k < cmd->use_sg; ++k, ++sgpnt) { + req_len = fin = 0; + scsi_for_each_sg(cmd, sgpnt, scsi_sg_count(cmd), k) { kaddr = kmap_atomic(sgpnt->page, KM_IRQ0); len = sgpnt->length; if ((req_len + len) > buflen) { @@ -177,12 +177,12 @@ static int ps3rom_atapi_request(struct ps3_storage_device *dev, memcpy(&atapi_cmnd.pkt, cmd->cmnd, 12); atapi_cmnd.pktlen = 12; atapi_cmnd.block_size = 1; /* transfer size is block_size * blocks */ - atapi_cmnd.blocks = atapi_cmnd.arglen = cmd->request_bufflen; + atapi_cmnd.blocks = atapi_cmnd.arglen = scsi_bufflen(cmd); atapi_cmnd.buffer = dev->bounce_lpar; switch (cmd->sc_data_direction) { case DMA_FROM_DEVICE: - if (cmd->request_bufflen >= CD_FRAMESIZE) + if (scsi_bufflen(cmd) >= CD_FRAMESIZE) atapi_cmnd.proto = DMA_PROTO; else atapi_cmnd.proto = PIO_DATA_IN_PROTO; @@ -190,7 +190,7 @@ static int ps3rom_atapi_request(struct ps3_storage_device *dev, break; case DMA_TO_DEVICE: - if (cmd->request_bufflen >= CD_FRAMESIZE) + if (scsi_bufflen(cmd) >= CD_FRAMESIZE) atapi_cmnd.proto = DMA_PROTO; else atapi_cmnd.proto = PIO_DATA_OUT_PROTO; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] fix write buffer length in scsi_req_map_sg()
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bd441deaf341c524b28fd72831ebf6fef88f1c41 Commit: bd441deaf341c524b28fd72831ebf6fef88f1c41 Parent: 358147403d1506ee43335c152fa3864d90f5ef6e Author: Mike Christie <[EMAIL PROTECTED]> AuthorDate: Tue Mar 13 12:52:29 2007 -0500 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:38:17 2007 -0400 [SCSI] fix write buffer length in scsi_req_map_sg() sg's may have setup a the buffer with a different length than the transfer length so we should be using the bufflen passed in as the request's data len. Signed-off-by: Mike Christie <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/scsi_lib.c | 14 ++ 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index a417a6f..277f1b6 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -301,7 +301,7 @@ static int scsi_req_map_sg(struct request *rq, struct scatterlist *sgl, { struct request_queue *q = rq->q; int nr_pages = (bufflen + sgl[0].offset + PAGE_SIZE - 1) >> PAGE_SHIFT; - unsigned int data_len = 0, len, bytes, off; + unsigned int data_len = bufflen, len, bytes, off; struct page *page; struct bio *bio = NULL; int i, err, nr_vecs = 0; @@ -310,10 +310,15 @@ static int scsi_req_map_sg(struct request *rq, struct scatterlist *sgl, page = sgl[i].page; off = sgl[i].offset; len = sgl[i].length; - data_len += len; - while (len > 0) { + while (len > 0 && data_len > 0) { + /* +* sg sends a scatterlist that is larger than +* the data_len it wants transferred for certain +* IO sizes +*/ bytes = min_t(unsigned int, len, PAGE_SIZE - off); + bytes = min(bytes, data_len); if (!bio) { nr_vecs = min_t(int, BIO_MAX_PAGES, nr_pages); @@ -345,12 +350,13 @@ static int scsi_req_map_sg(struct request *rq, struct scatterlist *sgl, page++; len -= bytes; + data_len -=bytes; off = 0; } } rq->buffer = rq->data = NULL; - rq->data_len = data_len; + rq->data_len = bufflen; return 0; free_bios: - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] microtek: use data accessors and !use_sg cleanup
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=afd9a033ca1354e95c95201f5d21a097da9f7fb2 Commit: afd9a033ca1354e95c95201f5d21a097da9f7fb2 Parent: bd441deaf341c524b28fd72831ebf6fef88f1c41 Author: Boaz Harrosh <[EMAIL PROTECTED]> AuthorDate: Thu Jul 12 16:11:24 2007 +0300 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:38:21 2007 -0400 [SCSI] microtek: use data accessors and !use_sg cleanup - use scsi_cmnd data accessors - Clean the !use_sg code paths Signed-off-by: Boaz Harrosh <[EMAIL PROTECTED]> Acked-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> [jejb: merge conflict fix] Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/usb/image/microtek.c | 32 ++-- 1 files changed, 14 insertions(+), 18 deletions(-) diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c index 768b2c1..e7d982a 100644 --- a/drivers/usb/image/microtek.c +++ b/drivers/usb/image/microtek.c @@ -446,7 +446,8 @@ static void mts_data_done( struct urb* transfer ) MTS_INT_INIT(); if ( context->data_length != transfer->actual_length ) { - context->srb->resid = context->data_length - transfer->actual_length; + scsi_set_resid(context->srb, context->data_length - + transfer->actual_length); } else if ( unlikely(status) ) { context->srb->result = (status == -ENOENT ? DID_ABORT : DID_ERROR)<<16; } @@ -490,7 +491,8 @@ static void mts_command_done( struct urb *transfer ) context->data_pipe, context->data, context->data_length, - context->srb->use_sg > 1 ? mts_do_sg : mts_data_done); + scsi_sg_count(context->srb) > 1 ? + mts_do_sg : mts_data_done); } else { mts_get_status(transfer); } @@ -505,21 +507,23 @@ static void mts_do_sg (struct urb* transfer) int status = transfer->status; MTS_INT_INIT(); - MTS_DEBUG("Processing fragment %d of %d\n", context->fragment,context->srb->use_sg); + MTS_DEBUG("Processing fragment %d of %d\n", context->fragment, + scsi_sg_count(context->srb)); if (unlikely(status)) { context->srb->result = (status == -ENOENT ? DID_ABORT : DID_ERROR)<<16; mts_transfer_cleanup(transfer); } - sg = context->srb->request_buffer; + sg = scsi_sglist(context->srb); context->fragment++; mts_int_submit_urb(transfer, context->data_pipe, page_address(sg[context->fragment].page) + sg[context->fragment].offset, sg[context->fragment].length, - context->fragment + 1 == context->srb->use_sg ? mts_data_done : mts_do_sg); + context->fragment + 1 == scsi_sg_count(context->srb) ? + mts_data_done : mts_do_sg); return; } @@ -547,20 +551,12 @@ mts_build_transfer_context(struct scsi_cmnd *srb, struct mts_desc* desc) desc->context.srb = srb; desc->context.fragment = 0; - if (!srb->use_sg) { - if ( !srb->request_bufflen ){ - desc->context.data = NULL; - desc->context.data_length = 0; - return; - } else { - desc->context.data = srb->request_buffer; - desc->context.data_length = srb->request_bufflen; - MTS_DEBUG("length = %d or %d\n", - srb->request_bufflen, srb->bufflen); - } + if (!scsi_bufflen(srb)) { + desc->context.data = NULL; + desc->context.data_length = 0; + return; } else { - MTS_DEBUG("Using scatter/gather\n"); - sg = srb->request_buffer; + sg = scsi_sglist(srb); desc->context.data = page_address(sg[0].page) + sg[0].offset; desc->context.data_length = sg[0].length; } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] Fix async scanning double-add problems
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6b7f123f378743d739377871c0cbfbaf28c7d25a Commit: 6b7f123f378743d739377871c0cbfbaf28c7d25a Parent: afd9a033ca1354e95c95201f5d21a097da9f7fb2 Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Tue Jun 26 15:18:51 2007 -0600 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:38:24 2007 -0400 [SCSI] Fix async scanning double-add problems Stress-testing and some thought has revealed some places where asynchronous scanning needs some more attention to locking. - Since async_scan is a bit, we need to hold the host_lock while modifying it to prevent races against other CPUs modifying the word that bit is in. This is probably a theoretical race for the moment, but other patches may change that. - The async_scan bit means not only that this host is being scanned asynchronously, but that all the devices attached to this host are not yet added to sysfs. So we must ensure that this bit is always in sync. I've chosen to do this with the scan_mutex since it's already acquired in most of the right places. - If the host changes state to deleted while we're in the middle of a scan, we'll end up with some devices on the host's list which must be deleted. Add a check to scsi_sysfs_add_devices() to ensure the host is still running. - To avoid the async_scan bit being protected by three locks, the async_scan_lock now only protects the scanning_list. Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/scsi_scan.c | 37 +++-- 1 files changed, 27 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index a86e62f..309b224 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -121,6 +121,7 @@ MODULE_PARM_DESC(inq_timeout, "Timeout (in seconds) waiting for devices to answer INQUIRY." " Default is 5. Some non-compliant devices need more."); +/* This lock protects only this list */ static DEFINE_SPINLOCK(async_scan_lock); static LIST_HEAD(scanning_hosts); @@ -1466,14 +1467,14 @@ struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel, if (strncmp(scsi_scan_type, "none", 4) == 0) return ERR_PTR(-ENODEV); - if (!shost->async_scan) - scsi_complete_async_scans(); - starget = scsi_alloc_target(parent, channel, id); if (!starget) return ERR_PTR(-ENOMEM); mutex_lock(&shost->scan_mutex); + if (!shost->async_scan) + scsi_complete_async_scans(); + if (scsi_host_scan_allowed(shost)) scsi_probe_and_add_lun(starget, lun, NULL, &sdev, 1, hostdata); mutex_unlock(&shost->scan_mutex); @@ -1586,10 +1587,10 @@ void scsi_scan_target(struct device *parent, unsigned int channel, if (strncmp(scsi_scan_type, "none", 4) == 0) return; + mutex_lock(&shost->scan_mutex); if (!shost->async_scan) scsi_complete_async_scans(); - mutex_lock(&shost->scan_mutex); if (scsi_host_scan_allowed(shost)) __scsi_scan_target(parent, channel, id, lun, rescan); mutex_unlock(&shost->scan_mutex); @@ -1634,15 +1635,15 @@ int scsi_scan_host_selected(struct Scsi_Host *shost, unsigned int channel, "%s: <%u:%u:%u>\n", __FUNCTION__, channel, id, lun)); - if (!shost->async_scan) - scsi_complete_async_scans(); - if (((channel != SCAN_WILD_CARD) && (channel > shost->max_channel)) || ((id != SCAN_WILD_CARD) && (id >= shost->max_id)) || ((lun != SCAN_WILD_CARD) && (lun > shost->max_lun))) return -EINVAL; mutex_lock(&shost->scan_mutex); + if (!shost->async_scan) + scsi_complete_async_scans(); + if (scsi_host_scan_allowed(shost)) { if (channel == SCAN_WILD_CARD) for (channel = 0; channel <= shost->max_channel; @@ -1661,7 +1662,8 @@ static void scsi_sysfs_add_devices(struct Scsi_Host *shost) { struct scsi_device *sdev; shost_for_each_device(sdev, shost) { - if (scsi_sysfs_add_sdev(sdev) != 0) + if (!scsi_host_scan_allowed(shost) || + scsi_sysfs_add_sdev(sdev) != 0) scsi_destroy_sdev(sdev); } } @@ -1679,6 +1681,7 @@ static void scsi_sysfs_add_devices(struct Scsi_Host *shost) static struct async_scan_data *scsi_prep_async_scan(struct Scsi_Host *shost) { struct async_scan_data *data; + unsigned long flags; if (strncmp(scsi_scan_type, "sync", 4) == 0) return NULL; @@ -1698
[SCSI] sg: increase sglist_len of the sg_scatter_hold structure
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ea312552e94883efc42cfa4651bcf964f3110564 Commit: ea312552e94883efc42cfa4651bcf964f3110564 Parent: 6b7f123f378743d739377871c0cbfbaf28c7d25a Author: FUJITA Tomonori <[EMAIL PROTECTED]> AuthorDate: Mon Aug 6 00:31:24 2007 +0900 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:38:28 2007 -0400 [SCSI] sg: increase sglist_len of the sg_scatter_hold structure unsigned short is too small for sizeof(struct scatterlist) * min(q->max_hw_segments, q->max_phys_segments). This fixes memory leak with 4096 segments since 16 (likely sg size with x86) * 4096 sets sglist_len to zero. This might not happen without sg chaining support. Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]> Acked-by: Douglas Gilbert <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/sg.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 85d3894..fdc6618 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -114,7 +114,7 @@ static struct class_interface sg_interface = { typedef struct sg_scatter_hold { /* holding area for scsi scatter gather info */ unsigned short k_use_sg; /* Count of kernel scatter-gather pieces */ - unsigned short sglist_len; /* size of malloc'd scatter-gather list ++ */ + unsigned sglist_len; /* size of malloc'd scatter-gather list ++ */ unsigned bufflen; /* Size of (aggregate) data buffer */ unsigned b_malloc_len; /* actual len malloc'ed in buffer */ struct scatterlist *buffer;/* scatter list */ - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] advansys: undate version, copyright, etc
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8c6af9e174abdf40c30a4a229bbd11b458869f97 Commit: 8c6af9e174abdf40c30a4a229bbd11b458869f97 Parent: ea312552e94883efc42cfa4651bcf964f3110564 Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Thu Jul 26 11:03:19 2007 -0400 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:38:33 2007 -0400 [SCSI] advansys: undate version, copyright, etc Update the version to 3.4 Add my copyright Add myself to MAINTAINERS Exercise my right to change the license from dual BSD/GPL to GPL Don't force the definition of CONFIG_ISA on x86 Always include pci.h Stop including stat.h Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- MAINTAINERS |6 ++ drivers/scsi/advansys.c | 43 +++ 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index e4dde7f..fa35397 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -288,6 +288,12 @@ P: Colin Leroy M: [EMAIL PROTECTED] S: Maintained +ADVANSYS SCSI DRIVER +P: Matthew Wilcox +M: [EMAIL PROTECTED] +L: [EMAIL PROTECTED] +S: Maintained + AEDSP16 DRIVER P: Riccardo Facchetti M: [EMAIL PROTECTED] diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 79c0b6e..8ace30e 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -1,20 +1,23 @@ -#define ASC_VERSION "3.3K" /* AdvanSys Driver Version */ +#define ASC_VERSION "3.4" /* AdvanSys Driver Version */ /* * advansys.c - Linux Host Driver for AdvanSys SCSI Adapters * * Copyright (c) 1995-2000 Advanced System Products, Inc. * Copyright (c) 2000-2001 ConnectCom Solutions, Inc. + * Copyright (c) 2007 Matthew Wilcox <[EMAIL PROTECTED]> * All Rights Reserved. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that redistributions of source - * code retain the above copyright notice and this comment without - * modification. - * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* * As of March 8, 2000 Advanced System Products, Inc. (AdvanSys) * changed its name to ConnectCom Solutions, Inc. - * + * On June 18, 2001 Initio Corp. acquired ConnectCom's SCSI assets */ /* @@ -755,11 +758,6 @@ */ #include - -#if defined(CONFIG_X86) && !defined(CONFIG_ISA) -#define CONFIG_ISA -#endif /* CONFIG_X86 && !CONFIG_ISA */ - #include #include #include @@ -771,7 +769,7 @@ #include #include #include -#include +#include #include #include @@ -779,6 +777,12 @@ #include #include +#include +#include +#include +#include +#include + /* FIXME: (by [EMAIL PROTECTED]) This warning is present for two * reasons: * @@ -793,15 +797,6 @@ */ #warning this driver is still not properly converted to the DMA API -#include -#include -#include -#include -#include -#ifdef CONFIG_PCI -#include -#endif /* CONFIG_PCI */ - /* * --- Driver Options */ @@ -17772,8 +17767,6 @@ static void AdvInquiryHandling(ADV_DVC_VAR *asc_dvc, ADV_SCSI_REQ_Q *scsiq) } } -MODULE_LICENSE("Dual BSD/GPL"); - static struct Scsi_Host *__devinit advansys_board_found(int iop, struct device *dev, int bus_type) { @@ -19029,3 +19022,5 @@ static struct pci_device_id advansys_pci_tbl[] __devinitdata = { MODULE_DEVICE_TABLE(pci, advansys_pci_tbl); #endif /* CONFIG_PCI */ + +MODULE_LICENSE("GPL"); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] advansys: Clean up proc_info implementation
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2a437959e963d98e04dbbcd26b69bfb1985567ce Commit: 2a437959e963d98e04dbbcd26b69bfb1985567ce Parent: 8c6af9e174abdf40c30a4a229bbd11b458869f97 Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Thu Jul 26 11:00:51 2007 -0400 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:38:37 2007 -0400 [SCSI] advansys: Clean up proc_info implementation Just use the Scsi_Host passed in, rather than looking through the driver's own array of boards for one that matches it. Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/advansys.c | 36 1 files changed, 12 insertions(+), 24 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 8ace30e..6d11076 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -4031,9 +4031,7 @@ static int advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, off_t offset, int length, int inout) { - struct Scsi_Host *shp; asc_board_t *boardp; - int i; char *cp; int cplen; int cnt; @@ -4058,18 +4056,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, * User read of /proc/scsi/advansys/[0...] file. */ - /* Find the specified board. */ - for (i = 0; i < asc_board_count; i++) { - if (asc_host[i]->host_no == shost->host_no) { - break; - } - } - if (i == asc_board_count) { - return (-ENOENT); - } - - shp = asc_host[i]; - boardp = ASC_BOARDP(shp); + boardp = ASC_BOARDP(shost); /* Copy read data starting at the beginning of the buffer. */ *start = buffer; @@ -4083,7 +4070,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, * * advansys_info() returns the board string from its own static buffer. */ - cp = (char *)advansys_info(shp); + cp = (char *)advansys_info(shost); strcat(cp, "\n"); cplen = strlen(cp); /* Copy board information. */ @@ -4102,7 +4089,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, */ if (ASC_WIDE_BOARD(boardp)) { cp = boardp->prtbuf; - cplen = asc_prt_adv_bios(shp, cp, ASC_PRTBUF_SIZE); + cplen = asc_prt_adv_bios(shost, cp, ASC_PRTBUF_SIZE); ASC_ASSERT(cplen < ASC_PRTBUF_SIZE); cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, @@ -4121,7 +4108,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, * Display driver information for each device attached to the board. */ cp = boardp->prtbuf; - cplen = asc_prt_board_devices(shp, cp, ASC_PRTBUF_SIZE); + cplen = asc_prt_board_devices(shost, cp, ASC_PRTBUF_SIZE); ASC_ASSERT(cplen < ASC_PRTBUF_SIZE); cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); totcnt += cnt; @@ -4138,9 +4125,9 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, */ cp = boardp->prtbuf; if (ASC_NARROW_BOARD(boardp)) { - cplen = asc_prt_asc_board_eeprom(shp, cp, ASC_PRTBUF_SIZE); + cplen = asc_prt_asc_board_eeprom(shost, cp, ASC_PRTBUF_SIZE); } else { - cplen = asc_prt_adv_board_eeprom(shp, cp, ASC_PRTBUF_SIZE); + cplen = asc_prt_adv_board_eeprom(shost, cp, ASC_PRTBUF_SIZE); } ASC_ASSERT(cplen < ASC_PRTBUF_SIZE); cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); @@ -4157,7 +4144,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, * Display driver configuration and information for the board. */ cp = boardp->prtbuf; - cplen = asc_prt_driver_conf(shp, cp, ASC_PRTBUF_SIZE); + cplen = asc_prt_driver_conf(shost, cp, ASC_PRTBUF_SIZE); ASC_ASSERT(cplen < ASC_PRTBUF_SIZE); cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); totcnt += cnt; @@ -4174,7 +4161,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, * Display driver statistics for the board. */ cp = boardp->prtbuf; - cplen = asc_prt_board_stats(shp, cp, ASC_PRTBUF_SIZE); + cplen = asc_prt_board_stats(shost, cp, ASC_PRTBUF_SIZE); ASC_ASSERT(cplen <= ASC_PRTBUF_SIZE); cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); totcnt += cnt; @@ -4191,7 +4178,8 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, */ for (tgt_id = 0; tgt_id <= ADV_
[SCSI] advansys: Improve interrupt handler
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=074c8fe4c0c0c7918d99bca34ea8e02a86997530 Commit: 074c8fe4c0c0c7918d99bca34ea8e02a86997530 Parent: 2a437959e963d98e04dbbcd26b69bfb1985567ce Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Sat Jul 28 23:11:05 2007 -0600 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:38:40 2007 -0400 [SCSI] advansys: Improve interrupt handler Pass the Scsi_Host to the interrupt handler, rather than polling all hosts for each interrupt. Return IRQ_NONE if we didn't handle this interrupt Don't set the IRQF_DISABLED flag; this is not a fast-executing interrupt handler. Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/advansys.c | 172 --- 1 files changed, 72 insertions(+), 100 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 6d11076..a407ff3 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -3951,7 +3951,6 @@ static PortAddr _asc_def_iop_base[]; * advansys.h contains function prototypes for functions global to Linux. */ -static irqreturn_t advansys_interrupt(int, void *); static int advansys_slave_configure(struct scsi_device *); static void asc_scsi_done_list(struct scsi_cmnd *); static int asc_execute_scsi_cmnd(struct scsi_cmnd *); @@ -4684,89 +4683,76 @@ static struct scsi_host_template driver_template = { */ static irqreturn_t advansys_interrupt(int irq, void *dev_id) { - ulong flags; - int i; - asc_board_t *boardp; + unsigned long flags; struct scsi_cmnd *done_scp = NULL, *last_scp = NULL; struct scsi_cmnd *new_last_scp; - struct Scsi_Host *shost; + struct Scsi_Host *shost = dev_id; + asc_board_t *boardp = ASC_BOARDP(shost); + irqreturn_t result = IRQ_NONE; - ASC_DBG(1, "advansys_interrupt: begin\n"); + ASC_DBG1(2, "advansys_interrupt: boardp 0x%p\n", boardp); + spin_lock_irqsave(&boardp->lock, flags); + if (ASC_NARROW_BOARD(boardp)) { + /* +* Narrow Board +*/ + if (AscIsIntPending(shost->io_port)) { + result = IRQ_HANDLED; + ASC_STATS(shost, interrupt); + ASC_DBG(1, "advansys_interrupt: before AscISR()\n"); + AscISR(&boardp->dvc_var.asc_dvc_var); + } + } else { + /* +* Wide Board +*/ + ASC_DBG(1, "advansys_interrupt: before AdvISR()\n"); + if (AdvISR(&boardp->dvc_var.adv_dvc_var)) { + result = IRQ_HANDLED; + ASC_STATS(shost, interrupt); + } + } /* -* Check for interrupts on all boards. -* AscISR() will call asc_isr_callback(). -*/ - for (i = 0; i < asc_board_count; i++) { - shost = asc_host[i]; - boardp = ASC_BOARDP(shost); - ASC_DBG2(2, "advansys_interrupt: i %d, boardp 0x%lx\n", -i, (ulong)boardp); - spin_lock_irqsave(&boardp->lock, flags); - if (ASC_NARROW_BOARD(boardp)) { - /* -* Narrow Board -*/ - if (AscIsIntPending(shost->io_port)) { - ASC_STATS(shost, interrupt); - ASC_DBG(1, - "advansys_interrupt: before AscISR()\n"); - AscISR(&boardp->dvc_var.asc_dvc_var); - } - } else { - /* -* Wide Board -*/ - ASC_DBG(1, "advansys_interrupt: before AdvISR()\n"); - if (AdvISR(&boardp->dvc_var.adv_dvc_var)) { - ASC_STATS(shost, interrupt); - } +* Start waiting requests and create a list of completed requests. +* +* If a reset request is being performed for the board, the reset +* handler will complete pending requests after it has completed. +*/ + if ((boardp->flags & ASC_HOST_IN_RESET) == 0) { + ASC_DBG2(1, "advansys_interrupt: done_scp 0x%p, " +"last_scp 0x%p\n", done_scp, last_scp); + + /* Start any waiting commands for the board. */ + if (!ASC_QUEUE_EMPTY(&boardp->waiting)) { + ASC_DBG(1, "advansys_interrupt: before " + "asc_execute_queue()\n"); + asc_execute_queue(&boardp->waiting); } /* -* Start waiti
[SCSI] advansys: Stop checking the scsi_cmnd belongs to our Scsi_Host
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=605fe5987f728e92e75ba12f7be01ffc3b132ad0 Commit: 605fe5987f728e92e75ba12f7be01ffc3b132ad0 Parent: 074c8fe4c0c0c7918d99bca34ea8e02a86997530 Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Sun Jul 29 17:27:20 2007 -0600 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:38:44 2007 -0400 [SCSI] advansys: Stop checking the scsi_cmnd belongs to our Scsi_Host The interrupt routines used to walk the list of Scsi_Hosts belonging to this driver to make sure that the scsi_cmnd belonged to one of them. This is a waste of time and gets in the way of later cleanups, so delete it. Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/advansys.c | 38 -- 1 files changed, 0 insertions(+), 38 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index a407ff3..7a964bb 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -5506,7 +5506,6 @@ static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep) asc_board_t *boardp; struct scsi_cmnd *scp; struct Scsi_Host *shost; - int i; ASC_DBG2(1, "asc_isr_callback: asc_dvc_varp 0x%lx, qdonep 0x%lx\n", (ulong)asc_dvc_varp, (ulong)qdonep); @@ -5525,23 +5524,7 @@ static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep) } ASC_DBG_PRT_CDB(2, scp->cmnd, scp->cmd_len); - /* -* If the request's host pointer is not valid, display a -* message and return. -*/ shost = scp->device->host; - for (i = 0; i < asc_board_count; i++) { - if (asc_host[i] == shost) { - break; - } - } - if (i == asc_board_count) { - ASC_PRINT2 - ("asc_isr_callback: scp 0x%lx has bad host pointer, host 0x%lx\n", -(ulong)scp, (ulong)shost); - return; - } - ASC_STATS(shost, callback); ASC_DBG1(1, "asc_isr_callback: shost 0x%lx\n", (ulong)shost); @@ -5680,7 +5663,6 @@ static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp) adv_sgblk_t *sgblkp; struct scsi_cmnd *scp; struct Scsi_Host *shost; - int i; ADV_DCNT resid_cnt; ASC_DBG2(1, "adv_isr_callback: adv_dvc_varp 0x%lx, scsiqp 0x%lx\n", @@ -5716,27 +5698,7 @@ static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp) } ASC_DBG_PRT_CDB(2, scp->cmnd, scp->cmd_len); - /* -* If the request's host pointer is not valid, display a message -* and return. -*/ shost = scp->device->host; - for (i = 0; i < asc_board_count; i++) { - if (asc_host[i] == shost) { - break; - } - } - /* -* Note: If the host structure is not found, the adv_req_t request -* structure and adv_sgblk_t structure, if any, is dropped. -*/ - if (i == asc_board_count) { - ASC_PRINT2 - ("adv_isr_callback: scp 0x%lx has bad host pointer, host 0x%lx\n", -(ulong)scp, (ulong)shost); - return; - } - ASC_STATS(shost, callback); ASC_DBG1(1, "adv_isr_callback: shost 0x%lx\n", (ulong)shost); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] advansys: Make advansys_board_found a little more readable
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b2c16f586ee529e97ac63183e70e2bfd586a2f47 Commit: b2c16f586ee529e97ac63183e70e2bfd586a2f47 Parent: 605fe5987f728e92e75ba12f7be01ffc3b132ad0 Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Sun Jul 29 17:30:28 2007 -0600 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:38:49 2007 -0400 [SCSI] advansys: Make advansys_board_found a little more readable - Put all the error cleanup at the end of the function and goto the appropriate label - Split advansys_wide_init_chip out of advansys_board_found - Split advansys_wide_free_mem out of advansys_board_found. Use it from advansys_release - Use GFP_KERNEL, not GFP_ATOMIC, when allocating memory during initialisation - Eliminate lots of PROC_FS ifdefs by removing the ifdefs around the prtbuf struct member Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/advansys.c | 394 +++ 1 files changed, 158 insertions(+), 236 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 7a964bb..303dc98 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -3825,10 +3825,8 @@ typedef struct asc_board { } eep_config; ulong last_reset; /* Saved last reset time */ spinlock_t lock;/* Board spinlock */ -#ifdef CONFIG_PROC_FS /* /proc/scsi/advansys/[0...] */ char *prtbuf; /* /proc print buffer */ -#endif /* CONFIG_PROC_FS */ #ifdef ADVANSYS_STATS struct asc_stats asc_stats; /* Board statistics */ #endif /* ADVANSYS_STATS */ @@ -3845,7 +3843,7 @@ typedef struct asc_board { */ void __iomem *ioremap_addr; /* I/O Memory remap address. */ ushort ioport; /* I/O Port address. */ - ADV_CARR_T *orig_carrp; /* ADV_CARR_T memory block. */ + ADV_CARR_T *carrp; /* ADV_CARR_T memory block. */ adv_req_t *orig_reqp; /* adv_req_t memory block. */ adv_req_t *adv_reqp;/* Request structures. */ adv_sgblk_t *adv_sgblkp;/* Scatter-gather structures. */ @@ -17703,6 +17701,124 @@ static void AdvInquiryHandling(ADV_DVC_VAR *asc_dvc, ADV_SCSI_REQ_Q *scsiq) } } +static int __devinit +advansys_wide_init_chip(asc_board_t *boardp, ADV_DVC_VAR *adv_dvc_varp) +{ + int req_cnt = 0; + adv_req_t *reqp = NULL; + int sg_cnt = 0; + adv_sgblk_t *sgp; + int warn_code, err_code; + + /* +* Allocate buffer carrier structures. The total size +* is about 4 KB, so allocate all at once. +*/ + boardp->carrp = kmalloc(ADV_CARRIER_BUFSIZE, GFP_KERNEL); + ASC_DBG1(1, "advansys_wide_init_chip: carrp 0x%p\n", boardp->carrp); + + if (!boardp->carrp) + goto kmalloc_failed; + + /* +* Allocate up to 'max_host_qng' request structures for the Wide +* board. The total size is about 16 KB, so allocate all at once. +* If the allocation fails decrement and try again. +*/ + for (req_cnt = adv_dvc_varp->max_host_qng; req_cnt > 0; req_cnt--) { + reqp = kmalloc(sizeof(adv_req_t) * req_cnt, GFP_KERNEL); + + ASC_DBG3(1, "advansys_wide_init_chip: reqp 0x%p, req_cnt %d, " +"bytes %lu\n", reqp, req_cnt, +(ulong)sizeof(adv_req_t) * req_cnt); + + if (reqp) + break; + } + + if (!reqp) + goto kmalloc_failed; + + boardp->orig_reqp = reqp; + + /* +* Allocate up to ADV_TOT_SG_BLOCK request structures for +* the Wide board. Each structure is about 136 bytes. +*/ + boardp->adv_sgblkp = NULL; + for (sg_cnt = 0; sg_cnt < ADV_TOT_SG_BLOCK; sg_cnt++) { + sgp = kmalloc(sizeof(adv_sgblk_t), GFP_KERNEL); + + if (!sgp) + break; + + sgp->next_sgblkp = boardp->adv_sgblkp; + boardp->adv_sgblkp = sgp; + + } + + ASC_DBG3(1, "advansys_wide_init_chip: sg_cnt %d * %u = %u bytes\n", +sg_cnt, sizeof(adv_sgblk_t), +(unsigned)(sizeof(adv_sgblk_t) * sg_cnt)); + + if (!boardp->adv_sgblkp) + goto kmalloc_failed; + + adv_dvc_varp->carrier_buf = boardp->carrp; + + /* +* Point 'adv_reqp' to the request structures and +* link them together. +*/ + req_cnt--; + reqp[req_cnt].next_reqp = NULL; + for (; req_cnt > 0; req_cnt--) { + reqp[req_cnt - 1].next_reqp = &reqp[req_cnt]; + } + boardp->adv_reqp = &reqp[0]; + + if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { +
[SCSI] advansys: Move to scsi hotplug initialisation model
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8dfb537933a87588e83196d14cd9ec245eb065b8 Commit: 8dfb537933a87588e83196d14cd9ec245eb065b8 Parent: b2c16f586ee529e97ac63183e70e2bfd586a2f47 Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Mon Jul 30 09:08:34 2007 -0600 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:38:53 2007 -0400 [SCSI] advansys: Move to scsi hotplug initialisation model - Switch from scsi_register/scsi_unregister to scsi_host_alloc, scsi_add_host, scsi_scan_host and scsi_host_put. - Rename the scsi_host_template to advansys_template - Use module_init and module_exit instead of scsi_module.c - Remove protection against advansys_detect being called twice Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/advansys.c | 61 +++--- 1 files changed, 36 insertions(+), 25 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 303dc98..8353680 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -3793,7 +3793,7 @@ typedef struct adv_req { /* * Structure allocated for each board. * - * This structure is allocated by scsi_register() at the end + * This structure is allocated by scsi_host_alloc() at the end * of the 'Scsi_Host' structure starting at the 'hostdata' * field. It is guaranteed to be allocated from DMA-able memory. */ @@ -4632,17 +4632,12 @@ advansys_biosparam(struct scsi_device *sdev, struct block_device *bdev, return 0; } -static int __init advansys_detect(struct scsi_host_template *tpnt); -static int advansys_release(struct Scsi_Host *shp); - -static struct scsi_host_template driver_template = { +static struct scsi_host_template advansys_template = { .proc_name = "advansys", #ifdef CONFIG_PROC_FS .proc_info = advansys_proc_info, #endif .name = "advansys", - .detect = advansys_detect, - .release = advansys_release, .info = advansys_info, .queuecommand = advansys_queuecommand, .eh_bus_reset_handler = advansys_reset, @@ -4650,8 +4645,8 @@ static struct scsi_host_template driver_template = { .slave_configure = advansys_slave_configure, /* * Because the driver may control an ISA adapter 'unchecked_isa_dma' -* must be set. The flag will be cleared in advansys_detect for non-ISA -* adapters. Refer to the comment in scsi_module.c for more information. +* must be set. The flag will be cleared in advansys_board_found +* for non-ISA adapters. */ .unchecked_isa_dma = 1, /* @@ -4664,8 +4659,6 @@ static struct scsi_host_template driver_template = { .use_clustering = ENABLE_CLUSTERING, }; -#include "scsi_module.c" - /* * --- Miscellaneous Driver Functions */ @@ -17839,8 +17832,8 @@ advansys_board_found(int iop, struct device *dev, int bus_type) * Register the adapter, get its configuration, and * initialize it. */ - ASC_DBG(2, "advansys_board_found: scsi_register()\n"); - shost = scsi_register(&driver_template, sizeof(asc_board_t)); + ASC_DBG(2, "advansys_board_found: scsi_host_alloc()\n"); + shost = scsi_host_alloc(&advansys_template, sizeof(asc_board_t)); if (!shost) return NULL; @@ -18503,6 +18496,11 @@ advansys_board_found(int iop, struct device *dev, int bus_type) ASC_DBG_PRT_SCSI_HOST(2, shost); + ret = scsi_add_host(shost, dev); + if (ret) + goto err_free_wide_mem; + + scsi_scan_host(shost); return shost; err_free_wide_mem: @@ -18519,7 +18517,7 @@ advansys_board_found(int iop, struct device *dev, int bus_type) if (boardp->ioremap_addr) iounmap(boardp->ioremap_addr); err_shost: - scsi_unregister(shost); + scsi_host_put(shost); asc_board_count--; return NULL; } @@ -18537,9 +18535,8 @@ advansys_board_found(int iop, struct device *dev, int bus_type) * it must not call SCSI mid-level functions including scsi_malloc() * and scsi_free(). */ -static int __init advansys_detect(struct scsi_host_template *tpnt) +static int __init advansys_detect(void) { - static int detect_called = ASC_FALSE; int iop; int bus; int ioport = 0; @@ -18561,14 +18558,6 @@ static int __init advansys_detect(struct scsi_host_template *tpnt) }; #endif /* CONFIG_PCI */ - if (detect_called == ASC_FALSE) { - detect_called = ASC_TRUE; - } else { - printk - ("AdvanSys SCSI: advansys_detect() multiple calls ignored\n"); - return 0; - } - ASC_DBG(1, "advansys_detect: begin\n"); asc_board_count = 0; @@ -18829,6 +18818,7 @@ static int advan
[SCSI] advansys: Convert to PCI driver model
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=78e77d8b50633241d34cd9e64626d39d0a8cd2c0 Commit: 78e77d8b50633241d34cd9e64626d39d0a8cd2c0 Parent: 8dfb537933a87588e83196d14cd9ec245eb065b8 Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Sun Jul 29 21:46:15 2007 -0600 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:38:56 2007 -0400 [SCSI] advansys: Convert to PCI driver model - Add a pci_driver interface for the PCI advansys devices (for ISA/EISA/VLB devices, we still call advansys_detect). - Many functions are converted from __init to __devinit to allow hotplug PCI to work. - Only keep devices found by advansys_detect in the asc_host list. - Rename asc_board_count to asc_legacy_count. New asc_board_count is only used to generate a unique name for each device. - Remove some now-unused macros and struct definitions Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/advansys.c | 378 --- 1 files changed, 129 insertions(+), 249 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 8353680..3ba7032 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -865,12 +865,8 @@ typedef unsigned char uchar; #define AscPCIConfigLatencyTimer 0x000D #define AscPCIIOBaseRegister 0x0010 #define AscPCICmdRegBits_IOMemBusMaster 0x0007 -#define ASC_PCI_ID2BUS(id)((id) & 0xFF) -#define ASC_PCI_ID2DEV(id)(((id) >> 11) & 0x1F) #define ASC_PCI_ID2FUNC(id) (((id) >> 8) & 0x7) #define ASC_PCI_MKID(bus, dev, func) dev) & 0x1F) << 11) | (((func) & 0x7) << 8) | ((bus) & 0xFF)) -#define ASC_PCI_REVISION_3150 0x02 -#define ASC_PCI_REVISION_3050 0x03 #define ASC_DVCLIB_CALL_DONE (1) #define ASC_DVCLIB_CALL_FAILED (0) @@ -3422,7 +3418,7 @@ typedef struct { #define ASC_NUM_BOARD_SUPPORTED 16 #define ASC_NUM_IOPORT_PROBE4 -#define ASC_NUM_BUS 4 +#define ASC_NUM_BUS 3 /* Reference Scsi_Host hostdata */ #define ASC_BOARDP(host) ((asc_board_t *) &((host)->hostdata)) @@ -3526,11 +3522,6 @@ typedef struct scsi_cmnd REQ, *REQP; /* Return non-zero, if the queue is empty. */ #define ASC_QUEUE_EMPTY(ascq)((ascq)->q_tidmask == 0) -#define PCI_MAX_SLOT0x1F -#define PCI_MAX_BUS 0xFF -#define PCI_IOADDRESS_MASK 0xFFFE -#define ASC_PCI_DEVICE_ID_CNT 6 /* PCI Device ID count. */ - #ifndef ADVANSYS_STATS #define ASC_STATS(shost, counter) #define ASC_STATS_ADD(shost, counter, count) @@ -3853,60 +3844,11 @@ typedef struct asc_board { ushort bios_codelen;/* BIOS Code Segment Length. */ } asc_board_t; -/* - * PCI configuration structures - */ -typedef struct _PCI_DATA_ { - uchar type; - uchar bus; - uchar slot; - uchar func; - uchar offset; -} PCI_DATA; - -typedef struct _PCI_DEVICE_ { - ushort vendorID; - ushort deviceID; - ushort slotNumber; - ushort slotFound; - uchar busNumber; - uchar maxBusNumber; - uchar devFunc; - ushort startSlot; - ushort endSlot; - uchar bridge; - uchar type; -} PCI_DEVICE; - -typedef struct _PCI_CONFIG_SPACE_ { - ushort vendorID; - ushort deviceID; - ushort command; - ushort status; - uchar revision; - uchar classCode[3]; - uchar cacheSize; - uchar latencyTimer; - uchar headerType; - uchar bist; - ADV_PADDR baseAddress[6]; - ushort reserved[4]; - ADV_PADDR optionRomAddr; - ushort reserved2[4]; - uchar irqLine; - uchar irqPin; - uchar minGnt; - uchar maxLatency; -} PCI_CONFIG_SPACE; - -/* - * --- Driver Data - */ - -/* Note: All driver global data should be initialized. */ - /* Number of boards detected in system. */ -static int asc_board_count = 0; +static int asc_board_count; + +/* Number of boards detected by advansys_detect */ +static int asc_legacy_count; static struct Scsi_Host *asc_host[ASC_NUM_BOARD_SUPPORTED] = { NULL }; /* Overrun buffer used by all narrow boards. */ @@ -3918,12 +3860,11 @@ static uchar overrun_buf[ASC_OVERRUN_BSIZE] = { 0 }; static ASC_SCSI_Q asc_scsi_q = { {0} }; static ASC_SG_HEAD asc_sg_head = { 0 }; -/* List of supported bus types. */ +/* List of bus types probed in advansys_detect. */ static ushort asc_bus[ASC_NUM_BUS] __initdata = { ASC_IS_ISA, ASC_IS_VL, ASC_IS_EISA, - ASC_IS_PCI, }; static int asc_iopflag = ASC_FALSE; @@ -3934,7 +3875,6 @@ static char *asc_bus_name[ASC_NUM_BUS] = { "ASC_IS_ISA", "ASC_IS_VL", "ASC_IS_EISA", - "ASC_IS_PCI", }; static int asc_dbglvl = 3; @@ -7441,7 +7381,7 @@ DvcGetQinfo(PortAddr iop_base, ushort s_addr, ucha
[SCSI] advansys: Convert to EISA driver model
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b09e05a73e8308397371edc15b7d45082971fa95 Commit: b09e05a73e8308397371edc15b7d45082971fa95 Parent: 78e77d8b50633241d34cd9e64626d39d0a8cd2c0 Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Mon Jul 30 09:14:52 2007 -0600 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:39:01 2007 -0400 [SCSI] advansys: Convert to EISA driver model - Switch EISA probing to the driver model - Remove some now-unused macros and functions - Update the FIXME now that we use the correct driver model probing API Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/advansys.c | 175 +-- 1 files changed, 94 insertions(+), 81 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 3ba7032..e096f19 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -769,6 +769,7 @@ #include #include #include +#include #include #include #include @@ -783,13 +784,9 @@ #include #include -/* FIXME: (by [EMAIL PROTECTED]) This warning is present for two - * reasons: +/* FIXME: (by [EMAIL PROTECTED]) * - * 1) This driver badly needs converting to the correct driver model - *probing API - * - * 2) Although all of the necessary command mapping places have the + * Although all of the necessary command mapping places have the * appropriate dma_map.. APIs, the driver still processes its internal * queue using bus_to_virt() and virt_to_bus() which are illegal under * the API. The entire queue processing structure will need to be @@ -1787,16 +1784,10 @@ typedef struct asceep_config { #define ASC_1000_ID0W 0x04C1 #define ASC_1000_ID0W_FIX 0x00C1 #define ASC_1000_ID1B 0x25 -#define ASC_EISA_BIG_IOP_GAP (0x1C30-0x0C50) -#define ASC_EISA_SMALL_IOP_GAP (0x0020) -#define ASC_EISA_MIN_IOP_ADDR (0x0C30) -#define ASC_EISA_MAX_IOP_ADDR (0xFC50) #define ASC_EISA_REV_IOP_MASK (0x0C83) #define ASC_EISA_PID_IOP_MASK (0x0C80) #define ASC_EISA_CFG_IOP_MASK (0x0C86) #define ASC_GET_EISA_SLOT(iop) (PortAddr)((iop) & 0xF000) -#define ASC_EISA_ID_7400x01745004UL -#define ASC_EISA_ID_7500x01755004UL #define INS_HALTINT(ushort)0x6281 #define INS_HALT (ushort)0x6280 #define INS_SINT (ushort)0x6200 @@ -1943,8 +1934,6 @@ static int AscIsrQDone(ASC_DVC_VAR *); static int AscCompareString(uchar *, uchar *, int); #ifdef CONFIG_ISA static ushort AscGetEisaChipCfg(PortAddr); -static ASC_DCNT AscGetEisaProductID(PortAddr); -static PortAddr AscSearchIOPortAddrEISA(PortAddr); static PortAddr AscSearchIOPortAddr11(PortAddr); static PortAddr AscSearchIOPortAddr(PortAddr, ushort); static void AscSetISAPNPWaitForKey(void); @@ -3418,7 +3407,7 @@ typedef struct { #define ASC_NUM_BOARD_SUPPORTED 16 #define ASC_NUM_IOPORT_PROBE4 -#define ASC_NUM_BUS 3 +#define ASC_NUM_BUS 2 /* Reference Scsi_Host hostdata */ #define ASC_BOARDP(host) ((asc_board_t *) &((host)->hostdata)) @@ -3864,7 +3853,6 @@ static ASC_SG_HEAD asc_sg_head = { 0 }; static ushort asc_bus[ASC_NUM_BUS] __initdata = { ASC_IS_ISA, ASC_IS_VL, - ASC_IS_EISA, }; static int asc_iopflag = ASC_FALSE; @@ -3874,7 +3862,6 @@ static int asc_ioport[ASC_NUM_IOPORT_PROBE] = { 0, 0, 0, 0 }; static char *asc_bus_name[ASC_NUM_BUS] = { "ASC_IS_ISA", "ASC_IS_VL", - "ASC_IS_EISA", }; static int asc_dbglvl = 3; @@ -8241,12 +8228,6 @@ static PortAddr __init AscSearchIOPortAddr(PortAddr iop_beg, ushort bus_type) } return (0); } - if (bus_type & ASC_IS_EISA) { - if ((iop_beg = AscSearchIOPortAddrEISA(iop_beg)) != 0) { - return (iop_beg); - } - return (0); - } return (0); } @@ -10256,57 +10237,6 @@ static void DvcDelayNanoSecond(ASC_DVC_VAR *asc_dvc, ASC_DCNT nano_sec) udelay((nano_sec + 999) / 1000); } -#ifdef CONFIG_ISA -static ASC_DCNT __init AscGetEisaProductID(PortAddr iop_base) -{ - PortAddr eisa_iop; - ushort product_id_high, product_id_low; - ASC_DCNT product_id; - - eisa_iop = ASC_GET_EISA_SLOT(iop_base) | ASC_EISA_PID_IOP_MASK; - product_id_low = inpw(eisa_iop); - product_id_high = inpw(eisa_iop + 2); - product_id = ((ASC_DCNT) product_id_high << 16) | - (ASC_DCNT) product_id_low; - return (product_id); -} - -static PortAddr __init AscSearchIOPortAddrEISA(PortAddr iop_base) -{ - ASC_DCNT eisa_product_id; - - if (iop_base == 0) { - iop_base = ASC_EISA_MIN_IOP_ADDR; - } else { - if (iop_base == ASC_EISA_MAX_IOP_ADDR) - return (0); - if ((iop_base & 0x0050) == 0x0050) { -
[SCSI] advansys: Convert to ISA driver model
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c304ec94733aec764396813f3f05dfbe02f4a6da Commit: c304ec94733aec764396813f3f05dfbe02f4a6da Parent: b09e05a73e8308397371edc15b7d45082971fa95 Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Mon Jul 30 09:18:45 2007 -0600 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:39:04 2007 -0400 [SCSI] advansys: Convert to ISA driver model Register two isa_drivers, one for ISA and one for VLB, in order to preserve detection order. When deleting advansys_detect, we lose the last vestiges of the code that limited IO port scanning. This code has been effectively disabled for many years anyway; I'll restore it in a module_param later. We also lose the code that placed all ISA PnP cards into WaitForKey state -- drivers shouldn't be doing this anyway. The asc_host array goes away too. Also remove some IOADR and other definitions, such as ASC_NUM_BOARD_SUPPORTED. Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/advansys.c | 412 +-- 1 files changed, 113 insertions(+), 299 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index e096f19..eda41f2 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -280,7 +280,7 @@ AdvanSys SCSI adapter files have the following path name format: - /proc/scsi/advansys/[0-(ASC_NUM_BOARD_SUPPORTED-1)] + /proc/scsi/advansys/{0,1,2,3,...} This information can be displayed with cat. For example: @@ -769,6 +769,7 @@ #include #include #include +#include #include #include #include @@ -1362,18 +1363,6 @@ typedef struct asc_risc_sg_list_q { #define ASC_MAX_INRAM_TAG_QNG 16 #define ASC_IOADR_TABLE_MAX_IX 11 #define ASC_IOADR_GAP 0x10 -#define ASC_SEARCH_IOP_GAP 0x10 -#define ASC_MIN_IOP_ADDR (PortAddr)0x0100 -#define ASC_MAX_IOP_ADDR (PortAddr)0x3F0 -#define ASC_IOADR_1 (PortAddr)0x0110 -#define ASC_IOADR_2 (PortAddr)0x0130 -#define ASC_IOADR_3 (PortAddr)0x0150 -#define ASC_IOADR_4 (PortAddr)0x0190 -#define ASC_IOADR_5 (PortAddr)0x0210 -#define ASC_IOADR_6 (PortAddr)0x0230 -#define ASC_IOADR_7 (PortAddr)0x0250 -#define ASC_IOADR_8 (PortAddr)0x0330 -#define ASC_IOADR_DEF ASC_IOADR_8 #define ASC_LIB_SCSIQ_WK_SP256 #define ASC_MAX_SYN_XFER_NO16 #define ASC_SYN_MAX_OFFSET 0x0F @@ -1934,9 +1923,6 @@ static int AscIsrQDone(ASC_DVC_VAR *); static int AscCompareString(uchar *, uchar *, int); #ifdef CONFIG_ISA static ushort AscGetEisaChipCfg(PortAddr); -static PortAddr AscSearchIOPortAddr11(PortAddr); -static PortAddr AscSearchIOPortAddr(PortAddr, ushort); -static void AscSetISAPNPWaitForKey(void); #endif /* CONFIG_ISA */ static uchar AscGetChipScsiCtrl(PortAddr); static uchar AscSetChipScsiID(PortAddr, uchar); @@ -3405,10 +3391,6 @@ typedef struct { * --- Driver Constants and Macros */ -#define ASC_NUM_BOARD_SUPPORTED 16 -#define ASC_NUM_IOPORT_PROBE4 -#define ASC_NUM_BUS 2 - /* Reference Scsi_Host hostdata */ #define ASC_BOARDP(host) ((asc_board_t *) &((host)->hostdata)) @@ -3836,10 +3818,6 @@ typedef struct asc_board { /* Number of boards detected in system. */ static int asc_board_count; -/* Number of boards detected by advansys_detect */ -static int asc_legacy_count; -static struct Scsi_Host *asc_host[ASC_NUM_BOARD_SUPPORTED] = { NULL }; - /* Overrun buffer used by all narrow boards. */ static uchar overrun_buf[ASC_OVERRUN_BSIZE] = { 0 }; @@ -3849,27 +3827,10 @@ static uchar overrun_buf[ASC_OVERRUN_BSIZE] = { 0 }; static ASC_SCSI_Q asc_scsi_q = { {0} }; static ASC_SG_HEAD asc_sg_head = { 0 }; -/* List of bus types probed in advansys_detect. */ -static ushort asc_bus[ASC_NUM_BUS] __initdata = { - ASC_IS_ISA, - ASC_IS_VL, -}; - -static int asc_iopflag = ASC_FALSE; -static int asc_ioport[ASC_NUM_IOPORT_PROBE] = { 0, 0, 0, 0 }; - #ifdef ADVANSYS_DEBUG -static char *asc_bus_name[ASC_NUM_BUS] = { - "ASC_IS_ISA", - "ASC_IS_VL", -}; - static int asc_dbglvl = 3; #endif /* ADVANSYS_DEBUG */ -/* Declaration for Asc Library internal data referenced by driver. */ -static PortAddr _asc_def_iop_base[]; - /* * --- Driver Function Prototypes * @@ -3932,7 +3893,7 @@ static void asc_prt_hex(char *f, uchar *, int); #ifdef CONFIG_PROC_FS /* - * advansys_proc_info() - /proc/scsi/advansys/[0-(ASC_NUM_BOARD_SUPPORTED-1)] + * advansys_proc_info() - /proc/scsi/advansys/{0,1,2,3,...} * * *buffer: I/O buffer * **start: if inout == FALSE pointer into buffer where user read should start @@ -8196,77 +8157,6 @@ static int AscFindSignature(PortAddr iop_base) return (0); } -static PortAddr _asc_def_iop_base[ASC_IOADR_TABLE_MAX_IX] __initdata = { - 0x100, ASC_IOADR
[SCSI] advansys: Update resource management
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=71f36115d20e8d8b0ef10479ff0cde877ec56f98 Commit: 71f36115d20e8d8b0ef10479ff0cde877ec56f98 Parent: c304ec94733aec764396813f3f05dfbe02f4a6da Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Mon Jul 30 08:04:53 2007 -0600 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:39:08 2007 -0400 [SCSI] advansys: Update resource management Make sure the resources are reserved and released by all the callers of advansys_board_found(). This eliminates the check_region-style race. It also allows us to use the pci_request_regions() API. Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/advansys.c | 70 ++- 1 files changed, 33 insertions(+), 37 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index eda41f2..d51ca86 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -17681,14 +17681,12 @@ advansys_board_found(int iop, struct device *dev, int bus_type) boardp->id, pci_memory_address, iolen); goto err_shost; } - ASC_DBG1(1, -"advansys_board_found: ioremap_addr: 0x%lx\n", + ASC_DBG1(1, "advansys_board_found: ioremap_addr: 0x%lx\n", (ulong)boardp->ioremap_addr); adv_dvc_varp->iop_base = (AdvPortAddr) (boardp->ioremap_addr + (pci_memory_address - (pci_memory_address & PAGE_MASK))); - ASC_DBG1(1, -"advansys_board_found: iop_base: 0x%lx\n", + ASC_DBG1(1, "advansys_board_found: iop_base: 0x%lx\n", adv_dvc_varp->iop_base); #endif /* CONFIG_PCI */ @@ -18169,25 +18167,6 @@ advansys_board_found(int iop, struct device *dev, int bus_type) * Register Board Resources - I/O Port, DMA, IRQ */ - /* -* Register I/O port range. -* -* For Wide boards the I/O ports are not used to access -* the board, but request the region anyway. -* -* 'shost->n_io_port' is not referenced, because it may be truncated. -*/ - ASC_DBG2(2, -"advansys_board_found: request_region port 0x%lx, len 0x%x\n", -(ulong)shost->io_port, boardp->asc_n_io_port); - if (request_region(shost->io_port, boardp->asc_n_io_port, - "advansys") == NULL) { - ASC_PRINT3 - ("advansys_board_found: board %d: request_region() failed, port 0x%lx, len 0x%x\n", -boardp->id, (ulong)shost->io_port, boardp->asc_n_io_port); - goto err_free_proc; - } - /* Register DMA Channel for Narrow boards. */ shost->dma_channel = NO_ISA_DMA;/* Default to no ISA DMA. */ #ifdef CONFIG_ISA @@ -18200,7 +18179,7 @@ advansys_board_found(int iop, struct device *dev, int bus_type) ASC_PRINT3 ("advansys_board_found: board %d: request_dma() %d failed %d\n", boardp->id, shost->dma_channel, ret); - goto err_free_region; + goto err_free_proc; } AscEnableIsaDma(shost->dma_channel); } @@ -18266,8 +18245,6 @@ advansys_board_found(int iop, struct device *dev, int bus_type) err_free_dma: if (shost->dma_channel != NO_ISA_DMA) free_dma(shost->dma_channel); - err_free_region: - release_region(shost->io_port, boardp->asc_n_io_port); err_free_proc: kfree(boardp->prtbuf); err_unmap: @@ -18295,7 +18272,6 @@ static int advansys_release(struct Scsi_Host *shost) ASC_DBG(1, "advansys_release: free_dma()\n"); free_dma(shost->dma_channel); } - release_region(shost->io_port, boardp->asc_n_io_port); if (ASC_WIDE_BOARD(boardp)) { iounmap(boardp->ioremap_addr); advansys_wide_free_mem(boardp); @@ -18317,19 +18293,17 @@ static int __devinit advansys_isa_probe(struct device *dev, unsigned int id) struct Scsi_Host *shost; if (!request_region(iop_base, ASC_IOADR_GAP, "advansys")) { - ASC_DBG1(1, "advansys_isa_match: check_region() failed " -"I/O port 0x%x\n", iop_base); + ASC_DBG1(1, "advansys_isa_match: I/O port 0x%x busy\n", +iop_base); return -ENODEV; } ASC_DBG1(1, "advansys_isa_match: probing I/O port 0x%x\n", iop_base); - release_region(iop_base, ASC_IOADR_GAP); if (!AscFindSignature(iop_base))
[SCSI] advansys: More PCI cleanups
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9649af39e30d8d2668c35d008e8e14ae138e4d40 Commit: 9649af39e30d8d2668c35d008e8e14ae138e4d40 Parent: 71f36115d20e8d8b0ef10479ff0cde877ec56f98 Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Thu Jul 26 21:51:47 2007 -0600 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:39:12 2007 -0400 [SCSI] advansys: More PCI cleanups - Remove wrappers around the PCI configuration space accessors - Call pci_set_master() instead of poking at config space directly - Move the latency setting into one function called for both narrow and wide boards. - Tidy up AdvInitGetConfig() a little. - Delete a few unused prototypes and definitions. Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/advansys.c | 254 +++ 1 files changed, 34 insertions(+), 220 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index d51ca86..424549d 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -854,15 +854,6 @@ typedef unsigned char uchar; #define ERR (-1) #define UW_ERR (uint)(0x) #define isodd_word(val) uint)val) & (uint)0x0001) != 0) -#define AscPCIConfigVendorIDRegister 0x -#define AscPCIConfigDeviceIDRegister 0x0002 -#define AscPCIConfigCommandRegister 0x0004 -#define AscPCIConfigStatusRegister0x0006 -#define AscPCIConfigRevisionIDRegister0x0008 -#define AscPCIConfigCacheSize 0x000C -#define AscPCIConfigLatencyTimer 0x000D -#define AscPCIIOBaseRegister 0x0010 -#define AscPCICmdRegBits_IOMemBusMaster 0x0007 #define ASC_PCI_ID2FUNC(id) (((id) >> 8) & 0x7) #define ASC_PCI_MKID(bus, dev, func) dev) & 0x1F) << 11) | (((func) & 0x7) << 8) | ((bus) & 0xFF)) @@ -1936,17 +1927,11 @@ static uchar AscSetChipIRQ(PortAddr, uchar, ushort); static ushort AscGetChipBiosAddress(PortAddr, ushort); static inline ulong DvcEnterCritical(void); static inline void DvcLeaveCritical(ulong); -#ifdef CONFIG_PCI -static uchar DvcReadPCIConfigByte(ASC_DVC_VAR *, ushort); -static void DvcWritePCIConfigByte(ASC_DVC_VAR *, ushort, uchar); -#endif /* CONFIG_PCI */ static ushort AscGetChipBiosAddress(PortAddr, ushort); static void DvcSleepMilliSecond(ASC_DCNT); static void DvcDelayNanoSecond(ASC_DVC_VAR *, ASC_DCNT); static void DvcPutScsiQ(PortAddr, ushort, uchar *, int); static void DvcGetQinfo(PortAddr, ushort, uchar *, int); -static ushort AscInitGetConfig(ASC_DVC_VAR *); -static ushort AscInitSetConfig(ASC_DVC_VAR *); static ushort AscInitAsc1000Driver(ASC_DVC_VAR *); static void AscAsyncFix(ASC_DVC_VAR *, uchar, ASC_SCSI_INQUIRY *); static int AscTagQueuingSafe(ASC_SCSI_INQUIRY *); @@ -3077,8 +3062,6 @@ typedef struct adv_scsi_req_q { static inline ulong DvcEnterCritical(void); static inline void DvcLeaveCritical(ulong); static void DvcSleepMilliSecond(ADV_DCNT); -static uchar DvcAdvReadPCIConfigByte(ADV_DVC_VAR *, ushort); -static void DvcAdvWritePCIConfigByte(ADV_DVC_VAR *, ushort, uchar); static ADV_PADDR DvcGetPhyAddr(ADV_DVC_VAR *, ADV_SCSI_REQ_Q *, uchar *, ASC_SDCNT *, int); static void DvcDelayMicroSecond(ADV_DVC_VAR *, ushort); @@ -3112,12 +3095,6 @@ static void AdvSet38C1600EEPConfig(AdvPortAddr, ADVEEP_38C1600_CONFIG *); static void AdvWaitEEPCmd(AdvPortAddr); static ushort AdvReadEEPWord(AdvPortAddr, int); -/* - * PCI Bus Definitions - */ -#define AscPCICmdRegBits_BusMastering 0x0007 -#define AscPCICmdRegBits_ParErrRespCtrl 0x0040 - /* Read byte from a register. */ #define AdvReadByteRegister(iop_base, reg_off) \ (ADV_MEM_READB((iop_base) + (reg_off))) @@ -7327,31 +7304,6 @@ DvcGetQinfo(PortAddr iop_base, ushort s_addr, uchar *inbuf, int words) } /* - * Read a PCI configuration byte. - */ -static uchar __devinit DvcReadPCIConfigByte(ASC_DVC_VAR *asc_dvc, ushort offset) -{ -#ifdef CONFIG_PCI - uchar byte_data; - pci_read_config_byte(to_pci_dev(asc_dvc->cfg->dev), offset, &byte_data); - return byte_data; -#else /* !defined(CONFIG_PCI) */ - return 0; -#endif /* !defined(CONFIG_PCI) */ -} - -/* - * Write a PCI configuration byte. - */ -static void __devinit -DvcWritePCIConfigByte(ASC_DVC_VAR *asc_dvc, ushort offset, uchar byte_data) -{ -#ifdef CONFIG_PCI - pci_write_config_byte(to_pci_dev(asc_dvc->cfg->dev), offset, byte_data); -#endif /* CONFIG_PCI */ -} - -/* * Return the BIOS address of the adapter at the specified * I/O port and with the specified bus type. */ @@ -7424,33 +7376,6 @@ DvcGetPhyAddr(ADV_DVC_VAR *asc_dvc, ADV_SCSI_REQ_Q *scsiq, } /* - * Read a PCI configuration byte. - */ -static uchar __devinit DvcAdvReadPCIConfigByte(ADV_DVC_VAR *asc_dvc, ushort offset) -{ -#ifdef CONFIG_PCI - uchar byte_da
[SCSI] advansys: remove AscCompareString()
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ce3a7f1202e02324841ef87d7d3f08ff351d07c7 Commit: ce3a7f1202e02324841ef87d7d3f08ff351d07c7 Parent: 9649af39e30d8d2668c35d008e8e14ae138e4d40 Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Thu Jul 26 11:39:17 2007 -0400 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:39:15 2007 -0400 [SCSI] advansys: remove AscCompareString() AscCompareString() is just another name for strncmp Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/advansys.c | 23 +++ 1 files changed, 3 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 424549d..277002a 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -1911,7 +1911,6 @@ static int AscIsrChipHalted(ASC_DVC_VAR *); static uchar _AscCopyLramScsiDoneQ(PortAddr, ushort, ASC_QDONE_INFO *, ASC_DCNT); static int AscIsrQDone(ASC_DVC_VAR *); -static int AscCompareString(uchar *, uchar *, int); #ifdef CONFIG_ISA static ushort AscGetEisaChipCfg(PortAddr); #endif /* CONFIG_ISA */ @@ -10998,8 +10997,7 @@ AscAsyncFix(ASC_DVC_VAR *asc_dvc, uchar tid_no, ASC_SCSI_INQUIRY *inq) if (asc_dvc->bug_fix_cntl & ASC_BUG_FIX_ASYN_USE_SYN) { if (!(asc_dvc->init_sdtr & tid_bits)) { if ((dvc_type == TYPE_ROM) && - (AscCompareString((uchar *)inq->vendor_id, - (uchar *)"HP ", 3) == 0)) { + (strncmp(inq->vendor_id, "HP ", 3) == 0)) { asc_dvc->pci_fix_asyn_xfer_always |= tid_bits; } asc_dvc->pci_fix_asyn_xfer |= tid_bits; @@ -11022,10 +11020,8 @@ AscAsyncFix(ASC_DVC_VAR *asc_dvc, uchar tid_no, ASC_SCSI_INQUIRY *inq) static int AscTagQueuingSafe(ASC_SCSI_INQUIRY *inq) { if ((inq->add_len >= 32) && - (AscCompareString((uchar *)inq->vendor_id, - (uchar *)"QUANTUM XP34301", 15) == 0) && - (AscCompareString((uchar *)inq->product_rev_level, - (uchar *)"1071", 4) == 0)) { + (strncmp(inq->vendor_id, "QUANTUM XP34301", 15) == 0) && + (strncmp(inq->product_rev_level, "1071", 4) == 0)) { return 0; } return 1; @@ -11076,19 +11072,6 @@ AscInquiryHandling(ASC_DVC_VAR *asc_dvc, uchar tid_no, ASC_SCSI_INQUIRY *inq) return; } -static int AscCompareString(uchar *str1, uchar *str2, int len) -{ - int i; - int diff; - - for (i = 0; i < len; i++) { - diff = (int)(str1[i] - str2[i]); - if (diff != 0) - return (diff); - } - return (0); -} - static uchar AscReadLramByte(PortAddr iop_base, ushort addr) { uchar byte_data; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] Add QUANTUM XP34301 to the blacklist
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2ffb45c672eff6a797712c5c8b5a6ddf3692187a Commit: 2ffb45c672eff6a797712c5c8b5a6ddf3692187a Parent: ce3a7f1202e02324841ef87d7d3f08ff351d07c7 Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Thu Jul 26 11:39:46 2007 -0400 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:39:19 2007 -0400 [SCSI] Add QUANTUM XP34301 to the blacklist According to the AdvanSys driver, this device has a problem with tagged queueing. Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/scsi_devinfo.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c index e2ea739..348cc5a 100644 --- a/drivers/scsi/scsi_devinfo.c +++ b/drivers/scsi/scsi_devinfo.c @@ -214,6 +214,7 @@ static struct { {"PIONEER", "CD-ROM DRM-604X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, {"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, {"Promise", "", NULL, BLIST_SPARSELUN}, + {"QUANTUM", "XP34301", "1071", BLIST_NOTQ}, {"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN}, {"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN}, {"SEAGATE", "ST34555N", "0930", BLIST_NOTQ},/* Chokes on tagged INQUIRY */ - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] advansys: remove INQUIRY sniffing
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=47d853ccbe7fc6b79aeddd97cf6f5b08bf81d58b Commit: 47d853ccbe7fc6b79aeddd97cf6f5b08bf81d58b Parent: 2ffb45c672eff6a797712c5c8b5a6ddf3692187a Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Thu Jul 26 11:41:33 2007 -0400 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:39:22 2007 -0400 [SCSI] advansys: remove INQUIRY sniffing Use slave_configure() to do all the work that used to be done in AscInquiryHandling and AdvInquiryHandling. Split slave_configure into two functions, one for wide and one for narrow controllers. Remove some unused definitions, duplicate definitions, unnecessary declarations, and scsireqq, cap_info and inquiry from struct asc_board. Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/advansys.c | 637 --- 1 files changed, 211 insertions(+), 426 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 277002a..5885ce4 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -944,10 +944,6 @@ typedef unsigned char uchar; #define ASC_MAX_CDB_LEN 12 #define ASC_SCSI_RESET_HOLD_TIME_US 60 -#define ADV_INQ_CLOCKING_ST_ONLY0x0 -#define ADV_INQ_CLOCKING_DT_ONLY0x1 -#define ADV_INQ_CLOCKING_ST_AND_DT 0x3 - /* * Inquiry SPC-2 SPI Byte 1 EVPD (Enable Vital Product Data) * and CmdDt (Command Support Data) field bit definitions. @@ -966,57 +962,8 @@ typedef unsigned char uchar; #define ASC_SRB_TID(x) ((uchar)((uchar)(x) & (uchar)0x0F)) #define ASC_SRB_LUN(x) ((uchar)((uint)(x) >> 13)) #define PUT_CDB1(x) ((uchar)((uint)(x) >> 8)) -#define MS_CMD_DONE0x00 -#define MS_EXTEND 0x01 #define MS_SDTR_LEN0x03 -#define MS_SDTR_CODE 0x01 #define MS_WDTR_LEN0x02 -#define MS_WDTR_CODE 0x03 -#define MS_MDP_LEN0x05 -#define MS_MDP_CODE 0x00 - -/* - * Inquiry data structure and bitfield macros - * - * Only quantities of more than 1 bit are shifted, since the others are - * just tested for true or false. C bitfields aren't portable between big - * and little-endian platforms so they are not used. - */ - -#define ASC_INQ_DVC_TYPE(inq) ((inq)->periph & 0x1f) -#define ASC_INQ_QUALIFIER(inq) (((inq)->periph & 0xe0) >> 5) -#define ASC_INQ_DVC_TYPE_MOD(inq) ((inq)->devtype & 0x7f) -#define ASC_INQ_REMOVABLE(inq) ((inq)->devtype & 0x80) -#define ASC_INQ_ANSI_VER(inq) ((inq)->ver & 0x07) -#define ASC_INQ_ECMA_VER(inq) (((inq)->ver & 0x38) >> 3) -#define ASC_INQ_ISO_VER(inq)(((inq)->ver & 0xc0) >> 6) -#define ASC_INQ_RESPONSE_FMT(inq) ((inq)->byte3 & 0x0f) -#define ASC_INQ_TERM_IO(inq)((inq)->byte3 & 0x40) -#define ASC_INQ_ASYNC_NOTIF(inq)((inq)->byte3 & 0x80) -#define ASC_INQ_SOFT_RESET(inq) ((inq)->flags & 0x01) -#define ASC_INQ_CMD_QUEUE(inq) ((inq)->flags & 0x02) -#define ASC_INQ_LINK_CMD(inq) ((inq)->flags & 0x08) -#define ASC_INQ_SYNC(inq) ((inq)->flags & 0x10) -#define ASC_INQ_WIDE16(inq) ((inq)->flags & 0x20) -#define ASC_INQ_WIDE32(inq) ((inq)->flags & 0x40) -#define ASC_INQ_REL_ADDR(inq) ((inq)->flags & 0x80) -#define ASC_INQ_INFO_UNIT(inq) ((inq)->info & 0x01) -#define ASC_INQ_QUICK_ARB(inq) ((inq)->info & 0x02) -#define ASC_INQ_CLOCKING(inq) (((inq)->info & 0x0c) >> 2) - -typedef struct { - uchar periph; - uchar devtype; - uchar ver; - uchar byte3; - uchar add_len; - uchar res1; - uchar res2; - uchar flags; - uchar vendor_id[8]; - uchar product_id[16]; - uchar product_rev_level[4]; -} ASC_SCSI_INQUIRY; #define ASC_SG_LIST_PER_Q 7 #define QS_FREE0x00 @@ -1932,9 +1879,7 @@ static void DvcDelayNanoSecond(ASC_DVC_VAR *, ASC_DCNT); static void DvcPutScsiQ(PortAddr, ushort, uchar *, int); static void DvcGetQinfo(PortAddr, ushort, uchar *, int); static ushort AscInitAsc1000Driver(ASC_DVC_VAR *); -static void AscAsyncFix(ASC_DVC_VAR *, uchar, ASC_SCSI_INQUIRY *); -static int AscTagQueuingSafe(ASC_SCSI_INQUIRY *); -static void AscInquiryHandling(ASC_DVC_VAR *, uchar, ASC_SCSI_INQUIRY *); +static void AscAsyncFix(ASC_DVC_VAR *, struct scsi_device *); static int AscExeScsiQueue(ASC_DVC_VAR *, ASC_SCSI_Q *); static int AscISR(ASC_DVC_VAR *); static uint AscGetNumOfFreeQueue(ASC_DVC_VAR *, uchar, uchar); @@ -3081,7 +3026,6 @@ static int AdvResetSB(ADV_DVC_VAR *asc_dvc); * Internal Adv Library functions. */ static int AdvSendIdleCmd(ADV_DVC_VAR *, ushort, ADV_DCNT); -static void AdvInquiryHandling(ADV_DVC_VAR *, ADV_SCSI_REQ_Q *); static int AdvInitFrom3550EEP(ADV_DVC_VAR *); static int AdvInitFrom38C0800EEP(ADV_DVC_VAR *); static int AdvInitFrom38C1600EEP(ADV_DVC_VAR *); @@ -3296,74 +3240,6 @@ static ADVEEP_38C1600_CONFIG Default_
[SCSI] advansys: misc reformatting
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ecec1947479e52eeb4378cc5706d6d46b0cf5172 Commit: ecec1947479e52eeb4378cc5706d6d46b0cf5172 Parent: 47d853ccbe7fc6b79aeddd97cf6f5b08bf81d58b Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Mon Jul 30 08:08:22 2007 -0600 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:39:26 2007 -0400 [SCSI] advansys: misc reformatting Remove some useless forward declarations Reformat some comments, debug messages, and the occasional piece of real code Removal of unnecessary braces Remove duplicate setting of shost->irq Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/advansys.c | 260 --- 1 files changed, 110 insertions(+), 150 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 5885ce4..dc9dca3 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -1815,9 +1815,6 @@ static void AscEnableInterrupt(PortAddr); static void AscSetBank(PortAddr, uchar); static int AscResetChipAndScsiBus(ASC_DVC_VAR *); #ifdef CONFIG_ISA -static ushort AscGetIsaDmaChannel(PortAddr); -static ushort AscSetIsaDmaChannel(PortAddr, ushort); -static uchar AscSetIsaDmaSpeed(PortAddr, uchar); static uchar AscGetIsaDmaSpeed(PortAddr); #endif /* CONFIG_ISA */ static uchar AscReadLramByte(PortAddr, ushort); @@ -1862,18 +1859,11 @@ static int AscIsrQDone(ASC_DVC_VAR *); static ushort AscGetEisaChipCfg(PortAddr); #endif /* CONFIG_ISA */ static uchar AscGetChipScsiCtrl(PortAddr); -static uchar AscSetChipScsiID(PortAddr, uchar); static uchar AscGetChipVersion(PortAddr, ushort); -static ushort AscGetChipBusType(PortAddr); static ASC_DCNT AscLoadMicroCode(PortAddr, ushort, uchar *, ushort); -static int AscFindSignature(PortAddr); static void AscToggleIRQAct(PortAddr); -static uchar AscGetChipIRQ(PortAddr, ushort); -static uchar AscSetChipIRQ(PortAddr, uchar, ushort); -static ushort AscGetChipBiosAddress(PortAddr, ushort); static inline ulong DvcEnterCritical(void); static inline void DvcLeaveCritical(ulong); -static ushort AscGetChipBiosAddress(PortAddr, ushort); static void DvcSleepMilliSecond(ASC_DCNT); static void DvcDelayNanoSecond(ASC_DVC_VAR *, ASC_DCNT); static void DvcPutScsiQ(PortAddr, ushort, uchar *, int); @@ -1887,7 +1877,6 @@ static int AscSgListToQueue(int); #ifdef CONFIG_ISA static void AscEnableIsaDma(uchar); #endif /* CONFIG_ISA */ -static ASC_DCNT AscGetMaxDmaCount(ushort); static const char *advansys_info(struct Scsi_Host *shost); /* @@ -3710,10 +3699,6 @@ static int asc_prt_adv_board_info(struct Scsi_Host *, char *, int); static int asc_prt_line(char *, int, char *fmt, ...); #endif /* CONFIG_PROC_FS */ -/* Declaration for Asc Library internal functions referenced by driver. */ -static int AscFindSignature(PortAddr); -static ushort AscGetEEPConfig(PortAddr, ASCEEP_CONFIG *, ushort); - /* Statistics function prototypes. */ #ifdef ADVANSYS_STATS #ifdef CONFIG_PROC_FS @@ -3822,8 +3807,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, cp = boardp->prtbuf; cplen = asc_prt_adv_bios(shost, cp, ASC_PRTBUF_SIZE); ASC_ASSERT(cplen < ASC_PRTBUF_SIZE); - cnt = - asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, + cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); totcnt += cnt; leftlen -= cnt; @@ -3910,11 +3894,10 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, for (tgt_id = 0; tgt_id <= ADV_MAX_TID; tgt_id++) { cp = boardp->prtbuf; cplen = asc_prt_target_stats(shost, tgt_id, cp, - ASC_PRTBUF_SIZE); +ASC_PRTBUF_SIZE); ASC_ASSERT(cplen <= ASC_PRTBUF_SIZE); - cnt = - asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, - cplen); + cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, + cplen); totcnt += cnt; leftlen -= cnt; if (leftlen == 0) { @@ -4004,15 +3987,14 @@ static const char *advansys_info(struct Scsi_Host *shost) } } else { busname = "?"; - ASC_PRINT2 - ("advansys_info: board %d: unknown bus type %d\n", -boardp->id, asc_dvc_varp->bus_type); + ASC_PRINT2("advansys_info: board %d: unknown " +
[SCSI] advansys: delete AscGetChipBusType
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=59fcf844095a89fe5e42b4e9bfc4b49dd6909e6b Commit: 59fcf844095a89fe5e42b4e9bfc4b49dd6909e6b Parent: ecec1947479e52eeb4378cc5706d6d46b0cf5172 Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Thu Jul 26 11:54:15 2007 -0400 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:39:30 2007 -0400 [SCSI] advansys: delete AscGetChipBusType By moving a test from AscGetChipBusType into its only caller, we can delete the whole function Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/advansys.c | 36 1 files changed, 4 insertions(+), 32 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index dc9dca3..e661986 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -8001,34 +8001,6 @@ AscGetChipVersion(PortAddr iop_base, unsigned short bus_type) return AscGetChipVerNo(iop_base); } -static ushort __devinit AscGetChipBusType(PortAddr iop_base) -{ - ushort chip_ver; - - chip_ver = AscGetChipVerNo(iop_base); - if ((chip_ver >= ASC_CHIP_MIN_VER_VL) - && (chip_ver <= ASC_CHIP_MAX_VER_VL) - ) { - if (((iop_base & 0x0C30) == 0x0C30) - || ((iop_base & 0x0C50) == 0x0C50) - ) { - return (ASC_IS_EISA); - } - return (ASC_IS_VL); - } - if ((chip_ver >= ASC_CHIP_MIN_VER_ISA) && - (chip_ver <= ASC_CHIP_MAX_VER_ISA)) { - if (chip_ver >= ASC_CHIP_MIN_VER_ISA_PNP) { - return (ASC_IS_ISAPNP); - } - return (ASC_IS_ISA); - } else if ((chip_ver >= ASC_CHIP_MIN_VER_PCI) && - (chip_ver <= ASC_CHIP_MAX_VER_PCI)) { - return (ASC_IS_PCI); - } - return (0); -} - static ASC_DCNT AscLoadMicroCode(PortAddr iop_base, ushort s_addr, uchar *mcode_buf, ushort mcode_size) @@ -10468,12 +10440,12 @@ static ushort __devinit AscInitAscDvcVar(ASC_DVC_VAR *asc_dvc) } asc_dvc->cfg->isa_dma_speed = ASC_DEF_ISA_DMA_SPEED; - if (AscGetChipBusType(iop_base) == ASC_IS_ISAPNP) { - AscSetChipIFC(iop_base, IFC_INIT_DEFAULT); - asc_dvc->bus_type = ASC_IS_ISAPNP; - } #ifdef CONFIG_ISA if ((asc_dvc->bus_type & ASC_IS_ISA) != 0) { + if (chip_version >= ASC_CHIP_MIN_VER_ISA_PNP) { + AscSetChipIFC(iop_base, IFC_INIT_DEFAULT); + asc_dvc->bus_type = ASC_IS_ISAPNP; + } asc_dvc->cfg->isa_dma_channel = (uchar)AscGetIsaDmaChannel(iop_base); } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] advansys: ioremap no longer needs page-aligned addresses
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=57ba5fe988f6e0845c459bbe75ecd6aea536805d Commit: 57ba5fe988f6e0845c459bbe75ecd6aea536805d Parent: 59fcf844095a89fe5e42b4e9bfc4b49dd6909e6b Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Thu Jul 26 11:55:07 2007 -0400 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:39:33 2007 -0400 [SCSI] advansys: ioremap no longer needs page-aligned addresses At some point during Linux 2.1 development, ioremap() gained the ability to handle addresses which weren't page-aligned. Also expand the CONFIG_PCI range to encompass that entire section of wide board initialisation, since all wide boards are PCI. Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/advansys.c | 52 ++ 1 files changed, 12 insertions(+), 40 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index e661986..2f37076 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -17090,8 +17090,6 @@ advansys_board_found(int iop, struct device *dev, int bus_type) ASC_DVC_VAR *asc_dvc_varp = NULL; ADV_DVC_VAR *adv_dvc_varp = NULL; int share_irq; - int iolen = 0; - ADV_PADDR pci_memory_address; int warn_code, err_code; int ret; @@ -17136,13 +17134,13 @@ advansys_board_found(int iop, struct device *dev, int bus_type) asc_dvc_varp->iop_base = iop; asc_dvc_varp->isr_callback = asc_isr_callback; } else { +#ifdef CONFIG_PCI ASC_DBG(1, "advansys_board_found: wide board\n"); adv_dvc_varp = &boardp->dvc_var.adv_dvc_var; adv_dvc_varp->drv_ptr = boardp; adv_dvc_varp->cfg = &boardp->dvc_cfg.adv_dvc_cfg; adv_dvc_varp->isr_callback = adv_isr_callback; adv_dvc_varp->async_callback = adv_async_callback; -#ifdef CONFIG_PCI if (pdev->device == PCI_DEVICE_ID_ASP_ABP940UW) { ASC_DBG(1, "advansys_board_found: ASC-3550\n"); adv_dvc_varp->chip_type = ADV_CHIP_ASC3550; @@ -17153,46 +17151,20 @@ advansys_board_found(int iop, struct device *dev, int bus_type) ASC_DBG(1, "advansys_board_found: ASC-38C1600\n"); adv_dvc_varp->chip_type = ADV_CHIP_ASC38C1600; } -#endif /* CONFIG_PCI */ - /* -* Map the board's registers into virtual memory for -* PCI slave access. Only memory accesses are used to -* access the board's registers. -* -* Note: The PCI register base address is not always -* page aligned, but the address passed to ioremap() -* must be page aligned. It is guaranteed that the -* PCI register base address will not cross a page -* boundary. -*/ - if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { - iolen = ADV_3550_IOLEN; - } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { - iolen = ADV_38C0800_IOLEN; - } else { - iolen = ADV_38C1600_IOLEN; - } -#ifdef CONFIG_PCI - pci_memory_address = pci_resource_start(pdev, 1); - ASC_DBG1(1, -"advansys_board_found: pci_memory_address: 0x%lx\n", -(ulong)pci_memory_address); - if ((boardp->ioremap_addr = -ioremap(pci_memory_address & PAGE_MASK, PAGE_SIZE)) == 0) { + boardp->asc_n_io_port = pci_resource_len(pdev, 1); + boardp->ioremap_addr = ioremap(pci_resource_start(pdev, 1), + boardp->asc_n_io_port); + if (!boardp->ioremap_addr) { ASC_PRINT3 ("advansys_board_found: board %d: ioremap(%x, %d) returned NULL\n", -boardp->id, pci_memory_address, iolen); +boardp->id, pci_resource_start(pdev, 1), +boardp->asc_n_io_port); goto err_shost; } - ASC_DBG1(1, "advansys_board_found: ioremap_addr: 0x%lx\n", -(ulong)boardp->ioremap_addr); - adv_dvc_varp->iop_base = (AdvPortAddr) - (boardp->ioremap_addr + -(pci_memory_address - (pci_memory_address & PAGE_MASK))); + adv_dvc_varp->iop_base = (AdvPortAddr)boardp->ioremap_addr ASC_DBG1(1, "advansys_board_found: iop_base: 0x%lx\n", adv_dvc_varp->iop_base); -#endif /* CONF
[SCSI] advansys: Stop using n_io_port in Scsi_Host structure
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4a2d31c811542d37258b3976975395cb1c0fba1c Commit: 4a2d31c811542d37258b3976975395cb1c0fba1c Parent: 57ba5fe988f6e0845c459bbe75ecd6aea536805d Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Thu Jul 26 11:55:34 2007 -0400 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:39:37 2007 -0400 [SCSI] advansys: Stop using n_io_port in Scsi_Host structure n_io_port isn't suitable for advansys because some of the boards have more than 255 bytes of io port space. There's already a driver-private replacement, asc_n_io_port, but for some reason the driver was still setting and occasionally reporting n_io_port. Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/advansys.c | 38 -- 1 files changed, 8 insertions(+), 30 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 2f37076..e79f795 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -2289,10 +2289,8 @@ typedef struct adveep_38C1600_config { #define BIOS_CTRL_AIPP_DIS 0x2000 #define ADV_3550_MEMSIZE 0x2000 /* 8 KB Internal Memory */ -#define ADV_3550_IOLEN 0x40/* I/O Port Range in bytes */ #define ADV_38C0800_MEMSIZE 0x4000/* 16 KB Internal Memory */ -#define ADV_38C0800_IOLEN0x100 /* I/O Port Range in bytes */ /* * XXX - Since ASC38C1600 Rev.3 has a local RAM failure issue, there is @@ -2302,8 +2300,6 @@ typedef struct adveep_38C1600_config { * #define ADV_38C1600_MEMSIZE 0x8000L * 32 KB Internal Memory * */ #define ADV_38C1600_MEMSIZE 0x4000/* 16 KB Internal Memory */ -#define ADV_38C1600_IOLEN0x100 /* I/O Port Range 256 bytes */ -#define ADV_38C1600_MEMLEN 0x1000/* Memory Range 4KB bytes */ /* * Byte I/O register address from base of 'iop_base'. @@ -3952,7 +3948,6 @@ static const char *advansys_info(struct Scsi_Host *shost) ASC_DVC_VAR *asc_dvc_varp; ADV_DVC_VAR *adv_dvc_varp; char *busname; - int iolen; char *widename = NULL; boardp = ASC_BOARDP(shost); @@ -3966,13 +3961,12 @@ static const char *advansys_info(struct Scsi_Host *shost) } else { busname = "ISA"; } - /* Don't reference 'shost->n_io_port'; It may be truncated. */ sprintf(info, "AdvanSys SCSI %s: %s: IO 0x%lX-0x%lX, IRQ 0x%X, DMA 0x%X", ASC_VERSION, busname, (ulong)shost->io_port, - (ulong)shost->io_port + boardp->asc_n_io_port - - 1, shost->irq, shost->dma_channel); + (ulong)shost->io_port + ASC_IOADR_GAP - 1, + shost->irq, shost->dma_channel); } else { if (asc_dvc_varp->bus_type & ASC_IS_VL) { busname = "VL"; @@ -3991,12 +3985,11 @@ static const char *advansys_info(struct Scsi_Host *shost) "bus type %d\n", boardp->id, asc_dvc_varp->bus_type); } - /* Don't reference 'shost->n_io_port'; It may be truncated. */ sprintf(info, "AdvanSys SCSI %s: %s: IO 0x%lX-0x%lX, IRQ 0x%X", ASC_VERSION, busname, (ulong)shost->io_port, - (ulong)shost->io_port + boardp->asc_n_io_port - - 1, shost->irq); + (ulong)shost->io_port + ASC_IOADR_GAP - 1, + shost->irq); } } else { /* @@ -4008,19 +4001,16 @@ static const char *advansys_info(struct Scsi_Host *shost) */ adv_dvc_varp = &boardp->dvc_var.adv_dvc_var; if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { - iolen = ADV_3550_IOLEN; widename = "Ultra-Wide"; } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { - iolen = ADV_38C0800_IOLEN; widename = "Ultra2-Wide"; } else { - iolen = ADV_38C1600_IOLEN; widename = "Ultra3-Wide"; } sprintf(info, "AdvanSys SCSI %s: PCI %s: PCIMEM 0x%lX-0x%lX, IRQ 0x%X", ASC_VERSION, widename, (ulong)adv_dvc_varp->iop_base, - (ulong)adv_dvc_varp->iop_base + iolen - 1, shost->irq); +
[SCSI] advansys: Remove library-style callback routines
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=895d6b4ca88ecc69b9301675eb220c6a926d8bb1 Commit: 895d6b4ca88ecc69b9301675eb220c6a926d8bb1 Parent: 394dbf3f4005622fa52f1805eb950f08ce20f636 Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Thu Jul 26 11:57:06 2007 -0400 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:39:45 2007 -0400 [SCSI] advansys: Remove library-style callback routines Convert adv_isr_callback, adv_async_callback and asc_isr_callback into direct calls. Remove the unused asc_exe_callback. Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/advansys.c | 50 +++--- 1 files changed, 8 insertions(+), 42 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 73d974a..310b926 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -1404,17 +1404,12 @@ typedef struct asc_dvc_cfg { struct asc_dvc_var;/* Forward Declaration. */ -typedef void (*ASC_ISR_CALLBACK) (struct asc_dvc_var *, ASC_QDONE_INFO *); -typedef int (*ASC_EXE_CALLBACK) (struct asc_dvc_var *, ASC_SCSI_Q *); - typedef struct asc_dvc_var { PortAddr iop_base; ushort err_code; ushort dvc_cntl; ushort bug_fix_cntl; ushort bus_type; - ASC_ISR_CALLBACK isr_callback; - ASC_EXE_CALLBACK exe_callback; ASC_SCSI_BIT_ID_TYPE init_sdtr; ASC_SCSI_BIT_ID_TYPE sdtr_done; ASC_SCSI_BIT_ID_TYPE use_tagged_qng; @@ -2830,12 +2825,6 @@ typedef struct adv_dvc_cfg { struct adv_dvc_var; struct adv_scsi_req_q; -typedef void (*ADV_ISR_CALLBACK) - (struct adv_dvc_var *, struct adv_scsi_req_q *); - -typedef void (*ADV_ASYNC_CALLBACK) - (struct adv_dvc_var *, uchar); - /* * Adapter operation variable structure. * @@ -2852,8 +2841,6 @@ typedef struct adv_dvc_var { AdvPortAddr iop_base; /* I/O port address */ ushort err_code;/* fatal error code */ ushort bios_ctrl; /* BIOS control word, EEPROM word 12 */ - ADV_ISR_CALLBACK isr_callback; - ADV_ASYNC_CALLBACK async_callback; ushort wdtr_able; /* try WDTR for a device */ ushort sdtr_able; /* try SDTR for a device */ ushort ultra_able; /* try SDTR Ultra speed for a device */ @@ -3671,9 +3658,6 @@ static int asc_execute_scsi_cmnd(struct scsi_cmnd *); static int asc_build_req(asc_board_t *, struct scsi_cmnd *); static int adv_build_req(asc_board_t *, struct scsi_cmnd *, ADV_SCSI_REQ_Q **); static int adv_get_sglist(asc_board_t *, adv_req_t *, struct scsi_cmnd *, int); -static void asc_isr_callback(ASC_DVC_VAR *, ASC_QDONE_INFO *); -static void adv_isr_callback(ADV_DVC_VAR *, ADV_SCSI_REQ_Q *); -static void adv_async_callback(ADV_DVC_VAR *, uchar); static void asc_enqueue(asc_queue_t *, REQP, int); static REQP asc_dequeue(asc_queue_t *, int); static REQP asc_dequeue_list(asc_queue_t *, REQP *, int); @@ -7624,9 +7608,8 @@ static void asc_prt_asc_dvc_var(ASC_DVC_VAR *h) printk(" iop_base 0x%x, err_code 0x%x, dvc_cntl 0x%x, bug_fix_cntl " "%d,\n", h->iop_base, h->err_code, h->dvc_cntl, h->bug_fix_cntl); - printk(" bus_type %d, isr_callback 0x%p, exe_callback 0x%p, " - "init_sdtr 0x%x,\n", h->bus_type, h->isr_callback, - h->exe_callback, (unsigned)h->init_sdtr); + printk(" bus_type %d, init_sdtr 0x%x,\n", h->bus_type, + (unsigned)h->init_sdtr); printk(" sdtr_done 0x%x, use_tagged_qng 0x%x, unit_not_ready 0x%x, " "chip_no 0x%x,\n", (unsigned)h->sdtr_done, @@ -8631,10 +8614,8 @@ static int AscIsrQDone(ASC_DVC_VAR *asc_dvc) ASC_QDONE_INFO scsiq_buf; ASC_QDONE_INFO *scsiq; int false_overrun; - ASC_ISR_CALLBACK asc_isr_callback; iop_base = asc_dvc->iop_base; - asc_isr_callback = asc_dvc->isr_callback; n_q_used = 1; scsiq = (ASC_QDONE_INFO *)&scsiq_buf; done_q_tail = (uchar)AscGetVarDoneQTail(iop_base); @@ -8746,7 +8727,7 @@ static int AscIsrQDone(ASC_DVC_VAR *asc_dvc) } } if ((scsiq->cntl & QC_NO_CALLBACK) == 0) { - (*asc_isr_callback) (asc_dvc, scsiq); + asc_isr_callback(asc_dvc, scsiq); } else { if ((AscReadLramByte(iop_base, (ushort)(q_addr + (ushort) @@ -8764,7 +8745,7 @@ static int AscIsrQDone(ASC_DVC_VAR *asc_dvc) AscSetLibErrorCode(asc_dvc, ASCQ_ERR_Q_STATUS); FATAL_ERR_QDONE: if ((scsiq->cntl & QC_NO_CALLBACK) == 0) { - (*asc_isr_callback) (asc_dvc, scsiq); +
[SCSI] advansys: Move struct device out of the cfg structures
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=394dbf3f4005622fa52f1805eb950f08ce20f636 Commit: 394dbf3f4005622fa52f1805eb950f08ce20f636 Parent: 4a2d31c811542d37258b3976975395cb1c0fba1c Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Thu Jul 26 11:56:40 2007 -0400 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:39:41 2007 -0400 [SCSI] advansys: Move struct device out of the cfg structures The cfg structures are supposed to be disposable after initialisation; with the 'dev' used for DMA mapping in there, that's not possible. Move the dev to the board. Also inline AscInitFromAscDvcVar into its only caller, remove some unnecessary prototypes and sort out a few minor formatting issues. Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/advansys.c | 104 ++ 1 files changed, 41 insertions(+), 63 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index e79f795..73d974a 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -1380,7 +1380,6 @@ typedef struct asc_dvc_cfg { uchar sdtr_period_offset[ASC_MAX_TID + 1]; ushort pci_slot_info; uchar adapter_info[6]; - struct device *dev; } ASC_DVC_CFG; #define ASC_DEF_DVC_CNTL 0x @@ -1831,7 +1830,6 @@ static void AscMemDWordCopyPtrToLram(PortAddr, ushort, uchar *, int); static void AscMemWordCopyPtrFromLram(PortAddr, ushort, uchar *, int); static ushort AscInitAscDvcVar(ASC_DVC_VAR *); static ushort AscInitFromEEP(ASC_DVC_VAR *); -static ushort AscInitFromAscDvcVar(ASC_DVC_VAR *); static ushort AscInitMicroCodeVar(ASC_DVC_VAR *); static int AscTestExternalLram(ASC_DVC_VAR *); static uchar AscMsgOutSDTR(ASC_DVC_VAR *, uchar, uchar); @@ -2827,7 +2825,6 @@ typedef struct adv_dvc_cfg { ushort serial1; /* EEPROM serial number word 1 */ ushort serial2; /* EEPROM serial number word 2 */ ushort serial3; /* EEPROM serial number word 3 */ - struct device *dev; /* pointer to the pci dev structure for this board */ } ADV_DVC_CFG; struct adv_dvc_var; @@ -3000,7 +2997,6 @@ static void DvcDelayMicroSecond(ADV_DVC_VAR *, ushort); */ static int AdvExeScsiQueue(ADV_DVC_VAR *, ADV_SCSI_REQ_Q *); static int AdvISR(ADV_DVC_VAR *); -static int AdvInitGetConfig(ADV_DVC_VAR *); static int AdvInitAsc3550Driver(ADV_DVC_VAR *); static int AdvInitAsc38C0800Driver(ADV_DVC_VAR *); static int AdvInitAsc38C1600Driver(ADV_DVC_VAR *); @@ -3597,6 +3593,7 @@ typedef struct adv_req { * field. It is guaranteed to be allocated from DMA-able memory. */ typedef struct asc_board { + struct device *dev; int id; /* Board Id */ uint flags; /* Board flags */ union { @@ -4672,7 +4669,6 @@ static void asc_scsi_done_list(struct scsi_cmnd *scp) ASC_DBG(2, "asc_scsi_done_list: begin\n"); while (scp != NULL) { asc_board_t *boardp; - struct device *dev; ASC_DBG1(3, "asc_scsi_done_list: scp 0x%lx\n", (ulong)scp); tscp = REQPNEXT(scp); @@ -4680,17 +4676,12 @@ static void asc_scsi_done_list(struct scsi_cmnd *scp) boardp = ASC_BOARDP(scp->device->host); - if (ASC_NARROW_BOARD(boardp)) - dev = boardp->dvc_cfg.asc_dvc_cfg.dev; - else - dev = boardp->dvc_cfg.adv_dvc_cfg.dev; - if (scp->use_sg) - dma_unmap_sg(dev, + dma_unmap_sg(boardp->dev, (struct scatterlist *)scp->request_buffer, scp->use_sg, scp->sc_data_direction); else if (scp->request_bufflen) - dma_unmap_single(dev, scp->SCp.dma_handle, + dma_unmap_single(boardp->dev, scp->SCp.dma_handle, scp->request_bufflen, scp->sc_data_direction); @@ -4929,8 +4920,6 @@ static int asc_execute_scsi_cmnd(struct scsi_cmnd *scp) */ static int asc_build_req(asc_board_t *boardp, struct scsi_cmnd *scp) { - struct device *dev = boardp->dvc_cfg.asc_dvc_cfg.dev; - /* * Mutually exclusive access is required to 'asc_scsi_q' and * 'asc_sg_head' until after the request is started. @@ -4994,7 +4983,7 @@ static int asc_build_req(asc_board_t *boardp, struct scsi_cmnd *scp) */ ASC_STATS(scp->device->host, cont_cnt); scp->SCp.dma_handle = scp->request_bufflen ? - dma_map_single(dev, scp->request_buffer, + dma_map_single(boardp->dev, scp->request_buffer,
[SCSI] advansys: Remove pci_slot_info
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=13ac2d9c791469d4af51aa65653ab0fbd0916fcc Commit: 13ac2d9c791469d4af51aa65653ab0fbd0916fcc Parent: 895d6b4ca88ecc69b9301675eb220c6a926d8bb1 Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Mon Jul 30 08:10:23 2007 -0600 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:39:49 2007 -0400 [SCSI] advansys: Remove pci_slot_info The driver kept a copy of the PCI config address; refer to the pci_dev associated with the card instead. Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/advansys.c | 29 + 1 files changed, 9 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 310b926..986c52a 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -854,8 +854,6 @@ typedef unsigned char uchar; #define ERR (-1) #define UW_ERR (uint)(0x) #define isodd_word(val) uint)val) & (uint)0x0001) != 0) -#define ASC_PCI_ID2FUNC(id) (((id) >> 8) & 0x7) -#define ASC_PCI_MKID(bus, dev, func) dev) & 0x1F) << 11) | (((func) & 0x7) << 8) | ((bus) & 0xFF)) #define ASC_DVCLIB_CALL_DONE (1) #define ASC_DVCLIB_CALL_FAILED (0) @@ -1378,7 +1376,6 @@ typedef struct asc_dvc_cfg { uchar max_tag_qng[ASC_MAX_TID + 1]; uchar *overrun_buf; uchar sdtr_period_offset[ASC_MAX_TID + 1]; - ushort pci_slot_info; uchar adapter_info[6]; } ASC_DVC_CFG; @@ -2814,9 +2811,6 @@ typedef struct adv_dvc_cfg { ushort control_flag;/* Microcode Control Flag */ ushort mcode_date; /* Microcode date */ ushort mcode_version; /* Microcode version */ - ushort pci_slot_info; /* high byte device/function number */ - /* bits 7-3 device num., bits 2-0 function num. */ - /* low byte bus num. */ ushort serial1; /* EEPROM serial number word 1 */ ushort serial2; /* EEPROM serial number word 2 */ ushort serial3; /* EEPROM serial number word 3 */ @@ -3632,6 +3626,10 @@ typedef struct asc_board { ushort bios_codelen;/* BIOS Code Segment Length. */ } asc_board_t; +#define adv_dvc_to_board(adv_dvc) container_of(adv_dvc, struct asc_board, \ + dvc_var.adv_dvc_var) +#define adv_dvc_to_pdev(adv_dvc) to_pci_dev(adv_dvc_to_board(adv_dvc)->dev) + /* Number of boards detected in system. */ static int asc_board_count; @@ -7764,8 +7762,7 @@ static void asc_prt_adv_dvc_cfg(ADV_DVC_CFG *h) printk(" mcode_version 0x%x, pci_device_id 0x%x, lib_version %u\n", h->mcode_version, to_pci_dev(h->dev)->device, h->lib_version); - printk(" control_flag 0x%x, pci_slot_info 0x%x\n", - h->control_flag, h->pci_slot_info); + printk(" control_flag 0x%x\n", h->control_flag); } /* @@ -15201,6 +15198,7 @@ static int AdvInitAsc38C1600Driver(ADV_DVC_VAR *asc_dvc) * ready to be 'ored' into SCSI_CFG1. */ if ((asc_dvc->cfg->termination & TERM_SE) == 0) { + struct pci_dev *pdev = adv_dvc_to_pdev(asc_dvc); /* SE automatic termination control is enabled. */ switch (scsi_cfg1 & C_DET_SE) { /* TERM_SE_HI: on, TERM_SE_LO: on */ @@ -15211,7 +15209,7 @@ static int AdvInitAsc38C1600Driver(ADV_DVC_VAR *asc_dvc) break; case 0x0: - if (ASC_PCI_ID2FUNC(asc_dvc->cfg->pci_slot_info) == 0) { + if (PCI_FUNC(pdev->devfn) == 0) { /* Function 0 - TERM_SE_HI: off, TERM_SE_LO: off */ } else { /* Function 1 - TERM_SE_HI: on, TERM_SE_LO: off */ @@ -15817,15 +15815,14 @@ static int __devinit AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc) */ if (AdvGet38C1600EEPConfig(iop_base, &eep_config) != eep_config.check_sum) { + struct pci_dev *pdev = adv_dvc_to_pdev(asc_dvc); warn_code |= ASC_WARN_EEPROM_CHKSUM; /* * Set EEPROM default values. */ for (i = 0; i < sizeof(ADVEEP_38C1600_CONFIG); i++) { - if (i == 1 - && ASC_PCI_ID2FUNC(asc_dvc->cfg->pci_slot_info) != - 0) { + if (i == 1 && PCI_FUNC(pdev->devfn) != 0) { /* * Set Function 1 EEPROM Word 0 MSB * @@ -17146,10 +17143,6 @@ advansys_board_found(int iop, struct device *dev, int bus_type) #ifdef CONFIG_PCI case ASC_IS_PCI: shost->irq = asc_dvc_varp->irq_no =
[SCSI] advansys: use memcpy instead of open-coded loop
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d68f4321357165346fb15ef41dbbf9dce7894f29 Commit: d68f4321357165346fb15ef41dbbf9dce7894f29 Parent: 13ac2d9c791469d4af51aa65653ab0fbd0916fcc Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Thu Jul 26 11:58:12 2007 -0400 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:39:52 2007 -0400 [SCSI] advansys: use memcpy instead of open-coded loop Use memcpy to initialise eep_config instead of a loop. For AdvInitFrom38C1600EEP where we need to modify the default EEPROM configuration, do it after the loop, and do it using the structure definition, not by finding the right byte. I think it was wrong for big-endian machines. Also delete some non-useful comments and prototypes. Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/advansys.c | 119 --- 1 files changed, 40 insertions(+), 79 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 986c52a..19c2d19 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -3168,13 +3168,6 @@ do { \ #define QHSTA_M_SGBACKUP_ERROR 0x47 /* Scatter-Gather backup error */ /* - * Default EEPROM Configuration structure defined in a_init.c. - */ -static ADVEEP_3550_CONFIG Default_3550_EEPROM_Config; -static ADVEEP_38C0800_CONFIG Default_38C0800_EEPROM_Config; -static ADVEEP_38C1600_CONFIG Default_38C1600_EEPROM_Config; - -/* * DvcGetPhyAddr() flag arguments */ #define ADV_IS_SCSIQ_FLAG 0x01 /* 'addr' is ASC_SCSI_REQ_Q pointer */ @@ -13183,7 +13176,6 @@ static unsigned char _adv_asc38C1600_buf[] = { static unsigned short _adv_asc38C1600_size = sizeof(_adv_asc38C1600_buf); /* 0x1673 */ static ADV_DCNT _adv_asc38C1600_chksum = 0x0604EF77UL; /* Expanded little-endian checksum. */ -/* a_init.c */ /* * EEPROM Configuration. * @@ -15443,7 +15435,6 @@ static int __devinit AdvInitFrom3550EEP(ADV_DVC_VAR *asc_dvc) AdvPortAddr iop_base; ushort warn_code; ADVEEP_3550_CONFIG eep_config; - int i; iop_base = asc_dvc->iop_base; @@ -15460,15 +15451,12 @@ static int __devinit AdvInitFrom3550EEP(ADV_DVC_VAR *asc_dvc) /* * Set EEPROM default values. */ - for (i = 0; i < sizeof(ADVEEP_3550_CONFIG); i++) { - *((uchar *)&eep_config + i) = - *((uchar *)&Default_3550_EEPROM_Config + i); - } + memcpy(&eep_config, &Default_3550_EEPROM_Config, + sizeof(ADVEEP_3550_CONFIG)); /* -* Assume the 6 byte board serial number that was read -* from EEPROM is correct even if the EEPROM checksum -* failed. +* Assume the 6 byte board serial number that was read from +* EEPROM is correct even if the EEPROM checksum failed. */ eep_config.serial_number_word3 = AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 1); @@ -15597,7 +15585,6 @@ static int __devinit AdvInitFrom38C0800EEP(ADV_DVC_VAR *asc_dvc) AdvPortAddr iop_base; ushort warn_code; ADVEEP_38C0800_CONFIG eep_config; - int i; uchar tid, termination; ushort sdtr_speed = 0; @@ -15617,15 +15604,12 @@ static int __devinit AdvInitFrom38C0800EEP(ADV_DVC_VAR *asc_dvc) /* * Set EEPROM default values. */ - for (i = 0; i < sizeof(ADVEEP_38C0800_CONFIG); i++) { - *((uchar *)&eep_config + i) = - *((uchar *)&Default_38C0800_EEPROM_Config + i); - } + memcpy(&eep_config, &Default_38C0800_EEPROM_Config, + sizeof(ADVEEP_38C0800_CONFIG)); /* -* Assume the 6 byte board serial number that was read -* from EEPROM is correct even if the EEPROM checksum -* failed. +* Assume the 6 byte board serial number that was read from +* EEPROM is correct even if the EEPROM checksum failed. */ eep_config.serial_number_word3 = AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 1); @@ -15800,7 +15784,6 @@ static int __devinit AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc) AdvPortAddr iop_base; ushort warn_code; ADVEEP_38C1600_CONFIG eep_config; - int i; uchar tid, termination; ushort sdtr_speed = 0; @@ -15821,68 +15804,46 @@ static int __devinit AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc) /* * Set EEPROM default values. */ -
[SCSI] advansys: Move documentation to Documentation/scsi
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4bd6d7f35661a32ed50b72f02b684f894feeaa48 Commit: 4bd6d7f35661a32ed50b72f02b684f894feeaa48 Parent: d68f4321357165346fb15ef41dbbf9dce7894f29 Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Mon Jul 30 08:41:03 2007 -0600 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:39:56 2007 -0400 [SCSI] advansys: Move documentation to Documentation/scsi The 700+-line comment at the top of the advansys driver fits more comfortably in Documentation/scsi. Delete the sections on: - kernels supported - other files modified (obsolete) - source comments (obsolete) - tests to run - release history (that's what a VCS is for) - contacting connectcom (the domain has expired and the phone number is now in use by another organisation) Known problems/fix list is moved down to the section where jejb put his FIXME. Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- Documentation/scsi/advansys.txt | 243 + drivers/scsi/advansys.c | 766 +-- 2 files changed, 262 insertions(+), 747 deletions(-) diff --git a/Documentation/scsi/advansys.txt b/Documentation/scsi/advansys.txt new file mode 100644 index 000..4a3db62 --- /dev/null +++ b/Documentation/scsi/advansys.txt @@ -0,0 +1,243 @@ +AdvanSys (Advanced System Products, Inc.) manufactures the following +RISC-based, Bus-Mastering, Fast (10 Mhz) and Ultra (20 Mhz) Narrow +(8-bit transfer) SCSI Host Adapters for the ISA, EISA, VL, and PCI +buses and RISC-based, Bus-Mastering, Ultra (20 Mhz) Wide (16-bit +transfer) SCSI Host Adapters for the PCI bus. + +The CDB counts below indicate the number of SCSI CDB (Command +Descriptor Block) requests that can be stored in the RISC chip +cache and board LRAM. A CDB is a single SCSI command. The driver +detect routine will display the number of CDBs available for each +adapter detected. The number of CDBs used by the driver can be +lowered in the BIOS by changing the 'Host Queue Size' adapter setting. + +Laptop Products: + ABP-480 - Bus-Master CardBus (16 CDB) + +Connectivity Products: + ABP510/5150 - Bus-Master ISA (240 CDB) + ABP5140 - Bus-Master ISA PnP (16 CDB) + ABP5142 - Bus-Master ISA PnP with floppy (16 CDB) + ABP902/3902 - Bus-Master PCI (16 CDB) + ABP3905 - Bus-Master PCI (16 CDB) + ABP915 - Bus-Master PCI (16 CDB) + ABP920 - Bus-Master PCI (16 CDB) + ABP3922 - Bus-Master PCI (16 CDB) + ABP3925 - Bus-Master PCI (16 CDB) + ABP930 - Bus-Master PCI (16 CDB) + ABP930U - Bus-Master PCI Ultra (16 CDB) + ABP930UA - Bus-Master PCI Ultra (16 CDB) + ABP960 - Bus-Master PCI MAC/PC (16 CDB) + ABP960U - Bus-Master PCI MAC/PC Ultra (16 CDB) + +Single Channel Products: + ABP542 - Bus-Master ISA with floppy (240 CDB) + ABP742 - Bus-Master EISA (240 CDB) + ABP842 - Bus-Master VL (240 CDB) + ABP940 - Bus-Master PCI (240 CDB) + ABP940U - Bus-Master PCI Ultra (240 CDB) + ABP940UA/3940UA - Bus-Master PCI Ultra (240 CDB) + ABP970 - Bus-Master PCI MAC/PC (240 CDB) + ABP970U - Bus-Master PCI MAC/PC Ultra (240 CDB) + ABP3960UA - Bus-Master PCI MAC/PC Ultra (240 CDB) + ABP940UW/3940UW - Bus-Master PCI Ultra-Wide (253 CDB) + ABP970UW - Bus-Master PCI MAC/PC Ultra-Wide (253 CDB) + ABP3940U2W - Bus-Master PCI LVD/Ultra2-Wide (253 CDB) + +Multi-Channel Products: + ABP752 - Dual Channel Bus-Master EISA (240 CDB Per Channel) + ABP852 - Dual Channel Bus-Master VL (240 CDB Per Channel) + ABP950 - Dual Channel Bus-Master PCI (240 CDB Per Channel) + ABP950UW - Dual Channel Bus-Master PCI Ultra-Wide (253 CDB Per Channel) + ABP980 - Four Channel Bus-Master PCI (240 CDB Per Channel) + ABP980U - Four Channel Bus-Master PCI Ultra (240 CDB Per Channel) + ABP980UA/3980UA - Four Channel Bus-Master PCI Ultra (16 CDB Per Chan.) + ABP3950U2W - Bus-Master PCI LVD/Ultra2-Wide and Ultra-Wide (253 CDB) + ABP3950U3W - Bus-Master PCI Dual LVD2/Ultra3-Wide (253 CDB) + +Driver Compile Time Options and Debugging + +The following constants can be defined in the source file. + +1. ADVANSYS_ASSERT - Enable driver assertions (Def: Enabled) + + Enabling this option adds assertion logic statements to the + driver. If an assertion fails a message will be displayed to + the console, but the system will continue to operate. Any + assertions encountered should be reported to the person + responsible for the driver. Assertion statements may proactively + detect problems with the driver and facilitate fixing these + problems. Enabling assertions will add a small overhead to the + execution of the driver. + +2. ADVANSYS_DEBUG - Enable driver debugging (Def: Disabled) + + Enabling this option adds tracing functions to the driver and the + ability to set a driver tracing level at boot time.
[SCSI] fc4: convert to use the data buffer accessors
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a43e6bd1be17573b4f9489190d440677bcb300f6 Commit: a43e6bd1be17573b4f9489190d440677bcb300f6 Parent: 4bd6d7f35661a32ed50b72f02b684f894feeaa48 Author: FUJITA Tomonori <[EMAIL PROTECTED]> AuthorDate: Tue Aug 7 17:38:20 2007 +0900 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:40:00 2007 -0400 [SCSI] fc4: convert to use the data buffer accessors - remove the unnecessary map_single path. - convert to use the new accessors for the sg lists and the parameters. Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/fc4/fc.c | 41 +++-- 1 files changed, 15 insertions(+), 26 deletions(-) diff --git a/drivers/fc4/fc.c b/drivers/fc4/fc.c index 22b62b3..82de9e1 100644 --- a/drivers/fc4/fc.c +++ b/drivers/fc4/fc.c @@ -427,15 +427,10 @@ static inline void fcp_scsi_receive(fc_channel *fc, int token, int status, fc_hd memcpy(SCpnt->sense_buffer, ((char *)(rsp+1)), sense_len); } - if (fcmd->data) { - if (SCpnt->use_sg) - dma_unmap_sg(fc->dev, (struct scatterlist *)SCpnt->request_buffer, - SCpnt->use_sg, - SCpnt->sc_data_direction); - else - dma_unmap_single(fc->dev, fcmd->data, SCpnt->request_bufflen, -SCpnt->sc_data_direction); - } + if (fcmd->data) + dma_unmap_sg(fc->dev, scsi_sglist(SCpnt), +scsi_sg_count(SCpnt), +SCpnt->sc_data_direction); break; default: host_status=DID_ERROR; /* FIXME */ @@ -793,10 +788,14 @@ static int fcp_scsi_queue_it(fc_channel *fc, struct scsi_cmnd *SCpnt, fcp_cntl = FCP_CNTL_QTYPE_SIMPLE; } else fcp_cntl = FCP_CNTL_QTYPE_UNTAGGED; - if (!SCpnt->request_bufflen && !SCpnt->use_sg) { + + if (!scsi_bufflen(SCpnt)) { cmd->fcp_cntl = fcp_cntl; fcmd->data = (dma_addr_t)NULL; } else { + struct scatterlist *sg; + int nents; + switch (SCpnt->cmnd[0]) { case WRITE_6: case WRITE_10: @@ -805,22 +804,12 @@ static int fcp_scsi_queue_it(fc_channel *fc, struct scsi_cmnd *SCpnt, default: cmd->fcp_cntl = (FCP_CNTL_READ | fcp_cntl); break; } - if (!SCpnt->use_sg) { - cmd->fcp_data_len = SCpnt->request_bufflen; - fcmd->data = dma_map_single (fc->dev, (char *)SCpnt->request_buffer, - SCpnt->request_bufflen, - SCpnt->sc_data_direction); - } else { - struct scatterlist *sg = (struct scatterlist *)SCpnt->request_buffer; - int nents; - - FCD(("XXX: Use_sg %d %d\n", SCpnt->use_sg, sg->length)) - nents = dma_map_sg (fc->dev, sg, SCpnt->use_sg, - SCpnt->sc_data_direction); - if (nents > 1) printk ("%s: SG for nents %d (use_sg %d) not handled yet\n", fc->name, nents, SCpnt->use_sg); - fcmd->data = sg_dma_address(sg); - cmd->fcp_data_len = sg_dma_len(sg); - } + + sg = scsi_sglist(SCpnt); + nents = dma_map_sg(fc->dev, sg, scsi_sg_count(SCpnt), + SCpnt->sc_data_direction); + fcmd->data = sg_dma_address(sg); + cmd->fcp_data_len = sg_dma_len(sg); } memcpy (cmd->fcp_cdb, SCpnt->cmnd, SCpnt->cmd_len); memset (cmd->fcp_cdb+SCpnt->cmd_len, 0, sizeof(cmd->fcp_cdb)-SCpnt->cmd_len); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] lpfc: fix potential overflow of hbqs array
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a0a74e45057cc3138c29173e7b0b3db8b30939ae Commit: a0a74e45057cc3138c29173e7b0b3db8b30939ae Parent: a43e6bd1be17573b4f9489190d440677bcb300f6 Author: Jesper Juhl <[EMAIL PROTECTED]> AuthorDate: Thu Aug 9 20:47:15 2007 +0200 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:40:03 2007 -0400 [SCSI] lpfc: fix potential overflow of hbqs array The Coverity checker noticed that we may overrun a statically allocated array in drivers/scsi/lpfc/lpfc_sli.c::lpfc_sli_hbqbuf_find(). The case is this; In 'struct lpfc_hba' we have #define LPFC_MAX_HBQS 4 ... struct lpfc_hba { ... struct hbq_s hbqs[LPFC_MAX_HBQS]; ... }; But then in lpfc_sli_hbqbuf_find() we have this code hbqno = tag >> 16; if (hbqno > LPFC_MAX_HBQS) return NULL; if 'hbqno' ends up as exactely 4, then we won't return, and then this list_for_each_entry(d_buf, &phba->hbqs[hbqno].hbq_buffer_list, list) { will cause an overflow of the statically allocated array at index 4, since the valid indices are only 0-3. I propose this patch, that simply changes the 'hbqno > LPFC_MAX_HBQS' into 'hbqno >= LPFC_MAX_HBQS' as a possible fix. Signed-off-by: Jesper Juhl <[EMAIL PROTECTED]> Acked-by: James Smart <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/lpfc/lpfc_sli.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index ce5ff2b..e5337ad 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -675,7 +675,7 @@ lpfc_sli_hbqbuf_find(struct lpfc_hba *phba, uint32_t tag) uint32_t hbqno; hbqno = tag >> 16; - if (hbqno > LPFC_MAX_HBQS) + if (hbqno >= LPFC_MAX_HBQS) return NULL; list_for_each_entry(d_buf, &phba->hbqs[hbqno].hbq_buffer_list, list) { - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] aacraid: rename check_reset
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=87f3bda35e306a449ea75c2bdb79a3c4d84cfa95 Commit: 87f3bda35e306a449ea75c2bdb79a3c4d84cfa95 Parent: a0a74e45057cc3138c29173e7b0b3db8b30939ae Author: Andrew Morton <[EMAIL PROTECTED]> AuthorDate: Fri Aug 10 14:50:30 2007 -0700 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:40:07 2007 -0400 [SCSI] aacraid: rename check_reset Too generic, clashes with ISDN. Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Acked-by: Mark Salyzyn <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/aacraid/aachba.c |8 drivers/scsi/aacraid/aacraid.h |2 +- drivers/scsi/aacraid/commsup.c |5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 6800e57..80e448d 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -177,9 +177,9 @@ int check_interval = 24 * 60 * 60; module_param(check_interval, int, S_IRUGO|S_IWUSR); MODULE_PARM_DESC(check_interval, "Interval in seconds between adapter health checks."); -int check_reset = 1; -module_param(check_reset, int, S_IRUGO|S_IWUSR); -MODULE_PARM_DESC(check_reset, "If adapter fails health check, reset the adapter."); +int aac_check_reset = 1; +module_param_named(check_reset, aac_check_reset, int, S_IRUGO|S_IWUSR); +MODULE_PARM_DESC(aac_check_reset, "If adapter fails health check, reset the adapter."); int expose_physicals = -1; module_param(expose_physicals, int, S_IRUGO|S_IWUSR); @@ -1305,7 +1305,7 @@ int aac_get_adapter_info(struct aac_dev* dev) (int)sizeof(dev->supplement_adapter_info.VpdInfo.Tsid), dev->supplement_adapter_info.VpdInfo.Tsid); } - if (!check_reset || + if (!aac_check_reset || (dev->supplement_adapter_info.SupportedOptions2 & le32_to_cpu(AAC_OPTION_IGNORE_RESET))) { printk(KERN_INFO "%s%d: Reset Adapter Ignored\n", diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 94727b9..03b5102 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -1871,4 +1871,4 @@ extern int aac_reset_devices; extern int aac_commit; extern int update_interval; extern int check_interval; -extern int check_reset; +extern int aac_check_reset; diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index bb87090..240a0bb 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c @@ -1372,8 +1372,9 @@ int aac_check_health(struct aac_dev * aac) printk(KERN_ERR "%s: Host adapter BLINK LED 0x%x\n", aac->name, BlinkLED); - if (!check_reset || (aac->supplement_adapter_info.SupportedOptions2 & - le32_to_cpu(AAC_OPTION_IGNORE_RESET))) + if (!aac_check_reset || + (aac->supplement_adapter_info.SupportedOptions2 & + le32_to_cpu(AAC_OPTION_IGNORE_RESET))) goto out; host = aac->scsi_host_ptr; if (aac->thread->pid != current->pid) - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] ips: warning fix
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=305aad0bf5b3f890bf6f59f8045bd553fd1051df Commit: 305aad0bf5b3f890bf6f59f8045bd553fd1051df Parent: ffcde188a82497385139c62c6b6362aa4f29406f Author: Andrew Morton <[EMAIL PROTECTED]> AuthorDate: Fri Aug 10 14:50:52 2007 -0700 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:40:14 2007 -0400 [SCSI] ips: warning fix drivers/scsi/ips.c: In function 'ips_insert_device': drivers/scsi/ips.c:6957: warning: 'index' may be used uninitialized in this function Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/ips.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index 492a51b..b17771b 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c @@ -6946,7 +6946,7 @@ module_exit(ips_module_exit); static int __devinit ips_insert_device(struct pci_dev *pci_dev, const struct pci_device_id *ent) { - int index; + int uninitialized_var(index); int rc; METHOD_TRACE("ips_insert_device", 1); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] scsi_error.c should #include "scsi_transport_api.h"
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=79ee8304429b497263734e59747df12117de2ea2 Commit: 79ee8304429b497263734e59747df12117de2ea2 Parent: 305aad0bf5b3f890bf6f59f8045bd553fd1051df Author: Adrian Bunk <[EMAIL PROTECTED]> AuthorDate: Fri Aug 10 14:50:42 2007 -0700 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:40:18 2007 -0400 [SCSI] scsi_error.c should #include "scsi_transport_api.h" Every file should #include the headers containing the prototypes for its global functions (in this case for scsi_schedule_eh()). Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/scsi_error.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 8a525ab..c8e351f 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -37,6 +37,7 @@ #include "scsi_priv.h" #include "scsi_logging.h" +#include "scsi_transport_api.h" #define SENSE_TIMEOUT (10*HZ) - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] NCR5380: fix NCR53C400_PSEUDO_DMA is not defined
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8d9e0f46b4a37077e112bdec3c6228e31547e3c9 Commit: 8d9e0f46b4a37077e112bdec3c6228e31547e3c9 Parent: 79ee8304429b497263734e59747df12117de2ea2 Author: Gabriel C <[EMAIL PROTECTED]> AuthorDate: Fri Aug 10 14:50:39 2007 -0700 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:40:22 2007 -0400 [SCSI] NCR5380: fix NCR53C400_PSEUDO_DMA is not defined In file included from drivers/scsi/g_NCR5380_mmio.c:9: drivers/scsi/g_NCR5380.c:559:5: warning: "NCR53C400_PSEUDO_DMA" is not defined Signed-off-by: Gabriel Craciunescu <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/g_NCR5380.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c index 880f70d..607336f 100644 --- a/drivers/scsi/g_NCR5380.c +++ b/drivers/scsi/g_NCR5380.c @@ -556,7 +556,7 @@ generic_NCR5380_biosparam(struct scsi_device *sdev, struct block_device *bdev, } #endif -#if NCR53C400_PSEUDO_DMA +#ifdef NCR53C400_PSEUDO_DMA /** * NCR5380_pread - pseudo DMA read - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] NCR_D700, lpfc: Clean up duplicate includes
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ffcde188a82497385139c62c6b6362aa4f29406f Commit: ffcde188a82497385139c62c6b6362aa4f29406f Parent: 87f3bda35e306a449ea75c2bdb79a3c4d84cfa95 Author: Jesper Juhl <[EMAIL PROTECTED]> AuthorDate: Fri Aug 10 14:50:38 2007 -0700 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:40:11 2007 -0400 [SCSI] NCR_D700, lpfc: Clean up duplicate includes Signed-off-by: Jesper Juhl <[EMAIL PROTECTED]> Acked-by: James Smart <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/NCR_D700.c |1 - drivers/scsi/lpfc/lpfc_debugfs.c |1 - drivers/scsi/lpfc/lpfc_init.c|1 - 3 files changed, 0 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/NCR_D700.c b/drivers/scsi/NCR_D700.c index 3a80897..e0f1991 100644 --- a/drivers/scsi/NCR_D700.c +++ b/drivers/scsi/NCR_D700.c @@ -97,7 +97,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index 2e3c01b..dcf808b 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -43,7 +43,6 @@ #include "lpfc_crtn.h" #include "lpfc_vport.h" #include "lpfc_version.h" -#include "lpfc_vport.h" #include "lpfc_debugfs.h" #ifdef CONFIG_LPFC_DEBUG_FS diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 414350a..42e2061 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -43,7 +43,6 @@ #include "lpfc_crtn.h" #include "lpfc_vport.h" #include "lpfc_version.h" -#include "lpfc_vport.h" static int lpfc_parse_vpd(struct lpfc_hba *, uint8_t *, int); static void lpfc_get_hba_model_desc(struct lpfc_hba *, uint8_t *, uint8_t *); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] dtc: clean up indent damage and add printk levels
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1fbe85292f50ce6186619b83ed04d1bb91dda569 Commit: 1fbe85292f50ce6186619b83ed04d1bb91dda569 Parent: 8f8bf7e64ef76e1de66eb5212cd50f6a294d459f Author: Alan Cox <[EMAIL PROTECTED]> AuthorDate: Fri Aug 10 14:50:41 2007 -0700 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:40:29 2007 -0400 [SCSI] dtc: clean up indent damage and add printk levels Signed-off-by: Alan Cox <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/dtc.c | 16 +++- 1 files changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/dtc.c b/drivers/scsi/dtc.c index 9d52e45..da7409e 100644 --- a/drivers/scsi/dtc.c +++ b/drivers/scsi/dtc.c @@ -137,11 +137,9 @@ static struct override { #ifdef OVERRIDE [] __initdata = OVERRIDE; #else -[4] __initdata = { { -0, IRQ_AUTO}, { -0, IRQ_AUTO}, { -0, IRQ_AUTO}, { -0, IRQ_AUTO}}; +[4] __initdata = { + { 0, IRQ_AUTO }, { 0, IRQ_AUTO }, { 0, IRQ_AUTO }, { 0, IRQ_AUTO } +}; #endif #define NO_OVERRIDES ARRAY_SIZE(overrides) @@ -176,7 +174,7 @@ static const struct signature { * Inputs : str - unused, ints - array of integer parameters with ints[0] * equal to the number of ints. * -*/ + */ static void __init dtc_setup(char *str, int *ints) { @@ -233,7 +231,7 @@ static int __init dtc_detect(struct scsi_host_template * tpnt) } else for (; !addr && (current_base < NO_BASES); ++current_base) { #if (DTCDEBUG & DTCDEBUG_INIT) - printk("scsi-dtc : probing address %08x\n", bases[current_base].address); + printk(KERN_DEBUG "scsi-dtc : probing address %08x\n", bases[current_base].address); #endif if (bases[current_base].noauto) continue; @@ -244,7 +242,7 @@ static int __init dtc_detect(struct scsi_host_template * tpnt) if (check_signature(base + signatures[sig].offset, signatures[sig].string, strlen(signatures[sig].string))) { addr = bases[current_base].address; #if (DTCDEBUG & DTCDEBUG_INIT) - printk("scsi-dtc : detected board.\n"); + printk(KERB_DEBUG "scsi-dtc : detected board.\n"); #endif goto found; } @@ -253,7 +251,7 @@ static int __init dtc_detect(struct scsi_host_template * tpnt) } #if defined(DTCDEBUG) && (DTCDEBUG & DTCDEBUG_INIT) - printk("scsi-dtc : base = %08x\n", addr); + printk(KERN_DEBUG "scsi-dtc : base = %08x\n", addr); #endif if (!addr) - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] Addition to pci_ids.h for ATTO Technology, Inc.
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6778a35bd02939767a17463d74da113541c9371f Commit: 6778a35bd02939767a17463d74da113541c9371f Parent: 1fbe85292f50ce6186619b83ed04d1bb91dda569 Author: Eric Moore <[EMAIL PROTECTED]> AuthorDate: Tue Aug 14 16:18:02 2007 -0600 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:40:32 2007 -0400 [SCSI] Addition to pci_ids.h for ATTO Technology, Inc. A new PCI_VENDOR_ID for pci_ids.h. signed-off-by: Eric Moore <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- include/linux/pci_ids.h |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 07fc574..715a23e 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -1460,6 +1460,8 @@ #define PCI_DEVICE_ID_TOSHIBA_TC86C001_MISC0x0108 #define PCI_DEVICE_ID_TOSHIBA_SPIDER_NET 0x01b3 +#define PCI_VENDOR_ID_ATTO 0x117c + #define PCI_VENDOR_ID_RICOH0x1180 #define PCI_DEVICE_ID_RICOH_RL5C4650x0465 #define PCI_DEVICE_ID_RICOH_RL5C4660x0466 - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] make scsi_decode_sense_buffer and scsi_decode_sense_extras static
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8f8bf7e64ef76e1de66eb5212cd50f6a294d459f Commit: 8f8bf7e64ef76e1de66eb5212cd50f6a294d459f Parent: 8d9e0f46b4a37077e112bdec3c6228e31547e3c9 Author: Adrian Bunk <[EMAIL PROTECTED]> AuthorDate: Fri Aug 10 14:50:43 2007 -0700 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:40:25 2007 -0400 [SCSI] make scsi_decode_sense_buffer and scsi_decode_sense_extras static Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/constants.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index 2a458d6..7bdeed1 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c @@ -1235,7 +1235,7 @@ scsi_print_sense_hdr(const char *name, struct scsi_sense_hdr *sshdr) } EXPORT_SYMBOL(scsi_print_sense_hdr); -void +static void scsi_decode_sense_buffer(const unsigned char *sense_buffer, int sense_len, struct scsi_sense_hdr *sshdr) { @@ -1258,7 +1258,7 @@ scsi_decode_sense_buffer(const unsigned char *sense_buffer, int sense_len, } } -void +static void scsi_decode_sense_extras(const unsigned char *sense_buffer, int sense_len, struct scsi_sense_hdr *sshdr) { - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] mpt fusion: Add support for ATTO 4LD: Rebranded LSI 53C1030
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=232f08fc82b15fdcaffc68c558115bfb2b34db86 Commit: 232f08fc82b15fdcaffc68c558115bfb2b34db86 Parent: 6778a35bd02939767a17463d74da113541c9371f Author: Eric Moore <[EMAIL PROTECTED]> AuthorDate: Tue Aug 14 17:28:27 2007 -0600 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:40:36 2007 -0400 [SCSI] mpt fusion: Add support for ATTO 4LD: Rebranded LSI 53C1030 Per request from Matthew Wilcox - using PCI_VENDOR_ATTO. Add support for ATTO UL4D, they are rebranded 53C1030. The changes are 1. Adding a new PCI vendor ID in pci table 2. The spi_port_page_2 is in different format than that of LSI generic spi_port_page_2 and hence mapping code is added. signed-off-by: Sathya Prakash <[EMAIL PROTECTED]> signed-off-by: Eric Moore <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/message/fusion/Kconfig |1 + drivers/message/fusion/mptbase.c | 32 drivers/message/fusion/mptbase.h | 29 + drivers/message/fusion/mptspi.c |2 ++ 4 files changed, 64 insertions(+), 0 deletions(-) diff --git a/drivers/message/fusion/Kconfig b/drivers/message/fusion/Kconfig index f55cc03..3c44a2f 100644 --- a/drivers/message/fusion/Kconfig +++ b/drivers/message/fusion/Kconfig @@ -20,6 +20,7 @@ config FUSION_SPI LSI53C1020A LSI53C1030 LSI53C1035 + ATTO UL4D config FUSION_FC tristate "Fusion MPT ScsiHost drivers for FC" diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 414c109..828f0ca 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c @@ -4888,6 +4888,38 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum) /* Nvram data is left with INVALID mark */ rc = 1; + } else if (ioc->pcidev->vendor == PCI_VENDOR_ID_ATTO) { + + /* This is an ATTO adapter, read Page2 accordingly + */ + ATTO_SCSIPortPage2_t *pPP2 = (ATTO_SCSIPortPage2_t *) pbuf; + ATTODeviceInfo_t *pdevice = NULL; + u16 ATTOFlags; + + /* Save the Port Page 2 data +* (reformat into a 32bit quantity) +*/ + for (ii=0; ii < MPT_MAX_SCSI_DEVICES; ii++) { + pdevice = &pPP2->DeviceSettings[ii]; + ATTOFlags = le16_to_cpu(pdevice->ATTOFlags); + data = 0; + + /* Translate ATTO device flags to LSI format + */ + if (ATTOFlags & ATTOFLAG_DISC) + data |= (MPI_SCSIPORTPAGE2_DEVICE_DISCONNECT_ENABLE); + if (ATTOFlags & ATTOFLAG_ID_ENB) + data |= (MPI_SCSIPORTPAGE2_DEVICE_ID_SCAN_ENABLE); + if (ATTOFlags & ATTOFLAG_LUN_ENB) + data |= (MPI_SCSIPORTPAGE2_DEVICE_LUN_SCAN_ENABLE); + if (ATTOFlags & ATTOFLAG_TAGGED) + data |= (MPI_SCSIPORTPAGE2_DEVICE_TAG_QUEUE_ENABLE); + if (!(ATTOFlags & ATTOFLAG_WIDE_ENB)) + data |= (MPI_SCSIPORTPAGE2_DEVICE_WIDE_DISABLE); + + data = (data << 16) | (pdevice->Period << 8) | 10; + ioc->spi_data.nvram[ii] = data; + } } else { SCSIPortPage2_t *pPP2 = (SCSIPortPage2_t *) pbuf; MpiDeviceInfo_t *pdevice = NULL; diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h index 15ff226..a8c8080 100644 --- a/drivers/message/fusion/mptbase.h +++ b/drivers/message/fusion/mptbase.h @@ -194,6 +194,35 @@ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /* + * ATTO UL4D associated structures and defines + */ +#define ATTOFLAG_DISC 0x0001 +#define ATTOFLAG_TAGGED 0x0002 +#define ATTOFLAG_WIDE_ENB 0x0008 +#define ATTOFLAG_ID_ENB 0x0010 +#define ATTOFLAG_LUN_ENB 0x0060 + +typedef struct _ATTO_DEVICE_INFO +{ + u8 Offset; /* 00h */ + u8 Period; /* 01h */ + u16 ATTOFlags; /* 02h */ +} ATTO_DEVICE_INFO, MPI_POINTER PTR_ATTO_DEVICE_INFO, + ATTODevi
[SCSI] mpt fusion: Usage of high priority request FIFO to send task management commands
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7a195f464e0692607aca8150c8489a838fab684b Commit: 7a195f464e0692607aca8150c8489a838fab684b Parent: 232f08fc82b15fdcaffc68c558115bfb2b34db86 Author: Prakash, Sathya <[EMAIL PROTECTED]> AuthorDate: Tue Aug 14 16:08:40 2007 +0530 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:40:40 2007 -0400 [SCSI] mpt fusion: Usage of high priority request FIFO to send task management commands Added support for sending the task management requests through High priority request FIFO instead of Doorbell writes when firmware support High priority FIFO. signed-off-by: Sathya Prakash <[EMAIL PROTECTED]> Acked-by: Eric Moore <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/message/fusion/mptbase.c | 33 +++ drivers/message/fusion/mptbase.h |4 ++- drivers/message/fusion/mptctl.c | 44 +++- drivers/message/fusion/mptsas.c |8 +-- drivers/message/fusion/mptscsih.c | 14 --- 5 files changed, 75 insertions(+), 28 deletions(-) diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 828f0ca..7ef86cb 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c @@ -842,6 +842,38 @@ mpt_put_msg_frame(int handle, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf) CHIPREG_WRITE32(&ioc->chip->RequestFifo, mf_dma_addr); } +/** + * mpt_put_msg_frame_hi_pri - Send a protocol specific MPT request frame + * to a IOC using hi priority request queue. + * @handle: Handle of registered MPT protocol driver + * @ioc: Pointer to MPT adapter structure + * @mf: Pointer to MPT request frame + * + * This routine posts a MPT request frame to the request post FIFO of a + * specific MPT adapter. + **/ +void +mpt_put_msg_frame_hi_pri(int handle, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf) +{ + u32 mf_dma_addr; + int req_offset; + u16 req_idx; /* Request index */ + + /* ensure values are reset properly! */ + mf->u.frame.hwhdr.msgctxu.fld.cb_idx = handle; + req_offset = (u8 *)mf - (u8 *)ioc->req_frames; + req_idx = req_offset / ioc->req_sz; + mf->u.frame.hwhdr.msgctxu.fld.req_idx = cpu_to_le16(req_idx); + mf->u.frame.hwhdr.msgctxu.fld.rsvd = 0; + + DBG_DUMP_PUT_MSG_FRAME(ioc, (u32 *)mf); + + mf_dma_addr = (ioc->req_frames_low_dma + req_offset); + dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mf_dma_addr=%x req_idx=%d\n", + ioc->name, mf_dma_addr, req_idx)); + CHIPREG_WRITE32(&ioc->chip->RequestHiPriFifo, mf_dma_addr); +} + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /** * mpt_free_msg_frame - Place MPT request frame back on FreeQ. @@ -7315,6 +7347,7 @@ EXPORT_SYMBOL(mpt_device_driver_register); EXPORT_SYMBOL(mpt_device_driver_deregister); EXPORT_SYMBOL(mpt_get_msg_frame); EXPORT_SYMBOL(mpt_put_msg_frame); +EXPORT_SYMBOL(mpt_put_msg_frame_hi_pri); EXPORT_SYMBOL(mpt_free_msg_frame); EXPORT_SYMBOL(mpt_add_sge); EXPORT_SYMBOL(mpt_send_handshake_request); diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h index a8c8080..012be5e 100644 --- a/drivers/message/fusion/mptbase.h +++ b/drivers/message/fusion/mptbase.h @@ -336,7 +336,8 @@ typedef struct _SYSIF_REGS u32 Reserved2[2]; /* 38-3F reserved for future use*/ u32 RequestFifo;/* 40 Request Post/Free FIFO */ u32 ReplyFifo; /* 44 Reply Post/Free FIFO */ - u32 Reserved3[2]; /* 48-4F reserved for future use*/ + u32 RequestHiPriFifo; /* 48 Hi Priority Request FIFO */ + u32 Reserved3; /* 4C-4F reserved for future use*/ u32 HostIndex; /* 50 Host Index register*/ u32 Reserved4[15]; /* 54-8F */ u32 Fubar; /* 90 For Fubar usage*/ @@ -893,6 +894,7 @@ extern void mpt_device_driver_deregister(int cb_idx); extern MPT_FRAME_HDR *mpt_get_msg_frame(int handle, MPT_ADAPTER *ioc); extern void mpt_free_msg_frame(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf); extern void mpt_put_msg_frame(int handle, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf); +extern void mpt_put_msg_frame_hi_pri(int handle, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf); extern void mpt_add_sge(char *pAddr, u32 flagslength, dma_addr_t dma_addr); extern int mpt_send_handshake_request(int handle, MPT_ADAPTER *ioc, int reqBytes, u32 *req, int sleepFlag); diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index 89695e7..dce1e9c 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c @@ -342,7 +342,7 @@ static int mptctl_bus_reset(MPT_IOCTL *ioctl)
[SCSI] mpt fusion: Change call back indices to u8 from int
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f606f5718fa5a36e40f91c44a5725b0f005d Commit: f606f5718fa5a36e40f91c44a5725b0f005d Parent: 7a195f464e0692607aca8150c8489a838fab684b Author: Prakash, Sathya <[EMAIL PROTECTED]> AuthorDate: Tue Aug 14 16:12:53 2007 +0530 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:40:43 2007 -0400 [SCSI] mpt fusion: Change call back indices to u8 from int The call back index requires only u8 but in lot of places it is referred as int, now everywhere the call back index variables are declared as u8 with uniform name cb_idx signed-off-by: Sathya Prakash <[EMAIL PROTECTED]> Acked-by: Eric Moore <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/message/fusion/mptbase.c | 220 - drivers/message/fusion/mptbase.h | 33 +++--- drivers/message/fusion/mptctl.c |5 +- drivers/message/fusion/mptfc.c |6 +- drivers/message/fusion/mptlan.c | 16 +--- drivers/message/fusion/mptsas.c |8 +- drivers/message/fusion/mptspi.c |6 +- 7 files changed, 150 insertions(+), 144 deletions(-) diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 7ef86cb..8cf0f51 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c @@ -102,8 +102,6 @@ static int mfcounter = 0; /* * Public data... */ -int mpt_lan_index = -1; -int mpt_stm_index = -1; struct proc_dir_entry *mpt_proc_root_dir; @@ -125,11 +123,14 @@ static MPT_EVHANDLER MptEvHandlers[MPT_MAX_PROTOCOL_DRIVERS]; static MPT_RESETHANDLER MptResetHandlers[MPT_MAX_PROTOCOL_DRIVERS]; static struct mpt_pci_driver *MptDeviceDriverHandlers[MPT_MAX_PROTOCOL_DRIVERS]; -static int mpt_base_index = -1; -static int last_drv_idx = -1; - static DECLARE_WAIT_QUEUE_HEAD(mpt_waitq); +/* + * Driver Callback Index's + */ +static u8 mpt_base_index = MPT_MAX_PROTOCOL_DRIVERS; +static u8 last_drv_idx; + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /* * Forward protos... @@ -235,6 +236,23 @@ static int mpt_set_debug_level(const char *val, struct kernel_param *kp) return 0; } +/** + * mpt_get_cb_idx - obtain cb_idx for registered driver + * @dclass: class driver enum + * + * Returns cb_idx, or zero means it wasn't found + **/ +static u8 +mpt_get_cb_idx(MPT_DRIVER_CLASS dclass) +{ + u8 cb_idx; + + for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) + if (MptDriverClass[cb_idx] == dclass) + return cb_idx; + return 0; +} + /* * Process turbo (context) reply... */ @@ -243,8 +261,8 @@ mpt_turbo_reply(MPT_ADAPTER *ioc, u32 pa) { MPT_FRAME_HDR *mf = NULL; MPT_FRAME_HDR *mr = NULL; - int req_idx = 0; - int cb_idx; + u16 req_idx = 0; + u8 cb_idx; dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Got TURBO reply req_idx=%08x\n", ioc->name, pa)); @@ -256,7 +274,7 @@ mpt_turbo_reply(MPT_ADAPTER *ioc, u32 pa) mf = MPT_INDEX_2_MFPTR(ioc, req_idx); break; case MPI_CONTEXT_REPLY_TYPE_LAN: - cb_idx = mpt_lan_index; + cb_idx = mpt_get_cb_idx(MPTLAN_DRIVER); /* * Blind set of mf to NULL here was fatal * after lan_reply says "freeme" @@ -277,7 +295,7 @@ mpt_turbo_reply(MPT_ADAPTER *ioc, u32 pa) mr = (MPT_FRAME_HDR *) CAST_U32_TO_PTR(pa); break; case MPI_CONTEXT_REPLY_TYPE_SCSI_TARGET: - cb_idx = mpt_stm_index; + cb_idx = mpt_get_cb_idx(MPTSTM_DRIVER); mr = (MPT_FRAME_HDR *) CAST_U32_TO_PTR(pa); break; default: @@ -286,7 +304,7 @@ mpt_turbo_reply(MPT_ADAPTER *ioc, u32 pa) } /* Check for (valid) IO callback! */ - if (cb_idx < 1 || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS || + if (!cb_idx || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS || MptCallbacks[cb_idx] == NULL) { printk(MYIOC_s_WARN_FMT "%s: Invalid cb_idx (%d)!\n", __FUNCTION__, ioc->name, cb_idx); @@ -304,8 +322,8 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa) { MPT_FRAME_HDR *mf; MPT_FRAME_HDR *mr; - int req_idx; - int cb_idx; + u16 req_idx; + u8 cb_idx; int freeme; u32 reply_dma_low; @@ -350,7 +368,7 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa) mpt_iocstatus_info(ioc, (u32)ioc_stat, mf); /* Check for (valid) IO callback! */ - if (cb_idx < 1 || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS || + if (!cb_idx || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS |
[SCSI] mpt fusion: Creation of mptsas.h header file
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=56af97ae477cf8c2983edf86db2559d6394ca860 Commit: 56af97ae477cf8c2983edf86db2559d6394ca860 Parent: f606f5718fa5a36e40f91c44a5725b0f005d Author: Prakash, Sathya <[EMAIL PROTECTED]> AuthorDate: Tue Aug 14 16:15:38 2007 +0530 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:40:47 2007 -0400 [SCSI] mpt fusion: Creation of mptsas.h header file The data structure definitions from mptsas.c are moved to a new header file mptsas.h signed-off-by: Sathya Prakash <[EMAIL PROTECTED]> Acked-by: Eric Moore <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/message/fusion/mptsas.c | 106 +-- drivers/message/fusion/mptsas.h | 158 +++ 2 files changed, 159 insertions(+), 105 deletions(-) diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index ffbf0e5..5951fe0 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c @@ -61,6 +61,7 @@ #include "mptbase.h" #include "mptscsih.h" +#include "mptsas.h" #define my_NAME"Fusion MPT SAS Host driver" @@ -96,111 +97,6 @@ static u8 mptsasMgmtCtx = MPT_MAX_PROTOCOL_DRIVERS; static void mptsas_hotplug_work(struct work_struct *work); -struct mptsas_target_reset_event { - struct list_headlist; - EVENT_DATA_SAS_DEVICE_STATUS_CHANGE sas_event_data; - u8 target_reset_issued; -}; - -enum mptsas_hotplug_action { - MPTSAS_ADD_DEVICE, - MPTSAS_DEL_DEVICE, - MPTSAS_ADD_RAID, - MPTSAS_DEL_RAID, - MPTSAS_ADD_INACTIVE_VOLUME, - MPTSAS_IGNORE_EVENT, -}; - -struct mptsas_hotplug_event { - struct work_struct work; - MPT_ADAPTER *ioc; - enum mptsas_hotplug_action event_type; - u64 sas_address; - u8 channel; - u8 id; - u32 device_info; - u16 handle; - u16 parent_handle; - u8 phy_id; - u8 phys_disk_num_valid;/* hrc (hidden raid component) */ - u8 phys_disk_num; /* hrc - unique index*/ - u8 hidden_raid_component; /* hrc - don't expose*/ -}; - -struct mptsas_discovery_event { - struct work_struct work; - MPT_ADAPTER *ioc; -}; - -/* - * SAS topology structures - * - * The MPT Fusion firmware interface spreads information about the - * SAS topology over many manufacture pages, thus we need some data - * structure to collect it and process it for the SAS transport class. - */ - -struct mptsas_devinfo { - u16 handle; /* unique id to address this device */ - u16 handle_parent; /* unique id to address parent device */ - u16 handle_enclosure; /* enclosure identifier of the enclosure */ - u16 slot; /* physical slot in enclosure */ - u8 phy_id; /* phy number of parent device */ - u8 port_id;/* sas physical port this device - is assoc'd with */ - u8 id; /* logical target id of this device */ - u32 phys_disk_num; /* phys disk id, for csmi-ioctls */ - u8 channel;/* logical bus number of this device */ - u64 sas_address;/* WWN of this device, - SATA is assigned by HBA,expander */ - u32 device_info;/* bitfield detailed info about this device */ -}; - -/* - * Specific details on ports, wide/narrow - */ -struct mptsas_portinfo_details{ - u16 num_phys; /* number of phys belong to this port */ - u64 phy_bitmask;/* TODO, extend support for 255 phys */ - struct sas_rphy *rphy; /* transport layer rphy object */ - struct sas_port *port; /* transport layer port object */ - struct scsi_target *starget; - struct mptsas_portinfo *port_info; -}; - -struct mptsas_phyinfo { - u16 handle; /* unique id to address this */ - u8 phy_id; /* phy index */ - u8 port_id;/* firmware port identifier */ - u8 negotiated_link_rate; /* nego'd link rate for this phy */ - u8 hw_link_rate; /* hardware max/min phys link rate */ - u8 programmed_link_rate; /* programmed max/min phy link rate */ - u8 sas_port_add_phy; /* flag to request sas_port_add_phy*/ - struct mptsas_devinfo identify; /* point to phy device info */ - struct mptsas_devinfo attached; /* point to attached device info */ - struct sas_phy *phy;/* transport layer phy object */ -
[SCSI] mpt fusion: Link speed change display support
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=eb5329f40c13923e84a847204b5c5d62954eaf05 Commit: eb5329f40c13923e84a847204b5c5d62954eaf05 Parent: 56af97ae477cf8c2983edf86db2559d6394ca860 Author: Prakash, Sathya <[EMAIL PROTECTED]> AuthorDate: Tue Aug 14 16:19:32 2007 +0530 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:40:50 2007 -0400 [SCSI] mpt fusion: Link speed change display support When there is state change in FC links, a message is displayed with old and new link speed. signed-off-by: Sathya Prakash <[EMAIL PROTECTED]> Acked-by: Eric Moore <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/message/fusion/mptbase.h |2 + drivers/message/fusion/mptfc.c | 66 ++ 2 files changed, 68 insertions(+), 0 deletions(-) diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h index 04ef0a3..1197eba 100644 --- a/drivers/message/fusion/mptbase.h +++ b/drivers/message/fusion/mptbase.h @@ -698,6 +698,8 @@ typedef struct _MPT_ADAPTER struct work_struct fc_setup_reset_work; struct list_head fc_rports; + struct work_struct fc_lsc_work; + u8 fc_link_speed[2]; spinlock_t fc_rescan_work_lock; struct work_struct fc_rescan_work; char fc_rescan_work_q_name[KOBJ_NAME_LEN]; diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c index 2b3e27a..aadb071 100644 --- a/drivers/message/fusion/mptfc.c +++ b/drivers/message/fusion/mptfc.c @@ -675,6 +675,50 @@ mptfc_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) } /* + * mptfc_display_port_link_speed - displaying link speed + * @ioc: Pointer to MPT_ADAPTER structure + * @portnum: IOC Port number + * @pp0dest: port page0 data payload + * + */ +static void +mptfc_display_port_link_speed(MPT_ADAPTER *ioc, int portnum, FCPortPage0_t *pp0dest) +{ + u8 old_speed, new_speed, state; + char*old, *new; + + if (portnum >= 2) + return; + + old_speed = ioc->fc_link_speed[portnum]; + new_speed = pp0dest->CurrentSpeed; + state = pp0dest->PortState; + + if (state != MPI_FCPORTPAGE0_PORTSTATE_OFFLINE && + new_speed != MPI_FCPORTPAGE0_CURRENT_SPEED_UKNOWN) { + + old = old_speed == MPI_FCPORTPAGE0_CURRENT_SPEED_1GBIT ? "1 Gbps" : + old_speed == MPI_FCPORTPAGE0_CURRENT_SPEED_2GBIT ? "2 Gbps" : + old_speed == MPI_FCPORTPAGE0_CURRENT_SPEED_4GBIT ? "4 Gbps" : +"Unknown"; + new = new_speed == MPI_FCPORTPAGE0_CURRENT_SPEED_1GBIT ? "1 Gbps" : + new_speed == MPI_FCPORTPAGE0_CURRENT_SPEED_2GBIT ? "2 Gbps" : + new_speed == MPI_FCPORTPAGE0_CURRENT_SPEED_4GBIT ? "4 Gbps" : +"Unknown"; + if (old_speed == 0) + printk(MYIOC_s_NOTE_FMT + "FC Link Established, Speed = %s\n", + ioc->name, new); + else if (old_speed != new_speed) + printk(MYIOC_s_WARN_FMT + "FC Link Speed Change, Old Speed = %s, New Speed = %s\n", + ioc->name, old, new); + + ioc->fc_link_speed[portnum] = new_speed; + } +} + +/* * mptfc_GetFcPortPage0 - Fetch FCPort config Page0. * @ioc: Pointer to MPT_ADAPTER structure * @portnum: IOC Port number @@ -773,6 +817,7 @@ mptfc_GetFcPortPage0(MPT_ADAPTER *ioc, int portnum) " complete.\n", ioc->name); } + mptfc_display_port_link_speed(ioc, portnum, pp0dest); } pci_free_consistent(ioc->pcidev, data_sz, (u8 *) ppage0_alloc, page0_dma); @@ -1023,6 +1068,18 @@ mptfc_init_host_attr(MPT_ADAPTER *ioc,int portnum) } static void +mptfc_link_status_change(struct work_struct *work) +{ + MPT_ADAPTER *ioc = + container_of(work, MPT_ADAPTER, fc_rescan_work); + int ii; + + for (ii=0; ii < ioc->facts.NumberOfPorts; ii++) + (void) mptfc_GetFcPortPage0(ioc, ii); + +} + +static void mptfc_setup_reset(struct work_struct *work) { MPT_ADAPTER *ioc = @@ -1163,6 +1220,7 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id) spin_lock_init(&ioc->fc_rescan_work_lock); INIT_WORK(&ioc->fc_rescan_work, mptfc_rescan_devices); INIT_WORK(&ioc->fc_setup_reset_work, mptfc_setup_reset); + INIT_WORK(&ioc->fc_lsc_work, mptfc_link_status_change); spin_lock_
[SCSI] mpt fusion: Change company name from LSI Logic to LSI
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f36789e22ac32a6554b8e4d05ab6125fc1161745 Commit: f36789e22ac32a6554b8e4d05ab6125fc1161745 Parent: eb5329f40c13923e84a847204b5c5d62954eaf05 Author: Prakash, Sathya <[EMAIL PROTECTED]> AuthorDate: Tue Aug 14 16:22:54 2007 +0530 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:40:54 2007 -0400 [SCSI] mpt fusion: Change company name from LSI Logic to LSI Recently LSI Logic Corp was renamed as LSI Corp, so whereever there is a reference of LSI Logic, it is changed to LSI in mpt fusion driver code. signed-off-by: Sathya Prakash <[EMAIL PROTECTED]> Acked-by: Eric Moore <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/message/fusion/lsi/mpi.h |2 +- drivers/message/fusion/lsi/mpi_cnfg.h |2 +- drivers/message/fusion/lsi/mpi_fc.h|2 +- drivers/message/fusion/lsi/mpi_history.txt |2 +- drivers/message/fusion/lsi/mpi_init.h |2 +- drivers/message/fusion/lsi/mpi_ioc.h |2 +- drivers/message/fusion/lsi/mpi_lan.h |2 +- drivers/message/fusion/lsi/mpi_log_fc.h|2 +- drivers/message/fusion/lsi/mpi_log_sas.h |2 +- drivers/message/fusion/lsi/mpi_raid.h |2 +- drivers/message/fusion/lsi/mpi_sas.h |2 +- drivers/message/fusion/lsi/mpi_targ.h |2 +- drivers/message/fusion/lsi/mpi_tool.h |2 +- drivers/message/fusion/lsi/mpi_type.h |2 +- drivers/message/fusion/mptbase.c |6 +++--- drivers/message/fusion/mptbase.h |6 +++--- drivers/message/fusion/mptctl.c| 10 +- drivers/message/fusion/mptctl.h|4 ++-- drivers/message/fusion/mptfc.c |6 +++--- drivers/message/fusion/mptlan.c|6 +++--- drivers/message/fusion/mptlan.h|8 drivers/message/fusion/mptsas.c|6 +++--- drivers/message/fusion/mptscsih.c |6 +++--- drivers/message/fusion/mptscsih.h |4 ++-- drivers/message/fusion/mptspi.c|6 +++--- 25 files changed, 48 insertions(+), 48 deletions(-) diff --git a/drivers/message/fusion/lsi/mpi.h b/drivers/message/fusion/lsi/mpi.h index 6a92e3d..1acbdd6 100644 --- a/drivers/message/fusion/lsi/mpi.h +++ b/drivers/message/fusion/lsi/mpi.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2007 LSI Logic Corporation. + * Copyright (c) 2000-2007 LSI Corporation. * * * Name: mpi.h diff --git a/drivers/message/fusion/lsi/mpi_cnfg.h b/drivers/message/fusion/lsi/mpi_cnfg.h index eda7697..2bd8ada 100644 --- a/drivers/message/fusion/lsi/mpi_cnfg.h +++ b/drivers/message/fusion/lsi/mpi_cnfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2007 LSI Logic Corporation. + * Copyright (c) 2000-2007 LSI Corporation. * * * Name: mpi_cnfg.h diff --git a/drivers/message/fusion/lsi/mpi_fc.h b/drivers/message/fusion/lsi/mpi_fc.h index 51a6aeb..627acfb 100644 --- a/drivers/message/fusion/lsi/mpi_fc.h +++ b/drivers/message/fusion/lsi/mpi_fc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2004 LSI Logic Corporation. + * Copyright (c) 2000-2004 LSI Corporation. * * * Name: mpi_fc.h diff --git a/drivers/message/fusion/lsi/mpi_history.txt b/drivers/message/fusion/lsi/mpi_history.txt index a1f4790..241592a 100644 --- a/drivers/message/fusion/lsi/mpi_history.txt +++ b/drivers/message/fusion/lsi/mpi_history.txt @@ -3,7 +3,7 @@ MPI Header File Change History == - Copyright (c) 2000-2007 LSI Logic Corporation. + Copyright (c) 2000-2007 LSI Corporation. --- Header Set Release Version:01.05.16 diff --git a/drivers/message/fusion/lsi/mpi_init.h b/drivers/message/fusion/lsi/mpi_init.h index 3a02615..a9e3693 100644 --- a/drivers/message/fusion/lsi/mpi_init.h +++ b/drivers/message/fusion/lsi/mpi_init.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2007 LSI Logic Corporation. + * Copyright (c) 2000-2007 LSI Corporation. * * * Name: mpi_init.h diff --git a/drivers/message/fusion/lsi/mpi_ioc.h b/drivers/message/fusion/lsi/mpi_ioc.h index b1893d1..5cbb6bd 100644 --- a/drivers/message/fusion/lsi/mpi_ioc.h +++ b/drivers/message/fusion/lsi/mpi_ioc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2007 LSI Logic Corporation. + * Copyright (c) 2000-2007 LSI Corporation. * * * Name: mpi_ioc.h diff --git a/drivers/message/fusion/lsi/mpi_lan.h b/drivers/message/fusion/lsi/mpi_lan.h index dc0b52a..03253b5 100644 --- a/drivers/message/fusion/lsi/mpi_lan.h +++ b/drivers/message/fusion/lsi/mpi_lan.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2004 LSI Logic Corporation. + * Copyright (c) 2000-2004 LSI Corporation. * * * Name: mpi_lan.h diff --git a/drivers/message/fusion/lsi/mpi_log_fc.h b/drivers/message/fusion/lsi
[SCSI] kmalloc + memset conversion to kzalloc
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bbfbbbc1182f8b44c8cc4c99f4a3f3a512149022 Commit: bbfbbbc1182f8b44c8cc4c99f4a3f3a512149022 Parent: f36789e22ac32a6554b8e4d05ab6125fc1161745 Author: Mariusz Kozlowski <[EMAIL PROTECTED]> AuthorDate: Sat Aug 11 10:13:24 2007 +0200 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:41:00 2007 -0400 [SCSI] kmalloc + memset conversion to kzalloc In NCR_D700, a4000t, aic7xxx_old, bvme6000, dpt_i2o, gdth, lpfc, megaraid, mvme16x osst, pluto, qla2xxx, zorro7xx Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/NCR_D700.c |4 ++-- drivers/scsi/a4000t.c|7 +++ drivers/scsi/aic7xxx_old.c |8 +++- drivers/scsi/bvme6000_scsi.c |7 +++ drivers/scsi/dpt_i2o.c | 27 +++ drivers/scsi/gdth.c |7 +++ drivers/scsi/lpfc/lpfc_debugfs.c |4 +--- drivers/scsi/lpfc/lpfc_init.c|3 +-- drivers/scsi/lpfc/lpfc_scsi.c|3 +-- drivers/scsi/megaraid.c |3 +-- drivers/scsi/mvme16x_scsi.c |3 +-- drivers/scsi/osst.c |5 ++--- drivers/scsi/pluto.c |8 +++- drivers/scsi/qla2xxx/qla_init.c | 14 ++ drivers/scsi/zorro7xx.c |8 +++- 15 files changed, 44 insertions(+), 67 deletions(-) diff --git a/drivers/scsi/NCR_D700.c b/drivers/scsi/NCR_D700.c index e0f1991..9e64b21 100644 --- a/drivers/scsi/NCR_D700.c +++ b/drivers/scsi/NCR_D700.c @@ -313,10 +313,10 @@ NCR_D700_probe(struct device *dev) break; } - p = kmalloc(sizeof(*p), GFP_KERNEL); + p = kzalloc(sizeof(*p), GFP_KERNEL); if (!p) return -ENOMEM; - memset(p, '\0', sizeof(*p)); + p->dev = dev; snprintf(p->name, sizeof(p->name), "D700(%s)", dev->bus_id); if (request_irq(irq, NCR_D700_intr, IRQF_SHARED, p->name, p)) { diff --git a/drivers/scsi/a4000t.c b/drivers/scsi/a4000t.c index 0c758d1..d4bda20 100644 --- a/drivers/scsi/a4000t.c +++ b/drivers/scsi/a4000t.c @@ -37,7 +37,7 @@ static struct platform_device *a4000t_scsi_device; static int __devinit a4000t_probe(struct device *dev) { - struct Scsi_Host * host = NULL; + struct Scsi_Host *host; struct NCR_700_Host_Parameters *hostdata; if (!(MACH_IS_AMIGA && AMIGAHW_PRESENT(A4000_SCSI))) @@ -47,12 +47,11 @@ static int __devinit a4000t_probe(struct device *dev) "A4000T builtin SCSI")) goto out; - hostdata = kmalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL); - if (hostdata == NULL) { + hostdata = kzalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL); + if (!hostdata) { printk(KERN_ERR "a4000t-scsi: Failed to allocate host data\n"); goto out_release; } - memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters)); /* Fill in the required pieces of hostdata */ hostdata->base = (void __iomem *)ZTWO_VADDR(A4000T_SCSI_ADDR); diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c index 4998bb8..1a71b02 100644 --- a/drivers/scsi/aic7xxx_old.c +++ b/drivers/scsi/aic7xxx_old.c @@ -8416,10 +8416,9 @@ aic7xxx_alloc(struct scsi_host_template *sht, struct aic7xxx_host *temp) *p = *temp; p->host = host; -p->scb_data = kmalloc(sizeof(scb_data_type), GFP_ATOMIC); -if (p->scb_data != NULL) +p->scb_data = kzalloc(sizeof(scb_data_type), GFP_ATOMIC); +if (!p->scb_data) { - memset(p->scb_data, 0, sizeof(scb_data_type)); scbq_init (&p->scb_data->free_scbs); } else @@ -9196,10 +9195,9 @@ aic7xxx_detect(struct scsi_host_template *template) printk(KERN_INFO " this driver, we are ignoring it.\n"); } } -else if ( (temp_p = kmalloc(sizeof(struct aic7xxx_host), +else if ( (temp_p = kzalloc(sizeof(struct aic7xxx_host), GFP_ATOMIC)) != NULL ) { - memset(temp_p, 0, sizeof(struct aic7xxx_host)); temp_p->chip = aic_pdevs[i].chip | AHC_PCI; temp_p->flags = aic_pdevs[i].flags; temp_p->features = aic_pdevs[i].features; diff --git a/drivers/scsi/bvme6000_scsi.c b/drivers/scsi/bvme6000_scsi.c index cac3540..d858f3d 100644 --- a/drivers/scsi/bvme6000_scsi.c +++ b/drivers/scsi/bvme6000_scsi.c @@ -36,19 +36,18 @@ static struct platform_device *bvme6000_scsi_device; static __devinit int bvme6000_probe(struct device *dev) { - struct Scsi_Host * host = NULL; + struct Scsi_Host *host; struct NCR_700_Host_Parameters *hostdata; if (!MACH_IS_BVME6000) goto out; - hostdata = kmalloc(sizeof(struct NCR_700_Host_P
[SCSI] zfcp: correct indentation for nested if-else
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2282f658914e316ca32fd120fded130d1c0e26e4 Commit: 2282f658914e316ca32fd120fded130d1c0e26e4 Parent: bbfbbbc1182f8b44c8cc4c99f4a3f3a512149022 Author: Christof Schmitt <[EMAIL PROTECTED]> AuthorDate: Tue Aug 28 09:30:22 2007 +0200 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:45:36 2007 -0400 [SCSI] zfcp: correct indentation for nested if-else correct indentation for nested if-else Signed-off-by: Christof Schmitt <[EMAIL PROTECTED]> Signed-off-by: Swen Schillig <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/s390/scsi/zfcp_fsf.c | 22 +++--- 1 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index 9929997..13ed689 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c @@ -3586,17 +3586,17 @@ zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *adapter, ZFCP_LOG_DEBUG( "Data did not fit into available buffer(s), " "waiting for more...\n"); - retval = -EIO; - } else { - ZFCP_LOG_NORMAL("error: No truncation implemented but " - "required. Shutting down unit " - "(adapter %s, port 0x%016Lx, " - "unit 0x%016Lx)\n", - zfcp_get_busid_by_unit(unit), - unit->port->wwpn, - unit->fcp_lun); - zfcp_erp_unit_shutdown(unit, 0); - retval = -EINVAL; + retval = -EIO; + } else { + ZFCP_LOG_NORMAL("error: No truncation implemented but " + "required. Shutting down unit " + "(adapter %s, port 0x%016Lx, " + "unit 0x%016Lx)\n", + zfcp_get_busid_by_unit(unit), + unit->port->wwpn, + unit->fcp_lun); + zfcp_erp_unit_shutdown(unit, 0); + retval = -EINVAL; } goto no_fit; } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] zfcp: avoid if (whatever) ; constructs.
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cc16cebad086090891a3f39957ec771a2292359b Commit: cc16cebad086090891a3f39957ec771a2292359b Parent: 2282f658914e316ca32fd120fded130d1c0e26e4 Author: Heiko Carstens <[EMAIL PROTECTED]> AuthorDate: Tue Aug 28 09:30:42 2007 +0200 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:46:18 2007 -0400 [SCSI] zfcp: avoid if (whatever) ; constructs. Avoid "if (whatever) ;" constructs since they seem to confuse people, even if there is a comment. Signed-off-by: Heiko Carstens <[EMAIL PROTECTED]> Signed-off-by: Swen Schillig <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/s390/scsi/zfcp_erp.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index d8cd75c..40fa056 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c @@ -1687,8 +1687,8 @@ zfcp_erp_strategy_followup_actions(int action, break; case ZFCP_ERP_ACTION_REOPEN_UNIT: - if (status == ZFCP_ERP_SUCCEEDED) ; /* no further action */ - else + /* Nothing to do if status == ZFCP_ERP_SUCCEEDED */ + if (status != ZFCP_ERP_SUCCEEDED) zfcp_erp_port_reopen_internal(unit->port, 0); break; } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] zfcp: Remove unnecessary assignment
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6ddd90a5b1618523dbfe3a11c50945f6660135a0 Commit: 6ddd90a5b1618523dbfe3a11c50945f6660135a0 Parent: cc16cebad086090891a3f39957ec771a2292359b Author: Christof Schmitt <[EMAIL PROTECTED]> AuthorDate: Tue Aug 28 09:30:50 2007 +0200 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:46:21 2007 -0400 [SCSI] zfcp: Remove unnecessary assignment zfcp_adapter_enqueue initialized adapter->ccw_device twice with the same value. Remove the second assignment, since it is not necessary. Signed-off-by: Christof Schmitt <[EMAIL PROTECTED]> Signed-off-by: Swen Schillig <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/s390/scsi/zfcp_aux.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index 90aa53f..eb3af41 100644 --- a/drivers/s390/scsi/zfcp_aux.c +++ b/drivers/s390/scsi/zfcp_aux.c @@ -1058,7 +1058,6 @@ zfcp_adapter_enqueue(struct ccw_device *ccw_device) /* mark adapter unusable as long as sysfs registration is not complete */ atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &adapter->status); - adapter->ccw_device = ccw_device; dev_set_drvdata(&ccw_device->dev, adapter); if (zfcp_sysfs_adapter_create_files(&ccw_device->dev)) - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] zfcp: Remove braces for only one statement
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6b76a72141c57260adaf07977f79760ddb8618ee Commit: 6b76a72141c57260adaf07977f79760ddb8618ee Parent: 6ddd90a5b1618523dbfe3a11c50945f6660135a0 Author: Christof Schmitt <[EMAIL PROTECTED]> AuthorDate: Tue Aug 28 09:30:59 2007 +0200 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:46:25 2007 -0400 [SCSI] zfcp: Remove braces for only one statement Remove braces for only one statement Signed-off-by: Christof Schmitt <[EMAIL PROTECTED]> Signed-off-by: Swen Schillig <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/s390/scsi/zfcp_scsi.c |6 ++ 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c index ad7eb4a..3a7f3b8 100644 --- a/drivers/s390/scsi/zfcp_scsi.c +++ b/drivers/s390/scsi/zfcp_scsi.c @@ -189,10 +189,9 @@ static void zfcp_scsi_slave_destroy(struct scsi_device *sdpnt) unit->device = NULL; zfcp_erp_unit_failed(unit); zfcp_unit_put(unit); - } else { + } else ZFCP_LOG_NORMAL("bug: no unit associated with SCSI device at " "address %p\n", sdpnt); - } } /* @@ -361,12 +360,11 @@ zfcp_unit_lookup(struct zfcp_adapter *adapter, int channel, unsigned int id, list_for_each_entry(port, &adapter->port_list_head, list) { if (!port->rport || (id != port->rport->scsi_target_id)) continue; - list_for_each_entry(unit, &port->unit_list_head, list) { + list_for_each_entry(unit, &port->unit_list_head, list) if (lun == unit->scsi_lun) { retval = unit; goto out; } - } } out: return retval; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] scsi_transport_fc: Introduce disable_target_scan flag
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=03f002f778e58e9056e8e9a22952c5c6f4d76269 Commit: 03f002f778e58e9056e8e9a22952c5c6f4d76269 Parent: 6b76a72141c57260adaf07977f79760ddb8618ee Author: Christof Schmitt <[EMAIL PROTECTED]> AuthorDate: Tue Aug 28 09:31:21 2007 +0200 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:46:29 2007 -0400 [SCSI] scsi_transport_fc: Introduce disable_target_scan flag This change has already been discussed on linux-scsi: http://marc.info/?t=11877109643 http://marc.info/?t=11876091315 Signed-off-by: Christof Schmitt <[EMAIL PROTECTED]> Signed-off-by: Swen Schillig <[EMAIL PROTECTED]> Acked-by: James Smart <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/scsi_transport_fc.c |4 +++- include/scsi/scsi_transport_fc.h |2 ++ 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 4705725..dd97f26 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -2988,10 +2988,12 @@ fc_scsi_scan_rport(struct work_struct *work) struct fc_rport *rport = container_of(work, struct fc_rport, scan_work); struct Scsi_Host *shost = rport_to_shost(rport); + struct fc_internal *i = to_fc_internal(shost->transportt); unsigned long flags; if ((rport->port_state == FC_PORTSTATE_ONLINE) && - (rport->roles & FC_PORT_ROLE_FCP_TARGET)) { + (rport->roles & FC_PORT_ROLE_FCP_TARGET) && + !(i->f->disable_target_scan)) { scsi_scan_target(&rport->dev, rport->channel, rport->scsi_target_id, SCAN_WILD_CARD, 1); } diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index a0d80bc..616a96a 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h @@ -632,6 +632,8 @@ struct fc_function_template { unsigned long show_host_fabric_name:1; unsigned long show_host_symbolic_name:1; unsigned long show_host_system_hostname:1; + + unsigned long disable_target_scan:1; }; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] zfcp: cleanup, separation of ERP, non ERP-version for exchange_ functions
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=52ef11a7170e1b8a0d5f9a42dbb43c38c335c32e Commit: 52ef11a7170e1b8a0d5f9a42dbb43c38c335c32e Parent: 03f002f778e58e9056e8e9a22952c5c6f4d76269 Author: Swen Schillig <[EMAIL PROTECTED]> AuthorDate: Tue Aug 28 09:31:09 2007 +0200 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:46:32 2007 -0400 [SCSI] zfcp: cleanup, separation of ERP, non ERP-version for exchange_ functions cleanup, using ERP request mempool for all ERP versions of the exchange functions (exchange_config (ECD), exchange_port (EPD) ) providing individual versions of the ECD, EPD functions for ERP and other purposes (_sync). Signed-off-by: Swen Schillig <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/s390/scsi/zfcp_erp.c |2 +- drivers/s390/scsi/zfcp_ext.h |8 +- drivers/s390/scsi/zfcp_fsf.c | 231 + drivers/s390/scsi/zfcp_scsi.c |5 +- 4 files changed, 175 insertions(+), 71 deletions(-) diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index 40fa056..31c2178 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c @@ -2197,7 +2197,7 @@ zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action *erp_action) zfcp_erp_action_to_running(erp_action); write_unlock_irq(&adapter->erp_lock); - ret = zfcp_fsf_exchange_port_data(erp_action, adapter, NULL); + ret = zfcp_fsf_exchange_port_data(erp_action); if (ret == -EOPNOTSUPP) { debug_text_event(adapter->erp_dbf, 3, "a_xport_notsupp"); return ZFCP_ERP_SUCCEEDED; diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h index 991d456..722c55b 100644 --- a/drivers/s390/scsi/zfcp_ext.h +++ b/drivers/s390/scsi/zfcp_ext.h @@ -82,9 +82,11 @@ extern int zfcp_fsf_open_unit(struct zfcp_erp_action *); extern int zfcp_fsf_close_unit(struct zfcp_erp_action *); extern int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *); -extern int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *, - struct zfcp_adapter *, - struct fsf_qtcb_bottom_port *); +extern int zfcp_fsf_exchange_config_data_sync(struct zfcp_adapter *, + struct fsf_qtcb_bottom_config *); +extern int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *); +extern int zfcp_fsf_exchange_port_data_sync(struct zfcp_adapter *, + struct fsf_qtcb_bottom_port *); extern int zfcp_fsf_control_file(struct zfcp_adapter *, struct zfcp_fsf_req **, u32, u32, struct zfcp_sg_list *); extern void zfcp_fsf_start_timer(struct zfcp_fsf_req *, unsigned long); diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index 13ed689..4aa8834 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c @@ -1941,25 +1941,28 @@ zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action) { volatile struct qdio_buffer_element *sbale; struct zfcp_fsf_req *fsf_req; + struct zfcp_adapter *adapter = erp_action->adapter; unsigned long lock_flags; - int retval = 0; + int retval; /* setup new FSF request */ - retval = zfcp_fsf_req_create(erp_action->adapter, + retval = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_CONFIG_DATA, ZFCP_REQ_AUTO_CLEANUP, -erp_action->adapter->pool.fsf_req_erp, +adapter->pool.fsf_req_erp, &lock_flags, &fsf_req); - if (retval < 0) { + if (retval) { ZFCP_LOG_INFO("error: Could not create exchange configuration " "data request for adapter %s.\n", - zfcp_get_busid_by_adapter(erp_action->adapter)); - goto out; + zfcp_get_busid_by_adapter(adapter)); + write_unlock_irqrestore(&adapter->request_queue.queue_lock, + lock_flags); + return retval; } sbale = zfcp_qdio_sbale_req(fsf_req, fsf_req->sbal_curr, 0); -sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; -sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; + sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; + sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; fsf_req->qtcb->bottom.config.feature_selection = FSF_FEATURE_CFDC | @@ -1971,23 +1974,71 @@ zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action) zfcp_erp_start_timer(fsf_req); retval = zfcp_fsf_req_send(fsf_req); + w
[SCSI] zfcp: Enable debug feature before setting adapter online
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ff17a29d3cd9819a0977a07047e8f54e57dca7ce Commit: ff17a29d3cd9819a0977a07047e8f54e57dca7ce Parent: 52ef11a7170e1b8a0d5f9a42dbb43c38c335c32e Author: Christof Schmitt <[EMAIL PROTECTED]> AuthorDate: Tue Aug 28 09:31:41 2007 +0200 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:46:36 2007 -0400 [SCSI] zfcp: Enable debug feature before setting adapter online Already register the debug feature before the zfcp adapter is set online. This allows to use the debug feature to investigate the online/offline sequence. Signed-off-by: Christof Schmitt <[EMAIL PROTECTED]> Signed-off-by: Swen Schillig <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/s390/scsi/zfcp_aux.c |8 drivers/s390/scsi/zfcp_ccw.c |8 +--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index eb3af41..4a67320 100644 --- a/drivers/s390/scsi/zfcp_aux.c +++ b/drivers/s390/scsi/zfcp_aux.c @@ -1038,6 +1038,10 @@ zfcp_adapter_enqueue(struct ccw_device *ccw_device) spin_lock_init(&adapter->san_dbf_lock); spin_lock_init(&adapter->scsi_dbf_lock); + retval = zfcp_adapter_debug_register(adapter); + if (retval) + goto debug_register_failed; + /* initialize error recovery stuff */ rwlock_init(&adapter->erp_lock); @@ -1084,6 +1088,8 @@ zfcp_adapter_enqueue(struct ccw_device *ccw_device) generic_services_failed: zfcp_sysfs_adapter_remove_files(&adapter->ccw_device->dev); sysfs_failed: + zfcp_adapter_debug_unregister(adapter); + debug_register_failed: dev_set_drvdata(&ccw_device->dev, NULL); zfcp_reqlist_free(adapter); failed_low_mem_buffers: @@ -1129,6 +1135,8 @@ zfcp_adapter_dequeue(struct zfcp_adapter *adapter) goto out; } + zfcp_adapter_debug_unregister(adapter); + /* remove specified adapter data structure from list */ write_lock_irq(&zfcp_data.config_lock); list_del(&adapter->list); diff --git a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c index 1c8f71a..2773724 100644 --- a/drivers/s390/scsi/zfcp_ccw.c +++ b/drivers/s390/scsi/zfcp_ccw.c @@ -150,15 +150,12 @@ zfcp_ccw_set_online(struct ccw_device *ccw_device) down(&zfcp_data.config_sema); adapter = dev_get_drvdata(&ccw_device->dev); - retval = zfcp_adapter_debug_register(adapter); - if (retval) - goto out; retval = zfcp_erp_thread_setup(adapter); if (retval) { ZFCP_LOG_INFO("error: start of error recovery thread for " "adapter %s failed\n", zfcp_get_busid_by_adapter(adapter)); - goto out_erp_thread; + goto out; } retval = zfcp_adapter_scsi_register(adapter); @@ -177,8 +174,6 @@ zfcp_ccw_set_online(struct ccw_device *ccw_device) out_scsi_register: zfcp_erp_thread_kill(adapter); - out_erp_thread: - zfcp_adapter_debug_unregister(adapter); out: up(&zfcp_data.config_sema); return retval; @@ -201,7 +196,6 @@ zfcp_ccw_set_offline(struct ccw_device *ccw_device) zfcp_erp_adapter_shutdown(adapter, 0); zfcp_erp_wait(adapter); zfcp_erp_thread_kill(adapter); - zfcp_adapter_debug_unregister(adapter); up(&zfcp_data.config_sema); return 0; } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] hptiop: adding new firmware interface and more PCI device IDs
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=db9b6e89ea8dc3f32dea1125c672de1a9710be7c Commit: db9b6e89ea8dc3f32dea1125c672de1a9710be7c Parent: ff17a29d3cd9819a0977a07047e8f54e57dca7ce Author: HighPoint Linux Team <[EMAIL PROTECTED]> AuthorDate: Thu Aug 30 18:06:21 2007 +0800 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:46:40 2007 -0400 [SCSI] hptiop: adding new firmware interface and more PCI device IDs updated patch based on Jeff Garzik's comments. - check adapter firmware version and use appropriate interface accordingly - add new PCI device IDs and use PCI_VDEVICE macro - update driver version string - remove unused data structures - remove unnecessary typecasts Signed-off-by: HighPoint Linux Team <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/hptiop.c | 63 ++--- drivers/scsi/hptiop.h | 229 ++-- 2 files changed, 58 insertions(+), 234 deletions(-) diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c index 0e579ca..8b384fa 100644 --- a/drivers/scsi/hptiop.c +++ b/drivers/scsi/hptiop.c @@ -1,6 +1,6 @@ /* * HighPoint RR3xxx controller driver for Linux - * Copyright (C) 2006 HighPoint Technologies, Inc. All Rights Reserved. + * Copyright (C) 2006-2007 HighPoint Technologies, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,7 +42,7 @@ MODULE_DESCRIPTION("HighPoint RocketRAID 3xxx SATA Controller Driver"); static char driver_name[] = "hptiop"; static const char driver_name_long[] = "RocketRAID 3xxx SATA Controller driver"; -static const char driver_ver[] = "v1.0 (060426)"; +static const char driver_ver[] = "v1.2 (070830)"; static void hptiop_host_request_callback(struct hptiop_hba *hba, u32 tag); static void hptiop_iop_request_callback(struct hptiop_hba *hba, u32 tag); @@ -76,7 +76,7 @@ static int iop_wait_ready(struct hpt_iopmu __iomem *iop, u32 millisec) static void hptiop_request_callback(struct hptiop_hba *hba, u32 tag) { - if ((tag & IOPMU_QUEUE_MASK_HOST_BITS) == IOPMU_QUEUE_ADDR_HOST_BIT) + if (tag & IOPMU_QUEUE_ADDR_HOST_BIT) return hptiop_host_request_callback(hba, tag & ~IOPMU_QUEUE_ADDR_HOST_BIT); else @@ -323,12 +323,22 @@ static inline void free_req(struct hptiop_hba *hba, struct hptiop_request *req) hba->req_list = req; } -static void hptiop_host_request_callback(struct hptiop_hba *hba, u32 tag) +static void hptiop_host_request_callback(struct hptiop_hba *hba, u32 _tag) { struct hpt_iop_request_scsi_command *req; struct scsi_cmnd *scp; + u32 tag; + + if (hba->iopintf_v2) { + tag = _tag & ~ IOPMU_QUEUE_REQUEST_RESULT_BIT; + req = hba->reqs[tag].req_virt; + if (likely(_tag & IOPMU_QUEUE_REQUEST_RESULT_BIT)) + req->header.result = IOP_RESULT_SUCCESS; + } else { + tag = _tag; + req = hba->reqs[tag].req_virt; + } - req = (struct hpt_iop_request_scsi_command *)hba->reqs[tag].req_virt; dprintk("hptiop_host_request_callback: req=%p, type=%d, " "result=%d, context=0x%x tag=%d\n", req, req->header.type, req->header.result, @@ -497,7 +507,7 @@ static int hptiop_queuecommand(struct scsi_cmnd *scp, goto cmd_done; } - req = (struct hpt_iop_request_scsi_command *)_req->req_virt; + req = _req->req_virt; /* build S/G table */ sg_count = hptiop_buildsgl(scp, req->sg_list); @@ -521,8 +531,19 @@ static int hptiop_queuecommand(struct scsi_cmnd *scp, memcpy(req->cdb, scp->cmnd, sizeof(req->cdb)); - writel(IOPMU_QUEUE_ADDR_HOST_BIT | _req->req_shifted_phy, - &hba->iop->inbound_queue); + if (hba->iopintf_v2) { + u32 size_bits; + if (req->header.size < 256) + size_bits = IOPMU_QUEUE_REQUEST_SIZE_BIT; + else if (req->header.size < 512) + size_bits = IOPMU_QUEUE_ADDR_HOST_BIT; + else + size_bits = IOPMU_QUEUE_REQUEST_SIZE_BIT | + IOPMU_QUEUE_ADDR_HOST_BIT; + writel(_req->req_shifted_phy | size_bits, &hba->iop->inbound_queue); + } else + writel(_req->req_shifted_phy | IOPMU_QUEUE_ADDR_HOST_BIT, + &hba->iop->inbound_queue); return 0; @@ -688,6 +709,7 @@ static int __devinit hptiop_probe(struct pci_dev *pcidev, hba->pcidev = pcidev; hba->host = host; hba->initialized = 0; + hba->iopint
[SCSI] aacraid: Add documentation for new Adaptec, SMC and SUN cards
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c0d9a413a59024e27298c39c2df30eb6076437b8 Commit: c0d9a413a59024e27298c39c2df30eb6076437b8 Parent: db9b6e89ea8dc3f32dea1125c672de1a9710be7c Author: Salyzyn, Mark <[EMAIL PROTECTED]> AuthorDate: Tue Sep 4 12:55:47 2007 -0400 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:46:43 2007 -0400 [SCSI] aacraid: Add documentation for new Adaptec, SMC and SUN cards Add the SMC LP, SUN EM and Adaptec 5405 cards to the aacraid documentation list of supported products. These cards are picked up with family match, so no associated code changes. Signed-off-by: Mark Salyzyn <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- Documentation/scsi/aacraid.txt |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Documentation/scsi/aacraid.txt b/Documentation/scsi/aacraid.txt index cc12b55..a825784 100644 --- a/Documentation/scsi/aacraid.txt +++ b/Documentation/scsi/aacraid.txt @@ -38,10 +38,8 @@ Supported Cards/Chipsets 9005:0286:9005:02ac Adaptec 1800 (Typhoon44) 9005:0285:9005:02b5 Adaptec 5445 (Voodoo44) 9005:0285:15d9:02b5 SMC AOC-USAS-S4i - 9005:0285:15d9:02c9 SMC AOC-USAS-S4iR 9005:0285:9005:02b6 Adaptec 5805 (Voodoo80) 9005:0285:15d9:02b6 SMC AOC-USAS-S8i - 9005:0285:15d9:02ca SMC AOC-USAS-S8iR 9005:0285:9005:02b7 Adaptec 5085 (Voodoo08) 9005:0285:9005:02bb Adaptec 3405 (Marauder40LP) 9005:0285:9005:02bc Adaptec 3805 (Marauder80LP) @@ -50,9 +48,14 @@ Supported Cards/Chipsets 9005:0285:9005:02be Adaptec 31605 (Marauder160) 9005:0285:9005:02c3 Adaptec 51205 (Voodoo120) 9005:0285:9005:02c4 Adaptec 51605 (Voodoo160) + 9005:0285:15d9:02c9 SMC AOC-USAS-S4iR + 9005:0285:15d9:02ca SMC AOC-USAS-S8iR 9005:0285:9005:02ce Adaptec 51245 (Voodoo124) 9005:0285:9005:02cf Adaptec 51645 (Voodoo164) 9005:0285:9005:02d0 Adaptec 52445 (Voodoo244) + 9005:0285:9005:02d1 Adaptec 5405 (Voodoo40) + 9005:0285:15d9:02d2 SMC AOC-USAS-S8i-LP + 9005:0285:15d9:02d3 SMC AOC-USAS-S8iR-LP 1011:0046:9005:0364 Adaptec 5400S (Mustang) 9005:0287:9005:0800 Adaptec Themisto (Jupiter) 9005:0200:9005:0200 Adaptec Themisto (Jupiter) @@ -103,6 +106,7 @@ Supported Cards/Chipsets 9005:0285:108e:7aac SUN STK RAID REM (Voodoo44 Coyote) 9005:0285:108e:0286 SUN STK RAID INT (Cougar) 9005:0285:108e:0287 SUN STK RAID EXT (Prometheus) + 9005:0285:108e:7aae SUN STK RAID EM (Narvi) People - - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] aic94xx: Add new PCI ID for ASC58300
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f9755bea9c44aaeae4d7f76e0cd86dfbbd5dfe12 Commit: f9755bea9c44aaeae4d7f76e0cd86dfbbd5dfe12 Parent: c0d9a413a59024e27298c39c2df30eb6076437b8 Author: Gilbert Wu <[EMAIL PROTECTED]> AuthorDate: Wed Sep 5 16:04:29 2007 -0700 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:46:47 2007 -0400 [SCSI] aic94xx: Add new PCI ID for ASC58300 Add new HBA PCI ID (0x416) for ASC58300 which has eight port SAS and SATA PCI-X 133MHz low profile host bus adapter with two mini SAS 4x external connectors. Signed-off-by: Gilbert Wu <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/aic94xx/aic94xx_hwi.h | 12 drivers/scsi/aic94xx/aic94xx_init.c | 25 + 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.h b/drivers/scsi/aic94xx/aic94xx_hwi.h index c6c3d18..491e5d8 100644 --- a/drivers/scsi/aic94xx/aic94xx_hwi.h +++ b/drivers/scsi/aic94xx/aic94xx_hwi.h @@ -40,18 +40,6 @@ #define ASD_MAX_PHYS 8 #define ASD_PCBA_SN_SIZE 12 -/* Those are to be further named properly, the "RAZORx" part, and - * subsequently included in include/linux/pci_ids.h. - */ -#define PCI_DEVICE_ID_ADAPTEC2_RAZOR10 0x410 -#define PCI_DEVICE_ID_ADAPTEC2_RAZOR12 0x412 -#define PCI_DEVICE_ID_ADAPTEC2_RAZOR1E 0x41E -#define PCI_DEVICE_ID_ADAPTEC2_RAZOR1F 0x41F -#define PCI_DEVICE_ID_ADAPTEC2_RAZOR30 0x430 -#define PCI_DEVICE_ID_ADAPTEC2_RAZOR32 0x432 -#define PCI_DEVICE_ID_ADAPTEC2_RAZOR3E 0x43E -#define PCI_DEVICE_ID_ADAPTEC2_RAZOR3F 0x43F - struct asd_ha_addrspace { void __iomem *addr; unsigned long start; /* pci resource start */ diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c index 63bcde2..63d1045 100644 --- a/drivers/scsi/aic94xx/aic94xx_init.c +++ b/drivers/scsi/aic94xx/aic94xx_init.c @@ -829,22 +829,15 @@ static struct sas_domain_function_template aic94xx_transport_functions = { }; static const struct pci_device_id aic94xx_pci_table[] __devinitdata = { - {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_RAZOR10), -0, 0, 1}, - {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_RAZOR12), -0, 0, 1}, - {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_RAZOR1E), -0, 0, 1}, - {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_RAZOR1F), -0, 0, 1}, - {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_RAZOR30), -0, 0, 2}, - {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_RAZOR32), -0, 0, 2}, - {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_RAZOR3E), -0, 0, 2}, - {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_RAZOR3F), -0, 0, 2}, + {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x410),0, 0, 1}, + {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x412),0, 0, 1}, + {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x416),0, 0, 1}, + {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x41E),0, 0, 1}, + {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x41F),0, 0, 1}, + {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x430),0, 0, 2}, + {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x432),0, 0, 2}, + {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x43E),0, 0, 2}, + {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x43F),0, 0, 2}, {} }; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] tgt: fix can_queue bug
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8184fe9b6e8928c8d5be3e2a1326b8b9183e409d Commit: 8184fe9b6e8928c8d5be3e2a1326b8b9183e409d Parent: f9755bea9c44aaeae4d7f76e0cd86dfbbd5dfe12 Author: FUJITA Tomonori <[EMAIL PROTECTED]> AuthorDate: Sat Sep 1 02:02:16 2007 +0900 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:46:51 2007 -0400 [SCSI] tgt: fix can_queue bug should use host->can_queue instead of host->hostt->can_queue. Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]> Signed-off-by: Mike Christie <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/scsi_tgt_lib.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/scsi_tgt_lib.c b/drivers/scsi/scsi_tgt_lib.c index 5851c8e..66c692f 100644 --- a/drivers/scsi/scsi_tgt_lib.c +++ b/drivers/scsi/scsi_tgt_lib.c @@ -237,7 +237,7 @@ int scsi_tgt_alloc_queue(struct Scsi_Host *shost) * command as is recvd to userspace. uspace can then make * sure we do not overload the HBA */ - q->nr_requests = shost->hostt->can_queue; + q->nr_requests = shost->can_queue; /* * We currently only support software LLDs so this does * not matter for now. Do we need this for the cards we support? - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] add supported_mode and active_mode attributes to the host
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5dc2b89e124251662f580f4ba3c9f6195d1eaff6 Commit: 5dc2b89e124251662f580f4ba3c9f6195d1eaff6 Parent: 8184fe9b6e8928c8d5be3e2a1326b8b9183e409d Author: FUJITA Tomonori <[EMAIL PROTECTED]> AuthorDate: Sat Sep 1 02:02:20 2007 +0900 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:46:55 2007 -0400 [SCSI] add supported_mode and active_mode attributes to the host This adds supported_mode and active_mode attributes to /sys/class/sys_host/hostX/ for specifying the mode that a lld supports and the currently activated mode. The output format is similar to fc rport roles: luce:/sys/class/scsi_host/host0$ cat supported_mode Initiator luce:/sys/class/scsi_host/host0$ cat active_mode Initiator The mode values uses bitmap since we would support dual-mode llds in the future like this: luce:/sys/class/scsi_host/host0$ cat supported_mode Initiator, Target The supported_mode attribute looks at a scsi_host_template and the active_mode attribute looks at a scsi_host. We would add a hook to a scsi_host_template to change the active_mode attribute dynamically. But now there is no hook since no lld supports that feature. Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]> Signed-off-by: Mike Christie <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/hosts.c |1 + drivers/scsi/scsi_sysfs.c | 42 ++ include/scsi/scsi_host.h |9 + 3 files changed, 52 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 96bc312..adc9559 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -342,6 +342,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) shost->unchecked_isa_dma = sht->unchecked_isa_dma; shost->use_clustering = sht->use_clustering; shost->ordered_tag = sht->ordered_tag; + shost->active_mode = sht->supported_mode; if (sht->max_host_blocked) shost->max_host_blocked = sht->max_host_blocked; diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 34cdce6..a3d227f 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -190,6 +190,46 @@ show_shost_state(struct class_device *class_dev, char *buf) static CLASS_DEVICE_ATTR(state, S_IRUGO | S_IWUSR, show_shost_state, store_shost_state); +static ssize_t +show_shost_mode(unsigned int mode, char *buf) +{ + ssize_t len = 0; + + if (mode & MODE_INITIATOR) + len = sprintf(buf, "%s", "Initiator"); + + if (mode & MODE_TARGET) + len += sprintf(buf + len, "%s%s", len ? ", " : "", "Target"); + + len += sprintf(buf + len, "\n"); + + return len; +} + +static ssize_t show_shost_supported_mode(struct class_device *class_dev, char *buf) +{ + struct Scsi_Host *shost = class_to_shost(class_dev); + + if (shost->hostt->supported_mode == MODE_UNKNOWN) + return snprintf(buf, 20, "unknown\n"); + else + return show_shost_mode(shost->hostt->supported_mode, buf); +} + +static CLASS_DEVICE_ATTR(supported_mode, S_IRUGO | S_IWUSR, show_shost_supported_mode, NULL); + +static ssize_t show_shost_active_mode(struct class_device *class_dev, char *buf) +{ + struct Scsi_Host *shost = class_to_shost(class_dev); + + if (shost->active_mode == MODE_UNKNOWN) + return snprintf(buf, 20, "unknown\n"); + else + return show_shost_mode(shost->active_mode, buf); +} + +static CLASS_DEVICE_ATTR(active_mode, S_IRUGO | S_IWUSR, show_shost_active_mode, NULL); + shost_rd_attr(unique_id, "%u\n"); shost_rd_attr(host_busy, "%hu\n"); shost_rd_attr(cmd_per_lun, "%hd\n"); @@ -208,6 +248,8 @@ static struct class_device_attribute *scsi_sysfs_shost_attrs[] = { &class_device_attr_proc_name, &class_device_attr_scan, &class_device_attr_state, + &class_device_attr_supported_mode, + &class_device_attr_active_mode, NULL }; diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 88f6871..5b79697 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -32,6 +32,9 @@ struct blk_queue_tags; #define SG_NONE 0 #define SG_ALL 0xff +#define MODE_UNKNOWN 0x00 +#define MODE_INITIATOR 0x01 +#define MODE_TARGET 0x02 #define DISABLE_CLUSTERING 0 #define ENABLE_CLUSTERING 1 @@ -405,6 +408,11 @@ struct scsi_host_template { unsigned char present; /* +* This specifies the mode that a LLD supports. +*/ + unsigned supported_mode:2; + + /* * true if this host adapter uses unchecked DMA onto an ISA bus. */ unsigned unchecked_isa_dma:1; @@ -574,6 +582,7 @@ st
[SCSI] mpt fusion: Use menuconfig objects
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1d9a3d06511751f02d9767de3e4d28d4dafc63b3 Commit: 1d9a3d06511751f02d9767de3e4d28d4dafc63b3 Parent: 72e39ea7e03d0685945d177dc8cb8fe633ca9400 Author: Jan Engelhardt <[EMAIL PROTECTED]> AuthorDate: Fri Aug 10 14:50:37 2007 -0700 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:47:05 2007 -0400 [SCSI] mpt fusion: Use menuconfig objects Change Kconfig objects from "menu, config" into "menuconfig" so that the user can disable the whole feature without having to enter the menu first. Signed-off-by: Jan Engelhardt <[EMAIL PROTECTED]> Acked-by: "Moore, Eric Dean" <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/message/fusion/Kconfig | 19 ++- 1 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/message/fusion/Kconfig b/drivers/message/fusion/Kconfig index 3c44a2f..9b87c2f 100644 --- a/drivers/message/fusion/Kconfig +++ b/drivers/message/fusion/Kconfig @@ -1,15 +1,19 @@ -menu "Fusion MPT device support" +menuconfig FUSION + bool "Fusion MPT device support" depends on PCI + ---help--- + Say Y here to get to see options for Fusion Message + Passing Technology (MPT) drivers. + This option alone does not add any kernel code. + + If you say N, all options in this submenu will be skipped and disabled. -config FUSION - bool - default n +if FUSION config FUSION_SPI tristate "Fusion MPT ScsiHost drivers for SPI" depends on PCI && SCSI - select FUSION select SCSI_SPI_ATTRS ---help--- SCSI HOST support for a parallel SCSI host adapters. @@ -25,7 +29,6 @@ config FUSION_SPI config FUSION_FC tristate "Fusion MPT ScsiHost drivers for FC" depends on PCI && SCSI - select FUSION select SCSI_FC_ATTRS ---help--- SCSI HOST support for a Fiber Channel host adapters. @@ -43,7 +46,6 @@ config FUSION_FC config FUSION_SAS tristate "Fusion MPT ScsiHost drivers for SAS" depends on PCI && SCSI - select FUSION select SCSI_SAS_ATTRS ---help--- SCSI HOST support for a SAS host adapters. @@ -57,7 +59,6 @@ config FUSION_SAS config FUSION_MAX_SGE int "Maximum number of scatter gather entries (16 - 128)" - depends on FUSION default "128" range 16 128 help @@ -117,4 +118,4 @@ config FUSION_LOGGING There are various debug levels that an be found in the source: file:drivers/message/fusion/mptdebug.h -endmenu +endif # FUSION - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] mpt fusion: mostly kmalloc + memset conversion to kzalloc
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d7383a234626b58dc6bc210ed806a6911c1f44e1 Commit: d7383a234626b58dc6bc210ed806a6911c1f44e1 Parent: 1d9a3d06511751f02d9767de3e4d28d4dafc63b3 Author: Mariusz Kozlowski <[EMAIL PROTECTED]> AuthorDate: Fri Aug 10 14:50:50 2007 -0700 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:47:10 2007 -0400 [SCSI] mpt fusion: mostly kmalloc + memset conversion to kzalloc This patch does kmalloc + memset conversion to kzalloc anSigned-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]> d simplifies mptctl_probe(). drivers/message/fusion/mptctl.c | 82092 -> 81884 (-208 bytes) drivers/message/fusion/mptctl.o | 201784 -> 200648 (-1136 bytes) Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]> Acked-by: "Moore, Eric Dean" <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/message/fusion/mptctl.c | 36 1 files changed, 12 insertions(+), 24 deletions(-) diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index b9618f4..12dfa2e 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c @@ -977,10 +977,9 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, int sge_offset, int *frags, * structures for the SG elements. */ i = MAX_SGL_BYTES / 8; - buflist = kmalloc(i, GFP_USER); - if (buflist == NULL) + buflist = kzalloc(i, GFP_USER); + if (!buflist) return NULL; - memset(buflist, 0, i); buflist_ent = 0; /* Allocate a single block of memory to store the sg elements and @@ -1379,13 +1378,12 @@ mptctl_gettargetinfo (unsigned long arg) * 15- 8: Bus Number * 7- 0: Target ID */ - pmem = kmalloc(numBytes, GFP_KERNEL); - if (pmem == NULL) { + pmem = kzalloc(numBytes, GFP_KERNEL); + if (!pmem) { printk(KERN_ERR "%s::mptctl_gettargetinfo() @%d - no memory available!\n", __FILE__, __LINE__); return -ENOMEM; } - memset(pmem, 0, numBytes); pdata = (int *) pmem; /* Get number of devices @@ -1570,12 +1568,11 @@ mptctl_eventenable (unsigned long arg) /* Have not yet allocated memory - do so now. */ int sz = MPTCTL_EVENT_LOG_SIZE * sizeof(MPT_IOCTL_EVENTS); - ioc->events = kmalloc(sz, GFP_KERNEL); - if (ioc->events == NULL) { + ioc->events = kzalloc(sz, GFP_KERNEL); + if (!ioc->events) { printk(KERN_ERR MYNAM ": ERROR - Insufficient memory to add adapter!\n"); return -ENOMEM; } - memset(ioc->events, 0, sz); ioc->alloc_total += sz; ioc->eventContext = 0; @@ -2865,31 +2862,22 @@ static long compat_mpctl_ioctl(struct file *f, unsigned int cmd, unsigned long a static int mptctl_probe(struct pci_dev *pdev, const struct pci_device_id *id) { - int err; - int sz; - u8 *mem; + MPT_IOCTL *mem; MPT_ADAPTER *ioc = pci_get_drvdata(pdev); /* * Allocate and inite a MPT_IOCTL structure */ - sz = sizeof (MPT_IOCTL); - mem = kmalloc(sz, GFP_KERNEL); - if (mem == NULL) { - err = -ENOMEM; - goto out_fail; + mem = kzalloc(sizeof(MPT_IOCTL), GFP_KERNEL); + if (!mem) { + mptctl_remove(pdev); + return -ENOMEM; } - memset(mem, 0, sz); - ioc->ioctl = (MPT_IOCTL *) mem; + ioc->ioctl = mem; ioc->ioctl->ioc = ioc; mutex_init(&ioc->ioctl->ioctl_mutex); return 0; - -out_fail: - - mptctl_remove(pdev); - return err; } /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] mpt fusion: remove redundant memset
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=82d1ce505d1a77a03acb9d22240ef5a63a18b653 Commit: 82d1ce505d1a77a03acb9d22240ef5a63a18b653 Parent: 568761955ad01c6d238d8b12d21a554c1226a37b Author: Mariusz Kozlowski <[EMAIL PROTECTED]> AuthorDate: Fri Aug 10 14:50:53 2007 -0700 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:47:17 2007 -0400 [SCSI] mpt fusion: remove redundant memset alloc_fcdev() calls alloc_netdev() which uses kzalloc to alloc all the memory together with dev->priv region hence no zeroing of structs inside struct mpt_lan_priv needed. Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]> Acked-by: "Moore, Eric Dean" <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/message/fusion/mptlan.c |8 +++- 1 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/message/fusion/mptlan.c b/drivers/message/fusion/mptlan.c index 952e148..b550471 100644 --- a/drivers/message/fusion/mptlan.c +++ b/drivers/message/fusion/mptlan.c @@ -1345,10 +1345,11 @@ mpt_lan_post_receive_buckets_work(struct work_struct *work) static struct net_device * mpt_register_lan_device (MPT_ADAPTER *mpt_dev, int pnum) { - struct net_device *dev = alloc_fcdev(sizeof(struct mpt_lan_priv)); - struct mpt_lan_priv *priv = NULL; + struct net_device *dev; + struct mpt_lan_priv *priv; u8 HWaddr[FC_ALEN], *a; + dev = alloc_fcdev(sizeof(struct mpt_lan_priv)); if (!dev) return NULL; @@ -1360,7 +1361,6 @@ mpt_register_lan_device (MPT_ADAPTER *mpt_dev, int pnum) priv->mpt_dev = mpt_dev; priv->pnum = pnum; - memset(&priv->post_buckets_task, 0, sizeof(priv->post_buckets_task)); INIT_DELAYED_WORK(&priv->post_buckets_task, mpt_lan_post_receive_buckets_work); priv->post_buckets_active = 0; @@ -1385,8 +1385,6 @@ mpt_register_lan_device (MPT_ADAPTER *mpt_dev, int pnum) spin_lock_init(&priv->txfidx_lock); spin_lock_init(&priv->rxfidx_lock); - memset(&priv->stats, 0, sizeof(priv->stats)); - /* Grab pre-fetched LANPage1 stuff. :-) */ a = (u8 *) &mpt_dev->lan_cnfg_page1.HardwareAddressLow; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] mpt fusion: fix two potential mem leaks
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=568761955ad01c6d238d8b12d21a554c1226a37b Commit: 568761955ad01c6d238d8b12d21a554c1226a37b Parent: d7383a234626b58dc6bc210ed806a6911c1f44e1 Author: Jesper Juhl <[EMAIL PROTECTED]> AuthorDate: Fri Aug 10 14:50:51 2007 -0700 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:47:13 2007 -0400 [SCSI] mpt fusion: fix two potential mem leaks The Coverity checker spotted two potential memory leaks in drivers/message/fusion/mptbase.c::mpt_attach(). There are two returns that may leak the storage allocated for 'ioc' (sizeof(MPT_ADAPTER) bytes). A simple fix would be to simply add two kfree() calls before the return statements, but a better fix (that this patch implements) is to reorder the code so that if we hit the first return condition we don't have to do the allocation at all and then just add a kfree() call for the second case. Signed-off-by: Jesper Juhl <[EMAIL PROTECTED]> Acked-by: "Moore, Eric Dean" <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/message/fusion/mptbase.c | 13 +++-- 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 22cb0f8..635defd 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c @@ -1458,18 +1458,18 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) struct proc_dir_entry *dent, *ent; #endif + if (mpt_debug_level) + printk(KERN_INFO MYNAM ": mpt_debug_level=%xh\n", mpt_debug_level); + + if (pci_enable_device(pdev)) + return r; + ioc = kzalloc(sizeof(MPT_ADAPTER), GFP_ATOMIC); if (ioc == NULL) { printk(KERN_ERR MYNAM ": ERROR - Insufficient memory to add adapter!\n"); return -ENOMEM; } - ioc->debug_level = mpt_debug_level; - if (mpt_debug_level) - printk(KERN_INFO MYNAM ": mpt_debug_level=%xh\n", mpt_debug_level); - - if (pci_enable_device(pdev)) - return r; dinitprintk(ioc, printk(KERN_WARNING MYNAM ": mpt_adapter_install\n")); @@ -1478,6 +1478,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) ": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n")); } else if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { printk(KERN_WARNING MYNAM ": 32 BIT PCI BUS DMA ADDRESSING NOT SUPPORTED\n"); + kfree(ioc); return r; } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI] zfcp: whitespace cleanup
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=41fa2adabc0a750a40d6fe86d5ce2f75fb3ad287 Commit: 41fa2adabc0a750a40d6fe86d5ce2f75fb3ad287 Parent: 82d1ce505d1a77a03acb9d22240ef5a63a18b653 Author: Swen Schillig <[EMAIL PROTECTED]> AuthorDate: Fri Sep 7 09:15:31 2007 +0200 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:47:21 2007 -0400 [SCSI] zfcp: whitespace cleanup Cleanup the whitepace from the entire zfcp driver to prevent to have those changes in future feature or function patches. Signed-off-by: Swen Schillig <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/s390/scsi/zfcp_aux.c|4 +- drivers/s390/scsi/zfcp_def.h| 46 ++-- drivers/s390/scsi/zfcp_erp.c| 134 +- drivers/s390/scsi/zfcp_ext.h| 30 drivers/s390/scsi/zfcp_fsf.c| 40 +- drivers/s390/scsi/zfcp_fsf.h| 30 drivers/s390/scsi/zfcp_qdio.c |7 +- drivers/s390/scsi/zfcp_scsi.c | 36 +- drivers/s390/scsi/zfcp_sysfs_unit.c |4 +- 9 files changed, 165 insertions(+), 166 deletions(-) diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index 4a67320..7507067 100644 --- a/drivers/s390/scsi/zfcp_aux.c +++ b/drivers/s390/scsi/zfcp_aux.c @@ -891,7 +891,7 @@ zfcp_unit_dequeue(struct zfcp_unit *unit) /* * Allocates a combined QTCB/fsf_req buffer for erp actions and fcp/SCSI * commands. - * It also genrates fcp-nameserver request/response buffer and unsolicited + * It also genrates fcp-nameserver request/response buffer and unsolicited * status read fsf_req buffers. * * locks: must only be called with zfcp_data.config_sema taken @@ -982,7 +982,7 @@ zfcp_adapter_enqueue(struct ccw_device *ccw_device) struct zfcp_adapter *adapter; /* -* Note: It is safe to release the list_lock, as any list changes +* Note: It is safe to release the list_lock, as any list changes * are protected by the config_sema, which must be held to get here */ diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h index b36dfc4..16e5563 100644 --- a/drivers/s390/scsi/zfcp_def.h +++ b/drivers/s390/scsi/zfcp_def.h @@ -1,23 +1,23 @@ -/* +/* * This file is part of the zfcp device driver for * FCP adapters for IBM System z9 and zSeries. * * (C) Copyright IBM Corp. 2002, 2006 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ #ifndef ZFCP_DEF_H #define ZFCP_DEF_H @@ -90,7 +90,7 @@ zfcp_address_to_sg(void *address, struct scatterlist *list) #define ZFCP_DEVICE_TYPE0x1732 #define ZFCP_DEVICE_MODEL 0x03 #define ZFCP_DEVICE_MODEL_PRIV 0x04 - + /* allow as many chained SBALs as are supported by hardware */ #define ZFCP_MAX_SBALS_PER_REQ FSF_MAX_SBALS_PER_REQ #define ZFCP_MAX_SBALS_PER_CT_REQ FSF_MAX_SBALS_PER_REQ @@ -508,7 +508,7 @@ struct zfcp_rc_entry { /* * this allows removal of logging code by the preprocessor - * (the most detailed log level still to be compiled in is specified, + * (the most detailed log level still to be compiled in is specified, * higher log levels are removed) */ #define ZFCP_LOG_LEVEL_LIMIT ZFCP_LOG_LEVEL_TRACE @@ -546,7 +546,7 @@ do { \ if (ZFCP_LOG_CHECK(level)) \ _ZFCP_LOG(fmt, ##args); \ } while (0) - + #if ZFCP_LOG_LEVEL_LIMIT < ZFCP_LOG_LEVEL_NORMAL # define ZFCP_LOG_NORMAL(fmt, args...) do { } while (0) #else @@ -583,8 +
[SCSI] advansys: Create AdvLoadMicrocode
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b9d9661400dde3fb2027f5da8db600c66d0f876b Commit: b9d9661400dde3fb2027f5da8db600c66d0f876b Parent: a9f4a59a949c5de6313dcf4ebe2f91448c008a37 Author: Matthew Wilcox <[EMAIL PROTECTED]> AuthorDate: Sun Sep 9 08:56:28 2007 -0600 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Fri Oct 12 14:47:33 2007 -0400 [SCSI] advansys: Create AdvLoadMicrocode Split AdvLoadMicrocode out of AdvInitAsc3550Driver, AdvInitAsc38C0800Driver and AdvInitAsc38C1600Driver. Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/advansys.c | 382 +-- 1 files changed, 107 insertions(+), 275 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index c216d6a..0f02f3f 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -12932,6 +12932,78 @@ static void AdvBuildCarrierFreelist(struct adv_dvc_var *asc_dvc) } /* + * Load the Microcode + * + * Write the microcode image to RISC memory starting at address 0. + * + * The microcode is stored compressed in the following format: + * + * 254 word (508 byte) table indexed by byte code followed + * by the following byte codes: + * + *1-Byte Code: + * 00: Emit word 0 in table. + * 01: Emit word 1 in table. + * . + * FD: Emit word 253 in table. + * + *Multi-Byte Code: + * FE WW WW: (3 byte code) Word to emit is the next word WW WW. + * FF BB WW WW: (4 byte code) Emit BB count times next word WW WW. + * + * Returns 0 or an error if the checksum doesn't match + */ +static int AdvLoadMicrocode(AdvPortAddr iop_base, unsigned char *buf, int size, + int memsize, int chksum) +{ + int i, j, end, len = 0; + ADV_DCNT sum; + + AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, 0); + + for (i = 253 * 2; i < size; i++) { + if (buf[i] == 0xff) { + unsigned short word = (buf[i + 3] << 8) | buf[i + 2]; + for (j = 0; j < buf[i + 1]; j++) { + AdvWriteWordAutoIncLram(iop_base, word); + len += 2; + } + i += 3; + } else if (buf[i] == 0xfe) { + unsigned short word = (buf[i + 2] << 8) | buf[i + 1]; + AdvWriteWordAutoIncLram(iop_base, word); + i += 2; + len += 2; + } else { + unsigned char off = buf[i] * 2; + unsigned short word = (buf[off + 1] << 8) | buf[off]; + AdvWriteWordAutoIncLram(iop_base, word); + len += 2; + } + } + + end = len; + + while (len < memsize) { + AdvWriteWordAutoIncLram(iop_base, 0); + len += 2; + } + + /* Verify the microcode checksum. */ + sum = 0; + AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, 0); + + for (len = 0; len < end; len += 2) { + sum += AdvReadWordAutoIncLram(iop_base); + } + + if (sum != chksum) + return ASC_IERR_MCODE_CHKSUM; + + return 0; +} + +/* * Initialize the ASC-3550. * * On failure set the ADV_DVC_VAR field 'err_code' and return ADV_ERROR. @@ -12945,13 +13017,10 @@ static int AdvInitAsc3550Driver(ADV_DVC_VAR *asc_dvc) { AdvPortAddr iop_base; ushort warn_code; - ADV_DCNT sum; int begin_addr; int end_addr; ushort code_sum; int word; - int j; - int adv_asc3550_expanded_size; int i; ushort scsi_cfg1; uchar tid; @@ -12960,15 +13029,14 @@ static int AdvInitAsc3550Driver(ADV_DVC_VAR *asc_dvc) uchar max_cmd[ADV_MAX_TID + 1]; /* If there is already an error, don't continue. */ - if (asc_dvc->err_code != 0) { + if (asc_dvc->err_code != 0) return ADV_ERROR; - } /* * The caller must set 'chip_type' to ADV_CHIP_ASC3550. */ if (asc_dvc->chip_type != ADV_CHIP_ASC3550) { - asc_dvc->err_code |= ASC_IERR_BAD_CHIPTYPE; + asc_dvc->err_code = ASC_IERR_BAD_CHIPTYPE; return ADV_ERROR; } @@ -13012,84 +13080,11 @@ static int AdvInitAsc3550Driver(ADV_DVC_VAR *asc_dvc) max_cmd[tid]); } - /* -* Load the Microcode -* -* Write the microcode image to RISC memory starting at address 0. -*/ - AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, 0); - /* Assume the following compressed format of the microcode buffer: -* -* 254 word (508 byte) table indexed by byte code followed -* by the following by