Rev 9100 | Rev 9827 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9100 | Rev 9144 | ||
---|---|---|---|
Line 26... | Line 26... | ||
26 | #include |
26 | #include |
27 | #include |
27 | #include |
28 | #include |
28 | #include |
Line 29... | Line 29... | ||
29 | 29 | ||
30 | struct cpuinfo_x86 boot_cpu_data; |
30 | struct cpuinfo_x86 boot_cpu_data; |
- | 31 | extern void init_amd_nbs(void); |
|
- | 32 | ||
Line 31... | Line 33... | ||
31 | bool force; |
33 | #define KERNEL_SPACE 0x80000000 |
32 | 34 | ||
33 | /* CPUID function 0x80000001, ebx */ |
35 | /* CPUID function 0x80000001, ebx */ |
34 | #define CPUID_PKGTYPE_MASK GENMASK(31, 28) |
36 | #define CPUID_PKGTYPE_MASK GENMASK(31, 28) |
Line 164... | Line 166... | ||
164 | 166 | ||
165 | long get_raw_temp(struct k10temp_data *data) |
167 | long get_raw_temp(struct k10temp_data *data) |
166 | { |
168 | { |
167 | u32 regval; |
169 | u32 regval; |
168 | long temp; |
- | |
169 | //printk("b30\n"); |
170 | long temp; |
170 | data->read_tempreg(data->pdev, ®val); |
171 | data->read_tempreg(data->pdev, ®val); |
171 | temp = (regval >> ZEN_CUR_TEMP_SHIFT) * 125; |
172 | temp = (regval >> ZEN_CUR_TEMP_SHIFT) * 125; |
172 | if (regval & data->temp_adjust_mask) |
173 | if (regval & data->temp_adjust_mask) |
173 | temp -= 49000; |
174 | temp -= 49000; |
Line 532... | Line 533... | ||
532 | read_temp_info(dev, hwmon_temp_crit, 0, &k10temp_out.Tcrit); |
533 | read_temp_info(dev, hwmon_temp_crit, 0, &k10temp_out.Tcrit); |
533 | read_temp_info(dev, hwmon_temp_crit_hyst, 0, &k10temp_out.Tcrit_hyst); |
534 | read_temp_info(dev, hwmon_temp_crit_hyst, 0, &k10temp_out.Tcrit_hyst); |
534 | } |
535 | } |
Line 535... | Line 536... | ||
535 | 536 | ||
536 | int __stdcall service_proc(ioctl_t *my_ctl){ |
537 | int __stdcall service_proc(ioctl_t *my_ctl){ |
- | 538 | if(!my_ctl || !my_ctl->output || (int)my_ctl->output>=KERNEL_SPACE-sizeof(k10temp_out)){ |
|
537 | if(!my_ctl || !my_ctl->output){ |
539 | printk("k10temp: Bad address for writing data!\n"); |
538 | return 1; |
540 | return 0; |
- | 541 | } |
|
539 | } |
542 | |
- | 543 | read_all_info(&k10temp_device); |
|
540 | read_all_info(&k10temp_device); |
544 | |
541 | if(my_ctl->out_size == sizeof(k10temp_out)){ |
545 | if(my_ctl->out_size == sizeof(k10temp_out)){ |
542 | memcpy(my_ctl->output, &k10temp_out, sizeof(k10temp_out)); |
546 | memcpy(my_ctl->output, &k10temp_out, sizeof(k10temp_out)); |
543 | return 0; |
547 | return 0; |
- | 548 | } |
|
544 | } |
549 | printk("k10temp: Invalid buffer length!\n"); |
545 | return 1; |
550 | return 1; |
Line 546... | Line -... | ||
546 | } |
- | |
547 | - | ||
548 | extern void init_amd_nbs(void); |
551 | } |
549 | 552 | ||
550 | uint32_t drvEntry(int action, char *cmdline){ |
553 | uint32_t drvEntry(int action, char *cmdline){ |
551 | if(action != 1){ |
554 | if(action != 1){ |
552 | return 0; |
555 | return 0; |
Line 558... | Line 561... | ||
558 | cpu_detect(&boot_cpu_data); |
561 | cpu_detect(&boot_cpu_data); |
Line 559... | Line 562... | ||
559 | 562 | ||
560 | err = enum_pci_devices(); |
563 | err = enum_pci_devices(); |
561 | if(unlikely(err != 0)) { |
564 | if(unlikely(err != 0)) { |
562 | printk("k10temp: Device enumeration failed!\n"); |
565 | printk("k10temp: Device enumeration failed!\n"); |
563 | return -1; |
566 | return 0; |
Line 564... | Line 567... | ||
564 | } |
567 | } |
Line 565... | Line 568... | ||
565 | 568 | ||
566 | k10temp_id = find_pci_device(&device, k10temp_id_table); |
569 | k10temp_id = find_pci_device(&device, k10temp_id_table); |
567 | 570 | ||
568 | if(unlikely(k10temp_id == NULL)){ |
571 | if(unlikely(k10temp_id == NULL)){ |
Line 569... | Line 572... | ||
569 | printk("k10temp: Device not found!\n"); |
572 | printk("k10temp: Device not found!\n"); |
570 | return -ENODEV; |
573 | return 0; |
571 | } |
574 | } |