cxgbe(4): Add an ioctl to copy a firmware config file to the card's flash.
This commit is contained in:
parent
abdfa0b19c
commit
35b5ef914c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=306821
@ -56,6 +56,7 @@ enum {
|
||||
T4_SET_SCHED_QUEUE, /* set queue class */
|
||||
T4_GET_TRACER, /* get information about a tracer */
|
||||
T4_SET_TRACER, /* program a tracer */
|
||||
T4_LOAD_CFG, /* copy a config file to card's flash */
|
||||
};
|
||||
|
||||
struct t4_reg {
|
||||
@ -344,4 +345,5 @@ struct t4_tracer {
|
||||
struct t4_sched_queue)
|
||||
#define CHELSIO_T4_GET_TRACER _IOWR('f', T4_GET_TRACER, struct t4_tracer)
|
||||
#define CHELSIO_T4_SET_TRACER _IOW('f', T4_SET_TRACER, struct t4_tracer)
|
||||
#define CHELSIO_T4_LOAD_CFG _IOW('f', T4_LOAD_CFG, struct t4_data)
|
||||
#endif
|
||||
|
@ -549,6 +549,7 @@ static int set_tcb_rpl(struct sge_iq *, const struct rss_header *,
|
||||
struct mbuf *);
|
||||
static int get_sge_context(struct adapter *, struct t4_sge_context *);
|
||||
static int load_fw(struct adapter *, struct t4_data *);
|
||||
static int load_cfg(struct adapter *, struct t4_data *);
|
||||
static int read_card_mem(struct adapter *, int, struct t4_mem_range *);
|
||||
static int read_i2c(struct adapter *, struct t4_i2c_data *);
|
||||
#ifdef TCP_OFFLOAD
|
||||
@ -8620,6 +8621,38 @@ load_fw(struct adapter *sc, struct t4_data *fw)
|
||||
return (rc);
|
||||
}
|
||||
|
||||
static int
|
||||
load_cfg(struct adapter *sc, struct t4_data *cfg)
|
||||
{
|
||||
int rc;
|
||||
uint8_t *cfg_data = NULL;
|
||||
|
||||
rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4ldcf");
|
||||
if (rc)
|
||||
return (rc);
|
||||
|
||||
if (cfg->len == 0) {
|
||||
/* clear */
|
||||
rc = -t4_load_cfg(sc, NULL, 0);
|
||||
goto done;
|
||||
}
|
||||
|
||||
cfg_data = malloc(cfg->len, M_CXGBE, M_WAITOK);
|
||||
if (cfg_data == NULL) {
|
||||
rc = ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
|
||||
rc = copyin(cfg->data, cfg_data, cfg->len);
|
||||
if (rc == 0)
|
||||
rc = -t4_load_cfg(sc, cfg_data, cfg->len);
|
||||
|
||||
free(cfg_data, M_CXGBE);
|
||||
done:
|
||||
end_synchronized_op(sc, 0);
|
||||
return (rc);
|
||||
}
|
||||
|
||||
#define MAX_READ_BUF_SIZE (128 * 1024)
|
||||
static int
|
||||
read_card_mem(struct adapter *sc, int win, struct t4_mem_range *mr)
|
||||
@ -9177,6 +9210,9 @@ t4_ioctl(struct cdev *dev, unsigned long cmd, caddr_t data, int fflag,
|
||||
case CHELSIO_T4_SET_TRACER:
|
||||
rc = t4_set_tracer(sc, (struct t4_tracer *)data);
|
||||
break;
|
||||
case CHELSIO_T4_LOAD_CFG:
|
||||
rc = load_cfg(sc, (struct t4_data *)data);
|
||||
break;
|
||||
default:
|
||||
rc = ENOTTY;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user