![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 */ 0002 0003 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. 0004 * Copyright (C) 2019-2021 Linaro Ltd. 0005 */ 0006 #ifndef _IPA_MEM_H_ 0007 #define _IPA_MEM_H_ 0008 0009 struct ipa; 0010 struct ipa_mem_data; 0011 0012 /** 0013 * DOC: IPA Local Memory 0014 * 0015 * The IPA has a block of shared memory, divided into regions used for 0016 * specific purposes. 0017 * 0018 * The regions within the shared block are bounded by an offset (relative to 0019 * the "ipa-shared" memory range) and size found in the IPA_SHARED_MEM_SIZE 0020 * register. 0021 * 0022 * Each region is optionally preceded by one or more 32-bit "canary" values. 0023 * These are meant to detect out-of-range writes (if they become corrupted). 0024 * A given region (such as a filter or routing table) has the same number 0025 * of canaries for all IPA hardware versions. Still, the number used is 0026 * defined in the config data, allowing for generic handling of regions. 0027 * 0028 * The set of memory regions is defined in configuration data. They are 0029 * subject to these constraints: 0030 * - a zero offset and zero size represents and undefined region 0031 * - a region's size does not include space for its "canary" values 0032 * - a region's offset is defined to be *past* all "canary" values 0033 * - offset must be large enough to account for all canaries 0034 * - a region's size may be zero, but may still have canaries 0035 * - all offsets must be 8-byte aligned 0036 * - most sizes must be a multiple of 8 0037 * - modem memory size must be a multiple of 4 0038 * - the microcontroller ring offset must be a multiple of 1024 0039 */ 0040 0041 /* The maximum allowed size for any memory region */ 0042 #define IPA_MEM_MAX (2 * PAGE_SIZE) 0043 0044 /* IPA-resident memory region ids */ 0045 enum ipa_mem_id { 0046 IPA_MEM_UC_SHARED, /* 0 canaries */ 0047 IPA_MEM_UC_INFO, /* 0 canaries */ 0048 IPA_MEM_V4_FILTER_HASHED, /* 2 canaries */ 0049 IPA_MEM_V4_FILTER, /* 2 canaries */ 0050 IPA_MEM_V6_FILTER_HASHED, /* 2 canaries */ 0051 IPA_MEM_V6_FILTER, /* 2 canaries */ 0052 IPA_MEM_V4_ROUTE_HASHED, /* 2 canaries */ 0053 IPA_MEM_V4_ROUTE, /* 2 canaries */ 0054 IPA_MEM_V6_ROUTE_HASHED, /* 2 canaries */ 0055 IPA_MEM_V6_ROUTE, /* 2 canaries */ 0056 IPA_MEM_MODEM_HEADER, /* 2 canaries */ 0057 IPA_MEM_AP_HEADER, /* 0 canaries, optional */ 0058 IPA_MEM_MODEM_PROC_CTX, /* 2 canaries */ 0059 IPA_MEM_AP_PROC_CTX, /* 0 canaries */ 0060 IPA_MEM_MODEM, /* 0/2 canaries */ 0061 IPA_MEM_UC_EVENT_RING, /* 1 canary, optional */ 0062 IPA_MEM_PDN_CONFIG, /* 0/2 canaries (IPA v4.0+) */ 0063 IPA_MEM_STATS_QUOTA_MODEM, /* 2/4 canaries (IPA v4.0+) */ 0064 IPA_MEM_STATS_QUOTA_AP, /* 0 canaries, optional (IPA v4.0+) */ 0065 IPA_MEM_STATS_TETHERING, /* 0 canaries (IPA v4.0+) */ 0066 IPA_MEM_STATS_DROP, /* 0 canaries, optional (IPA v4.0+) */ 0067 /* The next 5 filter and route statistics regions are optional */ 0068 IPA_MEM_STATS_V4_FILTER, /* 0 canaries (IPA v4.0-v4.2) */ 0069 IPA_MEM_STATS_V6_FILTER, /* 0 canaries (IPA v4.0-v4.2) */ 0070 IPA_MEM_STATS_V4_ROUTE, /* 0 canaries (IPA v4.0-v4.2) */ 0071 IPA_MEM_STATS_V6_ROUTE, /* 0 canaries (IPA v4.0-v4.2) */ 0072 IPA_MEM_STATS_FILTER_ROUTE, /* 0 canaries (IPA v4.5+) */ 0073 IPA_MEM_NAT_TABLE, /* 4 canaries, optional (IPA v4.5+) */ 0074 IPA_MEM_END_MARKER, /* 1 canary (not a real region) */ 0075 IPA_MEM_COUNT, /* Number of regions (not an index) */ 0076 }; 0077 0078 /** 0079 * struct ipa_mem - IPA local memory region description 0080 * @id: memory region identifier 0081 * @offset: offset in IPA memory space to base of the region 0082 * @size: size in bytes base of the region 0083 * @canary_count: Number of 32-bit "canary" values that precede region 0084 */ 0085 struct ipa_mem { 0086 enum ipa_mem_id id; 0087 u32 offset; 0088 u16 size; 0089 u16 canary_count; 0090 }; 0091 0092 const struct ipa_mem *ipa_mem_find(struct ipa *ipa, enum ipa_mem_id mem_id); 0093 0094 int ipa_mem_config(struct ipa *ipa); 0095 void ipa_mem_deconfig(struct ipa *ipa); 0096 0097 int ipa_mem_setup(struct ipa *ipa); /* No ipa_mem_teardown() needed */ 0098 0099 int ipa_mem_zero_modem(struct ipa *ipa); 0100 0101 int ipa_mem_init(struct ipa *ipa, const struct ipa_mem_data *mem_data); 0102 void ipa_mem_exit(struct ipa *ipa); 0103 0104 #endif /* _IPA_MEM_H_ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |