示例#1
0
int
zoran_proc_init (struct zoran *zr)
{
#ifdef CONFIG_PROC_FS
	char name[8];

	snprintf(name, 7, "zoran%d", zr->id);
	if ((zr->zoran_proc = create_proc_entry(name, 0, 0))) {
		zr->zoran_proc->read_proc = zoran_read_proc;
		zr->zoran_proc->write_proc = zoran_write_proc;
		zr->zoran_proc->data = zr;
		zr->zoran_proc->owner = THIS_MODULE;
		dprintk(2,
			KERN_INFO
			"%s: procfs entry /proc/%s allocated. data=%p\n",
			ZR_DEVNAME(zr), name, zr->zoran_proc->data);
	} else {
		dprintk(1, KERN_ERR "%s: Unable to initialise /proc/%s\n",
			ZR_DEVNAME(zr), name);
		return 1;
	}
#endif
	return 0;
}
示例#2
0
static int __init CAMERA_HW_i2C_init(void)
{
    struct proc_dir_entry *prEntry;

	i2c_register_board_info(CAMERA_I2C_BUSNUM, &kd_camera_dev, 1);
    if(platform_driver_register(&g_stCAMERA_HW_Driver)){
        PK_ERR("failed to register CAMERA_HW driver\n");
        return -ENODEV;
    }

    //Register proc file for sensor register debug 
    prEntry = create_proc_entry("driver/camsensor", 0, NULL); 
    if (prEntry) {
        prEntry->read_proc = CAMERA_HW_DumpReg_To_Proc; 
        prEntry->write_proc = CAMERA_HW_Reg_Debug; 
    }
    else {
        PK_ERR("add /proc/driver/camsensor entry fail \n");  
    }
    atomic_set(&g_CamHWOpend, 0); 
    atomic_set(&g_CamDrvOpenCnt, 0);
    atomic_set(&g_CamHWOpening, 0);
    return 0;
}
示例#3
0
/************************************************************************
* Name: fts_create_apk_debug_channel
* Brief:  create apk debug channel
* Input: i2c info
* Output: no
* Return: success =0
***********************************************************************/
int fts_create_apk_debug_channel(struct i2c_client * client)
{	
	#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0))
		fts_proc_entry = proc_create(PROC_NAME, 0777, NULL, &fts_proc_fops);		
	#else
		fts_proc_entry = create_proc_entry(PROC_NAME, 0777, NULL);
	#endif
	if (NULL == fts_proc_entry) 
	{
		dev_err(&client->dev, "Couldn't create proc entry!\n");
		
		return -ENOMEM;
	} 
	else 
	{
		dev_info(&client->dev, "Create proc entry success!\n");
		
		#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0))
			fts_proc_entry->write_proc = fts_debug_write;
			fts_proc_entry->read_proc = fts_debug_read;
		#endif
	}
	return 0;
}
示例#4
0
/* Initialize the module */
int init_ns_strlen_module(void) {
int ret = 0;
ns_buffer = (char *) vmalloc(NS_MAX_SIZE);
/* Return error if buffer initialization fails */
if (!ns_buffer) {
ret = -ENOMEM;
} else {
/* Initialize buffer 'ns_buffer' to 0 */
memset(ns_buffer, 0, NS_MAX_SIZE);
/* create 'ns_strlen' module */
ns_proc_entry = create_proc_entry("ns_strlen", 0644, NULL);
if (ns_proc_entry == NULL) {
ret = -ENOMEM;
vfree(ns_buffer);
printk(KERN_INFO "ns_strlen couldn't create proc entry.\n");
} else {
/* Initializing read and write procedures */
ns_proc_entry->read_proc = ns_strlen_read;
ns_proc_entry->write_proc = ns_strlen_write;
printk(KERN_INFO "ns_strlen module loaded.\n");
}
}
return ret;
}
示例#5
0
static int __init TMP103_HW_i2c_init( void )
{
	struct proc_dir_entry *prEntry;

	i2c_register_board_info(TMP_I2C_BUSNUM, TMP103_HW_i2c_info, ARRAY_SIZE(TMP103_HW_i2c_info)); 
	
	prEntry = create_proc_entry("TMP103", 0660, 0); 

  if (prEntry) 
  {
  	prEntry->read_proc = TMP103_HW_Read_Proc; 
    prEntry->write_proc = TMP103_HW_Write_Proc; 
    PK_DBG_FUNC("add /proc/TMP103 entry success \n"); 
  }
  else 
  {
    PK_DBG_FUNC("add /proc/TMP103 entry fail \n");  
  }
  
	mtktspcb1_register_thermal();
	mtktspcb2_register_thermal();
	
	return i2c_add_driver( &TMP103_HW_i2c_driver );
}
int __init apanic_report_block_init(void)
{
	int result = 0;

	memset(&drv_ctx, 0, sizeof(drv_ctx));

	drv_ctx.apanic_trigger = create_proc_entry("apanic",
						   S_IFREG | S_IRUGO, NULL);
	if (!drv_ctx.apanic_trigger)
		printk(KERN_ERR "%s: failed creating procfile\n",
			   __func__);
	else {
		drv_ctx.apanic_trigger->read_proc = NULL;
		drv_ctx.apanic_trigger->write_proc = apanic_trigger_check;
		drv_ctx.apanic_trigger->size = 1;
		drv_ctx.apanic_trigger->data = NULL;

		drv_ctx.bounce = (void *)__get_free_page(GFP_KERNEL);
		INIT_WORK(&proc_removal_work, apanic_remove_proc_work);
		printk(KERN_INFO DRVNAME "kernel panic reporter initialized\n");
	}

	return result;
}
示例#7
0
static int __devinit mtktspmic_probe(struct platform_device *device)
{
    struct proc_dir_entry *entry = NULL;
    struct proc_dir_entry *mtktspmic_dir = NULL;

    mtktspmic_dprintk("[mtktspmic_probe] \n");

    mtktspmic_dir = proc_mkdir("mtktspmic", NULL);
    if (!mtktspmic_dir)
    {
        mtktspmic_dprintk("[mtktspmic_probe]: mkdir /proc/mtktspmic failed\n");
    }
    else
    {
        entry = create_proc_entry("mtktspmic", S_IRUGO | S_IWUSR, mtktspmic_dir);
        if (entry)
        {
            entry->read_proc = mtktspmic_read;
            entry->write_proc = mtktspmic_write;
        }
    }
    
	return 0;
}
static int __init intel_fw_logging_init(void)
{
	int length = 0;

	oshob_base = get_oshob_addr();

	if (oshob_base == NULL)
		return -EINVAL;

	length = create_fwerr_log(log_buffer, oshob_base);
	if (length != 0) {

#ifdef CONFIG_PROC_FS
		ipanic_faberr = create_proc_entry("ipanic_fabric_err",
						S_IFREG | S_IRUGO, NULL);
		if (ipanic_faberr == 0) {
			pr_err("Fail creating procfile ipanic_fabric_err\n");
			return -ENOMEM;
		}

		ipanic_faberr->read_proc = intel_fw_logging_proc_read;
		ipanic_faberr->write_proc = NULL;
		ipanic_faberr->size = length;

#endif /* CONFIG_PROC_FS */

		/* Dump log as error to console */
		pr_err("%s", log_buffer);

		/* Clear fabric error region inside OSHOB if neccessary */
		intel_scu_ipc_simple_command(IPCMSG_CLEAR_FABERROR, 0);
	}

	iounmap(oshob_base);
	return 0;
}
示例#9
0
/* 
 * Module initialization and cleanup 
 */
int init_module()
{
	/* create the /proc file */
	Our_Proc_File = create_proc_entry(PROC_ENTRY_FILENAME, 0644, NULL);
	
	/* check if the /proc file was created successfuly */
	if (Our_Proc_File == NULL){
		printk(KERN_ALERT "Error: Could not initialize /proc/%s\n",
		       PROC_ENTRY_FILENAME);
		return -ENOMEM;
	}
	
	//Our_Proc_File->owner = THIS_MODULE;
	Our_Proc_File->proc_iops = &Inode_Ops_4_Our_Proc_File;
	Our_Proc_File->proc_fops = &File_Ops_4_Our_Proc_File;
	Our_Proc_File->mode = S_IFREG | S_IRUGO | S_IWUSR;
	Our_Proc_File->uid = 0;
	Our_Proc_File->gid = 0;
	Our_Proc_File->size = 80;

	printk(KERN_INFO "/proc/%s created\n", PROC_ENTRY_FILENAME);

	return 0;	/* success */
}
示例#10
0
文件: transform.c 项目: menghsu/bs
int init_my_module( void )
{
  int ret = 0;
  cookie_pot = (char *)vmalloc( MAX_COOKIE_LENGTH );
  if (!cookie_pot) {
    ret = -ENOMEM;
  } else {
    memset( cookie_pot, 0, MAX_COOKIE_LENGTH );
    proc_entry = create_proc_entry( MODULE_NAME, 0666, NULL );
    if (proc_entry == NULL) {
      ret = -ENOMEM;
      vfree(cookie_pot);
      printk(KERN_INFO "Couldn't create proc entry\n");
    } else {
      next_write_pos = 0;
      next_read_pos = 0;
      proc_entry->read_proc = procfs_read;
      proc_entry->write_proc = procfs_write;
  //    proc_entry->owner = THIS_MODULE;
      printk(KERN_INFO "Module loaded.\n");
    }
  }
  return ret;
}
示例#11
0
int proc_register(const bcmsw_proc_t* node)
{
	bcmsw_proc_node* i_node;
	bcmsw_proc_dev_s* dev;
	dev = get_bcmsw_dir();

	if(strlen(node->name) >= PROC_NAME_L)
		return -1;

	// kmalloc
	i_node = (bcmsw_proc_node*)kmalloc(sizeof(bcmsw_proc_node), GFP_KERNEL);
	if(i_node == NULL) {
		printk(KERN_ALERT "Error: Could not malloc \n");
		return -ENOMEM;
	}

	// create proc file system
	i_node->proc = create_proc_entry(node->name, node->mode, dev->dev_dir);
	if(i_node->proc == NULL) {
		remove_proc_entry(node->name, dev->dev_dir);
		printk(KERN_ALERT "Error: Could not initialize ..\n");
		return -ENOMEM;
	}

	memcpy(i_node->name, node->name, PROC_NAME_L);

	i_node->proc->read_proc = node->read;
	i_node->proc->mode		= S_IFREG | S_IRUGO;
	i_node->proc->uid		= 0;
	i_node->proc->gid		= 0;
	i_node->proc->size		= 100;	// ?? ..

	// add to list
	list_add_tail(&i_node->_list, &dev->list_head);
	return 0;
}
static int __init wifi_proc_init(void)
{
    //kevin add,init wifi power to close
    wifi_power_ctrl_comm(1,0);
    wifi_power_ctrl_comm(0,0);
    
	Our_Proc_File = create_proc_entry(procfs_name, 0644, NULL);
	
	if (Our_Proc_File == NULL) {
		remove_proc_entry(procfs_name, &proc_root);
		printk(KERN_ALERT "Error: Could not initialize /proc/%s\n",
		       procfs_name);
		return -ENOMEM;
	}

	Our_Proc_File->read_proc = procfile_read;
	//Our_Proc_File->owner 	 = THIS_MODULE;
	Our_Proc_File->mode 	 = S_IFREG | S_IRUGO;
	Our_Proc_File->uid 	 = 0;
	Our_Proc_File->gid 	 = 0;
	Our_Proc_File->size 	 = 37;

	return 0;	/* everything is ok */
}
示例#13
0
static int __init secwidevine_init(void)
{
#if 0
    struct proc_dir_entry *secwidevine_proc;
    secwidevine_proc = create_proc_entry("secwidevine0",
        (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH), NULL);
    
    if (IS_ERR(secwidevine_proc))
    {
        goto error;
    }

    secwidevine_proc->proc_fops = &secwidevine_fops;
#else
    proc_create("secwidevine0", (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH), NULL, &secwidevine_fops);
#endif

    return 0;

#if 0
error:
    return -1;
#endif
}
示例#14
0
static int __init alog_ram_console_late_init(void)
{
	struct proc_dir_entry *entry;
	int i;

	// create a proc file to read old log for alog ram console
	for (i=0; i<LOG_TYPE_NUM; i++)
		if (alog_ram_console_old_log[i] != NULL)
		{
			entry = create_proc_entry(alog_ram_console_proc_fn[i], S_IFREG | S_IRUGO, NULL);
			if (!entry) 
			{
				printk(KERN_ERR "[LastAlog] late_init: failed to create proc entry - /proc/%s\n", alog_ram_console_proc_fn[i]);
				kfree(alog_ram_console_old_log[i]);
				alog_ram_console_old_log[i] = NULL;
				return -EFAULT;
			}

			entry->proc_fops = &alog_ram_console_file_ops[i];
			entry->size = alog_ram_console_old_log_size[i];
		}
		
	return 0;
}
示例#15
0
static int __init tfswitch_init_module(void)
{
  printk("Loading TF7700 switch driver\n");

  /* create a proc entry and set the read function */
  pEntry = create_proc_entry(PROC_ENTRY_NAME, 0, NULL);
  if(pEntry == NULL)
  {
    printk("TF7700 switch driver: cannot allocate proc entry\n");
    return 1;
  }
  pEntry->read_proc = tfswitch_read_proc;

  /* allocate the I/O pin */
  pPin = stpio_request_pin(4, 4, "rear switch", STPIO_IN);
  if(pEntry == NULL)
  {
    printk("TF7700 switch driver: cannot allocate pin\n");
    remove_proc_entry(PROC_ENTRY_NAME, pEntry->parent);
    return 1;
  }

  return 0;
}
示例#16
0
int iet_procfs_init(void)
{
	int i;
	struct proc_dir_entry *ent;

	if (!(proc_iet_dir = proc_mkdir("iet", init_net.proc_net)))
		goto err;

	for (i = 0; i < ARRAY_SIZE(iet_proc_entries); i++) {
		ent = create_proc_entry(iet_proc_entries[i].name, 0, proc_iet_dir);
		if (ent)
			ent->proc_fops = iet_proc_entries[i].fops;
		else
			goto err;
	}

	return 0;

err:
	if (proc_iet_dir)
		iet_procfs_exit();

	return -ENOMEM;
}
示例#17
0
/**
 *This function is called when the module is loaded
 *
 */
