Subject: SMC card death
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: None <mycroft@gnu.ai.mit.edu>
List: current-users
Date: 04/27/1994 04:22:42
If you've been bitten by this problem, do the following:
1) Build a kernel from tonight's sources, which have the user-level I/O
by opening /dev/mem fixed.
2) Jumper the card at one of the two hard-wired settings.
3) Make sure you booted the kernel from step 1.  B-)
4) Run the attached program, giving it exactly one argument, the address
of the ethernet board.  (i.e. `./wdfix 2a0' if the board is at address
0x2a0.)
5) Mail me the output of the program, the correct ether address for the
board, and the exact model number.
6) I'll tell you how to fix the card.

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  wdfix.c
# Wrapped by mycroft@goldman.gnu.ai.mit.edu on Wed Apr 27 04:16:21 1994
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'wdfix.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'wdfix.c'\"
else
echo shar: Extracting \"'wdfix.c'\" \(1055 characters\)
sed "s/^X//" >'wdfix.c' <<'END_OF_FILE'
X#include <sys/types.h>
X#include <sys/fcntl.h>
X#include <stdio.h>
X#include <err.h>
X#include <machine/pio.h>
X
Xint
Xmain(argc, argv)
X	int argc;
X	char **argv;
X{
X	u_short port, n;
X	u_char x;
X
X	if (open("/dev/mem", O_RDWR) == -1)
X		errx(1, "you are not elite");
X
X	if (!--argc)
X		errx(1, "address not specified");
X	argv++;
X
X	--argc;
X	port = strtol(*(argv++), NULL, 16);
X
X	printf("Current settings (in hex):\n%03x:", port);
X	for (n = 0; n < 16; n++)
X		printf(" %02x", inb(port + n));
X	printf("\n");
X
X	if (!argc)
X		return;
X
X	if (argc % 2)
X		errx(1, "odd number of output arguments");
X
X	while (argc) {
X		argc -= 2;
X		n = strtol(*(argv++), NULL, 16);
X		x = strtol(*(argv++), NULL, 16);
X		printf("outb(%03x,%02x);\n", port + n, x);
X		outb(port + n, x);
X	}
X
X	x = 0xff;
X	for (n = 8; n < 15; n++)
X		x -= inb(port + n);
X	printf("New checksum: %02x\n", x);
X	outb(port + 15, x);
X
X	/* Store it permanently. */
X	outb(port + 1, inb(port + 1) | 0x80);
X
X	printf("New settings (in hex):\n%03x:", port);
X	for (n = 0; n < 16; n++)
X		printf(" %02x", inb(port + n));
X	printf("\n");
X}
END_OF_FILE
if test 1055 -ne `wc -c <'wdfix.c'`; then
    echo shar: \"'wdfix.c'\" unpacked with wrong size!
fi
# end of 'wdfix.c'
fi
echo shar: End of shell archive.
exit 0


------------------------------------------------------------------------------