mptable: Fix BUS type determination

Change-Id: I7268b35671f6629601fa3b2a589054b8c5da5d78
Signed-off-by: Sven Schnelle <svens@stackframe.org>
Reviewed-on: http://review.coreboot.org/1112
Tested-by: build bot (Jenkins)
This commit is contained in:
Sven Schnelle 2012-06-20 10:01:47 +02:00
parent b00c9a2257
commit 4fbcaecf9a
1 changed files with 17 additions and 2 deletions

View File

@ -50,6 +50,7 @@
#include <unistd.h>
#include <stdint.h>
#define ARRAY_SIZE(_x) (sizeof(_x) / sizeof(_x[0]))
#define SEP_LINE \
"\n-------------------------------------------------------------------------------\n"
@ -982,7 +983,7 @@ static void busEntry(void)
{
char name[8];
BusEntry entry;
int i;
/* read it into local memory */
readEntry(&entry, sizeof(entry));
@ -997,7 +998,21 @@ static void busEntry(void)
}
memset(name, '\0', sizeof(name));
strncpy(name, (char *)entry.busType, 6);
for(i = 0; i < 6; i++) {
switch(entry.busType[i]) {
case ' ':
case '\0':
break;
default:
name[i] = entry.busType[i];
break;
}
}
if (entry.busID > ARRAY_SIZE(busses)) {
fprintf(stderr, "busses array to small!\n");
exit(1);
}
busses[entry.busID] = lookupBusType(name);
printf("\tsmp_write_bus(mc, %d, \"", entry.busID);