2020-05-08 19:28:13 +02:00
|
|
|
/* This file is part of the superiotool project */
|
util/: Replace GPLv2 boiler plate with SPDX header
Used commands:
perl -i -p0e 's|\/\*[\s*]*.*is free software[:;][\s*]*you[\s*]*can[\s*]*redistribute[\s*]*it[\s*]*and\/or[\s*]*modify[\s*]*it[\s*]*under[\s*]*the[\s*]*terms[\s*]*of[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*as[\s*]*published[\s*]*by[\s*]*the[\s*]*Free[\s*]*Software[\s*]*Foundation[;,][\s*]*version[\s*]*2[\s*]*of[\s*]*the[\s*]*License.[\s*]*This[\s*]*program[\s*]*is[\s*]*distributed[\s*]*in[\s*]*the[\s*]*hope[\s*]*that[\s*]*it[\s*]*will[\s*]*be[\s*]*useful,[\s*]*but[\s*]*WITHOUT[\s*]*ANY[\s*]*WARRANTY;[\s*]*without[\s*]*even[\s*]*the[\s*]*implied[\s*]*warranty[\s*]*of[\s*]*MERCHANTABILITY[\s*]*or[\s*]*FITNESS[\s*]*FOR[\s*]*A[\s*]*PARTICULAR[\s*]*PURPOSE.[\s*]*See[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*for[\s*]*more[\s*]*details.[\s*]*\*\/|/* SPDX-License-Identifier: GPL-2.0-only */|' $(cat filelist)
perl -i -p0e 's|This[\s*]*program[\s*]*is[\s*]*free[\s*]*software[:;][\s*]*you[\s*]*can[\s*]*redistribute[\s*]*it[\s*]*and/or[\s*]*modify[\s*]*it[\s*]*under[\s*]*the[\s*]*terms[\s*]*of[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*as[\s*]*published[\s*]*by[\s*]*the[\s*]*Free[\s*]*Software[\s*]*Foundation[;,][\s*]*either[\s*]*version[\s*]*2[\s*]*of[\s*]*the[\s*]*License,[\s*]*or[\s*]*.at[\s*]*your[\s*]*option.*[\s*]*any[\s*]*later[\s*]*version.[\s*]*This[\s*]*program[\s*]*is[\s*]*distributed[\s*]*in[\s*]*the[\s*]*hope[\s*]*that[\s*]*it[\s*]*will[\s*]*be[\s*]*useful,[\s*]*but[\s*]*WITHOUT[\s*]*ANY[\s*]*WARRANTY;[\s*]*without[\s*]*even[\s*]*the[\s*]*implied[\s*]*warranty[\s*]*of[\s*]*MERCHANTABILITY[\s*]*or[\s*]*FITNESS[\s*]*FOR[\s*]*A[\s*]*PARTICULAR[\s*]*PURPOSE.[\s*]*See[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*for[\s*]*more[\s*]*details.[\s*]*\*\/|/* SPDX-License-Identifier: GPL-2.0-or-later */|' $(cat filelist)
perl -i -p0e 's|\/\*[\s*]*.*This[\s*#]*program[\s*#]*is[\s*#]*free[\s*#]*software[;:,][\s*#]*you[\s*#]*can[\s*#]*redistribute[\s*#]*it[\s*#]*and/or[\s*#]*modify[\s*#]*it[\s*#]*under[\s*#]*the[\s*#]*terms[\s*#]*of[\s*#]*the[\s*#]*GNU[\s*#]*General[\s*#]*Public[\s*#]*License[\s*#]*as[\s*#]*published[\s*#]*by[\s*#]*the[\s*#]*Free[\s*#]*Software[\s*#]*Foundation[;:,][\s*#]*either[\s*#]*version[\s*#]*3[\s*#]*of[\s*#]*the[\s*#]*License[;:,][\s*#]*or[\s*#]*.at[\s*#]*your[\s*#]*option.*[\s*#]*any[\s*#]*later[\s*#]*version.[\s*#]*This[\s*#]*program[\s*#]*is[\s*#]*distributed[\s*#]*in[\s*#]*the[\s*#]*hope[\s*#]*that[\s*#]*it[\s*#]*will[\s*#]*be[\s*#]*useful[;:,][\s*#]*but[\s*#]*WITHOUT[\s*#]*ANY[\s*#]*WARRANTY[;:,][\s*#]*without[\s*#]*even[\s*#]*the[\s*#]*implied[\s*#]*warranty[\s*#]*of[\s*#]*MERCHANTABILITY[\s*#]*or[\s*#]*FITNESS[\s*#]*FOR[\s*#]*A[\s*#]*PARTICULAR[\s*#]*PURPOSE.[\s*#]*See[\s*#]*the[\s*#]*GNU[\s*#]*General[\s*#]*Public[\s*#]*License[\s*#]*for[\s*#]*more[\s*#]*details.[\s*]*\*\/|/* SPDX-License-Identifier: GPL-3.0-or-later */|' $(cat filelist)
perl -i -p0e 's|(\#\#*)[\w]*.*is free software[:;][\#\s]*you[\#\s]*can[\#\s]*redistribute[\#\s]*it[\#\s]*and\/or[\#\s]*modify[\#\s]*it[\s\#]*under[\s \#]*the[\s\#]*terms[\s\#]*of[\s\#]*the[\s\#]*GNU[\s\#]*General[\s\#]*Public[\s\#]*License[\s\#]*as[\s\#]*published[\s\#]*by[\s\#]*the[\s\#]*Free[\s\#]*Software[\s\#]*Foundation[;,][\s\#]*version[\s\#]*2[\s\#]*of[\s\#]*the[\s\#]*License.*[\s\#]*This[\s\#]*program[\s\#]*is[\s\#]*distributed[\s\#]*in[\s\#]*the[\s\#]*hope[\s\#]*that[\s\#]*it[\s\#]*will[\#\s]*be[\#\s]*useful,[\#\s]*but[\#\s]*WITHOUT[\#\s]*ANY[\#\s]*WARRANTY;[\#\s]*without[\#\s]*even[\#\s]*the[\#\s]*implied[\#\s]*warranty[\#\s]*of[\#\s]*MERCHANTABILITY[\#\s]*or[\#\s]*FITNESS[\#\s]*FOR[\#\s]*A[\#\s]*PARTICULAR[\#\s]*PURPOSE.[\#\s]*See[\#\s]*the[\#\s]*GNU[\#\s]*General[\#\s]*Public[\#\s]*License[\#\s]*for[\#\s]*more[\#\s]*details.\s(#* *\n)*|\1 SPDX-License-Identifier: GPL-2.0-only\n\n|' $(cat filelist)
perl -i -p0e 's|(\#\#*)[\w*]*.*is free software[:;][\s*]*you[\s*]*can[\s*]*redistribute[\s*]*it[\s*]*and\/or[\s*]*modify[\s*]*it[\s*]*under[\s*]*the[\s*]*terms[\s*]*of[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*as[\s*]*published[\s*]*by[\s*]*the[\s*]*Free[\s*]*Software[\s*]*Foundation[;,][\s*]*version[\s*]*2[\s*]*of[\s*]*the[\s*]*License.[\s*]*This[\s*]*program[\s*]*is[\s*]*distributed[\s*]*in[\s*]*the[\s*]*hope[\s*]*that[\s*]*it[\s*]*will[\s*]*be[\s*]*useful,[\s*]*but[\s*]*WITHOUT[\s*]*ANY[\s*]*WARRANTY;[\s*]*without[\s*]*even[\s*]*the[\s*]*implied[\s*]*warranty[\s*]*of[\s*]*MERCHANTABILITY[\s*]*or[\s*]*FITNESS[\s*]*FOR[\s*]*A[\s*]*PARTICULAR[\s*]*PURPOSE.[\s*]*See[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*for[\s*]*more[\s*]*details.\s(#* *\n)*|\1 SPDX-License-Identifier: GPL-2.0-only\n\n|' $(cat filelist)
Change-Id: I1008a63b804f355a916221ac994701d7584f60ff
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41177
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-05-08 20:48:04 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2019-05-24 09:07:04 +02:00
|
|
|
|
|
|
|
#include "superiotool.h"
|
|
|
|
|
|
|
|
#define DEVICE_SCRATCH_REG 0x21
|
|
|
|
|
|
|
|
static const struct superio_registers reg_table[] = {
|
|
|
|
{0x00, "AST2400", {
|
|
|
|
{NOLDN, NULL,
|
|
|
|
{0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,
|
|
|
|
0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
|
|
|
|
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,EOT}},
|
|
|
|
{0x02, "SUART1",
|
|
|
|
{0x30,0x60,0x61,0x70,0x71,0xf0,EOT},
|
|
|
|
{0x00,0x03,0xf8,0x04,0x02,RSVD,EOT}},
|
2019-07-11 13:26:46 +02:00
|
|
|
{0x03, "SUART2",
|
2019-05-24 09:07:04 +02:00
|
|
|
{0x30,0x60,0x61,0x70,0x71,0xf0,EOT},
|
|
|
|
{0x00,0x02,0xf8,0x03,0x02,0x00,EOT}},
|
|
|
|
{0x04, "SWC",
|
|
|
|
{0x30,0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,
|
|
|
|
0x70,0x71,EOT},
|
|
|
|
{0x00,0x08,0xe6,0x08,0xe0,0x08,0xe4,0x08,0xe8,
|
|
|
|
0x09,0x01,EOT}},
|
|
|
|
{0x05, "Keyboard config (KBC)",
|
|
|
|
{0x30,0x60,0x61,0x62,0x63,0x70,0x71,0x72,0x73,
|
|
|
|
0xf0,EOT},
|
|
|
|
{0x00,0x00,0x60,0x00,0x64,0x01,0x02,0x0c,0x02,
|
|
|
|
0x83,EOT}},
|
|
|
|
{0x07, "GPIO",
|
|
|
|
{0x30,0x38,0x70,0x71,EOT},
|
|
|
|
{0x00,0x00,0x0b,0x01,EOT}},
|
|
|
|
{0x0b, "SUART3",
|
|
|
|
{0x30,0x60,0x61,0x70,0x71,0xf0,EOT},
|
|
|
|
{0x00,0x03,0xe8,0x06,0x02,0x00,EOT}},
|
|
|
|
{0x0c, "SUART4",
|
|
|
|
{0x30,0x60,0x61,0x70,0x71,0xf0,EOT},
|
|
|
|
{0x00,0x02,0xe8,0x05,0x02,0x00,EOT}},
|
|
|
|
{0x0d, "iLPC2AHB",
|
|
|
|
{0x30,0x70,0x71,0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,
|
|
|
|
0xf6,0xf7,0xf8,0xfe,EOT},
|
|
|
|
{0x00,0x09,0x01,NANA,NANA,NANA,NANA,NANA,NANA,
|
|
|
|
NANA,NANA,0x00,0x00,EOT}},
|
|
|
|
{0x0e, "Mailbox",
|
|
|
|
{0x30,0x60,0x61,0x70,0x71,EOT},
|
|
|
|
{0x00,0x08,0xc0,0x09,0x01,EOT}},
|
|
|
|
{EOT}}},
|
|
|
|
{EOT}
|
|
|
|
};
|
|
|
|
|
|
|
|
static void enter_conf_mode_ast(uint16_t port)
|
|
|
|
{
|
|
|
|
OUTB(0xa5, port);
|
|
|
|
OUTB(0xa5, port);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void exit_conf_mode_ast(uint16_t port)
|
|
|
|
{
|
|
|
|
OUTB(0xaa, port);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int detect_ast_superio(uint16_t port)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
enter_conf_mode_ast(port);
|
|
|
|
|
|
|
|
/* Aspeed devices doesn't have a DEVICE_ID_REG.
|
|
|
|
* Host cycles that aren't decoded read as 0xff.
|
|
|
|
* Probe for the scratch register that are initialized to zero.
|
|
|
|
* The firmware might overwrite that, but it's the best we have.
|
|
|
|
*/
|
|
|
|
|
|
|
|
for (i = DEVICE_SCRATCH_REG; i < 0x30; i++) {
|
|
|
|
if (regval(port, i) != 0xff)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (i == 0x30) {
|
|
|
|
if (verbose)
|
|
|
|
printf(NOTFOUND
|
|
|
|
"scratch registers all read as 0xff\n");
|
|
|
|
}
|
|
|
|
exit_conf_mode_ast(port);
|
|
|
|
|
|
|
|
return i < 0x30;
|
|
|
|
}
|
|
|
|
|
|
|
|
void probe_idregs_aspeed(uint16_t port)
|
|
|
|
{
|
|
|
|
uint16_t chip_id = 0;
|
|
|
|
|
|
|
|
probing_for("Aspeed", "", port);
|
|
|
|
|
|
|
|
if (!detect_ast_superio(port))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (superio_unknown(reg_table, chip_id)) {
|
|
|
|
if (verbose)
|
|
|
|
printf(NOTFOUND "id=0x%02x\n", chip_id);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("Found Aspeed %s (id=0x%02x) at 0x%x\n",
|
|
|
|
get_superio_name(reg_table, chip_id), chip_id, port);
|
|
|
|
chip_found = 1;
|
|
|
|
|
|
|
|
enter_conf_mode_ast(port);
|
|
|
|
dump_superio("Aspeed", reg_table, port, chip_id, LDN_SEL);
|
|
|
|
exit_conf_mode_ast(port);
|
|
|
|
}
|
|
|
|
|
|
|
|
void print_aspeed_chips(void)
|
|
|
|
{
|
|
|
|
print_vendor_chips("Aspeed", reg_table);
|
|
|
|
}
|