Lines Matching full: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); in release_firmware_map_entry() local
102 if (PageReserved(virt_to_page(entry))) { in release_firmware_map_entry()
105 * the memory is hot-added again. The entry will be added to in release_firmware_map_entry()
110 list_add(&entry->list, &map_entries_bootmem); in release_firmware_map_entry()
116 kfree(entry); in release_firmware_map_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) in firmware_map_add_entry() argument
148 entry->start = start; in firmware_map_add_entry()
149 entry->end = end - 1; in firmware_map_add_entry()
150 entry->type = type; in firmware_map_add_entry()
151 INIT_LIST_HEAD(&entry->list); in firmware_map_add_entry()
152 kobject_init(&entry->kobj, &memmap_ktype); in firmware_map_add_entry()
155 list_add_tail(&entry->list, &map_entries); in firmware_map_add_entry()
163 * memmap entry.
164 * @entry: removed entry.
168 static inline void firmware_map_remove_entry(struct firmware_map_entry *entry) in firmware_map_remove_entry() argument
170 list_del(&entry->list); in firmware_map_remove_entry()
174 * Add memmap entry on sysfs
176 static int add_sysfs_fw_map_entry(struct firmware_map_entry *entry) in add_sysfs_fw_map_entry() argument
181 if (entry->kobj.state_in_sysfs) in add_sysfs_fw_map_entry()
190 entry->kobj.kset = mmap_kset; in add_sysfs_fw_map_entry()
191 if (kobject_add(&entry->kobj, NULL, "%d", map_entries_nr++)) in add_sysfs_fw_map_entry()
192 kobject_put(&entry->kobj); in add_sysfs_fw_map_entry()
198 * Remove memmap entry on sysfs
200 static inline void remove_sysfs_fw_map_entry(struct firmware_map_entry *entry) in remove_sysfs_fw_map_entry() argument
202 kobject_put(&entry->kobj); in remove_sysfs_fw_map_entry()
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; in firmware_map_find_entry_in_list() local
224 list_for_each_entry(entry, list, list) in firmware_map_find_entry_in_list()
225 if ((entry->start == start) && (entry->end == end) && in firmware_map_find_entry_in_list()
226 (!strcmp(entry->type, type))) { in firmware_map_find_entry_in_list()
227 return entry; in firmware_map_find_entry_in_list()
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; in firmware_map_add_hotplug() local
286 entry = firmware_map_find_entry(start, end - 1, type); in firmware_map_add_hotplug()
287 if (entry) in firmware_map_add_hotplug()
290 entry = firmware_map_find_entry_bootmem(start, end - 1, type); in firmware_map_add_hotplug()
291 if (!entry) { in firmware_map_add_hotplug()
292 entry = kzalloc(sizeof(struct firmware_map_entry), GFP_ATOMIC); in firmware_map_add_hotplug()
293 if (!entry) in firmware_map_add_hotplug()
298 list_del(&entry->list); in firmware_map_add_hotplug()
301 memset(entry, 0, sizeof(*entry)); in firmware_map_add_hotplug()
304 firmware_map_add_entry(start, end, type, entry); in firmware_map_add_hotplug()
305 /* create the memmap entry */ in firmware_map_add_hotplug()
306 add_sysfs_fw_map_entry(entry); in firmware_map_add_hotplug()
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; in firmware_map_add_early() local
328 entry = memblock_alloc(sizeof(struct firmware_map_entry), in firmware_map_add_early()
330 if (WARN_ON(!entry)) in firmware_map_add_early()
333 return firmware_map_add_entry(start, end, type, entry); in firmware_map_add_early()
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; in firmware_map_remove() local
351 entry = firmware_map_find_entry(start, end - 1, type); in firmware_map_remove()
352 if (!entry) { in firmware_map_remove()
357 firmware_map_remove_entry(entry); in firmware_map_remove()
360 /* remove the memmap entry */ in firmware_map_remove()
361 remove_sysfs_fw_map_entry(entry); in firmware_map_remove()
370 static ssize_t start_show(struct firmware_map_entry *entry, char *buf) in start_show() argument
373 (unsigned long long)entry->start); in start_show()
376 static ssize_t end_show(struct firmware_map_entry *entry, char *buf) in end_show() argument
379 (unsigned long long)entry->end); in end_show()
382 static ssize_t type_show(struct firmware_map_entry *entry, char *buf) in type_show() argument
384 return snprintf(buf, PAGE_SIZE, "%s\n", entry->type); in type_show()
395 struct firmware_map_entry *entry = to_memmap_entry(kobj); in memmap_attr_show() local
398 return memmap_attr->show(entry, buf); in memmap_attr_show()
411 struct firmware_map_entry *entry; in firmware_memmap_init() local
413 list_for_each_entry(entry, &map_entries, list) in firmware_memmap_init()
414 add_sysfs_fw_map_entry(entry); in firmware_memmap_init()