summaryrefslogtreecommitdiffstats
path: root/mboxd_windows.c
diff options
context:
space:
mode:
authorSuraj Jitindar Singh <sjitindarsingh@gmail.com>2017-04-27 11:55:26 +1000
committerSuraj Jitindar Singh <sjitindarsingh@gmail.com>2017-05-03 17:19:15 +1000
commit5a3a0664b63feba8aff288a5691a9f873e4ea6eb (patch)
tree7e09d96625c0e7b6e48e5874481eca7627fd99bc /mboxd_windows.c
parent6479ed4034747414068d2c328f58b51eed737a24 (diff)
downloadphosphor-mboxd-5a3a0664b63feba8aff288a5691a9f873e4ea6eb.tar.gz
phosphor-mboxd-5a3a0664b63feba8aff288a5691a9f873e4ea6eb.zip
mboxd: Implement timeout return value in GET_MBOX_INFO
The previous patch added a new return field in GET_MBOX_INFO called "suggested timeout" to be used to provide a suggested maximum timeout value to the host. Add this to the return arguments of GET_MBOX_INFO. Note that the host is free to ignore the value and the daemon can leave this blank if it doesn't want to provide a timeout. We hard code a milliseconds per megabyte value which was determined to be approximately 8000 based on testing and is close to linear as the access size changes. Testing was conducted on an Aspeed ast2500 on a Witherspoon with the dev-4.7 OpenBMC branch. Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> Change-Id: If24e41ebb1d9f03c2bdcca84819f9430fd3eeff6
Diffstat (limited to 'mboxd_windows.c')
-rw-r--r--mboxd_windows.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/mboxd_windows.c b/mboxd_windows.c
index c64d19b..f02b0d7 100644
--- a/mboxd_windows.c
+++ b/mboxd_windows.c
@@ -479,6 +479,30 @@ struct window_context *find_oldest_window(struct mbox_context *context)
}
/*
+ * find_largest_window() - Find the largest window in the window cache
+ * @context: The mbox context pointer
+ *
+ * Return: The largest window
+ */
+struct window_context *find_largest_window(struct mbox_context *context)
+{
+ struct window_context *largest = NULL, *cur;
+ uint32_t max_size = 0;
+ int i;
+
+ for (i = 0; i < context->windows.num; i++) {
+ cur = &context->windows.window[i];
+
+ if (cur->size > max_size) {
+ max_size = cur->size;
+ largest = cur;
+ }
+ }
+
+ return largest;
+}
+
+/*
* search_windows() - Search the window cache for a window containing offset
* @context: The mbox context pointer
* @offset: Absolute flash offset to search for (bytes)
OpenPOWER on IntegriCloud