• Home
  • Raw
  • Download

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.
84 * map entry is allocated by bootmem, we need to remember the storage and
99 struct firmware_map_entry *entry = to_memmap_entry(kobj); in release_firmware_map_entry() local
101 if (PageReserved(virt_to_page(entry))) { in release_firmware_map_entry()
104 * the memory is hot-added again. The entry will be added to in release_firmware_map_entry()
109 list_add(&entry->list, &map_entries_bootmem); in release_firmware_map_entry()
115 kfree(entry); in release_firmware_map_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) in firmware_map_add_entry() argument
147 entry->start = start; in firmware_map_add_entry()
148 entry->end = end - 1; in firmware_map_add_entry()
149 entry->type = type; in firmware_map_add_entry()
150 INIT_LIST_HEAD(&entry->list); in firmware_map_add_entry()
151 kobject_init(&entry->kobj, &memmap_ktype); in firmware_map_add_entry()
154 list_add_tail(&entry->list, &map_entries); in firmware_map_add_entry()
162 * memmap entry.
163 * @entry: removed entry.
167 static inline void firmware_map_remove_entry(struct firmware_map_entry *entry) in firmware_map_remove_entry() argument
169 list_del(&entry->list); in firmware_map_remove_entry()
173 * Add memmap entry on sysfs
175 static int add_sysfs_fw_map_entry(struct firmware_map_entry *entry) in add_sysfs_fw_map_entry() argument
180 if (entry->kobj.state_in_sysfs) in add_sysfs_fw_map_entry()
189 entry->kobj.kset = mmap_kset; in add_sysfs_fw_map_entry()
190 if (kobject_add(&entry->kobj, NULL, "%d", map_entries_nr++)) in add_sysfs_fw_map_entry()
191 kobject_put(&entry->kobj); in add_sysfs_fw_map_entry()
197 * Remove memmap entry on sysfs
199 static inline void remove_sysfs_fw_map_entry(struct firmware_map_entry *entry) in remove_sysfs_fw_map_entry() argument
201 kobject_put(&entry->kobj); in remove_sysfs_fw_map_entry()
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; in firmware_map_find_entry_in_list() local
223 list_for_each_entry(entry, list, list) in firmware_map_find_entry_in_list()
224 if ((entry->start == start) && (entry->end == end) && in firmware_map_find_entry_in_list()
225 (!strcmp(entry->type, type))) { in firmware_map_find_entry_in_list()
226 return entry; in firmware_map_find_entry_in_list()
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; in firmware_map_add_hotplug() local
285 entry = firmware_map_find_entry(start, end - 1, type); in firmware_map_add_hotplug()
286 if (entry) in firmware_map_add_hotplug()
289 entry = firmware_map_find_entry_bootmem(start, end - 1, type); in firmware_map_add_hotplug()
290 if (!entry) { in firmware_map_add_hotplug()
291 entry = kzalloc(sizeof(struct firmware_map_entry), GFP_ATOMIC); in firmware_map_add_hotplug()
292 if (!entry) in firmware_map_add_hotplug()
297 list_del(&entry->list); in firmware_map_add_hotplug()
300 memset(entry, 0, sizeof(*entry)); in firmware_map_add_hotplug()
303 firmware_map_add_entry(start, end, type, entry); in firmware_map_add_hotplug()
304 /* create the memmap entry */ in firmware_map_add_hotplug()
305 add_sysfs_fw_map_entry(entry); in firmware_map_add_hotplug()
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; in firmware_map_add_early() local
327 entry = memblock_alloc(sizeof(struct firmware_map_entry), in firmware_map_add_early()
329 if (WARN_ON(!entry)) in firmware_map_add_early()
332 return firmware_map_add_entry(start, end, type, entry); in firmware_map_add_early()
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; in firmware_map_remove() local
350 entry = firmware_map_find_entry(start, end - 1, type); in firmware_map_remove()
351 if (!entry) { in firmware_map_remove()
356 firmware_map_remove_entry(entry); in firmware_map_remove()
359 /* remove the memmap entry */ in firmware_map_remove()
360 remove_sysfs_fw_map_entry(entry); in firmware_map_remove()
369 static ssize_t start_show(struct firmware_map_entry *entry, char *buf) in start_show() argument
372 (unsigned long long)entry->start); in start_show()
375 static ssize_t end_show(struct firmware_map_entry *entry, char *buf) in end_show() argument
378 (unsigned long long)entry->end); in end_show()
381 static ssize_t type_show(struct firmware_map_entry *entry, char *buf) in type_show() argument
383 return snprintf(buf, PAGE_SIZE, "%s\n", entry->type); in type_show()
394 struct firmware_map_entry *entry = to_memmap_entry(kobj); in memmap_attr_show() local
397 return memmap_attr->show(entry, buf); in memmap_attr_show()
410 struct firmware_map_entry *entry; in firmware_memmap_init() local
412 list_for_each_entry(entry, &map_entries, list) in firmware_memmap_init()
413 add_sysfs_fw_map_entry(entry); in firmware_memmap_init()