⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bios_core.c

📁 Linux下操作Bios的驱动
💻 C
字号:
/* * BIOS/Flashrom driver for Linux * * Copyright (C) 1998-2002 Stefan Reinauer <stepan@suse.de> * */#include <linux/config.h>#include <linux/pci.h>#include <linux/errno.h>#include <linux/vmalloc.h>#include <linux/init.h>#ifdef MODVERSIONS#include <linux/modversions.h>#endif#include <linux/module.h>#include <asm/io.h>#include "bios.h"#include "pcisets.h"#include "flashchips.h"#include "programming.h"extern struct file_operations bios_fops;int bios_proc_register(void);int bios_proc_unregister(void);int write = 0;unsigned char *bios;spinlock_t bios_lock = SPIN_LOCK_UNLOCKED;/* * ****************************************** * *	Initialization * * ******************************************  */int bios_init(void){	printk(KERN_INFO "BIOS driver v" BIOS_VERSION " (writing %s) for " UTS_RELEASE "\n", 								write?"*enabled*":"disabled");#if defined(__i386__) || defined(__ia64__) || defined(__alpha__)# ifndef UTC_BIOS	if (!pcibios_present())		return -EBUSY;#endif	if (chipset_init())	  return -EBUSY;#endif	flash_probe();	if (flashcount==0) {		printk(KERN_WARNING "BIOS: No flash devices found.\n");		return -EBUSY;	}		if (register_chrdev(BIOS_MAJOR, "bios",  &bios_fops) == -EBUSY) {		printk(KERN_WARNING "BIOS: Could not register bios devices.\n");		return -EBUSY;	}#ifdef CONFIG_PROC_FS	bios_proc_register();#endif	return 0;}/* * ****************************************** * *	module handling * * ******************************************  */#ifdef MODULEMODULE_PARM(write,"i");MODULE_AUTHOR("Stefan Reinauer <stepan@suse.de>");int init_module(void){	return bios_init();}void cleanup_module (void){	unsigned int i;#ifdef CONFIG_PROC_FS	bios_proc_unregister();#endif	/* FIXME if several flashchips are in the same	 * mapped area, the same address is iounmapped	 * twice.	 */		for (i=0; i<flashcount; i++)		iounmap(flashdevices[i].mapped);		unregister_chrdev(BIOS_MAJOR, "bios");	printk(KERN_INFO "BIOS driver removed.\n");}void inc_mod(void){	MOD_INC_USE_COUNT; }void dec_mod(void){	MOD_DEC_USE_COUNT; }#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,10)MODULE_LICENSE("GPL");#endif#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -