There was always exactly one elog descriptor declared and initialized, but its contents were being accessed through a pointer that was passed back and forth between functions instead of being accessed directly. This made the code more verbose than it needed to be and harder to follow. To address this the descriptor type was eliminated, its contents were turned into individual global variables, and various functions were adjusted to no longer take the descriptor as an argument. Similarly, the code was more verbose and complicated than it needed to be because of several wrapper functions which wrapped a single line of code which called an underlying function with particular arguments and were only used once. This makes it harder to tell what the code is doing because the call to the real function you may already be familiar with is obscured behind a new function you've never seen before. It also adds one more text to the file as a whole while providing at best a marginal benefit. Those functions were removed and their callers now call their contents directly. Built and booted on Link. Ran mosys eventlog list. Cleared the event log and ran mosys eventlog list again. Added 2000 events and ran mosys eventlog list. Cleared the log again and ran mosys eventlog list. Change-Id: I4f5f6b9f4f508548077b7f5a92f4322db99e01ca Signed-off-by: Gabe Black <gabeblack@google.com> Reviewed-on: https://gerrit.chromium.org/gerrit/49310 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Gabe Black <gabeblack@chromium.org> Tested-by: Gabe Black <gabeblack@chromium.org> Reviewed-on: http://review.coreboot.org/4245 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
72 lines
1.8 KiB
C
72 lines
1.8 KiB
C
/*
|
|
* This file is part of the coreboot project.
|
|
*
|
|
* Copyright (C) 2012 The ChromiumOS Authors. All rights reserved.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; version 2 of the License.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
|
|
*/
|
|
|
|
#ifndef ELOG_INTERNAL_H_
|
|
#define ELOG_INTERNAL_H_
|
|
|
|
/* ELOG header */
|
|
struct elog_header {
|
|
u32 magic;
|
|
u8 version;
|
|
u8 header_size;
|
|
u8 reserved[2];
|
|
} __attribute__ ((packed));
|
|
|
|
/* ELOG related constants */
|
|
#define ELOG_SIGNATURE 0x474f4c45 /* 'ELOG' */
|
|
#define ELOG_VERSION 1
|
|
|
|
/* SMBIOS event log header */
|
|
struct event_header {
|
|
u8 type;
|
|
u8 length;
|
|
u8 year;
|
|
u8 month;
|
|
u8 day;
|
|
u8 hour;
|
|
u8 minute;
|
|
u8 second;
|
|
} __attribute__ ((packed));
|
|
|
|
/* SMBIOS Type 15 related constants */
|
|
#define ELOG_HEADER_TYPE_OEM 0x88
|
|
|
|
typedef enum elog_area_state {
|
|
ELOG_AREA_UNDEFINED, /* Initial boot strap state */
|
|
ELOG_AREA_EMPTY, /* Entire area is empty */
|
|
ELOG_AREA_HAS_CONTENT, /* Area has some content */
|
|
} elog_area_state;
|
|
|
|
typedef enum elog_header_state {
|
|
ELOG_HEADER_INVALID,
|
|
ELOG_HEADER_VALID,
|
|
} elog_header_state;
|
|
|
|
typedef enum elog_event_buffer_state {
|
|
ELOG_EVENT_BUFFER_OK,
|
|
ELOG_EVENT_BUFFER_CORRUPTED,
|
|
} elog_event_buffer_state;
|
|
|
|
struct elog_area {
|
|
struct elog_header header;
|
|
u8 data[0];
|
|
} __attribute__((packed));
|
|
|
|
#endif /* ELOG_INTERNAL_H_ */
|