int init_module()
{
	/* create the /proc file */
	Our_Proc_File = create_proc_entry(PROCFS_NAME, 0644, NULL);
	
	if (Our_Proc_File == NULL) {
	        remove_proc_entry(PROCFS_NAME, NULL);
	        // WH remove_proc_entry(PROCFS_NAME, &proc_root);
		printk(KERN_ALERT "Error: Could not initialize /proc/%s\n",
			PROCFS_NAME);
		return -ENOMEM;
	}

	Our_Proc_File->read_proc  = procfile_read;
	Our_Proc_File->write_proc = procfile_write;
	// WH Our_Proc_File->owner 	  = THIS_MODULE;
	Our_Proc_File->mode 	  = S_IFREG | S_IRUGO;
	Our_Proc_File->uid 	  = 0;
	Our_Proc_File->gid 	  = 0;
	Our_Proc_File->size 	  = 37;

	printk(KERN_INFO "/proc/%s created\n", PROCFS_NAME);	
	return 0;	/* everything is ok */
}
示例#18
0
static int hdpu_cpustate_probe(struct platform_device *pdev)
{
	struct resource *res;
	struct proc_dir_entry *proc_de;
	int ret;

	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (!res) {
		printk(KERN_ERR "sky_cpustate: "
		       "Invalid memory resource.\n");
		return -EINVAL;
	}
	cpustate.set_addr = (unsigned long *)res->start;
	cpustate.clr_addr = (unsigned long *)res->end - 1;

	ret = misc_register(&cpustate_dev);
	if (ret) {
		printk(KERN_WARNING "sky_cpustate: "
		       "Unable to register misc device.\n");
		cpustate.set_addr = NULL;
		cpustate.clr_addr = NULL;
		return ret;
	}

	proc_de = create_proc_entry("sky_cpustate", 0666, &proc_root);
	if (!proc_de) {
		printk(KERN_WARNING "sky_cpustate: "
		       "Unable to create proc entry\n");
	} else {
		proc_de->proc_fops = &proc_cpustate;
		proc_de->owner = THIS_MODULE;
	}

	printk(KERN_INFO "Sky CPU State Driver v" SKY_CPUSTATE_VERSION "\n");
	return 0;
}
示例#19
0
static int __init rtas_init(void)
{
	struct proc_dir_entry *entry;

	if (!machine_is(pseries))
		return 0;

	/* No RTAS */
	if (rtas_token("event-scan") == RTAS_UNKNOWN_SERVICE) {
		printk(KERN_DEBUG "rtasd: no event-scan on system\n");
		return -ENODEV;
	}

	entry = create_proc_entry("ppc64/rtas/error_log", S_IRUSR, NULL);
	if (entry)
		entry->proc_fops = &proc_rtas_log_operations;
	else
		printk(KERN_ERR "Failed to create error_log proc entry\n");

	if (kernel_thread(rtasd, NULL, CLONE_FS) < 0)
		printk(KERN_ERR "Failed to start RTAS daemon\n");

	return 0;
}
示例#20
0
文件: gpioed.c 项目: fourks/tools
/*** init&exit ***/
static int __init gpioed_init(void)
{
	my_workqueue = create_workqueue(MY_WORK_QUEUE_NAME);
	
	proc_intf = create_proc_entry(procfs_name, 0644, NULL);
	if (proc_intf == NULL) {
		remove_proc_entry(procfs_name, &proc_root);
		printk(KERN_ALERT "Error: Could not initialize /proc/%s\n",
				procfs_name);
		return -ENOMEM;
	}
	
	proc_intf->read_proc = procfile_read;
	proc_intf->write_proc = procfile_write;
	proc_intf->owner     = THIS_MODULE;
	proc_intf->mode      = S_IFREG | S_IRUGO;
	proc_intf->uid       = 0;
	proc_intf->gid       = 0;
	proc_intf->size      = 37;

	printk(KERN_INFO "/proc/%s created\n", procfs_name);
	
        return 0;
}
static int lenovo_sl_procfs_init(void)
{
	struct proc_dir_entry *proc_ec;

	proc_dir = proc_mkdir(LENSL_PROC_DIRNAME, acpi_root_dir);
	if (!proc_dir) {
		vdbg_printk(LENSL_ERR,
		   "Failed to create proc dir acpi/%s/\n", LENSL_PROC_DIRNAME);
		return -ENOENT;
	}
	proc_dir->owner = THIS_MODULE;
	proc_ec = create_proc_entry(LENSL_PROC_EC, 0600, proc_dir);
	if (!proc_ec) {
		vdbg_printk(LENSL_ERR,
			"Failed to create proc entry acpi/%s/%s\n",
			LENSL_PROC_DIRNAME, LENSL_PROC_EC);
		return -ENOENT;
	}
	proc_ec->read_proc = lensl_ec_read_procmem;
	proc_ec->write_proc = lensl_ec_write_procmem;
	vdbg_printk(LENSL_DEBUG, "Initialized procfs debugging interface\n");

	return 0;
}
示例#22
0
static int __init proc_init( void ) {
#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 9, 0))
   ERR( "it's work only for kernel LE 3.9\n" );
   return -ECANCELED;
#else
   int ret;
   struct proc_dir_entry *own_proc_node;
   own_proc_node = create_proc_entry( NAME_NODE, S_IFREG | S_IRUGO | S_IWUGO, NULL );
   if( NULL == own_proc_node ) {
      ret = -ENOENT;
      ERR( "can't create /proc/%s\n", NAME_NODE );
      goto err_node;
   }
   own_proc_node->uid = own_proc_node->gid = 0;
   if( mode !=1 )
      own_proc_node->read_proc = proc_node_read;
   if( mode !=2 )
      own_proc_node->proc_fops = &node_fops;
   LOG( "/proc/%s installed\n", NAME_NODE );
   return 0;
err_node:
  return ret;
#endif
}
示例#23
0
/************************************************************
 * proc_fs init: creating and registering
 ************************************************************/
