aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/include/asm/acpi.h5
-rw-r--r--arch/x86/kernel/acpi/sleep.c13
-rw-r--r--arch/x86/kernel/acpi/sleep.h2
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce-apei.c42
4 files changed, 33 insertions, 29 deletions
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index 4ea15ca89b2b..ef14da1f4ec5 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -113,9 +113,8 @@ static inline void acpi_disable_pci(void)
113 acpi_noirq_set(); 113 acpi_noirq_set();
114} 114}
115 115
116/* routines for saving/restoring kernel state */ 116/* Low-level suspend routine. */
117extern int acpi_save_state_mem(void); 117extern int acpi_suspend_lowlevel(void);
118extern void acpi_restore_state_mem(void);
119 118
120extern unsigned long acpi_wakeup_address; 119extern unsigned long acpi_wakeup_address;
121 120
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index 68d1537b8c81..5f1b747f6ef1 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -29,14 +29,14 @@ static char temp_stack[4096];
29#endif 29#endif
30 30
31/** 31/**
32 * acpi_save_state_mem - save kernel state 32 * acpi_suspend_lowlevel - save kernel state
33 * 33 *
34 * Create an identity mapped page table and copy the wakeup routine to 34 * Create an identity mapped page table and copy the wakeup routine to
35 * low memory. 35 * low memory.
36 * 36 *
37 * Note that this is too late to change acpi_wakeup_address. 37 * Note that this is too late to change acpi_wakeup_address.
38 */ 38 */
39int acpi_save_state_mem(void) 39int acpi_suspend_lowlevel(void)
40{ 40{
41 struct wakeup_header *header; 41 struct wakeup_header *header;
42 42
@@ -107,17 +107,10 @@ int acpi_save_state_mem(void)
107 saved_magic = 0x123456789abcdef0L; 107 saved_magic = 0x123456789abcdef0L;
108#endif /* CONFIG_64BIT */ 108#endif /* CONFIG_64BIT */
109 109
110 do_suspend_lowlevel();
110 return 0; 111 return 0;
111} 112}
112 113
113/*
114 * acpi_restore_state - undo effects of acpi_save_state_mem
115 */
116void acpi_restore_state_mem(void)
117{
118}
119
120
121/** 114/**
122 * acpi_reserve_wakeup_memory - do _very_ early ACPI initialisation 115 * acpi_reserve_wakeup_memory - do _very_ early ACPI initialisation
123 * 116 *
diff --git a/arch/x86/kernel/acpi/sleep.h b/arch/x86/kernel/acpi/sleep.h
index adbcbaa6f1df..31ce13f20297 100644
--- a/arch/x86/kernel/acpi/sleep.h
+++ b/arch/x86/kernel/acpi/sleep.h
@@ -14,3 +14,5 @@ extern char swsusp_pg_dir[PAGE_SIZE];
14 14
15extern unsigned long acpi_copy_wakeup_routine(unsigned long); 15extern unsigned long acpi_copy_wakeup_routine(unsigned long);
16extern void wakeup_long64(void); 16extern void wakeup_long64(void);
17
18extern void do_suspend_lowlevel(void);
diff --git a/arch/x86/kernel/cpu/mcheck/mce-apei.c b/arch/x86/kernel/cpu/mcheck/mce-apei.c
index 8209472b27a5..83930deec3c6 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-apei.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-apei.c
@@ -106,24 +106,34 @@ int apei_write_mce(struct mce *m)
106ssize_t apei_read_mce(struct mce *m, u64 *record_id) 106ssize_t apei_read_mce(struct mce *m, u64 *record_id)
107{ 107{
108 struct cper_mce_record rcd; 108 struct cper_mce_record rcd;
109 ssize_t len; 109 int rc, pos;
110 110
111 len = erst_read_next(&rcd.hdr, sizeof(rcd)); 111 rc = erst_get_record_id_begin(&pos);
112 if (len <= 0) 112 if (rc)
113 return len; 113 return rc;
114 /* Can not skip other records in storage via ERST unless clear them */ 114retry:
115 else if (len != sizeof(rcd) || 115 rc = erst_get_record_id_next(&pos, record_id);
116 uuid_le_cmp(rcd.hdr.creator_id, CPER_CREATOR_MCE)) { 116 if (rc)
117 if (printk_ratelimit()) 117 goto out;
118 pr_warning( 118 /* no more record */
119 "MCE-APEI: Can not skip the unknown record in ERST"); 119 if (*record_id == APEI_ERST_INVALID_RECORD_ID)
120 return -EIO; 120 goto out;
121 } 121 rc = erst_read(*record_id, &rcd.hdr, sizeof(rcd));
122 122 /* someone else has cleared the record, try next one */
123 if (rc == -ENOENT)
124 goto retry;
125 else if (rc < 0)
126 goto out;
127 /* try to skip other type records in storage */
128 else if (rc != sizeof(rcd) ||
129 uuid_le_cmp(rcd.hdr.creator_id, CPER_CREATOR_MCE))
130 goto retry;
123 memcpy(m, &rcd.mce, sizeof(*m)); 131 memcpy(m, &rcd.mce, sizeof(*m));
124 *record_id = rcd.hdr.record_id; 132 rc = sizeof(*m);
133out:
134 erst_get_record_id_end();
125 135
126 return sizeof(*m); 136 return rc;
127} 137}
128 138
129/* Check whether there is record in ERST */ 139/* Check whether there is record in ERST */