diff options
author | Suraj Jitindar Singh <sjitindarsingh@gmail.com> | 2017-04-27 14:48:58 +1000 |
---|---|---|
committer | Andrew Jeffery <andrew@aj.id.au> | 2017-05-04 01:20:23 +0000 |
commit | 2851959877213f23fe5317b9a738d06db41a6666 (patch) | |
tree | efaa77cff69a17ae7b97a943fb7a25062c5cf46d /mboxd_windows.c | |
parent | 5a3a0664b63feba8aff288a5691a9f873e4ea6eb (diff) | |
download | phosphor-mboxd-2851959877213f23fe5317b9a738d06db41a6666.tar.gz phosphor-mboxd-2851959877213f23fe5317b9a738d06db41a6666.zip |
mboxd: Introduce a new DEBUG log level
Currently there is no output on the console unless -v is specified on
the command line which enables error output. A second -v will provide
info output.
We probably want error output irrespective of whether a -v was given
on the command line because people generally want to know why their
program stopped working.
Make error output unconditional.
A single -v will give minimal informational output which is a good
level to see what the daemon is doing without barfing all over the
console.
A second -v will enable debug output which will print highly verbose
information which will be useful for debugging. Probably don't enable
this under normal circumstances.
Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Change-Id: I3da25f7e4e9e976c17389fcceb1d85ef98de7e0a
Diffstat (limited to 'mboxd_windows.c')
-rw-r--r-- | mboxd_windows.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/mboxd_windows.c b/mboxd_windows.c index f02b0d7..451ecd1 100644 --- a/mboxd_windows.c +++ b/mboxd_windows.c @@ -82,8 +82,11 @@ static int init_window_mem(struct mbox_context *context) * did we will error out here */ for (i = 0; i < context->windows.num; i++) { + uint32_t size = context->windows.window[i].size; + MSG_DBG("Window %d @ %p for size 0x%.8x\n", i, + mem_location, size); context->windows.window[i].mem = mem_location; - mem_location += context->windows.window[i].size; + mem_location += size; if (mem_location > (context->mem + context->mem_size)) { /* Tried to allocate window past the end of memory */ MSG_ERR("Total size of windows exceeds reserved mem\n"); @@ -110,13 +113,13 @@ int init_windows(struct mbox_context *context) /* Default to 1MB windows */ context->windows.default_size = 1 << 20; } - MSG_OUT("Window size: 0x%.8x\n", context->windows.default_size); + MSG_INFO("Window size: 0x%.8x\n", context->windows.default_size); if (!context->windows.num) { /* Use the entire reserved memory region by default */ context->windows.num = context->mem_size / context->windows.default_size; } - MSG_OUT("Number of Windows: %d\n", context->windows.num); + MSG_INFO("Number of windows: %d\n", context->windows.num); context->windows.window = calloc(context->windows.num, sizeof(*context->windows.window)); @@ -404,6 +407,8 @@ int set_window_bytemap(struct mbox_context *context, struct window_context *cur, void close_current_window(struct mbox_context *context, bool set_bmc_event, uint8_t flags) { + MSG_DBG("Close current window, flags: 0x%.2x\n", flags); + if (set_bmc_event) { set_bmc_events(context, BMC_EVENT_WINDOW_RESET, SET_BMC_EVENT); } @@ -443,6 +448,7 @@ void reset_all_windows(struct mbox_context *context, bool set_bmc_event) { int i; + MSG_DBG("Resetting all windows\n"); /* We might have an open window which needs closing */ if (context->current) { close_current_window(context, set_bmc_event, FLAGS_NONE); @@ -522,6 +528,8 @@ struct window_context *search_windows(struct mbox_context *context, struct window_context *cur; int i; + MSG_DBG("Searching for window which contains 0x%.8x %s\n", + offset, exact ? "exactly" : ""); for (i = 0; i < context->windows.num; i++) { cur = &context->windows.window[i]; if (cur->flash_offset == FLASH_OFFSET_UNINIT) { @@ -567,12 +575,15 @@ int create_map_window(struct mbox_context *context, struct window_context *cur = NULL; int rc; + MSG_DBG("Creating window which maps 0x%.8x %s\n", offset, + exact ? "exactly" : ""); /* Search for an uninitialised window, use this before evicting */ cur = search_windows(context, FLASH_OFFSET_UNINIT, true); /* No uninitialised window found, we need to choose one to "evict" */ if (!cur) { + MSG_DBG("No uninitialised window, evicting one\n"); cur = find_oldest_window(context); } @@ -628,6 +639,8 @@ int create_map_window(struct mbox_context *context, if (context->version == API_VERSION_1) { uint32_t i; + MSG_DBG("Checking for window overlap\n"); + for (i = offset; i < (offset + cur->size); i += (cur->size - 1)) { struct window_context *tmp = NULL; do { |