2001-02-11 23:29:27

by James Brents

[permalink] [raw]
Subject: WOL failure after shutdown

Hello,
In the event of a power outtage, my servers all shutdown -h when the
backup UPS gets low, and I have them configured to start back up with a
router (that uses an AT mobo, so it will start automatically) to send
wakeonlan packets to my other servers to start them back up. Wakeonlan
works if i were to hit the power before Linux starts, so I know I have
it configured properly, and I also have wakeonlan turned on in the BIOS.
However, when I do shutdown -h, it will turn the power off, but
wakeonlan does not work. Ive tried enabling ACPI and tinkering with
options in the BIOS, but i cant power up with WOL after issuing shutdown -h.
Im using an Abit KT7 motherboard, which uses the Via Apollo KT133 chipset.
Any ideas/suggestions will be greatly appreciated.

--
James Brents
[email protected]


2001-02-12 02:37:34

by James Brents

[permalink] [raw]
Subject: Re: WOL failure after shutdown

Sorry, I wrote that in a hurry. Its a 3Com PCI 3c905C Tornado. I can
successfully use wakeonlan if I power off the machine immeadiatly after
turning it on. Using the shutdown command, which it will when I need it
to power back up, it will not work.
Im using a wakeonlan cable to my motherboard as well, not using wake
through PCI bus.
Kernel is 2.4.1
I appologize for not providing all required the specs in the original
message.

--
James

Mark Hahn wrote:

>> wakeonlan packets to my other servers to start them back up. Wakeonlan
>> works if i were to hit the power before Linux starts, so I know I have
>> it configured properly, and I also have wakeonlan turned on in the BIOS.
>> However, when I do shutdown -h, it will turn the power off, but
>> wakeonlan does not work. Ive tried enabling ACPI and tinkering with
>> options in the BIOS, but i cant power up with WOL after issuing shutdown -h.
>
>
> so when can you powerup with WOL? WOL requires that the driver leave the
> card in a particular state; obviously, you should mention which NIC.

2001-02-12 08:17:21

by Tobias Ringstrom

[permalink] [raw]
Subject: Re: WOL failure after shutdown

On Sun, 11 Feb 2001, James Brents wrote:

> Sorry, I wrote that in a hurry. Its a 3Com PCI 3c905C Tornado. I can
> successfully use wakeonlan if I power off the machine immeadiatly after
> turning it on. Using the shutdown command, which it will when I need it
> to power back up, it will not work.
> Im using a wakeonlan cable to my motherboard as well, not using wake
> through PCI bus.
> Kernel is 2.4.1
> I appologize for not providing all required the specs in the original
> message.

Try this patch. It is against the zero-copy version of the driver, but
I'm sure you can apply it, at least manually, to any 2.4 version.

Andrew, when can we expect to have WOL working in 2.4?

/Tobias


--- linux-2.4.1-zc1.orig/drivers/net/3c59x.c Tue Jan 30 22:16:01 2001
+++ linux-2.4.1-zc1/drivers/net/3c59x.c Wed Jan 31 08:46:00 2001
@@ -754,6 +754,7 @@
static void set_rx_mode(struct net_device *dev);
static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static void vortex_tx_timeout(struct net_device *dev);
+static void acpi_wake(struct pci_dev *pdev);
static void acpi_set_WOL(struct net_device *dev);

/* This driver uses 'options' to pass the media type, full-duplex flag, etc. */
@@ -1426,6 +1427,8 @@
int i;
int retval;

+ acpi_wake(vp->pdev);
+
/* Use the now-standard shared IRQ implementation. */
if ((retval = request_irq(dev->irq, vp->full_bus_master_rx ?
&boomerang_interrupt : &vortex_interrupt, SA_SHIRQ, dev->name, dev))) {
@@ -2647,12 +2650,6 @@
struct vortex_private *vp = (struct vortex_private *)dev->priv;
long ioaddr = dev->base_addr;

- /* AKPM: This kills the 905 */
- if (vortex_debug > 1) {
- printk(KERN_INFO PFX "Wake-on-LAN functions disabled\n");
- }
- return;
-
/* Power up on: 1==Downloaded Filter, 2==Magic Packets, 4==Link Status. */
EL3WINDOW(7);
outw(2, ioaddr + 0x0c);
@@ -2663,6 +2660,34 @@
pci_write_config_word(vp->pdev, 0xe0, 0x8103);
}

+/* Change from D3 (sleep) to D0 (active).
+ Problem: The Cyclone forgets all PCI config info during the transition! */
+static void acpi_wake(struct pci_dev *pdev)
+{
+ u32 base0, base1, romaddr;
+ u16 pci_command, pwr_command;
+ u8 pci_latency, pci_cacheline, irq;
+
+ pci_read_config_word(pdev, 0xe0, &pwr_command);
+ if ((pwr_command & 3) == 0)
+ return;
+ pci_read_config_word( pdev, PCI_COMMAND, &pci_command);
+ pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &base0);
+ pci_read_config_dword(pdev, PCI_BASE_ADDRESS_1, &base1);
+ pci_read_config_dword(pdev, PCI_ROM_ADDRESS, &romaddr);
+ pci_read_config_byte( pdev, PCI_LATENCY_TIMER, &pci_latency);
+ pci_read_config_byte( pdev, PCI_CACHE_LINE_SIZE, &pci_cacheline);
+ pci_read_config_byte( pdev, PCI_INTERRUPT_LINE, &irq);
+
+ pci_write_config_word( pdev, 0xe0, 0x0000);
+ pci_write_config_dword(pdev, PCI_BASE_ADDRESS_0, base0);
+ pci_write_config_dword(pdev, PCI_BASE_ADDRESS_1, base1);
+ pci_write_config_dword(pdev, PCI_ROM_ADDRESS, romaddr);
+ pci_write_config_byte( pdev, PCI_INTERRUPT_LINE, irq);
+ pci_write_config_byte( pdev, PCI_LATENCY_TIMER, pci_latency);
+ pci_write_config_byte( pdev, PCI_CACHE_LINE_SIZE, pci_cacheline);
+ pci_write_config_word( pdev, PCI_COMMAND, pci_command | 5);
+}

static void __devexit vortex_remove_one (struct pci_dev *pdev)
{

2001-02-12 08:27:15

by Jeff Garzik

[permalink] [raw]
Subject: Re: WOL failure after shutdown

Tobias Ringstrom wrote:
>
> On Sun, 11 Feb 2001, James Brents wrote:
>
> > Sorry, I wrote that in a hurry. Its a 3Com PCI 3c905C Tornado. I can
> > successfully use wakeonlan if I power off the machine immeadiatly after
> > turning it on. Using the shutdown command, which it will when I need it
> > to power back up, it will not work.
> > Im using a wakeonlan cable to my motherboard as well, not using wake
> > through PCI bus.
> > Kernel is 2.4.1
> > I appologize for not providing all required the specs in the original
> > message.
>
> Try this patch. It is against the zero-copy version of the driver, but
> I'm sure you can apply it, at least manually, to any 2.4 version.
>
> Andrew, when can we expect to have WOL working in 2.4?
>
> +/* Change from D3 (sleep) to D0 (active).
> + Problem: The Cyclone forgets all PCI config info during the transition! */
> +static void acpi_wake(struct pci_dev *pdev)
[...]

Compare this code with pci_set_power_state() function in
drivers/pci/pci.c.

Jeff



--
Jeff Garzik | "You see, in this world there's two kinds of
Building 1024 | people, my friend: Those with loaded guns
MandrakeSoft | and those who dig. You dig." --Blondie

2001-02-12 09:55:27

by Alan

[permalink] [raw]
Subject: Re: WOL failure after shutdown

> Sorry, I wrote that in a hurry. Its a 3Com PCI 3c905C Tornado. I can
> successfully use wakeonlan if I power off the machine immeadiatly after
> turning it on. Using the shutdown command, which it will when I need it
> to power back up, it will not work.

That would seem reasonable. You probably want the 'poweroff' command to
put the box into completely off state. If you want to just sleep then
apm -s will do an APM suspend.

2001-02-13 06:55:20

by Philipp Matthias Hahn

[permalink] [raw]
Subject: Re: WOL failure after shutdown

On Sun, 11 Feb 2001, James Brents wrote:

> Sorry, I wrote that in a hurry. Its a 3Com PCI 3c905C Tornado. I can
> successfully use wakeonlan if I power off the machine immeadiatly after
> turning it on. Using the shutdown command, which it will when I need it
> to power back up, it will not work.
Look at the page of Donald Becker at
http://cesdis.gsfc.nasa.gov/linux/drivers/vortex.html
Last time there was a small program to reactivate the D3-ACPI state which
is necessary to wake your nic. I think it's calles "pci-config.c"

BYtE
Philipp
--
/ / (_)__ __ ____ __ Philipp Hahn
/ /__/ / _ \/ // /\ \/ /
/____/_/_//_/\_,_/ /_/\_\ [email protected]