s390/qeth: use qeth_setup_ccw() to set up all CCWs
Re-work the helper a little bit, so that it can be used for all CCWs that qeth issues. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
750b162598
commit
45ca2fd646
|
@ -235,6 +235,8 @@ static inline int qeth_is_ipa_enabled(struct qeth_ipa_info *ipa,
|
||||||
#define QETH_IDX_FUNC_LEVEL_IQD 0x4108
|
#define QETH_IDX_FUNC_LEVEL_IQD 0x4108
|
||||||
|
|
||||||
#define QETH_BUFSIZE 4096
|
#define QETH_BUFSIZE 4096
|
||||||
|
#define CCW_CMD_WRITE 0x01
|
||||||
|
#define CCW_CMD_READ 0x02
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* some more defs
|
* some more defs
|
||||||
|
|
|
@ -65,7 +65,6 @@ static struct mutex qeth_mod_mutex;
|
||||||
static void qeth_send_control_data_cb(struct qeth_channel *,
|
static void qeth_send_control_data_cb(struct qeth_channel *,
|
||||||
struct qeth_cmd_buffer *);
|
struct qeth_cmd_buffer *);
|
||||||
static struct qeth_cmd_buffer *qeth_get_buffer(struct qeth_channel *);
|
static struct qeth_cmd_buffer *qeth_get_buffer(struct qeth_channel *);
|
||||||
static void qeth_setup_ccw(struct qeth_channel *, unsigned char *, __u32);
|
|
||||||
static void qeth_free_buffer_pool(struct qeth_card *);
|
static void qeth_free_buffer_pool(struct qeth_card *);
|
||||||
static int qeth_qdio_establish(struct qeth_card *);
|
static int qeth_qdio_establish(struct qeth_card *);
|
||||||
static void qeth_free_qdio_buffers(struct qeth_card *);
|
static void qeth_free_qdio_buffers(struct qeth_card *);
|
||||||
|
@ -532,6 +531,14 @@ static inline int qeth_is_cq(struct qeth_card *card, unsigned int queue)
|
||||||
queue == card->qdio.no_in_queues - 1;
|
queue == card->qdio.no_in_queues - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void qeth_setup_ccw(struct ccw1 *ccw, u8 cmd_code, u32 len, void *data)
|
||||||
|
{
|
||||||
|
ccw->cmd_code = cmd_code;
|
||||||
|
ccw->flags = CCW_FLAG_SLI;
|
||||||
|
ccw->count = len;
|
||||||
|
ccw->cda = (__u32) __pa(data);
|
||||||
|
}
|
||||||
|
|
||||||
static int __qeth_issue_next_read(struct qeth_card *card)
|
static int __qeth_issue_next_read(struct qeth_card *card)
|
||||||
{
|
{
|
||||||
struct qeth_channel *channel = &card->read;
|
struct qeth_channel *channel = &card->read;
|
||||||
|
@ -549,7 +556,7 @@ static int __qeth_issue_next_read(struct qeth_card *card)
|
||||||
"available\n", dev_name(&card->gdev->dev));
|
"available\n", dev_name(&card->gdev->dev));
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
qeth_setup_ccw(channel, iob->data, QETH_BUFSIZE);
|
qeth_setup_ccw(&channel->ccw, CCW_CMD_READ, QETH_BUFSIZE, iob->data);
|
||||||
QETH_CARD_TEXT(card, 6, "noirqpnd");
|
QETH_CARD_TEXT(card, 6, "noirqpnd");
|
||||||
rc = ccw_device_start(channel->ccwdev, &channel->ccw,
|
rc = ccw_device_start(channel->ccwdev, &channel->ccw,
|
||||||
(addr_t) iob, 0, 0);
|
(addr_t) iob, 0, 0);
|
||||||
|
@ -745,21 +752,6 @@ static struct qeth_card *CARD_FROM_CDEV(struct ccw_device *cdev)
|
||||||
return card;
|
return card;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qeth_setup_ccw(struct qeth_channel *channel, unsigned char *iob,
|
|
||||||
__u32 len)
|
|
||||||
{
|
|
||||||
struct qeth_card *card;
|
|
||||||
|
|
||||||
card = CARD_FROM_CDEV(channel->ccwdev);
|
|
||||||
QETH_CARD_TEXT(card, 4, "setupccw");
|
|
||||||
if (channel == &card->read)
|
|
||||||
memcpy(&channel->ccw, READ_CCW, sizeof(struct ccw1));
|
|
||||||
else
|
|
||||||
memcpy(&channel->ccw, WRITE_CCW, sizeof(struct ccw1));
|
|
||||||
channel->ccw.count = len;
|
|
||||||
channel->ccw.cda = (__u32) __pa(iob);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct qeth_cmd_buffer *__qeth_get_buffer(struct qeth_channel *channel)
|
static struct qeth_cmd_buffer *__qeth_get_buffer(struct qeth_channel *channel)
|
||||||
{
|
{
|
||||||
__u8 index;
|
__u8 index;
|
||||||
|
@ -1680,10 +1672,7 @@ static int qeth_read_conf_data(struct qeth_card *card, void **buffer,
|
||||||
if (!rcd_buf)
|
if (!rcd_buf)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
channel->ccw.cmd_code = ciw->cmd;
|
qeth_setup_ccw(&channel->ccw, ciw->cmd, ciw->count, rcd_buf);
|
||||||
channel->ccw.cda = (__u32) __pa(rcd_buf);
|
|
||||||
channel->ccw.count = ciw->count;
|
|
||||||
channel->ccw.flags = CCW_FLAG_SLI;
|
|
||||||
channel->state = CH_STATE_RCD;
|
channel->state = CH_STATE_RCD;
|
||||||
spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags);
|
spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags);
|
||||||
ret = ccw_device_start_timeout(channel->ccwdev, &channel->ccw,
|
ret = ccw_device_start_timeout(channel->ccwdev, &channel->ccw,
|
||||||
|
@ -1857,9 +1846,7 @@ static int qeth_idx_activate_get_answer(struct qeth_channel *channel,
|
||||||
if (!iob)
|
if (!iob)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
iob->callback = idx_reply_cb;
|
iob->callback = idx_reply_cb;
|
||||||
memcpy(&channel->ccw, READ_CCW, sizeof(struct ccw1));
|
qeth_setup_ccw(&channel->ccw, CCW_CMD_READ, QETH_BUFSIZE, iob->data);
|
||||||
channel->ccw.count = QETH_BUFSIZE;
|
|
||||||
channel->ccw.cda = (__u32) __pa(iob->data);
|
|
||||||
|
|
||||||
wait_event(card->wait_q,
|
wait_event(card->wait_q,
|
||||||
atomic_cmpxchg(&channel->irq_pending, 0, 1) == 0);
|
atomic_cmpxchg(&channel->irq_pending, 0, 1) == 0);
|
||||||
|
@ -1908,9 +1895,8 @@ static int qeth_idx_activate_channel(struct qeth_channel *channel,
|
||||||
if (!iob)
|
if (!iob)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
iob->callback = idx_reply_cb;
|
iob->callback = idx_reply_cb;
|
||||||
memcpy(&channel->ccw, WRITE_CCW, sizeof(struct ccw1));
|
qeth_setup_ccw(&channel->ccw, CCW_CMD_WRITE, IDX_ACTIVATE_SIZE,
|
||||||
channel->ccw.count = IDX_ACTIVATE_SIZE;
|
iob->data);
|
||||||
channel->ccw.cda = (__u32) __pa(iob->data);
|
|
||||||
if (channel == &card->write) {
|
if (channel == &card->write) {
|
||||||
memcpy(iob->data, IDX_ACTIVATE_WRITE, IDX_ACTIVATE_SIZE);
|
memcpy(iob->data, IDX_ACTIVATE_WRITE, IDX_ACTIVATE_SIZE);
|
||||||
memcpy(QETH_TRANSPORT_HEADER_SEQ_NO(iob->data),
|
memcpy(QETH_TRANSPORT_HEADER_SEQ_NO(iob->data),
|
||||||
|
@ -2070,7 +2056,7 @@ out:
|
||||||
void qeth_prepare_control_data(struct qeth_card *card, int len,
|
void qeth_prepare_control_data(struct qeth_card *card, int len,
|
||||||
struct qeth_cmd_buffer *iob)
|
struct qeth_cmd_buffer *iob)
|
||||||
{
|
{
|
||||||
qeth_setup_ccw(iob->channel, iob->data, len);
|
qeth_setup_ccw(&iob->channel->ccw, CCW_CMD_WRITE, len, iob->data);
|
||||||
iob->callback = qeth_release_buffer;
|
iob->callback = qeth_release_buffer;
|
||||||
|
|
||||||
memcpy(QETH_TRANSPORT_HEADER_SEQ_NO(iob->data),
|
memcpy(QETH_TRANSPORT_HEADER_SEQ_NO(iob->data),
|
||||||
|
|
|
@ -146,17 +146,6 @@ unsigned char IPA_PDU_HEADER[] = {
|
||||||
};
|
};
|
||||||
EXPORT_SYMBOL_GPL(IPA_PDU_HEADER);
|
EXPORT_SYMBOL_GPL(IPA_PDU_HEADER);
|
||||||
|
|
||||||
unsigned char WRITE_CCW[] = {
|
|
||||||
0x01, CCW_FLAG_SLI, 0, 0,
|
|
||||||
0, 0, 0, 0
|
|
||||||
};
|
|
||||||
|
|
||||||
unsigned char READ_CCW[] = {
|
|
||||||
0x02, CCW_FLAG_SLI, 0, 0,
|
|
||||||
0, 0, 0, 0
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct ipa_rc_msg {
|
struct ipa_rc_msg {
|
||||||
enum qeth_ipa_return_codes rc;
|
enum qeth_ipa_return_codes rc;
|
||||||
char *msg;
|
char *msg;
|
||||||
|
|
|
@ -818,10 +818,6 @@ extern char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd);
|
||||||
/* END OF IP Assist related definitions */
|
/* END OF IP Assist related definitions */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
extern unsigned char WRITE_CCW[];
|
|
||||||
extern unsigned char READ_CCW[];
|
|
||||||
|
|
||||||
extern unsigned char CM_ENABLE[];
|
extern unsigned char CM_ENABLE[];
|
||||||
#define CM_ENABLE_SIZE 0x63
|
#define CM_ENABLE_SIZE 0x63
|
||||||
#define QETH_CM_ENABLE_ISSUER_RM_TOKEN(buffer) (buffer + 0x2c)
|
#define QETH_CM_ENABLE_ISSUER_RM_TOKEN(buffer) (buffer + 0x2c)
|
||||||
|
|
Loading…
Reference in New Issue