static int proc_fs_init(void)
{
	/* Create /proc/kcache/ ... */
	proc_dir = proc_mkdir(PROC_DNAME, NULL);
	proc_def_dev  = create_proc_entry(PROC_FNAME_DEF_DEV , 0644, proc_dir);
	proc_tran_intvl = create_proc_entry(PROC_FNAME_TRAN_INTVL, 0644, proc_dir);	
	proc_delay_thre = create_proc_entry(PROC_FNAME_DELAY_THRE, 0644, proc_dir);
	proc_retran_intvl = create_proc_entry(PROC_FNAME_RETRAN_INTVL, 0644, proc_dir);
	proc_retran_incre = create_proc_entry(PROC_FNAME_RETRAN_INCRE, 0644, proc_dir);
	proc_max_retran_intvl = create_proc_entry(PROC_FNAME_MAX_RETRAN_INTVL, 0644, proc_dir);
	
	if ((proc_dir == NULL) || (proc_def_dev  == NULL) ||
		(proc_tran_intvl  == NULL) || (proc_delay_thre == NULL) ||
		(proc_retran_intvl == NULL) || (proc_retran_incre == NULL) ||
		(proc_max_retran_intvl == NULL))
		return -1;

	/* read/write interface for transmission interval */
	proc_tran_intvl->read_proc  =  read_tran_intvl;
	proc_tran_intvl->write_proc = write_tran_intvl;

	/* read/write interface for retransmission interval */
	proc_retran_intvl->read_proc  =  read_retran_intvl;
	proc_retran_intvl->write_proc = write_retran_intvl;

	/* read/write interface for retransmission interval increment*/
	proc_retran_incre->read_proc  =  read_retran_incre;
	proc_retran_incre->write_proc = write_retran_incre;

	/* read/write interface for maximum retransmission interval */
	proc_max_retran_intvl->read_proc  =  read_max_retran_intvl;
	proc_max_retran_intvl->write_proc = write_max_retran_intvl;
	
	/* read/write interface for delay threshold */
	proc_delay_thre->read_proc  =  read_delay_thre;
	proc_delay_thre->write_proc = write_delay_thre;

	/* read/write interface for default network interface */
	proc_def_dev->read_proc  =  read_def_dev;
	proc_def_dev->write_proc = write_def_dev;	

	return 0;
}
示例#24
0
/**
 * Module initialization
 *
 * @return
 */
