Lines Matching full:window

40  * init_window_state() - Initialise a new window to a known state
41 * @window: The window to initialise
42 * @size: The size of the window
44 static void init_window_state(struct window_context *window, uint32_t size) in init_window_state() argument
46 window->mem = NULL; in init_window_state()
47 window->flash_offset = FLASH_OFFSET_UNINIT; in init_window_state()
48 window->size = size; in init_window_state()
49 window->dirty_bmap = NULL; in init_window_state()
50 window->age = 0; in init_window_state()
67 * order, so the first window will be first in memory and so on. We in init_window_mem()
72 uint32_t size = context->windows.window[i].size; in init_window_mem()
73 MSG_DBG("Window %zd @ %p for size 0x%.8x\n", i, in init_window_mem()
75 context->windows.window[i].mem = mem_location; in init_window_mem()
78 /* Tried to allocate window past the end of memory */ in init_window_mem()
89 * windows_init() - Initalise the window cache
98 /* Check if window size and number set - otherwise set to default */ in windows_init()
103 MSG_INFO("Window size: 0x%.8x\n", context->windows.default_size); in windows_init()
111 context->windows.window = calloc(context->windows.num, in windows_init()
112 sizeof(*context->windows.window)); in windows_init()
113 if (!context->windows.window) { in windows_init()
119 init_window_state(&context->windows.window[i], in windows_init()
127 * windows_free() - Free the window cache
134 /* Check window cache has actually been allocated */ in windows_free()
135 if (context->windows.window) { in windows_free()
137 free(context->windows.window[i].dirty_bmap); in windows_free()
139 free(context->windows.window); in windows_free()
143 /* Write from Window Functions */
148 * @offset_bytes: The offset in the current window to write from (bytes)
167 /* Find where in phys flash this is based on the window.flash_offset */ in window_flush_v1()
188 * memory as part of the existing window in window_flush_v1()
191 /* Before the start of our current window */ in window_flush_v1()
205 /* After the end of our current window */ in window_flush_v1()
233 /* Exceed window at the start */ in window_flush_v1()
247 * either in the current window or the high_mem window. in window_flush_v1()
250 /* Exceed window at the end */ in window_flush_v1()
257 /* Write from the current window - it's atleast that big */ in window_flush_v1()
273 * window_flush() - Write back to the flash from the current window
275 * @offset_bytes: The offset in the current window to write from (blocks)
329 MSG_ERR("Write from window with invalid type: %d\n", type); in window_flush()
336 /* Window Management Functions */
339 * windows_alloc_dirty_bytemap() - (re)allocate all the window dirty bytemaps
348 cur = &context->windows.window[i]; in windows_alloc_dirty_bytemap()
359 * window_set_bytemap() - Set the window bytemap
361 * @cur: The window to set the bytemap of
362 * @offset: Where in the window to set the bytemap (blocks)
372 MSG_ERR("Tried to set window bytemap past end of window\n"); in window_set_bytemap()
373 MSG_ERR("Requested offset: 0x%x size: 0x%x window size: 0x%x\n", in window_set_bytemap()
385 * windows_close_current() - Close the current (active) window
389 * This closes the current window. If the host has requested the current window
391 * (set_bmc_event == false), otherwise if the current window has been closed
397 MSG_DBG("Close current window, flags: 0x%.2x\n", flags); in windows_close_current()
408 * window_reset() - Reset a window context to a well defined default state
410 * @window: The window to reset
412 void window_reset(struct mbox_context *context, struct window_context *window) in window_reset() argument
414 window->flash_offset = FLASH_OFFSET_UNINIT; in window_reset()
415 window->size = context->windows.default_size; in window_reset()
416 if (window->dirty_bmap) { /* Might not have been allocated */ in window_reset()
417 window_set_bytemap(context, window, 0, in window_reset()
418 window->size >> context->backend.block_size_shift, in window_reset()
421 window->age = 0; in window_reset()
428 * @return True if there was a window open that was closed, false otherwise
439 /* We might have an open window which needs closing */ in windows_reset_all()
446 window_reset(context, &context->windows.window[i]); in windows_reset_all()
453 * windows_find_oldest() - Find the oldest (Least Recently Used) window
456 * Return: Pointer to the least recently used window
465 cur = &context->windows.window[i]; in windows_find_oldest()
477 * windows_find_largest() - Find the largest window in the window cache
480 * Return: The largest window
489 cur = &context->windows.window[i]; in windows_find_largest()
501 * windows_search() - Search the window cache for a window containing offset
504 * @exact: If the window must exactly map the requested offset
509 * thus assume it can access window->size from the offset we give it.
511 * Return: Pointer to a window containing the requested offset otherwise
520 MSG_DBG("Searching for window which contains 0x%.8x %s\n", in windows_search()
523 cur = &context->windows.window[i]; in windows_search()
525 /* Uninitialised Window */ in windows_search()
536 /* This window contains the requested offset */ in windows_search()
546 * windows_create_map() - Create a window mapping which maps the requested offset
548 * @this_window: A pointer to update to the "new" window
550 * @exact: If the window must exactly map the requested offset
552 * This is used to create a window mapping for the requested offset when there
553 * is no existing window in the cache which satisfies the offset. This involves
554 * choosing an existing window from the window cache to evict so we can use it
556 * caller to that window since it now maps their request.
567 MSG_DBG("Creating window which maps 0x%.8x %s\n", offset, in windows_create_map()
570 /* Search for an uninitialised window, use this before evicting */ in windows_create_map()
573 /* No uninitialised window found, we need to choose one to "evict" */ in windows_create_map()
575 MSG_DBG("No uninitialised window, evicting one\n"); in windows_create_map()
590 MSG_ERR("Tried to open read window past flash limit\n"); in windows_create_map()
595 * mask offset with window size, meaning when we have in windows_create_map()
596 * window size == flash size we will never allow the host to in windows_create_map()
597 * open a window except at 0x0, which isn't always where the in windows_create_map()
599 * hope the host doesn't access past the end of the window in windows_create_map()
615 /* Copy from flash into the window buffer */ in windows_create_map()
618 /* We don't know how much we've copied -> better reset window */ in windows_create_map()
634 * window size it's possible that something already maps this offset. in windows_create_map()
637 * of the window since all windows are the same size so another window in windows_create_map()
638 * cannot map just the middle of this window. in windows_create_map()
643 MSG_DBG("Checking for window overlap\n"); in windows_create_map()
656 /* Clear the bytemap of the window just loaded -> we know it's clean */ in windows_create_map()
661 /* Update so we know what's in the window */ in windows_create_map()