// SPDX-License-Identifier: GPL-2.0-only /* * APEI Error Record Serialization Table debug support * * ERST is a way provided by APEI to save and retrieve hardware error * information to and from a persistent store. This file provide the * debugging/testing support for ERST kernel support and firmware * implementation. * * Copyright 2010 Intel Corp. * Author: Huang Ying <ying.huang@intel.com>
*/
if (mutex_lock_interruptible(&erst_dbg_mutex) != 0) return -EINTR;
pos = (int *)&filp->private_data;
retry_next:
rc = erst_get_record_id_next(pos, &id); if (rc) goto out; /* no more record */ if (id == APEI_ERST_INVALID_RECORD_ID) { /* * If the persistent store is empty initially, the function * 'erst_read' below will return "-ENOENT" value. This causes * 'retry_next' label is entered again. The returned value * should be zero indicating the read operation is EOF.
*/
len = 0;
goto out;
}
retry:
rc = len = erst_read_record(id, erst_dbg_buf, erst_dbg_buf_len,
erst_dbg_buf_len, NULL); /* The record may be cleared by others, try read next record */ if (rc == -ENOENT) goto retry_next; if (rc < 0) goto out; if (len > ERST_DBG_RECORD_LEN_MAX) {
pr_warn(ERST_DBG_PFX "Record (ID: 0x%llx) length is too long: %zd\n", id, len);
rc = -EIO; goto out;
} if (len > erst_dbg_buf_len) { void *p;
rc = -ENOMEM;
p = kmalloc(len, GFP_KERNEL); if (!p) goto out;
kfree(erst_dbg_buf);
erst_dbg_buf = p;
erst_dbg_buf_len = len; goto retry;
}
static __init int erst_dbg_init(void)
{ if (erst_disable) {
pr_info(ERST_DBG_PFX "ERST support is disabled.\n"); return -ENODEV;
} return misc_register(&erst_dbg_dev);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.