In order to save ourselves grief with the SUNPRO compiler under

Solaris (which, for reasons unknown to me, chokes on u_int16_t
as a typedef of unsigned short if used in a transitional (mixed K&R
and ANSI) way), we'll go the extra mile and fully ANSIfy things.
This commit is contained in:
mjacob 2001-03-14 04:11:56 +00:00
parent 4a6cbeb932
commit bd35206cf8
3 changed files with 80 additions and 176 deletions

View File

@ -143,8 +143,7 @@ static void isp_parse_nvram_2100 __P((struct ispsoftc *, u_int8_t *));
* Locking done elsewhere.
*/
void
isp_reset(isp)
struct ispsoftc *isp;
isp_reset(struct ispsoftc *isp)
{
mbreg_t mbs;
int loops, i, touched, dodnld = 1;
@ -730,8 +729,7 @@ isp_reset(isp)
*/
void
isp_init(isp)
struct ispsoftc *isp;
isp_init(struct ispsoftc *isp)
{
/*
* Must do this first to get defaults established.
@ -748,8 +746,7 @@ isp_init(isp)
}
static void
isp_scsi_init(isp)
struct ispsoftc *isp;
isp_scsi_init(struct ispsoftc *isp)
{
sdparam *sdp_chan0, *sdp_chan1;
mbreg_t mbs;
@ -913,9 +910,7 @@ isp_scsi_init(isp)
}
static void
isp_scsi_channel_init(isp, channel)
struct ispsoftc *isp;
int channel;
isp_scsi_channel_init(struct ispsoftc *isp, int channel)
{
sdparam *sdp;
mbreg_t mbs;
@ -1018,8 +1013,7 @@ isp_scsi_channel_init(isp, channel)
* Locks are held before coming here.
*/
static void
isp_fibre_init(isp)
struct ispsoftc *isp;
isp_fibre_init(struct ispsoftc *isp)
{
fcparam *fcp;
isp_icb_t *icbp;
@ -1201,9 +1195,7 @@ isp_fibre_init(isp)
*/
static int
isp_getmap(isp, map)
struct ispsoftc *isp;
fcpos_map_t *map;
isp_getmap(struct ispsoftc *isp, fcpos_map_t *map)
{
fcparam *fcp = (fcparam *) isp->isp_param;
mbreg_t mbs;
@ -1231,8 +1223,7 @@ isp_getmap(isp, map)
}
static void
isp_mark_getpdb_all(isp)
struct ispsoftc *isp;
isp_mark_getpdb_all(struct ispsoftc *isp)
{
fcparam *fcp = (fcparam *) isp->isp_param;
int i;
@ -1242,10 +1233,7 @@ isp_mark_getpdb_all(isp)
}
static int
isp_getpdb(isp, id, pdbp)
struct ispsoftc *isp;
int id;
isp_pdb_t *pdbp;
isp_getpdb(struct ispsoftc *isp, int id, isp_pdb_t *pdbp)
{
fcparam *fcp = (fcparam *) isp->isp_param;
mbreg_t mbs;
@ -1272,10 +1260,7 @@ isp_getpdb(isp, id, pdbp)
}
static u_int64_t
isp_get_portname(isp, loopid, nodename)
struct ispsoftc *isp;
int loopid;
int nodename;
isp_get_portname(struct ispsoftc *isp, int loopid, int nodename)
{
u_int64_t wwn = 0;
mbreg_t mbs;
@ -1304,9 +1289,7 @@ isp_get_portname(isp, loopid, nodename)
*/
static int
isp_fclink_test(isp, usdelay)
struct ispsoftc *isp;
int usdelay;
isp_fclink_test(struct ispsoftc *isp, int usdelay)
{
static char *toponames[] = {
"Private Loop",
@ -1357,10 +1340,10 @@ isp_fclink_test(isp, usdelay)
*/
enano = NANOTIME_SUB(&hrb, &hra);
isp_prt(isp, ISP_LOGDEBUG3, "usec%d: 0x%lx->0x%lx enano %lu",
isp_prt(isp, ISP_LOGDEBUG1,
"usec%d: 0x%lx->0x%lx enano 0x%x%08x",
count, (long) GET_NANOSEC(&hra), (long) GET_NANOSEC(&hrb),
(enano > ((u_int64_t)0xffffffff))? 0xffffffff :
(unsigned long) (enano & 0xffffffff));
(u_int32_t)(enano >> 32), (u_int32_t)(enano & 0xffffffff));
/*
* If the elapsed time is less than 1 millisecond,
@ -1379,7 +1362,8 @@ isp_fclink_test(isp, usdelay)
enano -= (u_int64_t) 4000000000U;
}
wrk = enano;
USEC_SLEEP(isp, wrk/1000);
wrk /= 1000;
USEC_SLEEP(isp, wrk);
} else {
while (enano > (u_int64_t) 4000000000U) {
count += 4000000;
@ -1528,8 +1512,7 @@ isp_fclink_test(isp, usdelay)
}
static char *
isp2100_fw_statename(state)
int state;
isp2100_fw_statename(int state)
{
switch(state) {
case FW_CONFIG_WAIT: return "Config Wait";
@ -1550,8 +1533,7 @@ isp2100_fw_statename(state)
*/
static int
isp_pdb_sync(isp)
struct ispsoftc *isp;
isp_pdb_sync(struct ispsoftc *isp)
{
struct lportdb *lp;
fcparam *fcp = isp->isp_param;
@ -1861,8 +1843,7 @@ isp_pdb_sync(isp)
}
static int
isp_scan_loop(isp)
struct ispsoftc *isp;
isp_scan_loop(struct ispsoftc *isp)
{
struct lportdb *lp;
fcparam *fcp = isp->isp_param;
@ -2131,8 +2112,7 @@ isp_scan_loop(isp)
}
static int
isp_scan_fabric(isp)
struct ispsoftc *isp;
isp_scan_fabric(struct ispsoftc *isp)
{
fcparam *fcp = isp->isp_param;
u_int32_t portid, first_portid;
@ -2242,8 +2222,7 @@ isp_register_fc4_type(struct ispsoftc *isp)
*/
int
isp_start(xs)
XS_T *xs;
isp_start(XS_T *xs)
{
struct ispsoftc *isp;
u_int16_t iptr, optr, handle;
@ -2621,10 +2600,7 @@ isp_start(xs)
*/
int
isp_control(isp, ctl, arg)
struct ispsoftc *isp;
ispctl_t ctl;
void *arg;
isp_control(struct ispsoftc *isp, ispctl_t ctl, void *arg)
{
XS_T *xs;
mbreg_t mbs;
@ -2809,8 +2785,7 @@ isp_control(isp, ctl, arg)
#define MAX_REQUESTQ_COMPLETIONS 32
int
isp_intr(arg)
void *arg;
isp_intr(void *arg)
{
struct ispsoftc *isp = arg;
XS_T *complist[MAX_REQUESTQ_COMPLETIONS], *xs;
@ -3193,9 +3168,7 @@ isp_intr(arg)
*/
static int
isp_parse_async(isp, mbox)
struct ispsoftc *isp;
int mbox;
isp_parse_async(struct ispsoftc *isp, int mbox)
{
int bus;
u_int16_t fast_post_handle = 0;
@ -3464,10 +3437,8 @@ isp_parse_async(isp, mbox)
*/
static int
isp_handle_other_response(isp, sp, optrp)
struct ispsoftc *isp;
ispstatusreq_t *sp;
u_int16_t *optrp;
isp_handle_other_response(struct ispsoftc *isp,
ispstatusreq_t *sp, u_int16_t *optrp)
{
switch (sp->req_header.rqs_entry_type) {
case RQSTYPE_STATUS_CONT:
@ -3501,10 +3472,7 @@ isp_handle_other_response(isp, sp, optrp)
}
static void
isp_parse_status(isp, sp, xs)
struct ispsoftc *isp;
ispstatusreq_t *sp;
XS_T *xs;
isp_parse_status(struct ispsoftc *isp, ispstatusreq_t *sp, XS_T *xs)
{
switch (sp->req_completion_status & 0xff) {
case RQCS_COMPLETE:
@ -3836,9 +3804,7 @@ isp_parse_status(isp, sp, xs)
}
static void
isp_fastpost_complete(isp, fph)
struct ispsoftc *isp;
u_int16_t fph;
isp_fastpost_complete(struct ispsoftc *isp, u_int16_t fph)
{
XS_T *xs;
@ -3969,7 +3935,7 @@ static u_int16_t mbpscsi[] = {
ISPOPMAP(0x01, 0x01) /* 0x5d: GET NOST DATA */
};
#ifndef ISP_STRIPEED
#ifndef ISP_STRIPPED
static char *scsi_mbcmd_names[] = {
"NO-OP",
"LOAD RAM",
@ -4331,10 +4297,7 @@ static char *fc_mbcmd_names[] = {
#endif
static void
isp_mboxcmd(isp, mbp, logmask)
struct ispsoftc *isp;
mbreg_t *mbp;
int logmask;
isp_mboxcmd(struct ispsoftc *isp, mbreg_t *mbp, int logmask)
{
char *cname, *xname, tname[16], mname[16];
unsigned int lim, ibits, obits, box, opcode;
@ -4468,8 +4431,7 @@ isp_mboxcmd(isp, mbp, logmask)
}
static void
isp_fw_state(isp)
struct ispsoftc *isp;
isp_fw_state(struct ispsoftc *isp)
{
if (IS_FC(isp)) {
mbreg_t mbs;
@ -4484,8 +4446,7 @@ isp_fw_state(isp)
}
static void
isp_update(isp)
struct ispsoftc *isp;
isp_update(struct ispsoftc *isp)
{
int bus, upmask;
@ -4498,9 +4459,7 @@ isp_update(isp)
}
static void
isp_update_bus(isp, bus)
struct ispsoftc *isp;
int bus;
isp_update_bus(struct ispsoftc *isp, int bus)
{
int tgt;
mbreg_t mbs;
@ -4618,9 +4577,7 @@ isp_update_bus(isp, bus)
}
static void
isp_setdfltparm(isp, channel)
struct ispsoftc *isp;
int channel;
isp_setdfltparm(struct ispsoftc *isp, int channel)
{
int tgt;
mbreg_t mbs;
@ -4880,8 +4837,7 @@ isp_setdfltparm(isp, channel)
*/
void
isp_reinit(isp)
struct ispsoftc *isp;
isp_reinit(struct ispsoftc *isp)
{
XS_T *xs;
u_int16_t handle;
@ -4925,8 +4881,7 @@ isp_reinit(isp)
* NVRAM Routines
*/
static int
isp_read_nvram(isp)
struct ispsoftc *isp;
isp_read_nvram(struct ispsoftc *isp)
{
int i, amt;
u_int8_t csum, minversion;
@ -4999,10 +4954,7 @@ isp_read_nvram(isp)
}
static void
isp_rdnvram_word(isp, wo, rp)
struct ispsoftc *isp;
int wo;
u_int16_t *rp;
isp_rdnvram_word(struct ispsoftc *isp, int wo, u_int16_t *rp)
{
int i, cbits;
u_int16_t bit, rqst;
@ -5065,9 +5017,7 @@ isp_rdnvram_word(isp, wo, rp)
}
static void
isp_parse_nvram_1020(isp, nvram_data)
struct ispsoftc *isp;
u_int8_t *nvram_data;
isp_parse_nvram_1020(struct ispsoftc *isp, u_int8_t *nvram_data)
{
int i;
sdparam *sdp = (sdparam *) isp->isp_param;
@ -5168,10 +5118,7 @@ isp_parse_nvram_1020(isp, nvram_data)
}
static void
isp_parse_nvram_1080(isp, bus, nvram_data)
struct ispsoftc *isp;
int bus;
u_int8_t *nvram_data;
isp_parse_nvram_1080(struct ispsoftc *isp, int bus, u_int8_t *nvram_data)
{
int i;
sdparam *sdp = (sdparam *) isp->isp_param;
@ -5244,10 +5191,7 @@ isp_parse_nvram_1080(isp, bus, nvram_data)
}
static void
isp_parse_nvram_12160(isp, bus, nvram_data)
struct ispsoftc *isp;
int bus;
u_int8_t *nvram_data;
isp_parse_nvram_12160(struct ispsoftc *isp, int bus, u_int8_t *nvram_data)
{
sdparam *sdp = (sdparam *) isp->isp_param;
int i;
@ -5321,9 +5265,7 @@ isp_parse_nvram_12160(isp, bus, nvram_data)
}
static void
isp_parse_nvram_2100(isp, nvram_data)
struct ispsoftc *isp;
u_int8_t *nvram_data;
isp_parse_nvram_2100(struct ispsoftc *isp, u_int8_t *nvram_data)
{
fcparam *fcp = (fcparam *) isp->isp_param;
u_int64_t wwn;

View File

@ -39,29 +39,15 @@
* will be a seed for the last handled allocated.
*/
static INLINE int
isp_save_xs __P((struct ispsoftc *, XS_T *, u_int16_t *));
static INLINE XS_T *
isp_find_xs __P((struct ispsoftc *, u_int16_t));
static INLINE u_int16_t
isp_find_handle __P((struct ispsoftc *, XS_T *));
static INLINE int isp_save_xs(struct ispsoftc *, XS_T *, u_int16_t *);
static INLINE XS_T *isp_find_xs(struct ispsoftc *, u_int16_t);
static INLINE u_int16_t isp_find_handle(struct ispsoftc *, XS_T *);
static INLINE int isp_handle_index(u_int16_t);
static INLINE void isp_destroy_handle(struct ispsoftc *, u_int16_t);
static INLINE void isp_remove_handle(struct ispsoftc *, XS_T *);
static INLINE int
isp_handle_index __P((u_int16_t));
static INLINE void
isp_destroy_handle __P((struct ispsoftc *, u_int16_t));
static INLINE void
isp_remove_handle __P((struct ispsoftc *, XS_T *));
static INLINE int
isp_save_xs(isp, xs, handlep)
struct ispsoftc *isp;
XS_T *xs;
u_int16_t *handlep;
isp_save_xs(struct ispsoftc *isp, XS_T *xs, u_int16_t *handlep)
{
int i, j;
@ -85,9 +71,7 @@ isp_save_xs(isp, xs, handlep)
}
static INLINE XS_T *
isp_find_xs(isp, handle)
struct ispsoftc *isp;
u_int16_t handle;
isp_find_xs(struct ispsoftc *isp, u_int16_t handle)
{
if (handle < 1 || handle > (u_int16_t) isp->isp_maxcmds) {
return (NULL);
@ -97,9 +81,7 @@ isp_find_xs(isp, handle)
}
static INLINE u_int16_t
isp_find_handle(isp, xs)
struct ispsoftc *isp;
XS_T *xs;
isp_find_handle(struct ispsoftc *isp, XS_T *xs)
{
int i;
if (xs != NULL) {
@ -113,16 +95,13 @@ isp_find_handle(isp, xs)
}
static INLINE int
isp_handle_index(handle)
u_int16_t handle;
isp_handle_index(u_int16_t handle)
{
return (handle-1);
}
static INLINE void
isp_destroy_handle(isp, handle)
struct ispsoftc *isp;
u_int16_t handle;
isp_destroy_handle(struct ispsoftc *isp, u_int16_t handle)
{
if (handle > 0 && handle <= (u_int16_t) isp->isp_maxcmds) {
isp->isp_xflist[isp_handle_index(handle)] = NULL;
@ -130,22 +109,17 @@ isp_destroy_handle(isp, handle)
}
static INLINE void
isp_remove_handle(isp, xs)
struct ispsoftc *isp;
XS_T *xs;
isp_remove_handle(struct ispsoftc *isp, XS_T *xs)
{
isp_destroy_handle(isp, isp_find_handle(isp, xs));
}
static INLINE int
isp_getrqentry __P((struct ispsoftc *, u_int16_t *, u_int16_t *, void **));
isp_getrqentry(struct ispsoftc *, u_int16_t *, u_int16_t *, void **);
static INLINE int
isp_getrqentry(isp, iptrp, optrp, resultp)
struct ispsoftc *isp;
u_int16_t *iptrp;
u_int16_t *optrp;
void **resultp;
isp_getrqentry(struct ispsoftc *isp, u_int16_t *iptrp,
u_int16_t *optrp, void **resultp)
{
volatile u_int16_t iptr, optr;
@ -163,17 +137,12 @@ isp_getrqentry(isp, iptrp, optrp, resultp)
return (0);
}
static INLINE void
isp_print_qentry __P((struct ispsoftc *, char *, int, void *));
static INLINE void isp_print_qentry (struct ispsoftc *, char *, int, void *);
#define TBA (4 * (((QENTRY_LEN >> 2) * 3) + 1) + 1)
static INLINE void
isp_print_qentry(isp, msg, idx, arg)
struct ispsoftc *isp;
char *msg;
int idx;
void *arg;
isp_print_qentry(struct ispsoftc *isp, char *msg, int idx, void *arg)
{
char buf[TBA];
int amt, i, j;
@ -190,15 +159,10 @@ isp_print_qentry(isp, msg, idx, arg)
}
}
static INLINE void
isp_print_bytes __P((struct ispsoftc *, char *, int, void *));
static INLINE void isp_print_bytes(struct ispsoftc *, char *, int, void *);
static INLINE void
isp_print_bytes(isp, msg, amt, arg)
struct ispsoftc *isp;
char *msg;
int amt;
void *arg;
isp_print_bytes(struct ispsoftc *isp, char *msg, int amt, void *arg)
{
char buf[128];
u_int8_t *ptr = arg;
@ -237,12 +201,10 @@ isp_print_bytes(isp, msg, amt, arg)
* We assume we enter here with any locks held.
*/
static INLINE int isp_fc_runstate __P((struct ispsoftc *, int));
static INLINE int isp_fc_runstate(struct ispsoftc *, int);
static INLINE int
isp_fc_runstate(isp, tval)
struct ispsoftc *isp;
int tval;
isp_fc_runstate(struct ispsoftc *isp, int tval)
{
fcparam *fcp;
int *tptr;

View File

@ -61,16 +61,16 @@
*/
struct ispsoftc;
struct ispmdvec {
u_int16_t (*dv_rd_reg) __P((struct ispsoftc *, int));
void (*dv_wr_reg) __P((struct ispsoftc *, int, u_int16_t));
int (*dv_mbxdma) __P((struct ispsoftc *));
int (*dv_dmaset) __P((struct ispsoftc *,
XS_T *, ispreq_t *, u_int16_t *, u_int16_t));
u_int16_t (*dv_rd_reg) (struct ispsoftc *, int);
void (*dv_wr_reg) (struct ispsoftc *, int, u_int16_t);
int (*dv_mbxdma) (struct ispsoftc *);
int (*dv_dmaset) (struct ispsoftc *,
XS_T *, ispreq_t *, u_int16_t *, u_int16_t);
void (*dv_dmaclr)
__P((struct ispsoftc *, XS_T *, u_int16_t));
void (*dv_reset0) __P((struct ispsoftc *));
void (*dv_reset1) __P((struct ispsoftc *));
void (*dv_dregs) __P((struct ispsoftc *, const char *));
(struct ispsoftc *, XS_T *, u_int16_t);
void (*dv_reset0) (struct ispsoftc *);
void (*dv_reset1) (struct ispsoftc *);
void (*dv_dregs) (struct ispsoftc *, const char *);
const u_int16_t *dv_ispfw; /* ptr to f/w */
u_int16_t dv_conf1;
u_int16_t dv_clock; /* clock frequency */
@ -499,27 +499,27 @@ typedef struct ispsoftc {
* Reset Hardware. Totally. Assumes that you'll follow this with
* a call to isp_init.
*/
void isp_reset __P((struct ispsoftc *));
void isp_reset(struct ispsoftc *);
/*
* Initialize Hardware to known state
*/
void isp_init __P((struct ispsoftc *));
void isp_init(struct ispsoftc *);
/*
* Reset the ISP and call completion for any orphaned commands.
*/
void isp_reinit __P((struct ispsoftc *));
void isp_reinit(struct ispsoftc *);
/*
* Interrupt Service Routine
*/
int isp_intr __P((void *));
int isp_intr(void *);
/*
* Command Entry Point- Platform Dependent layers call into this
*/
int isp_start __P((XS_T *));
int isp_start(XS_T *);
/* these values are what isp_start returns */
#define CMD_COMPLETE 101 /* command completed */
#define CMD_EAGAIN 102 /* busy- maybe retry later */
@ -529,7 +529,7 @@ int isp_start __P((XS_T *));
/*
* Command Completion Point- Core layers call out from this with completed cmds
*/
void isp_done __P((XS_T *));
void isp_done(XS_T *);
/*
* Platform Dependent to External to Internal Control Function
@ -579,7 +579,7 @@ typedef enum {
ISPCTL_RUN_MBOXCMD, /* run a mailbox command */
ISPCTL_TOGGLE_TMODE /* toggle target mode */
} ispctl_t;
int isp_control __P((struct ispsoftc *, ispctl_t, void *));
int isp_control(struct ispsoftc *, ispctl_t, void *);
/*
@ -637,7 +637,7 @@ typedef enum {
ISPASYNC_CONF_CHANGE, /* Platform Configuration Change */
ISPASYNC_UNHANDLED_RESPONSE /* Unhandled Response Entry */
} ispasync_t;
int isp_async __P((struct ispsoftc *, ispasync_t, void *));
int isp_async(struct ispsoftc *, ispasync_t, void *);
#define ISPASYNC_CHANGE_PDB ((void *) 0)
#define ISPASYNC_CHANGE_SNS ((void *) 1)
@ -647,10 +647,10 @@ int isp_async __P((struct ispsoftc *, ispasync_t, void *));
* Platform Dependent Error and Debug Printout
*/
#ifdef __GNUC__
void isp_prt __P((struct ispsoftc *, int level, const char *, ...))
void isp_prt(struct ispsoftc *, int level, const char *, ...)
__attribute__((__format__(__printf__,3,4)));
#else
void isp_prt __P((struct ispsoftc *, int level, const char *, ...));
void isp_prt(struct ispsoftc *, int level, const char *, ...);
#endif
#define ISP_LOGALL 0x0 /* log always */