static int __init intel_fw_logging_init(void) { int length = 0; oshob_base = get_oshob_addr(); if (oshob_base == NULL) return -EINVAL; length = create_fwerr_log(log_buffer, oshob_base); if (length != 0) { #ifdef CONFIG_PROC_FS ipanic_faberr = create_proc_entry("ipanic_fabric_err", S_IFREG | S_IRUGO, NULL); if (ipanic_faberr == 0) { pr_err("Fail creating procfile ipanic_fabric_err\n"); return -ENOMEM; } ipanic_faberr->read_proc = intel_fw_logging_proc_read; ipanic_faberr->write_proc = NULL; ipanic_faberr->size = length; #endif /* CONFIG_PROC_FS */ /* Dump log as error to console */ pr_err("%s", log_buffer); /* Clear fabric error region inside OSHOB if neccessary */ intel_scu_ipc_simple_command(IPCMSG_CLEAR_FABERROR, 0); } iounmap(oshob_base); return 0; }
static int __init intel_fw_logging_init(void) { int length = 0; int err = 0; u32 scu_trace_size; u32 trace_size; oshob_base = get_oshob_addr(); if (oshob_base == NULL) return -EINVAL; /* * Calculate size of SCU extra trace buffer. Size of the buffer * is given by SCU. Make sanity check in case of incorrect data. * We don't want to allocate all of the memory for trace dump. */ trace_size = intel_scu_ipc_get_scu_trace_buffer_size(); if (trace_size > MAX_SCU_EXTRA_DUMP_SIZE) trace_size = 0; /* * Buffer size is in bytes. We will dump 32-bit hex values + header. * Calculate number of lines and assume constant number of * characters per line. */ scu_trace_size = ((trace_size / sizeof(u32)) + 2) * CHAR_PER_LINE_EXTRA_TRACE; /* Allocate buffer for traditional trace and extra trace */ log_buffer = vzalloc(MAX_FULL_SIZE + scu_trace_size); if (!log_buffer) { err = -ENOMEM; goto err_nomem; } length = create_fwerr_log(log_buffer, oshob_base); if (!length) goto err_nolog; length = dump_scu_extented_trace(log_buffer, length, trace_size); #ifdef CONFIG_PROC_FS ipanic_faberr = create_proc_entry("ipanic_fabric_err", S_IFREG | S_IRUGO, NULL); if (ipanic_faberr == 0) { pr_err("Fail creating procfile ipanic_fabric_err\n"); err = -ENOMEM; goto err_procfail; } ipanic_faberr->read_proc = intel_fw_logging_proc_read; ipanic_faberr->write_proc = NULL; ipanic_faberr->size = length; #endif /* CONFIG_PROC_FS */ /* Dump log as error to console */ pr_err("%s", log_buffer); /* Clear fabric error region inside OSHOB if neccessary */ intel_scu_ipc_simple_command(IPCMSG_CLEAR_FABERROR, 0); goto leave; err_procfail: err_nolog: vfree(log_buffer); err_nomem: leave: iounmap(oshob_base); return err; }