--- via-diag.c.orig Sat Feb 3 10:14:50 2001 +++ via-diag.c Sat Feb 3 13:00:47 2001 @@ -150,6 +150,8 @@ static int get_media_index(const char *name); /* Chip-specific options, if any, go here. */ +static int try_to_start = 0, try_to_stop = 0; + int main(int argc, char **argv) @@ -161,7 +163,7 @@ int card_num = 0; extern char *optarg; - while ((c = getopt_long(argc, argv, "#:aA:DeEfF:G:mp:qrRst:vVwWH:BL:S:", + while ((c = getopt_long(argc, argv, "#:aA:DeEfF:G:mp:qrRst:vVwWH:BL:S:Ii", longopts, &longind)) != -1) switch (c) { @@ -205,6 +207,8 @@ case 'B': opt_flash_show++; break; case 'L': opt_flash_loadfile = optarg; break; case 'S': opt_flash_dumpfile = optarg; break; + case 'I': try_to_start = 1; try_to_stop = 0; break; + case 'i': try_to_start = 0; try_to_stop = 1; break; case '?': errflag++; } @@ -559,6 +563,25 @@ "Perhaps it is set to ACPI power-off mode.\n" "To examine this device anyway use the '-f' flag.\n"); return 1; + } + + /* Experiments with getting the card to stop working ... */ + if (try_to_stop) { + /* This doesn't stop my card :( */ + for (i=0; i<6; i++) + outb(0x00, ioaddr + i); + outb(0x01, ioaddr + 0x6c); + + /* this stops things, but ifconfig up/down resets properly */ + outb(0x80, ioaddr + 0x09); + } + /* ... and then starting it again */ + if (try_to_start) { + /* we know the PHY is 8 */ + outb(0x08, ioaddr + 0x6c); + + /* tell the chip to reload from EEPROM */ + outb(0x20, ioaddr + 0x74); } /* Always show the basic status. */