If the initialization of the ACPI device failed (acpi_dev) the call to
bus_generic_attach will still return success, but calling
acpi_install_wakeup_handler will panic the system because the softc
of the acpi_dev has been freed:
Fatal trap 12: page fault while in kernel mode
cpuid = 0; apic id = 00
fault virtual address = 0x60
fault code = supervisor write data, page not present
instruction pointer = 0x20:0xffffffff8109e61c
stack pointer = 0x28:0xffffffff822d79c0
frame pointer = 0x28:0xffffffff822d7a30
code segment = base 0x0, limit 0xfffff, type 0x1b
= DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags = interrupt enabled, resume, IOPL = 0
current process = 0 (swapper)
[ thread pid 0 tid 100000 ]
Stopped at acpi_install_wakeup_handler+0x1dc: movq %rdi,ll+0x3f(%r14)
Fix this by attaching the wakeup handler in acpi_attach itself for
amd64.
Sponsored by: Citrix Systems R&D