cpuid.c (84a73014d86fd660822a20c032625e3afe99ca58) cpuid.c (b25472f9b96159cc0b9b7ed449448805973cd789)
1/* ----------------------------------------------------------------------- *
2 *
3 * Copyright 2000-2008 H. Peter Anvin - All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
8 * USA; either version 2 of the License, or (at your option) any later

--- 44 unchanged lines hidden (view full) ---

53static void cpuid_smp_cpuid(void *cmd_block)
54{
55 struct cpuid_regs *cmd = (struct cpuid_regs *)cmd_block;
56
57 cpuid_count(cmd->eax, cmd->ecx,
58 &cmd->eax, &cmd->ebx, &cmd->ecx, &cmd->edx);
59}
60
1/* ----------------------------------------------------------------------- *
2 *
3 * Copyright 2000-2008 H. Peter Anvin - All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
8 * USA; either version 2 of the License, or (at your option) any later

--- 44 unchanged lines hidden (view full) ---

53static void cpuid_smp_cpuid(void *cmd_block)
54{
55 struct cpuid_regs *cmd = (struct cpuid_regs *)cmd_block;
56
57 cpuid_count(cmd->eax, cmd->ecx,
58 &cmd->eax, &cmd->ebx, &cmd->ecx, &cmd->edx);
59}
60
61static loff_t cpuid_seek(struct file *file, loff_t offset, int orig)
62{
63 loff_t ret;
64 struct inode *inode = file->f_mapping->host;
65
66 mutex_lock(&inode->i_mutex);
67 switch (orig) {
68 case 0:
69 file->f_pos = offset;
70 ret = file->f_pos;
71 break;
72 case 1:
73 file->f_pos += offset;
74 ret = file->f_pos;
75 break;
76 default:
77 ret = -EINVAL;
78 }
79 mutex_unlock(&inode->i_mutex);
80 return ret;
81}
82
83static ssize_t cpuid_read(struct file *file, char __user *buf,
84 size_t count, loff_t *ppos)
85{
86 char __user *tmp = buf;
87 struct cpuid_regs cmd;
88 int cpu = iminor(file_inode(file));
89 u64 pos = *ppos;
90 ssize_t bytes = 0;

--- 36 unchanged lines hidden (view full) ---

127 return 0;
128}
129
130/*
131 * File operations we support
132 */
133static const struct file_operations cpuid_fops = {
134 .owner = THIS_MODULE,
61static ssize_t cpuid_read(struct file *file, char __user *buf,
62 size_t count, loff_t *ppos)
63{
64 char __user *tmp = buf;
65 struct cpuid_regs cmd;
66 int cpu = iminor(file_inode(file));
67 u64 pos = *ppos;
68 ssize_t bytes = 0;

--- 36 unchanged lines hidden (view full) ---

105 return 0;
106}
107
108/*
109 * File operations we support
110 */
111static const struct file_operations cpuid_fops = {
112 .owner = THIS_MODULE,
135 .llseek = cpuid_seek,
113 .llseek = no_seek_end_llseek,
136 .read = cpuid_read,
137 .open = cpuid_open,
138};
139
140static int cpuid_device_create(int cpu)
141{
142 struct device *dev;
143

--- 102 unchanged lines hidden ---
114 .read = cpuid_read,
115 .open = cpuid_open,
116};
117
118static int cpuid_device_create(int cpu)
119{
120 struct device *dev;
121

--- 102 unchanged lines hidden ---