| /* |
| * Copyright (c) 2014-2015 TRUSTONIC LIMITED |
| * All Rights Reserved. |
| * |
| * This program is free software; you can redistribute it and/or |
| * modify it under the terms of the GNU General Public License |
| * version 2 as published by the Free Software Foundation. |
| * |
| * This program is distributed in the hope that it will be useful, |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| * GNU General Public License for more details. |
| */ |
| |
| #ifndef _TUI_HAL_H_ |
| #define _TUI_HAL_H_ |
| |
| #include <linux/types.h> |
| #include "tui_ioctl.h" |
| |
| /** |
| * hal_tui_init() - integrator specific initialization for kernel module |
| * |
| * This function is called when the kernel module is initialized, either at |
| * boot time, if the module is built statically in the kernel, or when the |
| * kernel is dynamically loaded if the module is built as a dynamic kernel |
| * module. This function may be used by the integrator, for instance, to get a |
| * memory pool that will be used to allocate the secure framebuffer and work |
| * buffer for TUI sessions. |
| * |
| * Return: must return 0 on success, or non-zero on error. If the function |
| * returns an error, the module initialization will fail. |
| */ |
| uint32_t hal_tui_init(void); |
| |
| /** |
| * hal_tui_exit() - integrator specific exit code for kernel module |
| * |
| * This function is called when the kernel module exit. It is called when the |
| * kernel module is unloaded, for a dynamic kernel module, and never called for |
| * a module built into the kernel. It can be used to free any resources |
| * allocated by hal_tui_init(). |
| */ |
| void hal_tui_exit(void); |
| |
| /** |
| * hal_tui_alloc() - allocator for secure framebuffer and working buffer |
| * @allocbuffer: input parameter that the allocator fills with the physical |
| * addresses of the allocated buffers |
| * @allocsize: size of the buffer to allocate. All the buffer are of the |
| * same size |
| * @number: Number to allocate. |
| * |
| * This function is called when the module receives a CMD_TUI_SW_OPEN_SESSION |
| * message from the secure driver. The function must allocate 'number' |
| * buffer(s) of physically contiguous memory, where the length of each buffer |
| * is at least 'allocsize' bytes. The physical address of each buffer must be |
| * stored in the array of structure 'allocbuffer' which is provided as |
| * arguments. |
| * |
| * Physical address of the first buffer must be put in allocate[0].pa , the |
| * second one on allocbuffer[1].pa, and so on. The function must return 0 on |
| * success, non-zero on error. For integrations where the framebuffer is not |
| * allocated by the Normal World, this function should do nothing and return |
| * success (zero). |
| * If the working buffer allocation is different from framebuffers, ensure that |
| * the physical address of the working buffer is at index 0 of the allocbuffer |
| * table (allocbuffer[0].pa). |
| */ |
| uint32_t hal_tui_alloc( |
| struct tui_alloc_buffer_t allocbuffer[MAX_DCI_BUFFER_NUMBER], |
| size_t allocsize, uint32_t number); |
| |
| /** |
| * hal_tui_free() - free memory allocated by hal_tui_alloc() |
| * |
| * This function is called at the end of the TUI session, when the TUI module |
| * receives the CMD_TUI_SW_CLOSE_SESSION message. The function should free the |
| * buffers allocated by hal_tui_alloc(...). |
| */ |
| void hal_tui_free(void); |
| |
| void hal_tui_post_start(struct tlc_tui_response_t *rsp); |
| |
| /** |
| * hal_tui_deactivate() - deactivate Normal World display and input |
| * |
| * This function should stop the Normal World display and, if necessary, Normal |
| * World input. It is called when a TUI session is opening, before the Secure |
| * World takes control of display and input. |
| * |
| * Return: must return 0 on success, non-zero otherwise. |
| */ |
| uint32_t hal_tui_deactivate(void); |
| |
| /** |
| * hal_tui_activate() - restore Normal World display and input after a TUI |
| * session |
| * |
| * This function should enable Normal World display and, if necessary, Normal |
| * World input. It is called after a TUI session, after the Secure World has |
| * released the display and input. |
| * |
| * Return: must return 0 on success, non-zero otherwise. |
| */ |
| uint32_t hal_tui_activate(void); |
| uint32_t hal_tui_process_cmd(struct tui_hal_cmd_t *cmd, |
| struct tui_hal_rsp_t *rsp); |
| uint32_t hal_tui_notif(void); |
| |
| /** |
| * hal_tui_process_cmd() - integrator specific exit code for kernel module |
| * |
| * This function is called when kernel module receives a command from the |
| * secure driver HAL, ie when drTuiCoreDciSendAndWait() is called. |
| */ |
| uint32_t hal_tui_process_cmd(struct tui_hal_cmd_t *cmd, |
| struct tui_hal_rsp_t *rsp); |
| |
| /** |
| * hal_tui_notif() - integrator specific exit code for kernel module |
| * |
| * This function is called when kernel module receives an answer from the |
| * secure driver HAL (the hal_rsp field of the world shared memory struct is |
| * not null). |
| * This should be the way to get an answer from the secure driver after a |
| * command has been sent to it (the hal_cmd field of the world shared memory |
| * struct has been set and a notification has been raised). |
| */ |
| uint32_t hal_tui_notif(void); |
| |
| /** |
| * hal_tui_process_cmd() - integrator specific exit code for kernel module |
| * |
| * This function is called when kernel module receives a command from the |
| * secure driver HAL, ie when drTuiCoreDciSendAndWait() is called. |
| */ |
| uint32_t hal_tui_process_cmd(struct tui_hal_cmd_t *cmd, |
| struct tui_hal_rsp_t *rsp); |
| |
| /** |
| * hal_tui_notif() - integrator specific exit code for kernel module |
| * |
| * This function is called when kernel module receives an answer from the |
| * secure driver HAL (the hal_rsp field of the world shared memory struct is |
| * not null). |
| * This should be the way to get an answer from the secure driver after a |
| * command has been sent to it (the hal_cmd field of the world shared memory |
| * struct has been set and a notification has been raised). |
| */ |
| uint32_t hal_tui_notif(void); |
| |
| #endif |