From 592ede258dc109f3a153ca040f005b5c4dd224ce Mon Sep 17 00:00:00 2001 From: "Andrew F. Davis" Date: Thu, 16 Jan 2020 15:34:31 -0600 Subject: [PATCH] ti: k3: drivers: ti_sci: Remove indirect structure of const data The 'info' structure contained what is only static data for this implementation of TI-SCI. Remove this indirection and remove the struct. Signed-off-by: Andrew F. Davis Change-Id: I2328fddf388bf7d56a56bd673c080e78c86fe072 --- plat/ti/k3/common/drivers/ti_sci/ti_sci.c | 59 +++++++---------------- 1 file changed, 17 insertions(+), 42 deletions(-) diff --git a/plat/ti/k3/common/drivers/ti_sci/ti_sci.c b/plat/ti/k3/common/drivers/ti_sci/ti_sci.c index ac33278a9..d5bcee8c7 100644 --- a/plat/ti/k3/common/drivers/ti_sci/ti_sci.c +++ b/plat/ti/k3/common/drivers/ti_sci/ti_sci.c @@ -20,32 +20,7 @@ #include "ti_sci_protocol.h" #include "ti_sci.h" -/** - * struct ti_sci_desc - Description of SoC integration - * @host_id: Host identifier representing the compute entity - * @max_msg_size: Maximum size of data per message that can be handled - */ -struct ti_sci_desc { - uint8_t host_id; - int max_msg_size; -}; - -/** - * struct ti_sci_info - Structure representing a TI SCI instance - * @desc: SoC description for this instance - * @seq: Seq id used for verification for tx and rx message - */ -struct ti_sci_info { - const struct ti_sci_desc desc; - uint8_t seq; -}; - -static struct ti_sci_info info = { - .desc = { - .host_id = TI_SCI_HOST_ID, - .max_msg_size = TI_SCI_MAX_MESSAGE_SIZE, - }, -}; +static uint8_t message_sequence; /** * struct ti_sci_xfer - Structure representing a message flow @@ -82,16 +57,16 @@ static int ti_sci_setup_one_xfer(uint16_t msg_type, uint32_t msg_flags, struct ti_sci_msg_hdr *hdr; /* Ensure we have sane transfer sizes */ - if (rx_message_size > info.desc.max_msg_size || - tx_message_size > info.desc.max_msg_size || + if (rx_message_size > TI_SCI_MAX_MESSAGE_SIZE || + tx_message_size > TI_SCI_MAX_MESSAGE_SIZE || rx_message_size < sizeof(*hdr) || tx_message_size < sizeof(*hdr)) return -ERANGE; hdr = (struct ti_sci_msg_hdr *)tx_buf; - hdr->seq = ++info.seq; + hdr->seq = ++message_sequence; hdr->type = msg_type; - hdr->host = info.desc.host_id; + hdr->host = TI_SCI_HOST_ID; hdr->flags = msg_flags | TI_SCI_FLAG_REQ_ACK_ON_PROCESSED; xfer->tx_message.buf = tx_buf; @@ -131,7 +106,7 @@ static inline int ti_sci_get_response(struct ti_sci_xfer *xfer, hdr = (struct ti_sci_msg_hdr *)msg->buf; /* Sanity check for message response */ - if (hdr->seq == info.seq) + if (hdr->seq == message_sequence) break; else WARN("Message with sequence ID %u is not expected\n", hdr->seq); @@ -141,9 +116,9 @@ static inline int ti_sci_get_response(struct ti_sci_xfer *xfer, return -EINVAL; } - if (msg->len > info.desc.max_msg_size) { + if (msg->len > TI_SCI_MAX_MESSAGE_SIZE) { ERROR("Unable to handle %lu xfer (max %d)\n", - msg->len, info.desc.max_msg_size); + msg->len, TI_SCI_MAX_MESSAGE_SIZE); return -EINVAL; } @@ -425,13 +400,13 @@ int ti_sci_device_put_no_wait(uint32_t id) int ret; /* Ensure we have sane transfer size */ - if (sizeof(req) > info.desc.max_msg_size) + if (sizeof(req) > TI_SCI_MAX_MESSAGE_SIZE) return -ERANGE; hdr = (struct ti_sci_msg_hdr *)&req; - hdr->seq = ++info.seq; + hdr->seq = ++message_sequence; hdr->type = TI_SCI_MSG_SET_DEVICE_STATE; - hdr->host = info.desc.host_id; + hdr->host = TI_SCI_HOST_ID; /* Setup with NORESPONSE flag to keep response queue clean */ hdr->flags = TI_SCI_FLAG_REQ_GENERIC_NORESPONSE; @@ -1408,13 +1383,13 @@ int ti_sci_proc_set_boot_ctrl_no_wait(uint8_t proc_id, int ret; /* Ensure we have sane transfer size */ - if (sizeof(req) > info.desc.max_msg_size) + if (sizeof(req) > TI_SCI_MAX_MESSAGE_SIZE) return -ERANGE; hdr = (struct ti_sci_msg_hdr *)&req; - hdr->seq = ++info.seq; + hdr->seq = ++message_sequence; hdr->type = TISCI_MSG_SET_PROC_BOOT_CTRL; - hdr->host = info.desc.host_id; + hdr->host = TI_SCI_HOST_ID; /* Setup with NORESPONSE flag to keep response queue clean */ hdr->flags = TI_SCI_FLAG_REQ_GENERIC_NORESPONSE; @@ -1650,13 +1625,13 @@ int ti_sci_proc_wait_boot_status_no_wait(uint8_t proc_id, int ret; /* Ensure we have sane transfer size */ - if (sizeof(req) > info.desc.max_msg_size) + if (sizeof(req) > TI_SCI_MAX_MESSAGE_SIZE) return -ERANGE; hdr = (struct ti_sci_msg_hdr *)&req; - hdr->seq = ++info.seq; + hdr->seq = ++message_sequence; hdr->type = TISCI_MSG_WAIT_PROC_BOOT_STATUS; - hdr->host = info.desc.host_id; + hdr->host = TI_SCI_HOST_ID; /* Setup with NORESPONSE flag to keep response queue clean */ hdr->flags = TI_SCI_FLAG_REQ_GENERIC_NORESPONSE;