Coverage Report

Created: 2017-10-25 09:10

/root/src/xen/xen/drivers/acpi/reboot.c
Line
Count
Source (jump to first uncovered line)
1
#include <xen/pci.h>
2
#include <xen/acpi.h>
3
#include <acpi/acpi.h>
4
5
void acpi_reboot(void)
6
0
{
7
0
  struct acpi_generic_address *rr;
8
0
  u8 reset_value;
9
0
10
0
  rr = &acpi_gbl_FADT.reset_register;
11
0
12
0
  /* Is the reset register supported? The spec says we should be
13
0
   * checking the bit width and bit offset, but Windows ignores
14
0
   * these fields */
15
0
  if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER))
16
0
    return;
17
0
18
0
  reset_value = acpi_gbl_FADT.reset_value;
19
0
20
0
  /* The reset register can only exist in I/O, Memory or PCI config space
21
0
   * on a device on bus 0. */
22
0
  switch (rr->space_id) {
23
0
  case ACPI_ADR_SPACE_PCI_CONFIG:
24
0
    printk("Resetting with ACPI PCI RESET_REG.\n");
25
0
    /* Write the value that resets us. */
26
0
    pci_conf_write8(0, 0,
27
0
        (rr->address >> 32) & 31,
28
0
        (rr->address >> 16) & 7,
29
0
        (rr->address & 255),
30
0
        reset_value);
31
0
    break;
32
0
  case ACPI_ADR_SPACE_SYSTEM_MEMORY:
33
0
  case ACPI_ADR_SPACE_SYSTEM_IO:
34
0
    printk("Resetting with ACPI MEMORY or I/O RESET_REG.\n");
35
0
    acpi_hw_low_level_write(8, reset_value, rr);
36
0
    break;
37
0
  }
38
0
}