Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 120915
b: refs/heads/master
c: 14d7ca5
h: refs/heads/master
i:
  120913: 7c1b10f
  120911: 498048b
v: v3
  • Loading branch information
H. Peter Anvin committed Nov 12, 2008
1 parent 1eb9587 commit 8dc1892
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d3ec5cae0921611ceae06464ef6291012dd9849f
refs/heads/master: 14d7ca5c575853664d8fe4f225a77b8df1b7de7d
4 changes: 3 additions & 1 deletion trunk/arch/x86/include/asm/emergency-restart.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ enum reboot_type {
BOOT_BIOS = 'b',
#endif
BOOT_ACPI = 'a',
BOOT_EFI = 'e'
BOOT_EFI = 'e',
BOOT_CF9 = 'p',
BOOT_CF9_COND = 'q',
};

extern enum reboot_type reboot_type;
Expand Down
34 changes: 27 additions & 7 deletions trunk/arch/x86/kernel/reboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ EXPORT_SYMBOL(pm_power_off);

static const struct desc_ptr no_idt = {};
static int reboot_mode;
enum reboot_type reboot_type = BOOT_KBD;
enum reboot_type reboot_type = BOOT_CF9_COND;
int reboot_force;

#if defined(CONFIG_X86_32) && defined(CONFIG_SMP)
static int reboot_cpu = -1;
#endif

/* reboot=b[ios] | s[mp] | t[riple] | k[bd] | e[fi] [, [w]arm | [c]old]
/* This is set by the PCI code if either type 1 or type 2 PCI is detected */
bool port_cf9_safe = false;

/* reboot=b[ios] | s[mp] | t[riple] | k[bd] | e[fi] [, [w]arm | [c]old] | p[ci]
warm Don't set the cold reboot flag
cold Set the cold reboot flag
bios Reboot by jumping through the BIOS (only for X86_32)
Expand All @@ -45,6 +48,7 @@ static int reboot_cpu = -1;
kbd Use the keyboard controller. cold reset (default)
acpi Use the RESET_REG in the FADT
efi Use efi reset_system runtime service
pci Use the so-called "PCI reset register", CF9
force Avoid anything that could hang.
*/
static int __init reboot_setup(char *str)
Expand Down Expand Up @@ -79,6 +83,7 @@ static int __init reboot_setup(char *str)
case 'k':
case 't':
case 'e':
case 'p':
reboot_type = *str;
break;

Expand Down Expand Up @@ -379,28 +384,43 @@ static void native_machine_emergency_restart(void)
load_idt(&no_idt);
__asm__ __volatile__("int3");

reboot_type = BOOT_KBD;
reboot_type = BOOT_CF9_COND;
break;

#ifdef CONFIG_X86_32
case BOOT_BIOS:
machine_real_restart(jump_to_bios, sizeof(jump_to_bios));

reboot_type = BOOT_KBD;
reboot_type = BOOT_CF9_COND;
break;
#endif

case BOOT_ACPI:
acpi_reboot();
reboot_type = BOOT_KBD;
reboot_type = BOOT_CF9_COND;
break;


case BOOT_EFI:
if (efi_enabled)
efi.reset_system(reboot_mode ? EFI_RESET_WARM : EFI_RESET_COLD,
efi.reset_system(reboot_mode ?
EFI_RESET_WARM :
EFI_RESET_COLD,
EFI_SUCCESS, 0, NULL);
reboot_type = BOOT_CF9_COND;
break;

case BOOT_CF9:
port_cf9_safe = true;
/* fall through */

case BOOT_CF9_COND:
if (port_cf9_safe) {
u8 cf9 = inb(0xcf9) & ~6;
outb(cf9|2, 0xcf9); /* Request hard reset */
udelay(50);
outb(cf9|6, 0xcf9); /* Actually do the reset */
udelay(50);
}
reboot_type = BOOT_KBD;
break;
}
Expand Down
4 changes: 3 additions & 1 deletion trunk/arch/x86/pci/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static int pci_conf2_write(unsigned int seg, unsigned int bus,

#undef PCI_CONF2_ADDRESS

static struct pci_raw_ops pci_direct_conf2 = {
struct pci_raw_ops pci_direct_conf2 = {
.read = pci_conf2_read,
.write = pci_conf2_write,
};
Expand Down Expand Up @@ -289,6 +289,7 @@ int __init pci_direct_probe(void)

if (pci_check_type1()) {
raw_pci_ops = &pci_direct_conf1;
port_cf9_safe = true;
return 1;
}
release_resource(region);
Expand All @@ -305,6 +306,7 @@ int __init pci_direct_probe(void)

if (pci_check_type2()) {
raw_pci_ops = &pci_direct_conf2;
port_cf9_safe = true;
return 2;
}

Expand Down
1 change: 1 addition & 0 deletions trunk/arch/x86/pci/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ extern struct pci_raw_ops *raw_pci_ops;
extern struct pci_raw_ops *raw_pci_ext_ops;

extern struct pci_raw_ops pci_direct_conf1;
extern bool port_cf9_safe;

/* arch_initcall level */
extern int pci_direct_probe(void);
Expand Down

0 comments on commit 8dc1892

Please sign in to comment.