Lines Matching refs:entry
22 * Firmware map entry. Because firmware memory maps are flat and not
34 struct list_head list; /* entry for the linked list */
35 struct kobject kobj; /* kobject for each entry */
43 static ssize_t start_show(struct firmware_map_entry *entry, char *buf);
44 static ssize_t end_show(struct firmware_map_entry *entry, char *buf);
45 static ssize_t type_show(struct firmware_map_entry *entry, char *buf);
56 ssize_t (*show)(struct firmware_map_entry *entry, char *buf);
64 * These are default attributes that are added for every memmap entry.
84 * map entry is allocated by bootmem, we need to remember the storage and
99 struct firmware_map_entry *entry = to_memmap_entry(kobj);
101 if (PageReserved(virt_to_page(entry))) {
104 * the memory is hot-added again. The entry will be added to
109 list_add(&entry->list, &map_entries_bootmem);
115 kfree(entry);
129 * firmware_map_add_entry() - Does the real work to add a firmware memmap entry.
133 * @entry: Pre-allocated (either kmalloc() or bootmem allocator), uninitialised
134 * entry.
143 struct firmware_map_entry *entry)
147 entry->start = start;
148 entry->end = end - 1;
149 entry->type = type;
150 INIT_LIST_HEAD(&entry->list);
151 kobject_init(&entry->kobj, &memmap_ktype);
154 list_add_tail(&entry->list, &map_entries);
162 * memmap entry.
163 * @entry: removed entry.
167 static inline void firmware_map_remove_entry(struct firmware_map_entry *entry)
169 list_del(&entry->list);
173 * Add memmap entry on sysfs
175 static int add_sysfs_fw_map_entry(struct firmware_map_entry *entry)
180 if (entry->kobj.state_in_sysfs)
189 entry->kobj.kset = mmap_kset;
190 if (kobject_add(&entry->kobj, NULL, "%d", map_entries_nr++))
191 kobject_put(&entry->kobj);
197 * Remove memmap entry on sysfs
199 static inline void remove_sysfs_fw_map_entry(struct firmware_map_entry *entry)
201 kobject_put(&entry->kobj);
205 * firmware_map_find_entry_in_list() - Search memmap entry in a given list.
209 * @list: In which to find the entry.
213 * the lock until the processing of the returned entry has completed.
215 * Return: Pointer to the entry to be found on success, or NULL on failure.
221 struct firmware_map_entry *entry;
223 list_for_each_entry(entry, list, list)
224 if ((entry->start == start) && (entry->end == end) &&
225 (!strcmp(entry->type, type))) {
226 return entry;
233 * firmware_map_find_entry() - Search memmap entry in map_entries.
240 * until the processing of the returned entry has completed.
242 * Return: Pointer to the entry to be found on success, or NULL on failure.
251 * firmware_map_find_entry_bootmem() - Search memmap entry in map_entries_bootmem.
257 * given entry in map_entries_bootmem.
259 * Return: Pointer to the entry to be found on success, or NULL on failure.
269 * firmware_map_add_hotplug() - Adds a firmware mapping entry when we do
275 * Adds a firmware mapping entry. This function is for memory hotplug, it is
277 * it will create the syfs entry dynamically.
283 struct firmware_map_entry *entry;
285 entry = firmware_map_find_entry(start, end - 1, type);
286 if (entry)
289 entry = firmware_map_find_entry_bootmem(start, end - 1, type);
290 if (!entry) {
291 entry = kzalloc(sizeof(struct firmware_map_entry), GFP_ATOMIC);
292 if (!entry)
297 list_del(&entry->list);
300 memset(entry, 0, sizeof(*entry));
303 firmware_map_add_entry(start, end, type, entry);
304 /* create the memmap entry */
305 add_sysfs_fw_map_entry(entry);
311 * firmware_map_add_early() - Adds a firmware mapping entry.
316 * Adds a firmware mapping entry. This function uses the bootmem allocator
325 struct firmware_map_entry *entry;
327 entry = memblock_alloc(sizeof(struct firmware_map_entry),
329 if (WARN_ON(!entry))
332 return firmware_map_add_entry(start, end, type, entry);
336 * firmware_map_remove() - remove a firmware mapping entry
341 * removes a firmware mapping entry.
343 * Return: 0 on success, or -EINVAL if no entry.
347 struct firmware_map_entry *entry;
350 entry = firmware_map_find_entry(start, end - 1, type);
351 if (!entry) {
356 firmware_map_remove_entry(entry);
359 /* remove the memmap entry */
360 remove_sysfs_fw_map_entry(entry);
369 static ssize_t start_show(struct firmware_map_entry *entry, char *buf)
372 (unsigned long long)entry->start);
375 static ssize_t end_show(struct firmware_map_entry *entry, char *buf)
378 (unsigned long long)entry->end);
381 static ssize_t type_show(struct firmware_map_entry *entry, char *buf)
383 return snprintf(buf, PAGE_SIZE, "%s\n", entry->type);
394 struct firmware_map_entry *entry = to_memmap_entry(kobj);
397 return memmap_attr->show(entry, buf);
410 struct firmware_map_entry *entry;
412 list_for_each_entry(entry, &map_entries, list)
413 add_sysfs_fw_map_entry(entry);