static int __init proc_perf_init(void)
{
    printk("/proc/octeon_perf: Octeon performace counter interface loaded\n");

    memset(proc_perf_label, 0, sizeof(proc_perf_label));
    memset(proc_perf_l2label, 0, sizeof(proc_perf_l2label));

    proc_perf_label[PROC_PERF_CORE_NONE] = "none";
    proc_perf_label[PROC_PERF_CORE_CLK] = "clk";
    proc_perf_label[PROC_PERF_CORE_ISSUE] = "issue";
    proc_perf_label[PROC_PERF_CORE_RET] = "ret";
    proc_perf_label[PROC_PERF_CORE_NISSUE] = "nissue";
    proc_perf_label[PROC_PERF_CORE_SISSUE] = "sissue";
    proc_perf_label[PROC_PERF_CORE_DISSUE] = "dissue";
    proc_perf_label[PROC_PERF_CORE_IFI] = "ifi";
    proc_perf_label[PROC_PERF_CORE_BR] = "br";
    proc_perf_label[PROC_PERF_CORE_BRMIS] = "brmis";
    proc_perf_label[PROC_PERF_CORE_J] = "j";
    proc_perf_label[PROC_PERF_CORE_JMIS] = "jmis";
    proc_perf_label[PROC_PERF_CORE_REPLAY] = "replay";
    proc_perf_label[PROC_PERF_CORE_IUNA] = "iuna";
    proc_perf_label[PROC_PERF_CORE_TRAP] = "trap";
    proc_perf_label[PROC_PERF_CORE_UULOAD] = "uuload";
    proc_perf_label[PROC_PERF_CORE_UUSTORE] = "uustore";
    proc_perf_label[PROC_PERF_CORE_ULOAD] = "uload";
    proc_perf_label[PROC_PERF_CORE_USTORE] = "ustore";
    proc_perf_label[PROC_PERF_CORE_EC] = "ec";
    proc_perf_label[PROC_PERF_CORE_MC] = "mc";
    proc_perf_label[PROC_PERF_CORE_CC] = "cc";
    proc_perf_label[PROC_PERF_CORE_CSRC] = "csrc";
    proc_perf_label[PROC_PERF_CORE_CFETCH] = "cfetch";
    proc_perf_label[PROC_PERF_CORE_CPREF] = "cpref";
    proc_perf_label[PROC_PERF_CORE_ICA] = "ica";
    proc_perf_label[PROC_PERF_CORE_II] = "ii";
    proc_perf_label[PROC_PERF_CORE_IP] = "ip";
    proc_perf_label[PROC_PERF_CORE_CIMISS] = "cimiss";
    proc_perf_label[PROC_PERF_CORE_WBUF] = "wbuf";
    proc_perf_label[PROC_PERF_CORE_WDAT] = "wdat";
    proc_perf_label[PROC_PERF_CORE_WBUFLD] = "wbufld";
    proc_perf_label[PROC_PERF_CORE_WBUFFL] = "wbuffl";
    proc_perf_label[PROC_PERF_CORE_WBUFTR] = "wbuftr";
    proc_perf_label[PROC_PERF_CORE_BADD] = "badd";
    proc_perf_label[PROC_PERF_CORE_BADDL2] = "baddl2";
    proc_perf_label[PROC_PERF_CORE_BFILL] = "bfill";
    proc_perf_label[PROC_PERF_CORE_DDIDS] = "ddids";
    proc_perf_label[PROC_PERF_CORE_IDIDS] = "idids";
    proc_perf_label[PROC_PERF_CORE_DIDNA] = "didna";
    proc_perf_label[PROC_PERF_CORE_LDS] = "lds";
    proc_perf_label[PROC_PERF_CORE_LMLDS] = "lmlds";
    proc_perf_label[PROC_PERF_CORE_IOLDS] = "iolds";
    proc_perf_label[PROC_PERF_CORE_DMLDS] = "dmlds";
    proc_perf_label[PROC_PERF_CORE_STS] = "sts";
    proc_perf_label[PROC_PERF_CORE_LMSTS] = "lmsts";
    proc_perf_label[PROC_PERF_CORE_IOSTS] = "iosts";
    proc_perf_label[PROC_PERF_CORE_IOBDMA] = "iobdma";
    proc_perf_label[PROC_PERF_CORE_DTLB] = "dtlb";
    proc_perf_label[PROC_PERF_CORE_DTLBAD] = "dtlbad";
    proc_perf_label[PROC_PERF_CORE_ITLB] = "itlb";
    proc_perf_label[PROC_PERF_CORE_SYNC] = "sync";
    proc_perf_label[PROC_PERF_CORE_SYNCIOB] = "synciob";
    proc_perf_label[PROC_PERF_CORE_SYNCW] = "syncw";

    proc_perf_l2label[PROC_PERF_L2_CYCLES] = "cycles";
    proc_perf_l2label[PROC_PERF_L2_IMISS] = "imiss";
    proc_perf_l2label[PROC_PERF_L2_IHIT] = "ihit";
    proc_perf_l2label[PROC_PERF_L2_DMISS] = "dmiss";
    proc_perf_l2label[PROC_PERF_L2_DHIT] = "dhit";
    proc_perf_l2label[PROC_PERF_L2_MISS] = "miss";
    proc_perf_l2label[PROC_PERF_L2_HIT] = "hit";
    proc_perf_l2label[PROC_PERF_L2_VICTIM_BUFFER_HIT] = "victim-buffer-hit";
    proc_perf_l2label[PROC_PERF_L2_LFB_NQ_INDEX_CONFLICT] = "lfb-nq-index-conflict";
    proc_perf_l2label[PROC_PERF_L2_TAG_PROBE] = "tag-probe";
    proc_perf_l2label[PROC_PERF_L2_TAG_UPDATE] = "tag-update";
    proc_perf_l2label[PROC_PERF_L2_TAG_PROBE_COMPLETED] = "tag-probe-completed";
    proc_perf_l2label[PROC_PERF_L2_TAG_DIRTY_VICTIM] = "tag-dirty-victim";
    proc_perf_l2label[PROC_PERF_L2_DATA_STORE_NOP] = "data-store-nop";
    proc_perf_l2label[PROC_PERF_L2_DATA_STORE_READ] = "data-store-read";
    proc_perf_l2label[PROC_PERF_L2_DATA_STORE_WRITE] = "data-store-write";
    proc_perf_l2label[PROC_PERF_L2_MEMORY_FILL_DATA_VALID] = "memory-fill-data-valid";
    proc_perf_l2label[PROC_PERF_L2_MEMORY_WRITE_REQUEST] = "memory-write-request";
    proc_perf_l2label[PROC_PERF_L2_MEMORY_READ_REQUEST] = "memory-read-request";
    proc_perf_l2label[PROC_PERF_L2_MEMORY_WRITE_DATA_VALID] = "memory-write-data-valid";
    proc_perf_l2label[PROC_PERF_L2_XMC_NOP] = "xmc-nop";
    proc_perf_l2label[PROC_PERF_L2_XMC_LDT] = "xmc-ldt";
    proc_perf_l2label[PROC_PERF_L2_XMC_LDI] = "xmc-ldi";
    proc_perf_l2label[PROC_PERF_L2_XMC_LDD] = "xmc-ldd";
    proc_perf_l2label[PROC_PERF_L2_XMC_STF] = "xmc-stf";
    proc_perf_l2label[PROC_PERF_L2_XMC_STT] = "xmc-stt";
    proc_perf_l2label[PROC_PERF_L2_XMC_STP] = "xmc-stp";
    proc_perf_l2label[PROC_PERF_L2_XMC_STC] = "xmc-stc";
    proc_perf_l2label[PROC_PERF_L2_XMC_DWB] = "xmc-dwb";
    proc_perf_l2label[PROC_PERF_L2_XMC_PL2] = "xmc-pl2";
    proc_perf_l2label[PROC_PERF_L2_XMC_PSL1] = "xmc-psl1";
    proc_perf_l2label[PROC_PERF_L2_XMC_IOBLD] = "xmc-iobld";
    proc_perf_l2label[PROC_PERF_L2_XMC_IOBST] = "xmc-iobst";
    proc_perf_l2label[PROC_PERF_L2_XMC_IOBDMA] = "xmc-iobdma";
    proc_perf_l2label[PROC_PERF_L2_XMC_IOBRSP] = "xmc-iobrsp";
    proc_perf_l2label[PROC_PERF_L2_XMD_BUS_VALID] = "xmd-bus-valid";
    proc_perf_l2label[PROC_PERF_L2_XMD_BUS_VALID_DST_L2C] = "xmd-bus-valid-dst-l2c";
    proc_perf_l2label[PROC_PERF_L2_XMD_BUS_VALID_DST_IOB] = "xmd-bus-valid-dst-iob";
    proc_perf_l2label[PROC_PERF_L2_XMD_BUS_VALID_DST_PP] = "xmd-bus-valid-dst-pp";
    proc_perf_l2label[PROC_PERF_L2_RSC_NOP] = "rsc-nop";
    proc_perf_l2label[PROC_PERF_L2_RSC_STDN] = "rsc-stdn";
    proc_perf_l2label[PROC_PERF_L2_RSC_FILL] = "rsc-fill";
    proc_perf_l2label[PROC_PERF_L2_RSC_REFL] = "rsc-refl";
    proc_perf_l2label[PROC_PERF_L2_RSC_STIN] = "rsc-stin";
    proc_perf_l2label[PROC_PERF_L2_RSC_SCIN] = "rsc-scin";
    proc_perf_l2label[PROC_PERF_L2_RSC_SCFL] = "rsc-scfl";
    proc_perf_l2label[PROC_PERF_L2_RSC_SCDN] = "rsc-scdn";
    proc_perf_l2label[PROC_PERF_L2_RSD_DATA_VALID] = "rsd-data-valid";
    proc_perf_l2label[PROC_PERF_L2_RSD_DATA_VALID_FILL] = "rsd-data-valid-fill";
    proc_perf_l2label[PROC_PERF_L2_RSD_DATA_VALID_STRSP] = "rsd-data-valid-strsp";
    proc_perf_l2label[PROC_PERF_L2_RSD_DATA_VALID_REFL] = "rsd-data-valid-refl";
    proc_perf_l2label[PROC_PERF_L2_LRF_REQ] = "lrf-req";
    proc_perf_l2label[PROC_PERF_L2_DT_RD_ALLOC] = "dt-rd-alloc";
    proc_perf_l2label[PROC_PERF_L2_DT_WR_INVA] = "dt-wr-inva";

	proc_perf_entry = create_proc_entry("octeon_perf", 0, NULL);
	if (proc_perf_entry)
		proc_perf_entry->proc_fops = &proc_perf_operations;

    proc_perf_setup();
	return 0;
}
void rtw_proc_init_one(struct net_device *dev)
{
	struct proc_dir_entry *dir_dev = NULL;
	struct proc_dir_entry *entry=NULL;
	_adapter	*padapter = rtw_netdev_priv(dev);

	if(rtw_proc == NULL)
	{
		if(padapter->chip_type == RTL8188C_8192C)
		{
			_rtw_memcpy(rtw_proc_name, RTL8192C_PROC_NAME, sizeof(RTL8192C_PROC_NAME));
		}
		else if(padapter->chip_type == RTL8192D)
		{
			_rtw_memcpy(rtw_proc_name, RTL8192D_PROC_NAME, sizeof(RTL8192D_PROC_NAME));
		}

#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
		rtw_proc=create_proc_entry(rtw_proc_name, S_IFDIR, proc_net);
#else
		rtw_proc=create_proc_entry(rtw_proc_name, S_IFDIR, init_net.proc_net);
#endif
		if (rtw_proc == NULL) {
			DBG_8192C(KERN_ERR "Unable to create rtw_proc directory\n");
			return;
		}

		entry = create_proc_read_entry("ver_info", S_IFREG | S_IRUGO, rtw_proc, proc_get_drv_version, dev);				   
		if (!entry) {
			DBG_871X("Unable to create_proc_read_entry!\n"); 
			return;
		}
	}

	

	if(padapter->dir_dev == NULL)
	{
		padapter->dir_dev = create_proc_entry(dev->name, 
					  S_IFDIR | S_IRUGO | S_IXUGO, 
					  rtw_proc);

		dir_dev = padapter->dir_dev;

		if(dir_dev==NULL)
		{
			if(rtw_proc_cnt == 0)
			{
				if(rtw_proc){
#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
					remove_proc_entry(rtw_proc_name, proc_net);
#else
					remove_proc_entry(rtw_proc_name, init_net.proc_net);
#endif		
					rtw_proc = NULL;
				}
			}

			DBG_8192C("Unable to create dir_dev directory\n");
			return;
		}
	}
	else
	{
		return;
	}

	rtw_proc_cnt++;

	entry = create_proc_read_entry("write_reg", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_write_reg, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}
	entry->write_proc = proc_set_write_reg;

	entry = create_proc_read_entry("read_reg", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_read_reg, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}
	entry->write_proc = proc_set_read_reg;

	
	entry = create_proc_read_entry("fwstate", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_fwstate, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}


	entry = create_proc_read_entry("sec_info", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_sec_info, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}


	entry = create_proc_read_entry("mlmext_state", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_mlmext_state, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}


	entry = create_proc_read_entry("qos_option", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_qos_option, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}

	entry = create_proc_read_entry("ht_option", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_ht_option, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}

	entry = create_proc_read_entry("rf_info", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_rf_info, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}
	
	entry = create_proc_read_entry("ap_info", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_ap_info, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}

	entry = create_proc_read_entry("adapter_state", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_adapter_state, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}

	entry = create_proc_read_entry("trx_info", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_trx_info, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}

#ifdef CONFIG_AP_MODE

	entry = create_proc_read_entry("all_sta_info", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_all_sta_info, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}
#endif

#ifdef DBG_MEMORY_LEAK
	entry = create_proc_read_entry("_malloc_cnt", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_malloc_cnt, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}
#endif

#ifdef CONFIG_FIND_BEST_CHANNEL
	entry = create_proc_read_entry("best_channel", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_best_channel, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}
#endif

	entry = create_proc_read_entry("rx_signal", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_rx_signal, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}
	entry->write_proc = proc_set_rx_signal;


	entry = create_proc_read_entry("rssi_disp", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_rssi_disp, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}
	entry->write_proc = proc_set_rssi_disp;

}
示例#26
0
/**
 *  @brief This function initializes proc entry
 *
 *  @param priv     A pointer to bt_private structure
 *  @param m_dev    A pointer to struct m_dev
 *  @param seq      Sequence number
 *
 *  @return	BT_STATUS_SUCCESS or BT_STATUS_FAILURE
 */
int
bt_proc_init(bt_private * priv, struct m_dev *m_dev, int seq)
{
	int ret = BT_STATUS_SUCCESS;
	struct proc_dir_entry *entry;
	int i, j;
	ENTER();

	bpriv = priv;
	memset(cmd52_string, 0, CMD52_STR_LEN);
	if (proc_mbt) {
		priv->dev_proc[seq].proc_entry =
			proc_mkdir(m_dev->name, proc_mbt);
		if (!priv->dev_proc[seq].proc_entry) {
			PRINTM(ERROR, "BT: Could not mkdir %s!\n", m_dev->name);
			ret = BT_STATUS_FAILURE;
			goto done;
		}
		priv->dev_proc[seq].pfiles =
			(struct proc_private_data *)kmalloc(sizeof(proc_files),
							    GFP_ATOMIC);
		if (!priv->dev_proc[seq].pfiles) {
			PRINTM(ERROR,
			       "BT: Could not alloc memory for pfile!\n");
			ret = BT_STATUS_FAILURE;
			goto done;
		}
		memcpy((u8 *) priv->dev_proc[seq].pfiles, (u8 *) proc_files,
		       sizeof(proc_files));
		priv->dev_proc[seq].num_proc_files =
			sizeof(proc_files) / sizeof(proc_files[0]);
		for (j = 0; j < priv->dev_proc[seq].num_proc_files; j++)
			priv->dev_proc[seq].pfiles[j].pdata = NULL;
		for (j = 0; j < priv->dev_proc[seq].num_proc_files; j++) {
			priv->dev_proc[seq].pfiles[j].pdata =
				(struct item_data *)kmalloc(priv->dev_proc[seq].
							    pfiles[j].num_items
							    *
							    sizeof(struct
								   item_data),
							    GFP_ATOMIC);
			if (!priv->dev_proc[seq].pfiles[j].pdata) {
				PRINTM(ERROR,
				       "BT: Could not alloc memory for pdata!\n");
				ret = BT_STATUS_FAILURE;
				goto done;
			}
			memcpy((u8 *) priv->dev_proc[seq].pfiles[j].pdata,
			       (u8 *) proc_files[j].pdata,
			       priv->dev_proc[seq].pfiles[j].num_items *
			       sizeof(struct item_data));
			for (i = 0; i < priv->dev_proc[seq].pfiles[j].num_items;
			     i++) {
				if (priv->dev_proc[seq].pfiles[j].
				    pdata[i].flag & OFFSET_BT_DEV)
					priv->dev_proc[seq].pfiles[j].pdata[i].
						addr =
						priv->dev_proc[seq].pfiles[j].
						pdata[i].offset +
						(t_ptr) & priv->bt_dev;
				if (priv->dev_proc[seq].pfiles[j].
				    pdata[i].flag & OFFSET_BT_ADAPTER)
					priv->dev_proc[seq].pfiles[j].pdata[i].
						addr =
						priv->dev_proc[seq].pfiles[j].
						pdata[i].offset +
						(t_ptr) priv->adapter;
			}
			priv->dev_proc[seq].pfiles[j].pbt = priv;
			entry = create_proc_entry(proc_files[j].name,
						  S_IFREG | proc_files[j].
						  fileflag,
						  priv->dev_proc[seq].
						  proc_entry);
			if (entry) {
				entry->data = &priv->dev_proc[seq].pfiles[j];
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
				entry->owner = THIS_MODULE;
#endif
				entry->proc_fops = proc_files[j].fops;
			} else
				PRINTM(MSG, "BT: Fail to create proc %s\n",
				       proc_files[j].name);
		}
	}
done:
	if (ret == BT_STATUS_FAILURE) {
		if (priv->dev_proc[seq].proc_entry) {
			remove_proc_entry(m_dev->name, proc_mbt);
			priv->dev_proc[seq].proc_entry = NULL;
		}
		if (priv->dev_proc[seq].pfiles) {
			for (j = 0; j < priv->dev_proc[seq].num_proc_files; j++) {
				if (priv->dev_proc[seq].pfiles[j].pdata) {
					kfree(priv->dev_proc[seq].pfiles[j].
					      pdata);
					priv->dev_proc[seq].pfiles[j].pdata =
						NULL;
				}
			}
			kfree(priv->dev_proc[seq].pfiles);
			priv->dev_proc[seq].pfiles = NULL;
		}
	}
	LEAVE();
	return ret;
}
void rtw_proc_init_one(struct net_device *dev)
{
	struct proc_dir_entry *dir_dev = NULL;
	struct proc_dir_entry *entry=NULL;
	_adapter	*padapter = netdev_priv(dev);

	if(rtw_proc == NULL)
	{
		if(padapter->chip_type == RTL8188C_8192C)
		{
			_rtw_memcpy(rtw_proc_name, RTL8192C_PROC_NAME, sizeof(RTL8192C_PROC_NAME));
		}
		else if(padapter->chip_type == RTL8192D)
		{
			_rtw_memcpy(rtw_proc_name, RTL8192D_PROC_NAME, sizeof(RTL8192D_PROC_NAME));
		}

#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
		rtw_proc=create_proc_entry(rtw_proc_name, S_IFDIR, proc_net);
#else
		rtw_proc=create_proc_entry(rtw_proc_name, S_IFDIR, init_net.proc_net);
#endif
		if (rtw_proc == NULL) {
			printk(KERN_ERR "Unable to create rtw_proc directory\n");
			return;
		}
	}

	padapter->dir_dev = create_proc_entry(dev->name, 
					  S_IFDIR | S_IRUGO | S_IXUGO, 
					  rtw_proc);

	dir_dev = padapter->dir_dev;

	if(dir_dev==NULL)
	{
#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
		remove_proc_entry(rtw_proc_name, proc_net);
#else
		remove_proc_entry(rtw_proc_name, init_net.proc_net);
#endif		
		rtw_proc = NULL;

		printk(KERN_ERR "Unable to create dir_dev directory\n");
		return;
	}

	rtw_proc_cnt++;

	entry = create_proc_read_entry("write_reg", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_write_reg, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}
	entry->write_proc = proc_set_write_reg;

	entry = create_proc_read_entry("read_reg", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_read_reg, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}
	entry->write_proc = proc_set_read_reg;

	
	entry = create_proc_read_entry("fwstate", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_fwstate, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}


	entry = create_proc_read_entry("sec_info", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_sec_info, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}


	entry = create_proc_read_entry("mlmext_state", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_mlmext_state, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}


	entry = create_proc_read_entry("qos_option", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_qos_option, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}

	entry = create_proc_read_entry("ht_option", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_ht_option, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}

	entry = create_proc_read_entry("rf_info", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_rf_info, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}
	
	entry = create_proc_read_entry("ap_info", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_ap_info, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}

	entry = create_proc_read_entry("adapter_state", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_adapter_state, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}

	entry = create_proc_read_entry("trx_info", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_trx_info, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}

#ifdef CONFIG_AP_MODE

	entry = create_proc_read_entry("all_sta_info", S_IFREG | S_IRUGO,
				   dir_dev, proc_get_all_sta_info, dev);				   
	if (!entry) {
		DBG_871X("Unable to create_proc_read_entry!\n"); 
		return;
	}

#endif
	
}
示例#28
0
static int freqhopping_debug_proc_init(void)
{
	struct proc_dir_entry *prDebugEntry;
	struct proc_dir_entry *prDramcEntry;
	struct proc_dir_entry *prDumpregEntry;
	struct proc_dir_entry *prStatusEntry;
	struct proc_dir_entry *prUserdefEntry;
	struct proc_dir_entry *fh_proc_dir = NULL;

	//TODO: check the permission!!

	FH_MSG("EN: %s",__func__);

	fh_proc_dir = proc_mkdir("freqhopping", NULL);
	if (!fh_proc_dir){
		FH_MSG("proc_mkdir fail!");
		return 1;
	}
	else{


		/* /proc/freqhopping/freqhopping_debug */
		//prDebugEntry = create_proc_entry("freqhopping_debug",  S_IRUGO | S_IWUSR | S_IWGRP, fh_proc_dir);
		prDebugEntry = proc_create("freqhopping_debug",  S_IRUGO | S_IWUSR | S_IWGRP, fh_proc_dir, &freqhopping_debug_fops);
		if(prDebugEntry)
		{
			//prDebugEntry->read_proc  = freqhopping_debug_proc_read;
			//prDebugEntry->write_proc = freqhopping_debug_proc_write;
			FH_MSG("[%s]: successfully create /proc/freqhopping_debug", __func__);
		}else{
			FH_MSG("[%s]: failed to create /proc/freqhopping/freqhopping_debug", __func__);
			return 1;
		}


		/* /proc/freqhopping/dramc */
		//prDramcEntry = create_proc_entry("dramc",  S_IRUGO | S_IWUSR | S_IWGRP, fh_proc_dir);
		prDramcEntry = proc_create("dramc",  S_IRUGO | S_IWUSR | S_IWGRP, fh_proc_dir, &dramc_fops);
		if(prDramcEntry)
		{
			//prDramcEntry->read_proc  = g_p_fh_hal_drv->proc.dramc_read;
			//prDramcEntry->write_proc = g_p_fh_hal_drv->proc.dramc_write;
			FH_MSG("[%s]: successfully create /proc/freqhopping/prDramcEntry", __func__);
		}else{
			FH_MSG("[%s]: failed to create /proc/freqhopping/prDramcEntry", __func__);
			return 1;
		}
		/* /proc/freqhopping/dvfs */
		//prDramcEntry = create_proc_entry("dvfs",  S_IRUGO | S_IWUSR | S_IWGRP, fh_proc_dir);
		prDramcEntry = proc_create("dvfs",  S_IRUGO | S_IWUSR | S_IWGRP, fh_proc_dir, &dvfs_fops);
		if(prDramcEntry)
		{
			//prDramcEntry->read_proc  = g_p_fh_hal_drv->proc.dvfs_read;
			//prDramcEntry->write_proc = g_p_fh_hal_drv->proc.dvfs_write;
			FH_MSG("[%s]: successfully create /proc/freqhopping/dvfs", __func__);
		}else{
			FH_MSG("[%s]: failed to create /proc/freqhopping/dvfs", __func__);
			return 1;
		}


		/* /proc/freqhopping/dumpregs */
		//prDumpregEntry = create_proc_entry("dumpregs",  S_IRUGO | S_IWUSR | S_IWGRP, fh_proc_dir);
		prDumpregEntry = proc_create("dumpregs",  S_IRUGO | S_IWUSR | S_IWGRP, fh_proc_dir, &dumpregs_fops);
		if(prDumpregEntry)
		{
			//prDumpregEntry->read_proc  =  g_p_fh_hal_drv->proc.dumpregs_read;
			//prDumpregEntry->write_proc = NULL;
			FH_MSG("[%s]: successfully create /proc/freqhopping/dumpregs", __func__);
		}else{
			FH_MSG("[%s]: failed to create /proc/freqhopping/dumpregs", __func__);
			return 1;
		}


		/* /proc/freqhopping/status */
		//prStatusEntry = create_proc_entry("status",  S_IRUGO | S_IWUSR | S_IWGRP, fh_proc_dir);
		prStatusEntry = proc_create("status",  S_IRUGO | S_IWUSR | S_IWGRP, fh_proc_dir, &status_fops);
		if(prStatusEntry)
		{
			//prStatusEntry->read_proc  = freqhopping_status_proc_read;
			//prStatusEntry->write_proc = freqhopping_status_proc_write;
			FH_MSG("[%s]: successfully create /proc/freqhopping/status", __func__);
		}else{
			FH_MSG("[%s]: failed to create /proc/freqhopping/status", __func__);
			return 1;
		}


		/* /proc/freqhopping/userdefine */
		//prUserdefEntry = create_proc_entry("userdef",  S_IRUGO | S_IWUSR | S_IWGRP, fh_proc_dir);
		prUserdefEntry = proc_create("userdef",  S_IRUGO | S_IWUSR | S_IWGRP, fh_proc_dir, &userdef_fops);
		if(prUserdefEntry)
		{
			//prUserdefEntry->read_proc  = freqhopping_userdefine_proc_read;
			//prUserdefEntry->write_proc = freqhopping_userdefine_proc_write;
			FH_MSG("[%s]: successfully create /proc/freqhopping/userdef", __func__);
		}else{
			FH_MSG("[%s]: failed to create /proc/freqhopping/userdef", __func__);
			return 1;
		}

#if 0// MT_FH_CLK_GEN
		/* /proc/freqhopping/clkgen */
		prUserdefEntry = create_proc_entry("clkgen",  S_IRUGO | S_IWUSR | S_IWGRP, fh_proc_dir);
		if(prUserdefEntry)
		{
			prUserdefEntry->read_proc  = g_p_fh_hal_drv->proc.clk_gen_read;
			prUserdefEntry->write_proc = g_p_fh_hal_drv->proc.clk_gen_write;
			FH_MSG("[%s]: successfully create /proc/freqhopping/clkgen", __func__);
		}else{
			FH_MSG("[%s]: failed to create /proc/freqhopping/clkgen", __func__);
			return 1;
		}
#endif //MT_FH_CLK_GEN
	}

	return 0 ;
}
示例#29
0
static int __init ram_console_late_init(void)
{
	struct proc_dir_entry *entry;

#ifdef CONFIG_DEBUG_LAST_BLDR_LOG
	if (last_bldr_log != NULL)
	{
		last_bldr_log_buf = kmalloc(last_bldr_log_size, GFP_KERNEL);
		if (last_bldr_log_buf == NULL)
			printk(KERN_ERR "[K] ram_console: failed to allocate buffer %ld for last bldr log\n", last_bldr_log_size);
		else {
			printk(KERN_INFO "[K] ram_console: allocate buffer %ld for last bldr log\n", last_bldr_log_size);
			bldr_log_parser(last_bldr_log, last_bldr_log_buf, last_bldr_log_size, &last_bldr_log_buf_size);
		}
	}
#endif

#ifdef CONFIG_DEBUG_BLDR_LOG
	if (bldr_log != NULL)
	{
		bldr_log_buf = kmalloc(bldr_log_size, GFP_KERNEL);
		if (bldr_log_buf == NULL)
			printk(KERN_ERR "[K] ram_console: failed to allocate buffer %ld for bldr log\n", bldr_log_size);
		else {
			printk(KERN_INFO "[K] ram_console: allocate buffer %ld for bldr log\n", bldr_log_size);
			bldr_log_parser(bldr_log, bldr_log_buf, bldr_log_size, &bldr_log_buf_size);
		}
	}
#endif

	if (ram_console_old_log == NULL)
		return 0;
#ifdef CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT
	ram_console_old_log = kmalloc(ram_console_old_log_size, GFP_KERNEL);
	if (ram_console_old_log == NULL) {
		printk(KERN_ERR
		       "[K] ram_console: failed to allocate buffer for old log\n");
		ram_console_old_log_size = 0;
		return 0;
	}
	memcpy(ram_console_old_log,
	       ram_console_old_log_init_buffer, ram_console_old_log_size);
#endif
	entry = create_proc_entry("last_kmsg", S_IFREG | S_IRUGO, NULL);
	if (!entry) {
		printk(KERN_ERR "[K] ram_console: failed to create proc entry\n");
		kfree(ram_console_old_log);
		ram_console_old_log = NULL;
		return 0;
	}

	entry->proc_fops = &ram_console_file_ops;
	entry->size = ram_console_old_log_size;
#ifdef CONFIG_DEBUG_LAST_BLDR_LOG
	entry->size += last_bldr_log_size;
#endif
#ifdef CONFIG_DEBUG_BLDR_LOG
	entry->size += bldr_log_size;
#endif
	return 0;
}
static int __init vfp_init(void)
{
	unsigned int vfpsid;
	unsigned int cpu_arch = cpu_architecture();
#ifdef CONFIG_PROC_FS
	static struct proc_dir_entry *procfs_entry;
#endif
	if (cpu_arch >= CPU_ARCH_ARMv6)
		on_each_cpu(vfp_enable, NULL, 1);

	vfp_vector = vfp_testing_entry;
	barrier();
	vfpsid = fmrx(FPSID);
	barrier();
	vfp_vector = vfp_null_entry;

	printk(KERN_INFO "VFP support v0.3: ");
	if (VFP_arch)
		printk("not present\n");
	else if (vfpsid & FPSID_NODOUBLE) {
		printk("no double precision support\n");
	} else {
		hotcpu_notifier(vfp_hotplug, 0);

		VFP_arch = (vfpsid & FPSID_ARCH_MASK) >> FPSID_ARCH_BIT;  
		printk("implementor %02x architecture %d part %02x variant %x rev %x\n",
			(vfpsid & FPSID_IMPLEMENTER_MASK) >> FPSID_IMPLEMENTER_BIT,
			(vfpsid & FPSID_ARCH_MASK) >> FPSID_ARCH_BIT,
			(vfpsid & FPSID_PART_MASK) >> FPSID_PART_BIT,
			(vfpsid & FPSID_VARIANT_MASK) >> FPSID_VARIANT_BIT,
			(vfpsid & FPSID_REV_MASK) >> FPSID_REV_BIT);

		vfp_vector = vfp_support_entry;

		thread_register_notifier(&vfp_notifier_block);
		vfp_pm_init();

		elf_hwcap |= HWCAP_VFP;
#ifdef CONFIG_VFPv3
		if (VFP_arch >= 2) {
			elf_hwcap |= HWCAP_VFPv3;

			/*
			 * Check for VFPv3 D16 and VFPv4 D16.  CPUs in
			 * this configuration only have 16 x 64bit
			 * registers.
			 */
			if (((fmrx(MVFR0) & MVFR0_A_SIMD_MASK)) == 1)
				elf_hwcap |= HWCAP_VFPv3D16; /* also v4-D16 */
			else
				elf_hwcap |= HWCAP_VFPD32;
		}
#endif
		if ((read_cpuid_id() & 0x000f0000) == 0x000f0000) {
#ifdef CONFIG_NEON
			if ((fmrx(MVFR1) & 0x000fff00) == 0x00011100)
				elf_hwcap |= HWCAP_NEON;
#endif
#ifdef CONFIG_VFPv3
			if ((fmrx(MVFR1) & 0xf0000000) == 0x10000000)
				elf_hwcap |= HWCAP_VFPv4;
#endif
		}
	}

#ifdef CONFIG_PROC_FS
	procfs_entry = create_proc_entry("cpu/vfp_bounce", S_IRUGO, NULL);

	if (procfs_entry)
		procfs_entry->read_proc = proc_read_status;
	else
		pr_err("Failed to create procfs node for VFP bounce reporting\n");
#endif

	return 0;
}