Lines Matching full:window
37 * init_window_state() - Initialise a new window to a known state
38 * @window: The window to initialise
39 * @size: The size of the window
41 static void init_window_state(struct window_context *window, uint32_t size) in init_window_state() argument
43 window->mem = NULL; in init_window_state()
44 window->flash_offset = FLASH_OFFSET_UNINIT; in init_window_state()
45 window->size = size; in init_window_state()
46 window->dirty_bmap = NULL; in init_window_state()
47 window->age = 0; in init_window_state()
64 * order, so the first window will be first in memory and so on. We in init_window_mem()
69 uint32_t size = context->windows.window[i].size; in init_window_mem()
70 MSG_DBG("Window %d @ %p for size 0x%.8x\n", i, in init_window_mem()
72 context->windows.window[i].mem = mem_location; in init_window_mem()
75 /* Tried to allocate window past the end of memory */ in init_window_mem()
86 * init_windows() - Initalise the window cache
95 /* Check if window size and number set - otherwise set to default */ in init_windows()
100 MSG_INFO("Window size: 0x%.8x\n", context->windows.default_size); in init_windows()
108 context->windows.window = calloc(context->windows.num, in init_windows()
109 sizeof(*context->windows.window)); in init_windows()
110 if (!context->windows.window) { in init_windows()
116 init_window_state(&context->windows.window[i], in init_windows()
124 * free_windows() - Free the window cache
131 /* Check window cache has actually been allocated */ in free_windows()
132 if (context->windows.window) { in free_windows()
134 free(context->windows.window[i].dirty_bmap); in free_windows()
136 free(context->windows.window); in free_windows()
140 /* Write from Window Functions */
145 * @offset_bytes: The offset in the current window to write from (bytes)
164 /* Find where in phys flash this is based on the window.flash_offset */ in write_from_window_v1()
185 * memory as part of the existing window in write_from_window_v1()
188 /* Before the start of our current window */ in write_from_window_v1()
202 /* After the end of our current window */ in write_from_window_v1()
230 /* Exceed window at the start */ in write_from_window_v1()
244 * either in the current window or the high_mem window. in write_from_window_v1()
247 /* Exceed window at the end */ in write_from_window_v1()
254 /* Write from the current window - it's atleast that big */ in write_from_window_v1()
270 * write_from_window() - Write back to the flash from the current window
272 * @offset_bytes: The offset in the current window to write from (blocks)
324 MSG_ERR("Write from window with invalid type: %d\n", type); in write_from_window()
331 /* Window Management Functions */
334 * alloc_window_dirty_bytemap() - (re)allocate all the window dirty bytemaps
343 cur = &context->windows.window[i]; in alloc_window_dirty_bytemap()
354 * set_window_bytemap() - Set the window bytemap
356 * @cur: The window to set the bytemap of
357 * @offset: Where in the window to set the bytemap (blocks)
367 MSG_ERR("Tried to set window bytemap past end of window\n"); in set_window_bytemap()
368 MSG_ERR("Requested offset: 0x%x size: 0x%x window size: 0x%x\n", in set_window_bytemap()
380 * close_current_window() - Close the current (active) window
385 * This closes the current window. If the host has requested the current window
387 * (set_bmc_event == false), otherwise if the current window has been closed
394 MSG_DBG("Close current window, flags: 0x%.2x\n", flags); in close_current_window()
409 * reset_window() - Reset a window context to a well defined default state
411 * @window: The window to reset
413 void reset_window(struct mbox_context *context, struct window_context *window) in reset_window() argument
415 window->flash_offset = FLASH_OFFSET_UNINIT; in reset_window()
416 window->size = context->windows.default_size; in reset_window()
417 if (window->dirty_bmap) { /* Might not have been allocated */ in reset_window()
418 set_window_bytemap(context, window, 0, in reset_window()
419 window->size >> context->block_size_shift, in reset_window()
422 window->age = 0; in reset_window()
435 /* We might have an open window which needs closing */ in reset_all_windows()
440 reset_window(context, &context->windows.window[i]); in reset_all_windows()
447 * find_oldest_window() - Find the oldest (Least Recently Used) window
450 * Return: Pointer to the least recently used window
459 cur = &context->windows.window[i]; in find_oldest_window()
471 * find_largest_window() - Find the largest window in the window cache
474 * Return: The largest window
483 cur = &context->windows.window[i]; in find_largest_window()
495 * search_windows() - Search the window cache for a window containing offset
498 * @exact: If the window must exactly map the requested offset
503 * thus assume it can access window->size from the offset we give it.
505 * Return: Pointer to a window containing the requested offset otherwise
514 MSG_DBG("Searching for window which contains 0x%.8x %s\n", in search_windows()
517 cur = &context->windows.window[i]; in search_windows()
519 /* Uninitialised Window */ in search_windows()
530 /* This window contains the requested offset */ in search_windows()
540 * create_map_window() - Create a window mapping which maps the requested offset
542 * @this_window: A pointer to update to the "new" window
544 * @exact: If the window must exactly map the requested offset
546 * This is used to create a window mapping for the requested offset when there
547 * is no existing window in the cache which satisfies the offset. This involves
548 * choosing an existing window from the window cache to evict so we can use it
550 * caller to that window since it now maps their request.
561 MSG_DBG("Creating window which maps 0x%.8x %s\n", offset, in create_map_window()
564 /* Search for an uninitialised window, use this before evicting */ in create_map_window()
567 /* No uninitialised window found, we need to choose one to "evict" */ in create_map_window()
569 MSG_DBG("No uninitialised window, evicting one\n"); in create_map_window()
575 * In case of the virtual pnor, as of now it's possible that a window may in create_map_window()
577 * per window, and some partitions are smaller than the max size. An offset in create_map_window()
584 * It would be nice to align the offsets which we map to window in create_map_window()
596 MSG_ERR("Tried to open read window past flash limit\n"); in create_map_window()
601 * mask offset with window size, meaning when we have in create_map_window()
602 * window size == flash size we will never allow the host to in create_map_window()
603 * open a window except at 0x0, which isn't always where the in create_map_window()
605 * hope the host doesn't access past the end of the window in create_map_window()
621 /* Copy from flash into the window buffer */ in create_map_window()
624 /* We don't know how much we've copied -> better reset window */ in create_map_window()
640 * window size it's possible that something already maps this offset. in create_map_window()
643 * of the window since all windows are the same size so another window in create_map_window()
644 * cannot map just the middle of this window. in create_map_window()
649 MSG_DBG("Checking for window overlap\n"); in create_map_window()
662 /* Clear the bytemap of the window just loaded -> we know it's clean */ in create_map_window()
667 /* Update so we know what's in the window */ in create_map_window()