Lines Matching refs:ghes

237 static struct ghes *ghes_new(struct acpi_hest_generic *generic)  in ghes_new()
239 struct ghes *ghes; in ghes_new() local
243 ghes = kzalloc(sizeof(*ghes), GFP_KERNEL); in ghes_new()
244 if (!ghes) in ghes_new()
246 ghes->generic = generic; in ghes_new()
258 ghes->estatus = kmalloc(error_block_length, GFP_KERNEL); in ghes_new()
259 if (!ghes->estatus) { in ghes_new()
264 return ghes; in ghes_new()
269 kfree(ghes); in ghes_new()
273 static void ghes_fini(struct ghes *ghes) in ghes_fini() argument
275 kfree(ghes->estatus); in ghes_fini()
276 apei_unmap_generic_address(&ghes->generic->error_status_address); in ghes_fini()
333 static int ghes_read_estatus(struct ghes *ghes, int silent) in ghes_read_estatus() argument
335 struct acpi_hest_generic *g = ghes->generic; in ghes_read_estatus()
351 ghes_copy_tofrom_phys(ghes->estatus, buf_paddr, in ghes_read_estatus()
352 sizeof(*ghes->estatus), 1); in ghes_read_estatus()
353 if (!ghes->estatus->block_status) in ghes_read_estatus()
356 ghes->buffer_paddr = buf_paddr; in ghes_read_estatus()
357 ghes->flags |= GHES_TO_CLEAR; in ghes_read_estatus()
360 len = cper_estatus_len(ghes->estatus); in ghes_read_estatus()
361 if (len < sizeof(*ghes->estatus)) in ghes_read_estatus()
363 if (len > ghes->generic->error_block_length) in ghes_read_estatus()
365 if (cper_estatus_check_header(ghes->estatus)) in ghes_read_estatus()
367 ghes_copy_tofrom_phys(ghes->estatus + 1, in ghes_read_estatus()
368 buf_paddr + sizeof(*ghes->estatus), in ghes_read_estatus()
369 len - sizeof(*ghes->estatus), 1); in ghes_read_estatus()
370 if (cper_estatus_check(ghes->estatus)) in ghes_read_estatus()
381 static void ghes_clear_estatus(struct ghes *ghes) in ghes_clear_estatus() argument
383 ghes->estatus->block_status = 0; in ghes_clear_estatus()
384 if (!(ghes->flags & GHES_TO_CLEAR)) in ghes_clear_estatus()
386 ghes_copy_tofrom_phys(ghes->estatus, ghes->buffer_paddr, in ghes_clear_estatus()
387 sizeof(ghes->estatus->block_status), 0); in ghes_clear_estatus()
388 ghes->flags &= ~GHES_TO_CLEAR; in ghes_clear_estatus()
423 static void ghes_do_proc(struct ghes *ghes, in ghes_do_proc() argument
436 ghes_edac_report_mem_error(ghes, sev, mem_err); in ghes_do_proc()
646 static int ghes_proc(struct ghes *ghes) in ghes_proc() argument
650 rc = ghes_read_estatus(ghes, 0); in ghes_proc()
653 if (!ghes_estatus_cached(ghes->estatus)) { in ghes_proc()
654 if (ghes_print_estatus(NULL, ghes->generic, ghes->estatus)) in ghes_proc()
655 ghes_estatus_cache_add(ghes->generic, ghes->estatus); in ghes_proc()
657 ghes_do_proc(ghes, ghes->estatus); in ghes_proc()
659 ghes_clear_estatus(ghes); in ghes_proc()
663 static void ghes_add_timer(struct ghes *ghes) in ghes_add_timer() argument
665 struct acpi_hest_generic *g = ghes->generic; in ghes_add_timer()
674 ghes->timer.expires = round_jiffies_relative(expire); in ghes_add_timer()
675 add_timer(&ghes->timer); in ghes_add_timer()
680 struct ghes *ghes = (void *)data; in ghes_poll_func() local
682 ghes_proc(ghes); in ghes_poll_func()
683 if (!(ghes->flags & GHES_EXITING)) in ghes_poll_func()
684 ghes_add_timer(ghes); in ghes_poll_func()
689 struct ghes *ghes = data; in ghes_irq_func() local
692 rc = ghes_proc(ghes); in ghes_irq_func()
702 struct ghes *ghes; in ghes_notify_sci() local
706 list_for_each_entry_rcu(ghes, &ghes_sci, list) { in ghes_notify_sci()
707 if (!ghes_proc(ghes)) in ghes_notify_sci()
762 ghes_do_proc(estatus_node->ghes, estatus); in ghes_proc_in_irq()
802 struct ghes *ghes, *ghes_global = NULL; in ghes_notify_nmi() local
807 list_for_each_entry_rcu(ghes, &ghes_nmi, list) { in ghes_notify_nmi()
808 if (ghes_read_estatus(ghes, 1)) { in ghes_notify_nmi()
809 ghes_clear_estatus(ghes); in ghes_notify_nmi()
812 sev = ghes_severity(ghes->estatus->error_severity); in ghes_notify_nmi()
815 ghes_global = ghes; in ghes_notify_nmi()
834 list_for_each_entry_rcu(ghes, &ghes_nmi, list) { in ghes_notify_nmi()
840 if (!(ghes->flags & GHES_TO_CLEAR)) in ghes_notify_nmi()
843 if (ghes_estatus_cached(ghes->estatus)) in ghes_notify_nmi()
846 len = cper_estatus_len(ghes->estatus); in ghes_notify_nmi()
851 estatus_node->ghes = ghes; in ghes_notify_nmi()
852 estatus_node->generic = ghes->generic; in ghes_notify_nmi()
854 memcpy(estatus, ghes->estatus, len); in ghes_notify_nmi()
859 ghes_clear_estatus(ghes); in ghes_notify_nmi()
890 static void ghes_nmi_add(struct ghes *ghes) in ghes_nmi_add() argument
894 len = ghes_esource_prealloc_size(ghes->generic); in ghes_nmi_add()
899 list_add_rcu(&ghes->list, &ghes_nmi); in ghes_nmi_add()
903 static void ghes_nmi_remove(struct ghes *ghes) in ghes_nmi_remove() argument
908 list_del_rcu(&ghes->list); in ghes_nmi_remove()
917 len = ghes_esource_prealloc_size(ghes->generic); in ghes_nmi_remove()
926 static inline void ghes_nmi_add(struct ghes *ghes) in ghes_nmi_add() argument
929 ghes->generic->header.source_id); in ghes_nmi_add()
933 static inline void ghes_nmi_remove(struct ghes *ghes) in ghes_nmi_remove() argument
936 ghes->generic->header.source_id); in ghes_nmi_remove()
948 struct ghes *ghes = NULL; in ghes_probe() local
986 ghes = ghes_new(generic); in ghes_probe()
987 if (IS_ERR(ghes)) { in ghes_probe()
988 rc = PTR_ERR(ghes); in ghes_probe()
989 ghes = NULL; in ghes_probe()
993 rc = ghes_edac_register(ghes, &ghes_dev->dev); in ghes_probe()
999 ghes->timer.function = ghes_poll_func; in ghes_probe()
1000 ghes->timer.data = (unsigned long)ghes; in ghes_probe()
1001 init_timer_deferrable(&ghes->timer); in ghes_probe()
1002 ghes_add_timer(ghes); in ghes_probe()
1006 rc = acpi_gsi_to_irq(generic->notify.vector, &ghes->irq); in ghes_probe()
1012 rc = request_irq(ghes->irq, ghes_irq_func, 0, "GHES IRQ", ghes); in ghes_probe()
1023 list_add_rcu(&ghes->list, &ghes_sci); in ghes_probe()
1027 ghes_nmi_add(ghes); in ghes_probe()
1032 platform_set_drvdata(ghes_dev, ghes); in ghes_probe()
1036 ghes_edac_unregister(ghes); in ghes_probe()
1038 if (ghes) { in ghes_probe()
1039 ghes_fini(ghes); in ghes_probe()
1040 kfree(ghes); in ghes_probe()
1047 struct ghes *ghes; in ghes_remove() local
1050 ghes = platform_get_drvdata(ghes_dev); in ghes_remove()
1051 generic = ghes->generic; in ghes_remove()
1053 ghes->flags |= GHES_EXITING; in ghes_remove()
1056 del_timer_sync(&ghes->timer); in ghes_remove()
1059 free_irq(ghes->irq, ghes); in ghes_remove()
1063 list_del_rcu(&ghes->list); in ghes_remove()
1069 ghes_nmi_remove(ghes); in ghes_remove()
1076 ghes_fini(ghes); in ghes_remove()
1078 ghes_edac_unregister(ghes); in ghes_remove()
1080 kfree(ghes); in ghes_remove()