Merge tag 'memblock-v5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt...
[linux-2.6-microblaze.git] / kernel / reboot.c
index 940cbb7..eb1b158 100644 (file)
@@ -615,8 +615,7 @@ __setup("reboot=", reboot_setup);
 #define BOOT_BIOS_STR          "bios"
 #define BOOT_ACPI_STR          "acpi"
 #define BOOT_EFI_STR           "efi"
-#define BOOT_CF9_FORCE_STR     "cf9_force"
-#define BOOT_CF9_SAFE_STR      "cf9_safe"
+#define BOOT_PCI_STR           "pci"
 
 static ssize_t mode_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
 {
@@ -663,10 +662,35 @@ static ssize_t mode_store(struct kobject *kobj, struct kobj_attribute *attr,
        else
                return -EINVAL;
 
+       reboot_default = 0;
+
        return count;
 }
 static struct kobj_attribute reboot_mode_attr = __ATTR_RW(mode);
 
+#ifdef CONFIG_X86
+static ssize_t force_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
+{
+       return sprintf(buf, "%d\n", reboot_force);
+}
+static ssize_t force_store(struct kobject *kobj, struct kobj_attribute *attr,
+                         const char *buf, size_t count)
+{
+       bool res;
+
+       if (!capable(CAP_SYS_BOOT))
+               return -EPERM;
+
+       if (kstrtobool(buf, &res))
+               return -EINVAL;
+
+       reboot_default = 0;
+       reboot_force = res;
+
+       return count;
+}
+static struct kobj_attribute reboot_force_attr = __ATTR_RW(force);
+
 static ssize_t type_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
 {
        const char *val;
@@ -688,10 +712,7 @@ static ssize_t type_show(struct kobject *kobj, struct kobj_attribute *attr, char
                val = BOOT_EFI_STR;
                break;
        case BOOT_CF9_FORCE:
-               val = BOOT_CF9_FORCE_STR;
-               break;
-       case BOOT_CF9_SAFE:
-               val = BOOT_CF9_SAFE_STR;
+               val = BOOT_PCI_STR;
                break;
        default:
                val = REBOOT_UNDEFINED_STR;
@@ -715,17 +736,19 @@ static ssize_t type_store(struct kobject *kobj, struct kobj_attribute *attr,
                reboot_type = BOOT_ACPI;
        else if (!strncmp(buf, BOOT_EFI_STR, strlen(BOOT_EFI_STR)))
                reboot_type = BOOT_EFI;
-       else if (!strncmp(buf, BOOT_CF9_FORCE_STR, strlen(BOOT_CF9_FORCE_STR)))
+       else if (!strncmp(buf, BOOT_PCI_STR, strlen(BOOT_PCI_STR)))
                reboot_type = BOOT_CF9_FORCE;
-       else if (!strncmp(buf, BOOT_CF9_SAFE_STR, strlen(BOOT_CF9_SAFE_STR)))
-               reboot_type = BOOT_CF9_SAFE;
        else
                return -EINVAL;
 
+       reboot_default = 0;
+
        return count;
 }
 static struct kobj_attribute reboot_type_attr = __ATTR_RW(type);
+#endif
 
+#ifdef CONFIG_SMP
 static ssize_t cpu_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
 {
        return sprintf(buf, "%d\n", reboot_cpu);
@@ -747,38 +770,23 @@ static ssize_t cpu_store(struct kobject *kobj, struct kobj_attribute *attr,
        if (cpunum >= num_possible_cpus())
                return -ERANGE;
 
+       reboot_default = 0;
        reboot_cpu = cpunum;
 
        return count;
 }
 static struct kobj_attribute reboot_cpu_attr = __ATTR_RW(cpu);
-
-static ssize_t force_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
-{
-       return sprintf(buf, "%d\n", reboot_force);
-}
-static ssize_t force_store(struct kobject *kobj, struct kobj_attribute *attr,
-                         const char *buf, size_t count)
-{
-       bool res;
-
-       if (!capable(CAP_SYS_BOOT))
-               return -EPERM;
-
-       if (kstrtobool(buf, &res))
-               return -EINVAL;
-
-       reboot_force = res;
-
-       return count;
-}
-static struct kobj_attribute reboot_force_attr = __ATTR_RW(force);
+#endif
 
 static struct attribute *reboot_attrs[] = {
        &reboot_mode_attr.attr,
+#ifdef CONFIG_X86
+       &reboot_force_attr.attr,
        &reboot_type_attr.attr,
+#endif
+#ifdef CONFIG_SMP
        &reboot_cpu_attr.attr,
-       &reboot_force_attr.attr,
+#endif
        NULL,
 };