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.
85 * map entry is allocated by bootmem, we need to remember the storage and
100 struct firmware_map_entry *entry = to_memmap_entry(kobj);
102 if (PageReserved(virt_to_page(entry))) {
105 * the memory is hot-added again. The entry will be added to
110 list_add(&entry->list, &map_entries_bootmem);
116 kfree(entry);
130 * firmware_map_add_entry() - Does the real work to add a firmware memmap entry.
134 * @entry: Pre-allocated (either kmalloc() or bootmem allocator), uninitialised
135 * entry.
144 struct firmware_map_entry *entry)
148 entry->start = start;
149 entry->end = end - 1;
150 entry->type = type;
151 INIT_LIST_HEAD(&entry->list);
152 kobject_init(&entry->kobj, &memmap_ktype);
155 list_add_tail(&entry->list, &map_entries);
163 * memmap entry.
164 * @entry: removed entry.
168 static inline void firmware_map_remove_entry(struct firmware_map_entry *entry)
170 list_del(&entry->list);
174 * Add memmap entry on sysfs
176 static int add_sysfs_fw_map_entry(struct firmware_map_entry *entry)
181 if (entry->kobj.state_in_sysfs)
190 entry->kobj.kset = mmap_kset;
191 if (kobject_add(&entry->kobj, NULL, "%d", map_entries_nr++))
192 kobject_put(&entry->kobj);
198 * Remove memmap entry on sysfs
200 static inline void remove_sysfs_fw_map_entry(struct firmware_map_entry *entry)
202 kobject_put(&entry->kobj);
206 * firmware_map_find_entry_in_list() - Search memmap entry in a given list.
210 * @list: In which to find the entry.
214 * the lock until the processing of the returned entry has completed.
216 * Return: Pointer to the entry to be found on success, or NULL on failure.
222 struct firmware_map_entry *entry;
224 list_for_each_entry(entry, list, list)
225 if ((entry->start == start) && (entry->end == end) &&
226 (!strcmp(entry->type, type))) {
227 return entry;
234 * firmware_map_find_entry() - Search memmap entry in map_entries.
241 * until the processing of the returned entry has completed.
243 * Return: Pointer to the entry to be found on success, or NULL on failure.
252 * firmware_map_find_entry_bootmem() - Search memmap entry in map_entries_bootmem.
258 * given entry in map_entries_bootmem.
260 * Return: Pointer to the entry to be found on success, or NULL on failure.
270 * firmware_map_add_hotplug() - Adds a firmware mapping entry when we do
276 * Adds a firmware mapping entry. This function is for memory hotplug, it is
278 * it will create the syfs entry dynamically.
284 struct firmware_map_entry *entry;
286 entry = firmware_map_find_entry(start, end - 1, type);
287 if (entry)
290 entry = firmware_map_find_entry_bootmem(start, end - 1, type);
291 if (!entry) {
292 entry = kzalloc(sizeof(struct firmware_map_entry), GFP_ATOMIC);
293 if (!entry)
298 list_del(&entry->list);
301 memset(entry, 0, sizeof(*entry));
304 firmware_map_add_entry(start, end, type, entry);
305 /* create the memmap entry */
306 add_sysfs_fw_map_entry(entry);
312 * firmware_map_add_early() - Adds a firmware mapping entry.
317 * Adds a firmware mapping entry. This function uses the bootmem allocator
326 struct firmware_map_entry *entry;
328 entry = memblock_alloc(sizeof(struct firmware_map_entry),
330 if (WARN_ON(!entry))
333 return firmware_map_add_entry(start, end, type, entry);
337 * firmware_map_remove() - remove a firmware mapping entry
342 * removes a firmware mapping entry.
344 * Return: 0 on success, or -EINVAL if no entry.
348 struct firmware_map_entry *entry;
351 entry = firmware_map_find_entry(start, end - 1, type);
352 if (!entry) {
357 firmware_map_remove_entry(entry);
360 /* remove the memmap entry */
361 remove_sysfs_fw_map_entry(entry);
370 static ssize_t start_show(struct firmware_map_entry *entry, char *buf)
373 (unsigned long long)entry->start);
376 static ssize_t end_show(struct firmware_map_entry *entry, char *buf)
379 (unsigned long long)entry->end);
382 static ssize_t type_show(struct firmware_map_entry *entry, char *buf)
384 return snprintf(buf, PAGE_SIZE, "%s\n", entry->type);
395 struct firmware_map_entry *entry = to_memmap_entry(kobj);
398 return memmap_attr->show(entry, buf);
411 struct firmware_map_entry *entry;
413 list_for_each_entry(entry, &map_entries, list)
414 add_sysfs_fw_map_entry(entry);