tws: clean up empty lines in .c and .h files

This commit is contained in:
Mateusz Guzik 2020-09-01 21:31:38 +00:00
parent 068dbf361a
commit 8644bfdbfa
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=365092
9 changed files with 3 additions and 104 deletions

View File

@ -49,8 +49,6 @@ int tws_queue_depth = TWS_MAX_REQS;
int tws_enable_msi = 0;
int tws_enable_msix = 0;
/* externs */
extern int tws_cam_attach(struct tws_softc *sc);
extern void tws_cam_detach(struct tws_softc *sc);
@ -68,15 +66,12 @@ extern boolean tws_ctlr_reset(struct tws_softc *sc);
extern void tws_intr(void *arg);
extern int tws_use_32bit_sgls;
struct tws_request *tws_get_request(struct tws_softc *sc, u_int16_t type);
int tws_init_connect(struct tws_softc *sc, u_int16_t mc);
void tws_send_event(struct tws_softc *sc, u_int8_t event);
uint8_t tws_get_state(struct tws_softc *sc);
void tws_release_request(struct tws_request *req);
/* Function prototypes */
static d_open_t tws_open;
static d_close_t tws_close;
@ -95,7 +90,6 @@ static int tws_setup_irq(struct tws_softc *sc);
int tws_setup_intr(struct tws_softc *sc, int irqs);
int tws_teardown_intr(struct tws_softc *sc);
/* Character device entry points */
static struct cdevsw tws_cdevsw = {
@ -209,7 +203,6 @@ tws_attach(device_t dev)
tws_send_event(sc, TWS_INIT_START);
mtx_unlock(&sc->gen_lock);
#if _BYTE_ORDER == _BIG_ENDIAN
TWS_TRACE(sc, "BIG endian", 0, 0);
#endif
@ -233,7 +226,7 @@ tws_attach(device_t dev)
bar = pci_read_config(dev, TWS_PCI_BAR1, 4);
bar = bar & ~TWS_BIT2;
TWS_TRACE_DEBUG(sc, "bar1 ", bar, 0);
/* MFA base address is BAR2 register used for
* push mode. Firmware will evatualy move to
* pull mode during witch this needs to change
@ -455,7 +448,6 @@ tws_setup_intr(struct tws_softc *sc, int irqs)
}
int
tws_teardown_intr(struct tws_softc *sc)
{
@ -471,7 +463,6 @@ tws_teardown_intr(struct tws_softc *sc)
return(SUCCESS);
}
static int
tws_setup_irq(struct tws_softc *sc)
{
@ -506,7 +497,6 @@ tws_setup_irq(struct tws_softc *sc)
return(FAILURE);
device_printf(sc->tws_dev, "Using MSI\n");
break;
}
return(SUCCESS);
@ -727,7 +717,6 @@ tws_send_event(struct tws_softc *sc, u_int8_t event)
mtx_assert(&sc->gen_lock, MA_OWNED);
TWS_TRACE_DEBUG(sc, "received event ", 0, event);
switch (event) {
case TWS_INIT_START:
sc->tws_state = TWS_INIT;
break;
@ -826,7 +815,6 @@ tws_resume(device_t dev)
return (0);
}
struct tws_request *
tws_get_request(struct tws_softc *sc, u_int16_t type)
{
@ -893,7 +881,6 @@ static driver_t tws_driver = {
sizeof(struct tws_softc)
};
static devclass_t tws_devclass;
/* DEFINE_CLASS_0(tws, tws_driver, tws_methods, sizeof(struct tws_softc)); */

View File

@ -60,14 +60,12 @@
#include <sys/sysctl.h>
#include <sys/stat.h>
#define TWS_PULL_MODE_ENABLE 1
MALLOC_DECLARE(M_TWS);
/* externs */
extern int tws_queue_depth;
#define TWS_DRIVER_VERSION_STRING "10.80.00.005"
#define TWS_MAX_NUM_UNITS 65
#define TWS_MAX_NUM_LUNS 32
@ -142,7 +140,7 @@ enum tws_req_flags {
TWS_DIR_NONE = 0x8,
TWS_DATA_CCB = 0x10,
};
enum tws_intrs {
TWS_INTx,
TWS_MSI,
@ -160,7 +158,6 @@ struct tws_ioctl_lock {
u_int32_t lock;
time_t timeout;
};
#define TWS_TRACE_FNAME_LEN 10
#define TWS_TRACE_FUNC_LEN 15
@ -182,8 +179,6 @@ struct tws_circular_q {
u_int8_t overflow;
void * q;
};
struct tws_stats {
u_int64_t reqs_in;
@ -206,7 +201,6 @@ struct tws_init_connect_info {
};
/* ------------ boolean types ------------------- */
#ifndef __bool_true_false_are_defined

View File

@ -50,8 +50,6 @@ static void tws_action(struct cam_sim *sim, union ccb *ccb);
static void tws_poll(struct cam_sim *sim);
static void tws_scsi_complete(struct tws_request *req);
void tws_unmap_request(struct tws_softc *sc, struct tws_request *req);
int32_t tws_map_request(struct tws_softc *sc, struct tws_request *req);
int tws_bus_scan(struct tws_softc *sc);
@ -73,7 +71,6 @@ static void tws_scsi_err_complete(struct tws_request *req,
static void tws_passthru_err_complete(struct tws_request *req,
struct tws_command_header *hdr);
void tws_timeout(void *arg);
static void tws_intr_attn_aen(struct tws_softc *sc);
static void tws_intr_attn_error(struct tws_softc *sc);
@ -88,7 +85,6 @@ int tws_set_param(struct tws_softc *sc, u_int32_t table_id, u_int32_t param_id,
int tws_get_param(struct tws_softc *sc, u_int32_t table_id, u_int32_t param_id,
u_int32_t param_size, void *data);
extern struct tws_request *tws_get_request(struct tws_softc *sc,
u_int16_t type);
extern void *tws_release_request(struct tws_request *req);
@ -126,8 +122,6 @@ extern u_int16_t tws_poll4_response(struct tws_softc *sc, u_int64_t *mfa);
extern int tws_setup_intr(struct tws_softc *sc, int irqs);
extern int tws_teardown_intr(struct tws_softc *sc);
int
tws_cam_attach(struct tws_softc *sc)
{
@ -233,7 +227,6 @@ tws_action(struct cam_sim *sim, union ccb *ccb)
{
struct tws_softc *sc = (struct tws_softc *)cam_sim_softc(sim);
switch( ccb->ccb_h.func_code ) {
case XPT_SCSI_IO:
{
@ -335,7 +328,6 @@ tws_scsi_complete(struct tws_request *req)
callout_stop(&req->timeout);
tws_unmap_request(req->sc, req);
req->ccb_ptr->ccb_h.status = CAM_REQ_CMP;
mtx_lock(&sc->sim_lock);
xpt_done(req->ccb_ptr);
@ -426,7 +418,6 @@ tws_aen_complete(struct tws_request *req)
sc->seq_id++;
mtx_unlock(&sc->gen_lock);
break;
}
free(req->data, M_TWS);
@ -516,7 +507,6 @@ tws_scsi_err_complete(struct tws_request *req, struct tws_command_header *hdr)
req->cmd_pkt->cmd.pkt_a.status);
if ( hdr->status_block.error == TWS_ERROR_LOGICAL_UNIT_NOT_SUPPORTED ||
hdr->status_block.error == TWS_ERROR_UNIT_OFFLINE ) {
if ( ccb->ccb_h.target_lun ) {
TWS_TRACE_DEBUG(sc, "invalid lun error",0,0);
ccb->ccb_h.status |= CAM_DEV_NOT_THERE;
@ -546,7 +536,7 @@ tws_scsi_err_complete(struct tws_request *req, struct tws_command_header *hdr)
ccb->ccb_h.status |= CAM_AUTOSNS_VALID;
}
ccb->csio.scsi_status = req->cmd_pkt->cmd.pkt_a.status;
ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
mtx_lock(&sc->sim_lock);
xpt_done(ccb);
@ -604,7 +594,6 @@ tws_drain_busy_queue(struct tws_softc *sc)
}
}
static void
tws_drain_reserved_reqs(struct tws_softc *sc)
{
@ -645,7 +634,6 @@ tws_drain_response_queue(struct tws_softc *sc)
while ( tws_get_response(sc, &req_id, &mfa) );
}
static int32_t
tws_execute_scsi(struct tws_softc *sc, union ccb *ccb)
{
@ -744,7 +732,6 @@ tws_execute_scsi(struct tws_softc *sc, union ccb *ccb)
return(error);
}
int
tws_send_scsi_cmd(struct tws_softc *sc, int cmd)
{
@ -842,7 +829,6 @@ tws_get_param(struct tws_softc *sc, u_int32_t table_id, u_int32_t param_id,
u_int64_t mfa;
int error = SUCCESS;
req = tws_get_request(sc, TWS_REQ_TYPE_GETSET_PARAM);
if ( req == NULL ) {
TWS_TRACE_DEBUG(sc, "null req", 0, 0);
@ -912,7 +898,6 @@ tws_map_request(struct tws_softc *sc, struct tws_request *req)
{
int32_t error = 0;
/* If the command involves data, map that too. */
if (req->data != NULL) {
int my_flags = ((req->type == TWS_REQ_TYPE_SCSI_IO) ? BUS_DMA_WAITOK : BUS_DMA_NOWAIT);
@ -944,7 +929,6 @@ tws_map_request(struct tws_softc *sc, struct tws_request *req)
return(error);
}
static void
tws_dmamap_data_load_cbfn(void *arg, bus_dma_segment_t *segs,
int nseg, int error)
@ -955,7 +939,6 @@ tws_dmamap_data_load_cbfn(void *arg, bus_dma_segment_t *segs,
void *sgl_ptr;
struct tws_cmd_generic *gcmd;
if ( error ) {
TWS_TRACE(sc, "SOMETHING BAD HAPPENED! error = %d\n", error, 0);
}
@ -991,12 +974,10 @@ tws_dmamap_data_load_cbfn(void *arg, bus_dma_segment_t *segs,
}
}
req->error_code = tws_submit_command(req->sc, req);
}
static void
tws_fill_sg_list(struct tws_softc *sc, void *sgl_src, void *sgl_dest,
u_int16_t num_sgl_entries)
@ -1037,7 +1018,6 @@ tws_fill_sg_list(struct tws_softc *sc, void *sgl_src, void *sgl_dest,
if ( num_sgl_entries > TWS_MAX_32BIT_SG_ELEMENTS )
TWS_TRACE(sc, "32bit sg overflow", num_sgl_entries, 0);
for (i = 0; i < num_sgl_entries; i++) {
sgl_d[i].address = sgl_s[i].address;
sgl_d[i].length = sgl_s[i].length;
@ -1045,7 +1025,6 @@ tws_fill_sg_list(struct tws_softc *sc, void *sgl_src, void *sgl_dest,
}
}
}
void
tws_intr(void *arg)
@ -1129,7 +1108,6 @@ tws_intr_resp(struct tws_softc *sc)
}
static void
tws_poll(struct cam_sim *sim)
{
@ -1144,7 +1122,6 @@ tws_timeout(void *arg)
struct tws_request *req = (struct tws_request *)arg;
struct tws_softc *sc = req->sc;
if ( req->error_code == TWS_REQ_RET_RESET ) {
return;
}
@ -1253,7 +1230,6 @@ tws_reinit(void *arg)
int try=2;
int done=0;
// device_printf(sc->tws_dev, "Waiting for Controller Ready\n");
while ( !done && try ) {
if ( tws_ctlr_ready(sc) ) {
@ -1288,7 +1264,6 @@ tws_reinit(void *arg)
wakeup_one(sc);
}
static void
tws_freeze_simq(struct tws_softc *sc, struct tws_request *req)
{
@ -1302,5 +1277,4 @@ tws_freeze_simq(struct tws_softc *sc, struct tws_request *req)
}
}
TUNABLE_INT("hw.tws.cam_depth", &tws_cam_depth);

View File

@ -36,12 +36,10 @@
* $FreeBSD$
*/
#include <dev/tws/tws.h>
#include <dev/tws/tws_services.h>
#include <dev/tws/tws_hdm.h>
int tws_use_32bit_sgls=0;
extern u_int64_t mfa_base;
extern struct tws_request *tws_get_request(struct tws_softc *sc,
@ -96,7 +94,6 @@ tws_init_ctlr(struct tws_softc *sc)
}
while( 1 ) {
regh = tws_read_reg(sc, TWS_I2O0_IOPOBQPH, 4);
regl = tws_read_reg(sc, TWS_I2O0_IOPOBQPL, 4);
@ -274,7 +271,6 @@ tws_send_generic_cmd(struct tws_softc *sc, u_int8_t opcode)
}
int
tws_submit_command(struct tws_softc *sc, struct tws_request *req)
{
@ -319,16 +315,13 @@ tws_submit_command(struct tws_softc *sc, struct tws_request *req)
* retry later
*/
return(TWS_REQ_RET_PEND_NOMFA);
}
#ifndef TWS_PULL_MODE_ENABLE
for (int i=mfa; i<(sizeof(struct tws_command_packet)+ mfa -
sizeof( struct tws_command_header)); i++) {
bus_space_write_1(sc->bus_mfa_tag, sc->bus_mfa_handle,i,
((u_int8_t *)&req->cmd_pkt->cmd)[i-mfa]);
}
#endif
@ -371,7 +364,6 @@ tws_get_response(struct tws_softc *sc, u_int16_t *req_id, u_int64_t *mfa)
if ( out_mfa == TWS_FIFO_EMPTY32 ) {
return(false);
}
out_mfa = out_mfa << 32;
val = tws_read_reg(sc, TWS_I2O0_HOBQPL, 4);
@ -389,9 +381,6 @@ tws_get_response(struct tws_softc *sc, u_int16_t *req_id, u_int64_t *mfa)
return(true);
}
u_int16_t
tws_poll4_response(struct tws_softc *sc, u_int64_t *mfa)
{
@ -401,7 +390,6 @@ tws_poll4_response(struct tws_softc *sc, u_int64_t *mfa)
endt = TWS_LOCAL_TIME + TWS_POLL_TIMEOUT;
do {
if(tws_get_response(sc, &req_id, mfa)) {
if ( req_id == TWS_INVALID_REQID ) {
TWS_TRACE_DEBUG(sc, "invalid req_id", 0, req_id);
return(TWS_INVALID_REQID);

View File

@ -36,7 +36,6 @@
* $FreeBSD$
*/
/* bit's defination */
#define TWS_BIT0 0x00000001
@ -84,7 +83,6 @@
#define TWS_SRC_FREEBSD_DRIVER 5
#define TWS_SRC_FREEBSD_OS 8
enum tws_sense_severity {
error = 1,
warning ,
@ -101,13 +99,11 @@ enum tws_sense_severity {
#define TWS_ERROR_UNIT_OFFLINE 0x0128
#define TWS_ERROR_MORE_DATA 0x0231
/* AEN codes of interest. */
#define TWS_AEN_QUEUE_EMPTY 0x00
#define TWS_AEN_SOFT_RESET 0x01
#define TWS_AEN_SYNC_TIME_WITH_HOST 0x31
/* AEN severity */
#define TWS_SEVERITY_ERROR 0x1
#define TWS_SEVERITY_WARNING 0x2
@ -126,11 +122,9 @@ enum tws_sense_severity {
#define TWS_CURRENT_FW_BUILD 4
#define TWS_CURRENT_ARCH_ID 0x000A
#define TWS_FIFO_EMPTY 0xFFFFFFFFFFFFFFFFull
#define TWS_FIFO_EMPTY32 0xFFFFFFFFull
/* Register offsets from base address. */
#define TWS_CONTROL_REGISTER_OFFSET 0x0
#define TWS_STATUS_REGISTER_OFFSET 0x4
@ -180,7 +174,6 @@ enum tws_sense_severity {
#define TWS_FW_CMD_GET_PARAM 0x12
#define TWS_FW_CMD_SET_PARAM 0x13
#define BUILD_SGL_OFF__OPCODE(sgl_off, opcode) \
((sgl_off << 5) & 0xE0) | (opcode & 0x1F) /* 3:5 */
@ -190,11 +183,8 @@ enum tws_sense_severity {
#define GET_OPCODE(sgl_off__opcode) \
(sgl_off__opcode & 0x1F) /* 3:5 */
/* end revisit */
/* Table #'s and id's of parameters of interest in firmware's param table. */
#define TWS_PARAM_VERSION_TABLE 0x0402
#define TWS_PARAM_VERSION_FW 3 /* firmware version [16] */
@ -212,10 +202,8 @@ enum tws_sense_severity {
#define TWS_9K_PARAM_DESCRIPTOR 0x8000
/* ----------- request ------------- */
#pragma pack(1)
struct tws_cmd_init_connect {
@ -258,7 +246,6 @@ struct tws_cmd_reset_firmware {
u_int8_t param;
};
/* Structure for sending get/set param commands. */
struct tws_cmd_param {
u_int8_t sgl_off__opcode;/* 3:5 */
@ -282,9 +269,6 @@ struct tws_cmd_generic {
u_int16_t count; /* block cnt, parameter cnt, message credits */
};
/* Command packet header. */
struct tws_command_header {
u_int8_t sense_data[TWS_SENSE_DATA_LENGTH];
@ -354,7 +338,6 @@ struct tws_outbound_response {
u_int32_t request_id:16; /* request id */
};
/* Scatter/Gather list entry with 32 bit addresses. */
struct tws_sg_desc32 {
u_int32_t address;
@ -387,8 +370,6 @@ struct tws_event_packet {
u_int8_t severity_str[20];
};
#pragma pack()
struct tws_sense {
@ -418,5 +399,3 @@ struct tws_request {
struct tws_request *next; /* pointer to next request */
struct tws_request *prev; /* pointer to prev request */
};

View File

@ -53,8 +53,6 @@ void tws_print_stats(void *arg);
struct tws_sense *tws_find_sense_from_mfa(struct tws_softc *sc, u_int64_t mfa);
static struct error_desc array[] = {
{ "Cannot add sysctl tree node", 0x2000, ERROR,
"%s: (0x%02X: 0x%04X): %s:\n", "ERROR" },
@ -89,7 +87,6 @@ tws_trace(const char *file, const char *fun, int linenum,
struct tws_softc *sc, char *desc, u_int64_t val1, u_int64_t val2)
{
struct tws_trace_rec *rec = (struct tws_trace_rec *)sc->trace_q.q;
volatile u_int16_t head, tail;
char fmt[256];
@ -142,7 +139,6 @@ tws_log(struct tws_softc *sc, int index)
/* ----------- swap functions ----------- */
u_int16_t
tws_swap16(u_int16_t val)
{
@ -156,7 +152,6 @@ tws_swap32(u_int32_t val)
((val >> 8) & (0xFF00)) | (val >> 24)));
}
u_int64_t
tws_swap64(u_int64_t val)
{
@ -164,10 +159,8 @@ tws_swap64(u_int64_t val)
((u_int32_t)(tws_swap32(((u_int32_t *)(&(val)))[0]))));
}
/* ----------- reg access ----------- */
void
tws_write_reg(struct tws_softc *sc, int offset,
u_int32_t value, int size)
@ -331,7 +324,6 @@ tws_q_remove_request(struct tws_softc *sc, struct tws_request *req,
if ( req == sc->q_tail[q_type] )
return(tws_q_remove_tail(sc, q_type));
/* The given node is not at head or tail.
* It's in the middle and there are more than
* 2 elements on the q.
@ -385,7 +377,6 @@ tws_find_sense_from_mfa(struct tws_softc *sc, u_int64_t mfa)
/* --------------------- Q service end --------------------- */
/* --------------------- misc service start --------------------- */
void
tws_print_stats(void *arg)
{

View File

@ -36,7 +36,6 @@
* $FreeBSD$
*/
/* #define TWS_DEBUG on */
void tws_trace(const char *file, const char *fun, int linenum,
@ -53,8 +52,6 @@ u_int64_t tws_swap64(u_int64_t val);
void tws_init_qs(struct tws_softc *sc);
/* ----------------- trace ----------------- */
#define TWS_TRACE_ON on /* Alawys on - use wisely to trace errors */
@ -81,7 +78,6 @@ void tws_init_qs(struct tws_softc *sc);
/* ---------------- logging ---------------- */
/* ---------------- logging ---------------- */
enum error_index {
SYSCTL_TREE_NODE_ADD,
@ -129,7 +125,6 @@ struct error_desc {
#define TWS_REQ_RET_RESET 2
#define TWS_REQ_RET_INVALID 0xdead
/* ------------------------ */
#include <sys/clock.h>
#define TWS_LOCAL_TIME (time_second - utc_offset())

View File

@ -41,14 +41,12 @@
#include <dev/tws/tws_hdm.h>
#include <dev/tws/tws_user.h>
int tws_ioctl(struct cdev *dev, long unsigned int cmd, caddr_t buf, int flags,
struct thread *td);
void tws_passthru_complete(struct tws_request *req);
extern void tws_circular_aenq_insert(struct tws_softc *sc,
struct tws_circular_q *cq, struct tws_event_packet *aen);
static int tws_passthru(struct tws_softc *sc, void *buf);
static int tws_ioctl_aen(struct tws_softc *sc, u_long cmd, void *buf);
@ -81,7 +79,6 @@ tws_ioctl(struct cdev *dev, u_long cmd, caddr_t buf, int flags,
TWS_TRACE_DEBUG(sc, "ioctl-aen", cmd, buf);
error = tws_ioctl_aen(sc, cmd, (void *)buf);
break;
}
return(error);
}
@ -327,7 +324,6 @@ tws_ioctl_aen(struct tws_softc *sc, u_long cmd, void *buf)
lpkt.time_remaining_msec = (u_int32_t)
((sc->ioctl_lock.timeout - ctime) * 1000);
ubuf->driver_pkt.status = TWS_IOCTL_LOCK_ALREADY_HELD;
}
break;
case TWS_IOCTL_RELEASE_LOCK :
@ -366,7 +362,6 @@ tws_ioctl_aen(struct tws_softc *sc, u_long cmd, void *buf)
TWS_TRACE_DEBUG(sc, "not valid cmd", cmd,
TWS_IOCTL_GET_COMPATIBILITY_INFO);
break;
}
mtx_unlock(&sc->gen_lock);
return(SUCCESS);

View File

@ -76,7 +76,6 @@ struct tws_compatibility_packet {
u_int16_t fw_on_ctlr_build;/* build # of running firmware */
};
/* Driver understandable part of the ioctl packet built by the API. */
struct tws_driver_packet {
u_int32_t control_code;
@ -97,7 +96,6 @@ struct tws_ioctl_packet {
#pragma pack()
#pragma pack(1)
/*
* We need the structure below to ensure that the first byte of
@ -116,7 +114,6 @@ struct tws_ioctl_no_data_buf {
#pragma pack()
#include <sys/ioccom.h>
#pragma pack(1)
@ -155,4 +152,3 @@ struct tws_ioctl_with_payload {
_IOWR('T', 208, struct tws_ioctl_with_payload)
#define TWS_IOCTL_GET_COMPATIBILITY_INFO \
_IOWR('T', 209, struct tws_ioctl_with_payload)