ia64/xen-unstable

view xen/drivers/acpi/reboot.c @ 18896:f7f8f44b9292

tools: Fix a few error-path memory leaks.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Dec 09 12:53:19 2008 +0000 (2008-12-09)
parents 675fb031df88
children 31983c30c460
line source
1 #include <xen/config.h>
2 #include <xen/pci.h>
3 #include <xen/acpi.h>
4 #include <acpi/acpi.h>
6 void acpi_reboot(void)
7 {
8 struct acpi_generic_address *rr;
9 u8 reset_value;
11 rr = &acpi_gbl_FADT.reset_register;
13 /* Is the reset register supported? */
14 if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) ||
15 (rr->bit_width != 8) || (rr->bit_offset != 0))
16 return;
18 reset_value = acpi_gbl_FADT.reset_value;
20 /* The reset register can only exist in I/O, Memory or PCI config space
21 * on a device on bus 0. */
22 switch (rr->space_id) {
23 case ACPI_ADR_SPACE_PCI_CONFIG:
24 printk("Resetting with ACPI PCI RESET_REG.");
25 /* Write the value that resets us. */
26 pci_conf_write8(0,
27 (rr->address >> 32) & 31,
28 (rr->address >> 16) & 7,
29 (rr->address & 255),
30 reset_value);
31 break;
32 case ACPI_ADR_SPACE_SYSTEM_MEMORY:
33 case ACPI_ADR_SPACE_SYSTEM_IO:
34 printk("ACPI MEMORY or I/O RESET_REG.");
35 acpi_hw_low_level_write(8, reset_value, rr);
36 break;
37 }
38 }