2 * Implement 'Simple Boot Flag Specification 2.0'
6 #include <linux/types.h>
7 #include <linux/kernel.h>
8 #include <linux/init.h>
9 #include <linux/string.h>
10 #include <linux/slab.h>
11 #include <linux/spinlock.h>
12 #include <linux/acpi.h>
15 #include <linux/mc146818rtc.h>
18 #define SBF_RESERVED (0x78)
19 #define SBF_PNPOS (1<<0)
20 #define SBF_BOOTING (1<<1)
21 #define SBF_DIAG (1<<2)
22 #define SBF_PARITY (1<<7)
25 int sbf_port __initdata
= -1; /* set via acpi_boot_init() */
28 static int __init
parity(u8 v
)
41 static void __init
sbf_write(u8 v
)
50 printk(KERN_INFO
"Simple Boot Flag at 0x%x set to 0x%x\n", sbf_port
, v
);
52 spin_lock_irqsave(&rtc_lock
, flags
);
53 CMOS_WRITE(v
, sbf_port
);
54 spin_unlock_irqrestore(&rtc_lock
, flags
);
58 static u8 __init
sbf_read(void)
64 spin_lock_irqsave(&rtc_lock
, flags
);
65 v
= CMOS_READ(sbf_port
);
66 spin_unlock_irqrestore(&rtc_lock
, flags
);
70 static int __init
sbf_value_valid(u8 v
)
72 if(v
&SBF_RESERVED
) /* Reserved bits */
79 static int __init
sbf_init(void)
85 if(!sbf_value_valid(v
))
86 printk(KERN_WARNING
"Simple Boot Flag value 0x%x read from CMOS RAM was invalid\n",v
);
91 #if defined(CONFIG_ISAPNP)
98 module_init(sbf_init
);