cregit-Linux how code gets into the kernel

Release 4.14 arch/x86/kernel/bootflag.c

Directory: arch/x86/kernel
// SPDX-License-Identifier: GPL-2.0
/*
 *      Implement 'Simple Boot Flag Specification 2.0'
 */
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/string.h>
#include <linux/spinlock.h>
#include <linux/acpi.h>
#include <asm/io.h>

#include <linux/mc146818rtc.h>


#define SBF_RESERVED (0x78)

#define SBF_PNPOS    (1<<0)

#define SBF_BOOTING  (1<<1)

#define SBF_DIAG     (1<<2)

#define SBF_PARITY   (1<<7)


int sbf_port __initdata = -1;	
/* set via acpi_boot_init() */


static int __init parity(u8 v) { int x = 0; int i; for (i = 0; i < 8; i++) { x ^= (v & 1); v >>= 1; } return x; }

Contributors

PersonTokensPropCommitsCommitProp
Dave Jones48100.00%1100.00%
Total48100.00%1100.00%


static void __init sbf_write(u8 v) { unsigned long flags; if (sbf_port != -1) { v &= ~SBF_PARITY; if (!parity(v)) v |= SBF_PARITY; printk(KERN_INFO "Simple Boot Flag at 0x%x set to 0x%x\n", sbf_port, v); spin_lock_irqsave(&rtc_lock, flags); CMOS_WRITE(v, sbf_port); spin_unlock_irqrestore(&rtc_lock, flags); } }

Contributors

PersonTokensPropCommitsCommitProp
Dave Jones7095.89%150.00%
Len Brown34.11%150.00%
Total73100.00%2100.00%


static u8 __init sbf_read(void) { unsigned long flags; u8 v; if (sbf_port == -1) return 0; spin_lock_irqsave(&rtc_lock, flags); v = CMOS_READ(sbf_port); spin_unlock_irqrestore(&rtc_lock, flags); return v; }

Contributors

PersonTokensPropCommitsCommitProp
Dave Jones4994.23%150.00%
Cyrill V. Gorcunov35.77%150.00%
Total52100.00%2100.00%


static int __init sbf_value_valid(u8 v) { if (v & SBF_RESERVED) /* Reserved bits */ return 0; if (!parity(v)) return 0; return 1; }

Contributors

PersonTokensPropCommitsCommitProp
Dave Jones34100.00%1100.00%
Total34100.00%1100.00%


static int __init sbf_init(void) { u8 v; if (sbf_port == -1) return 0; v = sbf_read(); if (!sbf_value_valid(v)) { printk(KERN_WARNING "Simple Boot Flag value 0x%x read from " "CMOS RAM was invalid\n", v); } v &= ~SBF_RESERVED; v &= ~SBF_BOOTING; v &= ~SBF_DIAG; #if defined(CONFIG_ISAPNP) v |= SBF_PNPOS; #endif sbf_write(v); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Dave Jones7288.89%133.33%
Len Brown56.17%133.33%
Cyrill V. Gorcunov44.94%133.33%
Total81100.00%3100.00%

arch_initcall(sbf_init);

Overall Contributors

PersonTokensPropCommitsCommitProp
Dave Jones32593.66%116.67%
Len Brown133.75%233.33%
Cyrill V. Gorcunov72.02%116.67%
Greg Kroah-Hartman10.29%116.67%
Paul Gortmaker10.29%116.67%
Total347100.00%6100.00%
Directory: arch/x86/kernel
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.