Forgotten commit. Added automount.
[AROS.git] / arch / all-pc / exec / shutdowna.c
blob253e213cd848359177f671b120293371abeac4db
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: ShutdownA() - Shut down the machine, PC version.
6 Lang: english
7 */
9 #include <asm/io.h>
10 #include <proto/dos.h>
11 #include <proto/exec.h>
14 * This code performs machine reset via legacy PC keyboard controller hardware.
15 * On modern machines it's replaced by either efi.resource or acpi.resource,
16 * using SetFunction().
18 AROS_LH1(ULONG, ShutdownA,
19 AROS_LHA(ULONG, action, D0),
20 struct ExecBase *, SysBase, 173, Exec)
22 AROS_LIBFUNC_INIT
24 /* Nothing worked, poor-man fallback */
25 if (action == SD_ACTION_COLDREBOOT)
27 struct DosLibrary *DOSBase;
29 outb(0xFE, 0x64);
31 * Keyboard controller can be slow, so we need to wait for some time.
32 * If we don't do this, we'll can see "Unsupported action" error, immediately
33 * followed by a restart, which looks strange.
34 * we use dos.library/Delay() here for simplicity. It works from within tasks.
36 DOSBase = (APTR)OpenLibrary("dos.library", 36);
37 if (DOSBase)
39 Delay(50);
40 CloseLibrary((struct Library *)DOSBase);
43 * On some machines (new PCs without PS/2 keyboard and ACPI disabled)
44 * this might not work.
45 * So we need to be able to return cleanly.
48 return 0;
50 AROS_LIBFUNC_EXIT