Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/tc PR/50849: Felix Deichmann: Relax TC option ROM he...
details: https://anonhg.NetBSD.org/src/rev/16621c23e4dd
branches: trunk
changeset: 346569:16621c23e4dd
user: christos <christos%NetBSD.org@localhost>
date: Tue Jul 19 16:58:05 2016 +0000
description:
PR/50849: Felix Deichmann: Relax TC option ROM header check for ROM widths < 4
diffstat:
sys/dev/tc/tc.c | 29 +++++++++++++++++++----------
1 files changed, 19 insertions(+), 10 deletions(-)
diffs (59 lines):
diff -r 0b25f1b30714 -r 16621c23e4dd sys/dev/tc/tc.c
--- a/sys/dev/tc/tc.c Tue Jul 19 16:39:54 2016 +0000
+++ b/sys/dev/tc/tc.c Tue Jul 19 16:58:05 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tc.c,v 1.51 2011/06/04 01:57:34 tsutsui Exp $ */
+/* $NetBSD: tc.c,v 1.52 2016/07/19 16:58:05 christos Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tc.c,v 1.51 2011/06/04 01:57:34 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tc.c,v 1.52 2016/07/19 16:58:05 christos Exp $");
#include "opt_tcverbose.h"
@@ -206,6 +206,22 @@
#endif
};
+static int
+tc_check_romp(const struct tc_rommap *romp)
+{
+ if (romp->tcr_stride.v != 4)
+ return 0;
+
+ for (size_t j = 0; j < 4; j++) {
+ if (romp->tcr_test[j + 0 * romp->tcr_stride.v] != 0x55 ||
+ romp->tcr_test[j + 1 * romp->tcr_stride.v] != 0x00 ||
+ romp->tcr_test[j + 2 * romp->tcr_stride.v] != 0xaa ||
+ romp->tcr_test[j + 3 * romp->tcr_stride.v] != 0xff)
+ return 0;
+ }
+ return 1;
+}
+
int
tc_checkslot(tc_addr_t slotbase, char *namep)
{
@@ -226,16 +242,9 @@
continue;
}
- if (romp->tcr_stride.v != 4)
+ if (!tc_check_romp(romp))
continue;
- for (j = 0; j < 4; j++)
- if (romp->tcr_test[j+0*romp->tcr_stride.v] != 0x55 ||
- romp->tcr_test[j+1*romp->tcr_stride.v] != 0x00 ||
- romp->tcr_test[j+2*romp->tcr_stride.v] != 0xaa ||
- romp->tcr_test[j+3*romp->tcr_stride.v] != 0xff)
- continue;
-
for (j = 0; j < TC_ROM_LLEN; j++)
namep[j] = romp->tcr_modname[j].v;
namep[j] = '\0';
Home |
Main Index |
Thread Index |
Old Index