Line data Source code
1 0 : /* SPDX-License-Identifier: Apache-2.0 */
2 : /*
3 : * Copyright (c) 2022 Intel Corporation.
4 : *
5 : * Author: Marcin Szkudlinski <marcin.szkudlinski@linux.intel.com>
6 : *
7 : */
8 :
9 : #ifndef ZEPHYR_INCLUDE_DRIVERS_INTEL_ADSP_MTL_TLB
10 : #define ZEPHYR_INCLUDE_DRIVERS_INTEL_ADSP_MTL_TLB
11 :
12 :
13 : /*
14 : * This function will save contents of the physical memory banks into a provided storage buffer
15 : *
16 : * the system must be almost stopped. Operation is destructive - it will change physical to
17 : * virtual addresses mapping leaving the system not operational
18 : * Power states of memory banks will stay not touched
19 : * assuming
20 : * - the dcache memory had been invalidated before
21 : * - no remapping of addresses below unused_l2_sram_start_marker has been made
22 : * (this is ensured by the driver itself - it rejects such remapping request)
23 : *
24 : * at this point the memory is still up&running so its safe to use libraries like memcpy
25 : * and the procedure can be called in a zephyr driver model way
26 : */
27 0 : typedef void (*mm_save_context)(void *storage_buffer);
28 :
29 : /*
30 : * This function will return a required size of storage buffer needed to perform context save
31 : *
32 : */
33 0 : typedef uint32_t (*mm_get_storage_size)(void);
34 :
35 : /*
36 : * This function will restore the contents and power state of the physical memory banks
37 : * and recreate physical to virtual mappings
38 : *
39 : * As the system memory is down at this point, the procedure
40 : * - MUST be located in IMR memory region
41 : * - MUST be called using a simple extern procedure call - API table is not yet loaded
42 : * - MUST NOT use libraries, like memcpy, use instead a special version bmemcpy located in IMR
43 : *
44 : */
45 0 : void adsp_mm_restore_context(void *storage_buffer);
46 :
47 : /*
48 : * This procedure return a pointer to a first unused address in L2 virtual memory
49 : */
50 0 : uintptr_t adsp_mm_get_unused_l2_start_aligned(void);
51 :
52 0 : struct intel_adsp_tlb_api {
53 0 : mm_save_context save_context;
54 0 : mm_get_storage_size get_storage_size;
55 : };
56 :
57 : #endif /* ZEPHYR_INCLUDE_DRIVERS_INTEL_ADSP_MTL_TLB */
|