diff mbox

[v2] bt: use the maximum retry count returned by the BMC

Message ID 1457951831-10523-1-git-send-email-clg@fr.ibm.com
State Accepted
Headers show

Commit Message

Cédric Le Goater March 14, 2016, 10:37 a.m. UTC
OpenPower systems using a AMI firmware on the BMC have a BT device
configured with a capability of '1' maximum retry. The following code
is equivalent to what skiboot currently supports but it will now also
handle setups of other BT devices, like in qemu or OpenBMC.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
---

 Changes since v2:

 - rename send_count to retries. Suggested by Vipin.

 hw/bt.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Vipin K Parashar March 14, 2016, 12:36 p.m. UTC | #1
Looks good.

Reviewed-by: Vipin K Parashar <vipin@linux.vnet.ibm.com>

On Monday 14 March 2016 04:07 PM, Cédric Le Goater wrote:
> bt.caps.max_retries = BT_MAX_RETRIES;
Vasant Hegde March 15, 2016, 4:45 a.m. UTC | #2
On 03/14/2016 04:07 PM, Cédric Le Goater wrote:
> OpenPower systems using a AMI firmware on the BMC have a BT device
> configured with a capability of '1' maximum retry. The following code
> is equivalent to what skiboot currently supports but it will now also
> handle setups of other BT devices, like in qemu or OpenBMC.
>
> Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>

Patch looks good.

Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>


-Vasant
Vasant Hegde March 15, 2016, 5:09 a.m. UTC | #3
On 03/15/2016 10:15 AM, Vasant Hegde wrote:
> On 03/14/2016 04:07 PM, Cédric Le Goater wrote:
>> OpenPower systems using a AMI firmware on the BMC have a BT device
>> configured with a capability of '1' maximum retry. The following code
>> is equivalent to what skiboot currently supports but it will now also
>> handle setups of other BT devices, like in qemu or OpenBMC.
>>
>> Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
>
> Patch looks good.
>
> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>

Cedric,

Looks like we are not making use of input_buf_len and output_buf_len 
capabilities. We will be in trouble if we endup getting capabilities lesser than 
IPMI_MAX_REQ_SIZE. May be its better to check that as well..

-Vasant
Stewart Smith April 1, 2016, 3:14 a.m. UTC | #4
Cédric Le Goater <clg@fr.ibm.com> writes:
> OpenPower systems using a AMI firmware on the BMC have a BT device
> configured with a capability of '1' maximum retry. The following code
> is equivalent to what skiboot currently supports but it will now also
> handle setups of other BT devices, like in qemu or OpenBMC.
>
> Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>

Looks good and correct.

Merged to master as of 53402d0.

I gather this gets us closer to being able to run with BT under qemu?
diff mbox

Patch

Index: skiboot.git/hw/bt.c
===================================================================
--- skiboot.git.orig/hw/bt.c
+++ skiboot.git/hw/bt.c
@@ -74,7 +74,7 @@ 
 /*
  * Maximum number of times to attempt sending a message before giving up.
  */
-#define BT_MAX_SEND_COUNT 2
+#define BT_MAX_RETRIES 1
 
 #define BT_QUEUE_DEBUG 0
 
@@ -112,7 +112,7 @@  struct bt_caps {
 	uint16_t input_buf_len;
 	uint16_t output_buf_len;
 	uint8_t msg_timeout;
-	uint8_t num_retries;
+	uint8_t max_retries;
 };
 
 struct bt {
@@ -183,13 +183,13 @@  static void get_bt_caps_complete(struct
 	bt.caps.input_buf_len = msg->data[1] + 1;
 	bt.caps.output_buf_len = msg->data[2] + 1;
 	bt.caps.msg_timeout = msg->data[3];
-	bt.caps.num_retries = msg->data[4];
+	bt.caps.max_retries = msg->data[4];
 	prlog(PR_DEBUG, "BMC BT capabilities received:\n");
 	prlog(PR_DEBUG, "buffer sizes: %d input %d output\n",
 			bt.caps.input_buf_len, bt.caps.output_buf_len);
 	prlog(PR_DEBUG, "number of requests: %d\n", bt.caps.num_requests);
 	prlog(PR_DEBUG,  "msg timeout: %d max retries: %d\n",
-			bt.caps.msg_timeout, bt.caps.num_retries);
+			bt.caps.msg_timeout, bt.caps.max_retries);
 
 out:
 	ipmi_free_msg(msg);
@@ -392,7 +392,7 @@  static void bt_expire_old_msg(uint64_t t
 
 	if (bt_msg && bt_msg->tb > 0 &&
 	    (tb_compare(tb, bt_msg->tb + secs_to_tb(bt.caps.msg_timeout)) == TB_AAFTERB)) {
-		if (bt_msg->send_count < BT_MAX_SEND_COUNT) {
+		if (bt_msg->send_count <= bt.caps.max_retries) {
 			/* A message timeout is usually due to the BMC
 			clearing the H2B_ATN flag without actually
 			doing anything. The data will still be in the
@@ -629,7 +629,7 @@  void bt_init(void)
 	bt.caps.input_buf_len = BT_FIFO_LEN;
 	bt.caps.output_buf_len = BT_FIFO_LEN;
 	bt.caps.msg_timeout = BT_MSG_TIMEOUT;
-	bt.caps.num_retries = 1;
+	bt.caps.max_retries = BT_MAX_RETRIES;
 
 	/* We support only one */
 	n = dt_find_compatible_node(dt_root, NULL, "ipmi-bt");