Lines Matching +full:c +full:- +full:define +full:- +full:name

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2020, Linaro Ltd.
15 #define SMEM_AARM_PARTITION_TABLE 9
16 #define SMEM_APPS 0
18 #define SMEM_FLASH_PART_MAGIC1 0x55ee73aa
19 #define SMEM_FLASH_PART_MAGIC2 0xe35ebddb
20 #define SMEM_FLASH_PTABLE_V3 3
21 #define SMEM_FLASH_PTABLE_V4 4
22 #define SMEM_FLASH_PTABLE_MAX_PARTS_V3 16
23 #define SMEM_FLASH_PTABLE_MAX_PARTS_V4 48
24 #define SMEM_FLASH_PTABLE_HDR_LEN (4 * sizeof(u32))
25 #define SMEM_FLASH_PTABLE_NAME_SIZE 16
28 * struct smem_flash_pentry - SMEM Flash partition entry
29 * @name: Name of the partition
35 char name[SMEM_FLASH_PTABLE_NAME_SIZE]; member
42 * struct smem_flash_ptable - SMEM Flash partition table
66 char *name, *c; in parse_qcomsmem_part() local
69 && mtd->type == MTD_NORFLASH) { in parse_qcomsmem_part()
71 mtd->name); in parse_qcomsmem_part()
72 return -EINVAL; in parse_qcomsmem_part()
78 if (PTR_ERR(ptable) != -EPROBE_DEFER) in parse_qcomsmem_part()
84 if (le32_to_cpu(ptable->magic1) != SMEM_FLASH_PART_MAGIC1 || in parse_qcomsmem_part()
85 le32_to_cpu(ptable->magic2) != SMEM_FLASH_PART_MAGIC2) { in parse_qcomsmem_part()
87 return -EINVAL; in parse_qcomsmem_part()
91 tmpparts = le32_to_cpu(ptable->numparts); in parse_qcomsmem_part()
94 return -EINVAL; in parse_qcomsmem_part()
98 if (le32_to_cpu(ptable->version) <= SMEM_FLASH_PTABLE_V3) { in parse_qcomsmem_part()
101 } else if (le32_to_cpu(ptable->version) == SMEM_FLASH_PTABLE_V4) { in parse_qcomsmem_part()
105 pr_err("Unknown ptable version (%d)", le32_to_cpu(ptable->version)); in parse_qcomsmem_part()
106 return -EINVAL; in parse_qcomsmem_part()
121 pentry = &ptable->pentry[i]; in parse_qcomsmem_part()
122 if (pentry->name[0] != '\0') in parse_qcomsmem_part()
128 return -ENOMEM; in parse_qcomsmem_part()
131 pentry = &ptable->pentry[i]; in parse_qcomsmem_part()
132 if (pentry->name[0] == '\0') in parse_qcomsmem_part()
135 name = kstrdup(pentry->name, GFP_KERNEL); in parse_qcomsmem_part()
136 if (!name) { in parse_qcomsmem_part()
137 ret = -ENOMEM; in parse_qcomsmem_part()
141 /* Convert name to lower case */ in parse_qcomsmem_part()
142 for (c = name; *c != '\0'; c++) in parse_qcomsmem_part()
143 *c = tolower(*c); in parse_qcomsmem_part()
145 parts[j].name = name; in parse_qcomsmem_part()
146 parts[j].offset = le32_to_cpu(pentry->offset) * mtd->erasesize; in parse_qcomsmem_part()
147 parts[j].mask_flags = pentry->attr; in parse_qcomsmem_part()
148 parts[j].size = le32_to_cpu(pentry->length) * mtd->erasesize; in parse_qcomsmem_part()
150 i, pentry->name, le32_to_cpu(pentry->offset), in parse_qcomsmem_part()
151 le32_to_cpu(pentry->length), pentry->attr); in parse_qcomsmem_part()
156 le32_to_cpu(ptable->version), tmpparts); in parse_qcomsmem_part()
162 while (--j >= 0) in parse_qcomsmem_part()
163 kfree(parts[j].name); in parse_qcomsmem_part()
176 kfree(pparts[i].name); in parse_qcomsmem_cleanup()
182 { .compatible = "qcom,smem-part" },
190 .name = "qcomsmem",