Lines Matching full:dump
3 * PowerNV OPAL Dump Interface
32 ssize_t (*show)(struct dump_obj *dump, struct dump_attribute *attr,
34 ssize_t (*store)(struct dump_obj *dump, struct dump_attribute *attr,
49 case 0x01: return "SP Dump"; in dump_type_to_string()
50 case 0x02: return "System/Platform Dump"; in dump_type_to_string()
51 case 0x03: return "SMA Dump"; in dump_type_to_string()
69 return sprintf(buf, "ack - acknowledge dump\n"); in dump_ack_show()
81 pr_warn("%s: Failed to send ack to Dump ID 0x%x (%d)\n", in dump_send_ack()
102 /* Attributes of a dump
103 * The binary attribute of the dump itself is dynamic
104 * due to the dynamic size of the dump
117 return sprintf(buf, "1 - initiate Service Processor(FSP) dump\n"); in init_dump_show()
126 pr_warn("%s: Failed to initiate FSP dump (%d)\n", in dump_fips_init()
140 pr_info("%s: Initiated FSP dump\n", __func__); in init_dump_store()
164 struct dump_obj *dump; in dump_attr_show() local
167 dump = to_dump_obj(kobj); in dump_attr_show()
172 return attribute->show(dump, attribute, buf); in dump_attr_show()
180 struct dump_obj *dump; in dump_attr_store() local
183 dump = to_dump_obj(kobj); in dump_attr_store()
188 return attribute->store(dump, attribute, buf, len); in dump_attr_store()
198 struct dump_obj *dump; in dump_release() local
200 dump = to_dump_obj(kobj); in dump_release()
201 vfree(dump->buffer); in dump_release()
202 kfree(dump); in dump_release()
231 pr_warn("%s: Failed to get dump info (%d)\n", in dump_read_info()
243 static int64_t dump_read_data(struct dump_obj *dump) in dump_read_data() argument
250 dump->buffer = vzalloc(PAGE_ALIGN(dump->size)); in dump_read_data()
251 if (!dump->buffer) { in dump_read_data()
258 list = opal_vmalloc_to_sg_list(dump->buffer, dump->size); in dump_read_data()
270 rc = opal_dump_read(dump->id, addr); in dump_read_data()
278 pr_warn("%s: Extract dump failed for ID 0x%x\n", in dump_read_data()
279 __func__, dump->id); in dump_read_data()
294 struct dump_obj *dump = to_dump_obj(kobj); in dump_attr_read() local
296 if (!dump->buffer) { in dump_attr_read()
297 rc = dump_read_data(dump); in dump_attr_read()
300 vfree(dump->buffer); in dump_attr_read()
301 dump->buffer = NULL; in dump_attr_read()
310 pr_info("%s: Platform dump partially read. ID = 0x%x\n", in dump_attr_read()
311 __func__, dump->id); in dump_attr_read()
316 memcpy(buffer, dump->buffer + pos, count); in dump_attr_read()
318 /* You may think we could free the dump buffer now and retrieve in dump_attr_read()
321 * we keep the dump around until it's acknowledged by userspace. in dump_attr_read()
329 struct dump_obj *dump; in create_dump_obj() local
332 dump = kzalloc(sizeof(*dump), GFP_KERNEL); in create_dump_obj()
333 if (!dump) in create_dump_obj()
336 dump->kobj.kset = dump_kset; in create_dump_obj()
338 kobject_init(&dump->kobj, &dump_ktype); in create_dump_obj()
340 sysfs_bin_attr_init(&dump->dump_attr); in create_dump_obj()
342 dump->dump_attr.attr.name = "dump"; in create_dump_obj()
343 dump->dump_attr.attr.mode = 0400; in create_dump_obj()
344 dump->dump_attr.size = size; in create_dump_obj()
345 dump->dump_attr.read = dump_attr_read; in create_dump_obj()
347 dump->id = id; in create_dump_obj()
348 dump->size = size; in create_dump_obj()
349 dump->type = type; in create_dump_obj()
351 rc = kobject_add(&dump->kobj, NULL, "0x%x-0x%x", type, id); in create_dump_obj()
353 kobject_put(&dump->kobj); in create_dump_obj()
358 * As soon as the sysfs file for this dump is created/activated there is in create_dump_obj()
360 * acknowledge the dump before kobject_uevent() is called. If that in create_dump_obj()
372 kobject_get(&dump->kobj); in create_dump_obj()
373 rc = sysfs_create_bin_file(&dump->kobj, &dump->dump_attr); in create_dump_obj()
375 kobject_uevent(&dump->kobj, KOBJ_ADD); in create_dump_obj()
377 pr_info("%s: New platform dump. ID = 0x%x Size %u\n", in create_dump_obj()
378 __func__, dump->id, dump->size); in create_dump_obj()
381 kobject_put(&dump->kobj); in create_dump_obj()
385 kobject_put(&dump->kobj); in create_dump_obj()
423 /* Dump not supported by firmware */ in opal_platform_dump_init()
427 dump_kset = kset_create_and_add("dump", NULL, opal_kobj); in opal_platform_dump_init()
429 pr_warn("%s: Failed to create dump kset\n", __func__); in opal_platform_dump_init()
435 pr_warn("%s: Failed to create initiate dump attr group\n", in opal_platform_dump_init()
450 "opal-dump", NULL); in opal_platform_dump_init()