2008-05-07 22:43:15 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the coreinfo project.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2008 Advanced Micro Devices, Inc.
|
|
|
|
*
|
|
|
|
* 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
|
Remove address from GPLv2 headers
As per discussion with lawyers[tm], it's not a good idea to
shorten the license header too much - not for legal reasons
but because there are tools that look for them, and giving
them a standard pattern simplifies things.
However, we got confirmation that we don't have to update
every file ever added to coreboot whenever the FSF gets a
new lease, but can drop the address instead.
util/kconfig is excluded because that's imported code that
we may want to synchronize every now and then.
$ find * -type f -exec sed -i "s:Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *MA[, ]*02110-1301[, ]*USA:Foundation, Inc.:" {} +
$ find * -type f -exec sed -i "s:Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA:Foundation, Inc.:" {} +
$ find * -type f -exec sed -i "s:Foundation, Inc., 59 Temple Place[-, ]*Suite 330, Boston, MA *02111-1307[, ]*USA:Foundation, Inc.:" {} +
$ find * -type f -exec sed -i "s:Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.:Foundation, Inc.:" {} +
$ find * -type f
-a \! -name \*.patch \
-a \! -name \*_shipped \
-a \! -name LICENSE_GPL \
-a \! -name LGPL.txt \
-a \! -name COPYING \
-a \! -name DISCLAIMER \
-exec sed -i "/Foundation, Inc./ N;s:Foundation, Inc.* USA\.* *:Foundation, Inc. :;s:Foundation, Inc. $:Foundation, Inc.:" {} +
Change-Id: Icc968a5a5f3a5df8d32b940f9cdb35350654bef9
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-on: http://review.coreboot.org/9233
Tested-by: build bot (Jenkins)
Reviewed-by: Vladimir Serbinenko <phcoder@gmail.com>
2015-03-26 15:17:45 +01:00
|
|
|
* Foundation, Inc.
|
2008-05-07 22:43:15 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "coreinfo.h"
|
|
|
|
|
2015-06-30 01:08:39 +02:00
|
|
|
#if IS_ENABLED(CONFIG_MODULE_LAR)
|
2008-05-07 22:43:15 +02:00
|
|
|
|
|
|
|
static struct LAR *lar;
|
2008-07-18 16:08:18 +02:00
|
|
|
static int lcount, selected;
|
2008-05-07 22:43:15 +02:00
|
|
|
static char **lnames;
|
2008-07-18 16:08:18 +02:00
|
|
|
static const char *compression_table[4] = {"none", "LZMA", "NRV2B", "zeroes"};
|
2008-05-07 22:43:15 +02:00
|
|
|
|
|
|
|
static int lar_module_init(void)
|
|
|
|
{
|
|
|
|
int index = 0;
|
|
|
|
struct larent *larent;
|
|
|
|
|
|
|
|
lar = openlar(NULL);
|
|
|
|
|
|
|
|
if (lar == NULL)
|
|
|
|
return 0;
|
|
|
|
|
2008-07-18 16:08:18 +02:00
|
|
|
while ((larent = readlar(lar)))
|
2008-05-07 22:43:15 +02:00
|
|
|
lcount++;
|
|
|
|
|
|
|
|
lnames = malloc(lcount * sizeof(char *));
|
|
|
|
|
|
|
|
if (lnames == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
rewindlar(lar);
|
|
|
|
|
2008-07-18 16:08:18 +02:00
|
|
|
while ((larent = readlar(lar)))
|
2008-05-07 22:43:15 +02:00
|
|
|
lnames[index++] = strdup((const char *) larent->name);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int lar_module_redraw(WINDOW *win)
|
|
|
|
{
|
2008-07-18 16:08:18 +02:00
|
|
|
int i, row = 2;
|
2008-05-07 22:43:15 +02:00
|
|
|
struct larstat stat;
|
|
|
|
|
|
|
|
print_module_title(win, "LAR Listing");
|
|
|
|
|
|
|
|
if (lar == 0) {
|
2008-08-07 16:35:39 +02:00
|
|
|
mvwprintw(win, 11, 61 / 2, "Bad or missing LAR");
|
2008-05-07 22:43:15 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-07-18 16:08:18 +02:00
|
|
|
/* Draw a line down the middle. */
|
|
|
|
for (i = 2; i < 21; i++)
|
2008-08-11 22:35:32 +02:00
|
|
|
mvwaddch(win, i, 30, ACS_VLINE);
|
2008-05-07 22:43:15 +02:00
|
|
|
|
2008-07-18 16:08:18 +02:00
|
|
|
/* Draw the names down the left side. */
|
|
|
|
for (i = 0; i < lcount; i++) {
|
2008-05-07 22:43:15 +02:00
|
|
|
if (i == selected)
|
|
|
|
wattrset(win, COLOR_PAIR(3) | A_BOLD);
|
|
|
|
else
|
|
|
|
wattrset(win, COLOR_PAIR(2));
|
|
|
|
|
|
|
|
mvwprintw(win, 2 + i, 1, "%.25s", lnames[i]);
|
|
|
|
}
|
|
|
|
|
2008-07-18 16:08:18 +02:00
|
|
|
/* Get the information for the LAR. */
|
2008-05-07 22:43:15 +02:00
|
|
|
if (larstat(lar, lnames[selected], &stat)) {
|
|
|
|
printf("larstat failed\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
wattrset(win, COLOR_PAIR(2));
|
|
|
|
|
|
|
|
mvwprintw(win, row++, 32, "Offset: 0x%x", stat.offset);
|
|
|
|
|
|
|
|
if (stat.compression) {
|
2008-07-18 16:08:18 +02:00
|
|
|
mvwprintw(win, row++, 32, "Compression: %s",
|
|
|
|
compression_table[stat.compression]);
|
2008-05-07 22:43:15 +02:00
|
|
|
mvwprintw(win, row++, 32, "Compressed length: %d", stat.len);
|
2008-07-18 16:08:18 +02:00
|
|
|
mvwprintw(win, row++, 32, "Compressed checksum: 0x%x",
|
|
|
|
stat.compchecksum);
|
2008-05-07 22:43:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
mvwprintw(win, row++, 32, "Length: %d", stat.reallen);
|
|
|
|
mvwprintw(win, row++, 32, "Checksum: 0x%x", stat.checksum);
|
2008-07-18 16:08:18 +02:00
|
|
|
mvwprintw(win, row++, 32, "Load address: 0x%llx", stat.loadaddress);
|
|
|
|
mvwprintw(win, row++, 32, "Entry point: 0x%llx", stat.entry);
|
2008-05-07 22:43:15 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int lar_module_handle(int key)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (lar == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
switch (key) {
|
|
|
|
case KEY_DOWN:
|
|
|
|
if (selected + 1 < lcount) {
|
|
|
|
selected++;
|
|
|
|
ret = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case KEY_UP:
|
|
|
|
if (selected > 0) {
|
|
|
|
selected--;
|
|
|
|
ret = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct coreinfo_module lar_module = {
|
|
|
|
.name = "LAR",
|
|
|
|
.init = lar_module_init,
|
|
|
|
.redraw = lar_module_redraw,
|
|
|
|
.handle = lar_module_handle
|
|
|
|
};
|
2008-07-18 16:08:18 +02:00
|
|
|
|
2008-05-07 22:43:15 +02:00
|
|
|
#else
|
|
|
|
|
|
|
|
struct coreinfo_module lar_module = {
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|