blob: dae8bd1d1a010d2a89dfe8ca9d99ac2791f1873a [file] [log] [blame]
Andrew Jeffery4fe996c2018-02-27 12:16:48 +10301/* SPDX-License-Identifier: Apache-2.0 */
2/* Copyright (C) 2018 IBM Corp. */
Suraj Jitindar Singhe39c9162017-03-28 10:47:43 +11003
Andrew Jefferya66bcea2018-08-08 17:03:10 +09304#ifndef WINDOWS_H
5#define WINDOWS_H
Suraj Jitindar Singhe39c9162017-03-28 10:47:43 +11006
Andrew Jeffery651ff9d2018-08-08 17:06:11 +09307#define WINDOWS_NO_FLUSH false
8#define WINDOWS_WITH_FLUSH true
Suraj Jitindar Singhe39c9162017-03-28 10:47:43 +11009
Andrew Jeffery2f342ef2017-04-11 13:20:43 +093010#include "mbox.h"
11
Suraj Jitindar Singhe39c9162017-03-28 10:47:43 +110012/* Initialisation Functions */
Andrew Jefferyc1a67fa2018-08-08 17:07:38 +093013int windows_init(struct mbox_context *context);
Andrew Jefferyf5f51422018-08-08 17:08:33 +093014void windows_free(struct mbox_context *context);
Suraj Jitindar Singhe39c9162017-03-28 10:47:43 +110015/* Write From Window Functions */
Andrew Jeffery3200c072018-08-08 17:12:03 +093016int window_flush_v1(struct mbox_context *context,
Suraj Jitindar Singhe39c9162017-03-28 10:47:43 +110017 uint32_t offset_bytes, uint32_t count_bytes);
Andrew Jeffery3200c072018-08-08 17:12:03 +093018int window_flush(struct mbox_context *context, uint32_t offset,
Suraj Jitindar Singhe39c9162017-03-28 10:47:43 +110019 uint32_t count, uint8_t type);
20/* Window Management Functions */
21void alloc_window_dirty_bytemap(struct mbox_context *context);
Suraj Jitindar Singhe39c9162017-03-28 10:47:43 +110022int set_window_bytemap(struct mbox_context *context, struct window_context *cur,
23 uint32_t offset, uint32_t size, uint8_t val);
24void close_current_window(struct mbox_context *context, bool set_bmc_event,
25 uint8_t flags);
26void reset_window(struct mbox_context *context, struct window_context *window);
27void reset_all_windows(struct mbox_context *context, bool set_bmc_event);
28struct window_context *find_oldest_window(struct mbox_context *context);
Suraj Jitindar Singh5a3a0662017-04-27 11:55:26 +100029struct window_context *find_largest_window(struct mbox_context *context);
Suraj Jitindar Singhe39c9162017-03-28 10:47:43 +110030struct window_context *search_windows(struct mbox_context *context,
31 uint32_t offset, bool exact);
32int create_map_window(struct mbox_context *context,
33 struct window_context **this_window,
34 uint32_t offset, bool exact);
35
Andrew Jefferya66bcea2018-08-08 17:03:10 +093036#endif /* WINDOWS_H */