2 * Implement 'Simple Boot Flag Specification 2.0'
6 #include <linux/config.h>
7 #include <linux/types.h>
8 #include <linux/kernel.h>
9 #include <linux/init.h>
10 #include <linux/string.h>
11 #include <linux/slab.h>
12 #include <linux/spinlock.h>
13 #include <linux/acpi.h>
16 #include <linux/mc146818rtc.h>
19 #define SBF_RESERVED (0x78)
20 #define SBF_PNPOS (1<<0)
21 #define SBF_BOOTING (1<<1)
22 #define SBF_DIAG (1<<2)
23 #define SBF_PARITY (1<<7)
26 int sbf_port __initdata
= -1; /* set via acpi_boot_init() */
29 static int __init
parity(u8 v
)
42 static void __init
sbf_write(u8 v
)
51 printk(KERN_INFO
"Simple Boot Flag at 0x%x set to 0x%x\n", sbf_port
, v
);
53 spin_lock_irqsave(&rtc_lock
, flags
);
54 CMOS_WRITE(v
, sbf_port
);
55 spin_unlock_irqrestore(&rtc_lock
, flags
);
59 static u8 __init
sbf_read(void)
65 spin_lock_irqsave(&rtc_lock
, flags
);
66 v
= CMOS_READ(sbf_port
);
67 spin_unlock_irqrestore(&rtc_lock
, flags
);
71 static int __init
sbf_value_valid(u8 v
)
73 if(v
&SBF_RESERVED
) /* Reserved bits */
80 static int __init
sbf_init(void)
86 if(!sbf_value_valid(v
))
87 printk(KERN_WARNING
"Simple Boot Flag value 0x%x read from CMOS RAM was invalid\n",v
);
92 #if defined(CONFIG_ISAPNP)
99 module_init(sbf_init
);