All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] Erratic value of MCH temp. (0C),
@ 2011-01-03 11:07 Joris Creyghton
  2011-01-05 11:35 ` Luca Tettamanti
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: Joris Creyghton @ 2011-01-03 11:07 UTC (permalink / raw)
  To: lm-sensors


[-- Attachment #1.1: Type: text/plain, Size: 1509 bytes --]

Dear reader,

Problem:
The sensors command reports 0C for the MCH temp., while the BIOS gives a
reasonable value of about 40C.

Output of sensors command:


        joris@Asus5:~$ sensors
        atk0110-acpi-0
        Adapter: ACPI interface
        Vcore Voltage:      +0.93 V  (min =  +0.80 V, max =  +1.60 V)
         +3.3 Voltage:      +3.31 V  (min =  +2.97 V, max =  +3.63 V)
         +5 Voltage:        +5.12 V  (min =  +4.50 V, max =  +5.50 V)
         +12 Voltage:      +12.25 V  (min = +10.20 V, max = +13.80 V)
        CPU FAN Speed:      958 RPM  (min =  600 RPM)
        CHASSIS1 FAN Speed: 669 RPM  (min =  600 RPM)
        CHASSIS2 FAN Speed: 496 RPM  (min =  600 RPM)
        CHASSIS3 FAN Speed:   0 RPM  (min =  600 RPM)
        POWER FAN Speed:    774 RPM  (min =    0 RPM)
        CPU Temperature:    +32.5°C  (high = +60.0°C, crit = +75.0°C)  
        MB Temperature:     +31.0°C  (high = +45.0°C, crit = +75.0°C)  
        MCH Temperature:     +0.0°C  (high = +60.0°C, crit = +95.0°C)  
        

Output of dmesg, sensors-detect and lsmod atttached as files.

I have added the suggested chipdrivers coretemp and w83627ehf
to /etc/modules but that didn't solve the problem; removed them again.

Hardware:
MB: Asus Sabertooth X58
CPU: Intel i7 950
Chipset: Intel X58 / ICH 10R

Software:
OS: Ubuntu 10.10 64 bit desktop
Kernel: 2.6.35-23
Sensors: version 3.1.2 with libsensors version 3.1.2
BIOS: AMI version 0603, build date 10/29/10



[-- Attachment #1.2: Type: text/html, Size: 2236 bytes --]

[-- Attachment #2: dmesg.txt --]
[-- Type: text/plain, Size: 58000 bytes --]

[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 2.6.35-23-generic (buildd@allspice) (gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5) ) #41-Ubuntu SMP Wed Nov 24 11:55:36 UTC 2010 (Ubuntu 2.6.35-23.41-generic 2.6.35.7)
[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-2.6.35-23-generic root=UUID=efc654c2-7fd0-4a12-aedc-0df0ba49d3a7 ro quiet splash
[    0.000000] BIOS-provided physical RAM map:
[    0.000000]  BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
[    0.000000]  BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
[    0.000000]  BIOS-e820: 00000000000e2c00 - 0000000000100000 (reserved)
[    0.000000]  BIOS-e820: 0000000000100000 - 00000000bf780000 (usable)
[    0.000000]  BIOS-e820: 00000000bf780000 - 00000000bf798000 (ACPI data)
[    0.000000]  BIOS-e820: 00000000bf798000 - 00000000bf7da000 (ACPI NVS)
[    0.000000]  BIOS-e820: 00000000bf7da000 - 00000000c0000000 (reserved)
[    0.000000]  BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
[    0.000000]  BIOS-e820: 00000000ffe00000 - 0000000100000000 (reserved)
[    0.000000]  BIOS-e820: 0000000100000000 - 0000000340000000 (usable)
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] DMI 2.5 present.
[    0.000000] AMI BIOS detected: BIOS may corrupt low RAM, working around it.
[    0.000000] e820 update range: 0000000000000000 - 0000000000010000 (usable) ==> (reserved)
[    0.000000] e820 update range: 0000000000000000 - 0000000000001000 (usable) ==> (reserved)
[    0.000000] e820 remove range: 00000000000a0000 - 0000000000100000 (usable)
[    0.000000] No AGP bridge found
[    0.000000] last_pfn = 0x340000 max_arch_pfn = 0x400000000
[    0.000000] MTRR default type: uncachable
[    0.000000] MTRR fixed ranges enabled:
[    0.000000]   00000-9FFFF write-back
[    0.000000]   A0000-BFFFF uncachable
[    0.000000]   C0000-DFFFF write-protect
[    0.000000]   E0000-EBFFF write-through
[    0.000000]   EC000-FFFFF write-protect
[    0.000000] MTRR variable ranges enabled:
[    0.000000]   0 base 000000000 mask E00000000 write-back
[    0.000000]   1 base 200000000 mask F00000000 write-back
[    0.000000]   2 base 300000000 mask FC0000000 write-back
[    0.000000]   3 base 0C0000000 mask FC0000000 uncachable
[    0.000000]   4 base 0BF800000 mask FFF800000 uncachable
[    0.000000]   5 disabled
[    0.000000]   6 disabled
[    0.000000]   7 disabled
[    0.000000] x86 PAT enabled: cpu 0, old 0x7040600070406, new 0x7010600070106
[    0.000000] e820 update range: 00000000bf800000 - 0000000100000000 (usable) ==> (reserved)
[    0.000000] last_pfn = 0xbf780 max_arch_pfn = 0x400000000
[    0.000000] Scanning 0 areas for low memory corruption
[    0.000000] modified physical RAM map:
[    0.000000]  modified: 0000000000000000 - 0000000000010000 (reserved)
[    0.000000]  modified: 0000000000010000 - 000000000009fc00 (usable)
[    0.000000]  modified: 000000000009fc00 - 00000000000a0000 (reserved)
[    0.000000]  modified: 00000000000e2c00 - 0000000000100000 (reserved)
[    0.000000]  modified: 0000000000100000 - 00000000bf780000 (usable)
[    0.000000]  modified: 00000000bf780000 - 00000000bf798000 (ACPI data)
[    0.000000]  modified: 00000000bf798000 - 00000000bf7da000 (ACPI NVS)
[    0.000000]  modified: 00000000bf7da000 - 00000000c0000000 (reserved)
[    0.000000]  modified: 00000000fee00000 - 00000000fee01000 (reserved)
[    0.000000]  modified: 00000000ffe00000 - 0000000100000000 (reserved)
[    0.000000]  modified: 0000000100000000 - 0000000340000000 (usable)
[    0.000000] initial memory mapped : 0 - 20000000
[    0.000000] found SMP MP-table at [ffff8800000ff780] ff780
[    0.000000] init_memory_mapping: 0000000000000000-00000000bf780000
[    0.000000]  0000000000 - 00bf600000 page 2M
[    0.000000]  00bf600000 - 00bf780000 page 4k
[    0.000000] kernel direct mapping tables up to bf780000 @ 16000-1b000
[    0.000000] init_memory_mapping: 0000000100000000-0000000340000000
[    0.000000]  0100000000 - 0340000000 page 2M
[    0.000000] kernel direct mapping tables up to 340000000 @ 19000-27000
[    0.000000] RAMDISK: 37573000 - 37ff0000
[    0.000000] ACPI: RSDP 00000000000fb940 00014 (v00 ACPIAM)
[    0.000000] ACPI: RSDT 00000000bf780000 00044 (v01 102910 RSDT2206 20101029 MSFT 00000097)
[    0.000000] ACPI: FACP 00000000bf780200 00084 (v01 102910 FACP2206 20101029 MSFT 00000097)
[    0.000000] ACPI: DSDT 00000000bf7804b0 0C469 (v01  A1682 A1682001 00000001 INTL 20060113)
[    0.000000] ACPI: FACS 00000000bf798000 00040
[    0.000000] ACPI: APIC 00000000bf780390 000D8 (v01 102910 APIC2206 20101029 MSFT 00000097)
[    0.000000] ACPI: MCFG 00000000bf780470 0003C (v01 102910 OEMMCFG  20101029 MSFT 00000097)
[    0.000000] ACPI: OEMB 00000000bf798040 00072 (v01 102910 OEMB2206 20101029 MSFT 00000097)
[    0.000000] ACPI: HPET 00000000bf78f4b0 00038 (v01 102910 OEMHPET  20101029 MSFT 00000097)
[    0.000000] ACPI: ASPT 00000000bf798360 00034 (v06 102910 PerfTune 20101029 MSFT 00000097)
[    0.000000] ACPI: OSFR 00000000bf78f4f0 000B0 (v01 102910 OEMOSFR  20101029 MSFT 00000097)
[    0.000000] ACPI: SSDT 00000000bf79a5e0 00363 (v01 DpgPmm    CpuPm 00000012 INTL 20060113)
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] No NUMA configuration found
[    0.000000] Faking a node at 0000000000000000-0000000340000000
[    0.000000] Initmem setup node 0 0000000000000000-0000000340000000
[    0.000000]   NODE_DATA [0000000100000000 - 0000000100004fff]
[    0.000000]  [ffffea0000000000-ffffea000b5fffff] PMD -> [ffff880100200000-ffff88010a9fffff] on node 0
[    0.000000] Zone PFN ranges:
[    0.000000]   DMA      0x00000010 -> 0x00001000
[    0.000000]   DMA32    0x00001000 -> 0x00100000
[    0.000000]   Normal   0x00100000 -> 0x00340000
[    0.000000] Movable zone start PFN for each node
[    0.000000] early_node_map[3] active PFN ranges
[    0.000000]     0: 0x00000010 -> 0x0000009f
[    0.000000]     0: 0x00000100 -> 0x000bf780
[    0.000000]     0: 0x00100000 -> 0x00340000
[    0.000000] On node 0 totalpages: 3143439
[    0.000000]   DMA zone: 56 pages used for memmap
[    0.000000]   DMA zone: 0 pages reserved
[    0.000000]   DMA zone: 3927 pages, LIFO batch:0
[    0.000000]   DMA32 zone: 14280 pages used for memmap
[    0.000000]   DMA32 zone: 765880 pages, LIFO batch:31
[    0.000000]   Normal zone: 32256 pages used for memmap
[    0.000000]   Normal zone: 2327040 pages, LIFO batch:31
[    0.000000] ACPI: PM-Timer IO Port: 0x808
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] ACPI: LAPIC (acpi_id[0x01] lapic_id[0x00] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x02] lapic_id[0x02] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x03] lapic_id[0x04] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x04] lapic_id[0x06] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x05] lapic_id[0x01] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x06] lapic_id[0x03] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x07] lapic_id[0x05] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x08] lapic_id[0x07] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x09] lapic_id[0x88] disabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x0a] lapic_id[0x89] disabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x0b] lapic_id[0x8a] disabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x0c] lapic_id[0x8b] disabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x0d] lapic_id[0x8c] disabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x0e] lapic_id[0x8d] disabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x0f] lapic_id[0x8e] disabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x10] lapic_id[0x8f] disabled)
[    0.000000] ACPI: IOAPIC (id[0x08] address[0xfec00000] gsi_base[0])
[    0.000000] IOAPIC[0]: apic_id 8, version 32, address 0xfec00000, GSI 0-23
[    0.000000] ACPI: IOAPIC (id[0x09] address[0xfec8a000] gsi_base[24])
[    0.000000] IOAPIC[1]: apic_id 9, version 32, address 0xfec8a000, GSI 24-47
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.000000] ACPI: IRQ0 used by override.
[    0.000000] ACPI: IRQ2 used by override.
[    0.000000] ACPI: IRQ9 used by override.
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] ACPI: HPET id: 0x8086a301 base: 0xfed00000
[    0.000000] SMP: Allowing 16 CPUs, 8 hotplug CPUs
[    0.000000] nr_irqs_gsi: 64
[    0.000000] early_res array is doubled to 64 at [22000 - 227ff]
[    0.000000] PM: Registered nosave memory: 000000000009f000 - 00000000000a0000
[    0.000000] PM: Registered nosave memory: 00000000000a0000 - 00000000000e3000
[    0.000000] PM: Registered nosave memory: 00000000000e3000 - 0000000000100000
[    0.000000] PM: Registered nosave memory: 00000000bf780000 - 00000000bf798000
[    0.000000] PM: Registered nosave memory: 00000000bf798000 - 00000000bf7da000
[    0.000000] PM: Registered nosave memory: 00000000bf7da000 - 00000000c0000000
[    0.000000] PM: Registered nosave memory: 00000000c0000000 - 00000000fee00000
[    0.000000] PM: Registered nosave memory: 00000000fee00000 - 00000000fee01000
[    0.000000] PM: Registered nosave memory: 00000000fee01000 - 00000000ffe00000
[    0.000000] PM: Registered nosave memory: 00000000ffe00000 - 0000000100000000
[    0.000000] Allocating PCI resources starting at c0000000 (gap: c0000000:3ee00000)
[    0.000000] Booting paravirtualized kernel on bare hardware
[    0.000000] setup_percpu: NR_CPUS:64 nr_cpumask_bits:64 nr_cpu_ids:16 nr_node_ids:1
[    0.000000] early_res array is doubled to 128 at [22800 - 237ff]
[    0.000000] PERCPU: Embedded 30 pages/cpu @ffff880001e00000 s91520 r8192 d23168 u131072
[    0.000000] pcpu-alloc: s91520 r8192 d23168 u131072 alloc=1*2097152
[    0.000000] pcpu-alloc: [0] 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 3096847
[    0.000000] Policy zone: Normal
[    0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-2.6.35-23-generic root=UUID=efc654c2-7fd0-4a12-aedc-0df0ba49d3a7 ro quiet splash
[    0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes)
[    0.000000] Checking aperture...
[    0.000000] No AGP bridge found
[    0.000000] Calgary: detecting Calgary via BIOS EBDA area
[    0.000000] Calgary: Unable to locate Rio Grande table in EBDA - bailing!
[    0.000000] Subtract (68 early reservations)
[    0.000000]   #1 [0001000000 - 0001d17114]   TEXT DATA BSS
[    0.000000]   #2 [0037573000 - 0037ff0000]         RAMDISK
[    0.000000]   #3 [0001d18000 - 0001d18294]             BRK
[    0.000000]   #4 [00000ff790 - 0000100000]   BIOS reserved
[    0.000000]   #5 [00000ff780 - 00000ff790]    MP-table mpf
[    0.000000]   #6 [000009fc00 - 00000f1300]   BIOS reserved
[    0.000000]   #7 [00000f14bc - 00000ff780]   BIOS reserved
[    0.000000]   #8 [00000f1300 - 00000f14bc]    MP-table mpc
[    0.000000]   #9 [0000010000 - 0000012000]      TRAMPOLINE
[    0.000000]   #10 [0000012000 - 0000016000]     ACPI WAKEUP
[    0.000000]   #11 [0000016000 - 0000019000]         PGTABLE
[    0.000000]   #12 [0000019000 - 0000022000]         PGTABLE
[    0.000000]   #13 [0100000000 - 0100005000]       NODE_DATA
[    0.000000]   #14 [0001d182c0 - 0001d192c0]         BOOTMEM
[    0.000000]   #15 [0001d17140 - 0001d17a40]         BOOTMEM
[    0.000000]   #16 [0100005000 - 0100006000]         BOOTMEM
[    0.000000]   #17 [0100006000 - 0100007000]         BOOTMEM
[    0.000000]   #18 [0100200000 - 010aa00000]        MEMMAP 0
[    0.000000]   #19 [0001d17a40 - 0001d17bc0]         BOOTMEM
[    0.000000]   #20 [0001d192c0 - 0001d312c0]         BOOTMEM
[    0.000000]   #21 [0001d312c0 - 0001d492c0]         BOOTMEM
[    0.000000]   #22 [0001d4a000 - 0001d4b000]         BOOTMEM
[    0.000000]   #23 [0001d17bc0 - 0001d17c01]         BOOTMEM
[    0.000000]   #24 [0001d17c40 - 0001d17cc6]         BOOTMEM
[    0.000000]   #25 [0001d17d00 - 0001d17f68]         BOOTMEM
[    0.000000]   #26 [0001d17f80 - 0001d17fe8]         BOOTMEM
[    0.000000]   #27 [0001d492c0 - 0001d49328]         BOOTMEM
[    0.000000]   #28 [0001d49340 - 0001d493a8]         BOOTMEM
[    0.000000]   #29 [0001d493c0 - 0001d49428]         BOOTMEM
[    0.000000]   #30 [0001d49440 - 0001d494a8]         BOOTMEM
[    0.000000]   #31 [0001d494c0 - 0001d49528]         BOOTMEM
[    0.000000]   #32 [0001d49540 - 0001d495a8]         BOOTMEM
[    0.000000]   #33 [0001d495c0 - 0001d49628]         BOOTMEM
[    0.000000]   #34 [0001d49640 - 0001d496a8]         BOOTMEM
[    0.000000]   #35 [0001d496c0 - 0001d49728]         BOOTMEM
[    0.000000]   #36 [0001d49740 - 0001d49760]         BOOTMEM
[    0.000000]   #37 [0001d49780 - 0001d497a0]         BOOTMEM
[    0.000000]   #38 [0001d497c0 - 0001d4982a]         BOOTMEM
[    0.000000]   #39 [0001d49840 - 0001d498aa]         BOOTMEM
[    0.000000]   #40 [0001e00000 - 0001e1e000]         BOOTMEM
[    0.000000]   #41 [0001e20000 - 0001e3e000]         BOOTMEM
[    0.000000]   #42 [0001e40000 - 0001e5e000]         BOOTMEM
[    0.000000]   #43 [0001e60000 - 0001e7e000]         BOOTMEM
[    0.000000]   #44 [0001e80000 - 0001e9e000]         BOOTMEM
[    0.000000]   #45 [0001ea0000 - 0001ebe000]         BOOTMEM
[    0.000000]   #46 [0001ec0000 - 0001ede000]         BOOTMEM
[    0.000000]   #47 [0001ee0000 - 0001efe000]         BOOTMEM
[    0.000000]   #48 [0001f00000 - 0001f1e000]         BOOTMEM
[    0.000000]   #49 [0001f20000 - 0001f3e000]         BOOTMEM
[    0.000000]   #50 [0001f40000 - 0001f5e000]         BOOTMEM
[    0.000000]   #51 [0001f60000 - 0001f7e000]         BOOTMEM
[    0.000000]   #52 [0001f80000 - 0001f9e000]         BOOTMEM
[    0.000000]   #53 [0001fa0000 - 0001fbe000]         BOOTMEM
[    0.000000]   #54 [0001fc0000 - 0001fde000]         BOOTMEM
[    0.000000]   #55 [0001fe0000 - 0001ffe000]         BOOTMEM
[    0.000000]   #56 [0001d498c0 - 0001d498c8]         BOOTMEM
[    0.000000]   #57 [0001d49900 - 0001d49908]         BOOTMEM
[    0.000000]   #58 [0001d49940 - 0001d49980]         BOOTMEM
[    0.000000]   #59 [0001d49980 - 0001d49a00]         BOOTMEM
[    0.000000]   #60 [0001d49a00 - 0001d49b10]         BOOTMEM
[    0.000000]   #61 [0001d49b40 - 0001d49b88]         BOOTMEM
[    0.000000]   #62 [0001d49bc0 - 0001d49c08]         BOOTMEM
[    0.000000]   #63 [0001d4b000 - 0001d53000]         BOOTMEM
[    0.000000]   #64 [0001ffe000 - 0005ffe000]         BOOTMEM
[    0.000000]   #65 [0001d53000 - 0001d73000]         BOOTMEM
[    0.000000]   #66 [0001d73000 - 0001db3000]         BOOTMEM
[    0.000000]   #67 [0000023800 - 000002b800]         BOOTMEM
[    0.000000] Memory: 12309364k/13631488k available (5710k kernel code, 1057732k absent, 264392k reserved, 5380k data, 908k init)
[    0.000000] SLUB: Genslabs=14, HWalign=64, Order=0-3, MinObjects=0, CPUs=16, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] 	RCU dyntick-idle grace-period acceleration is enabled.
[    0.000000] 	RCU-based detection of stalled CPUs is disabled.
[    0.000000] 	Verbose stalled-CPUs detection is disabled.
[    0.000000] NR_IRQS:4352 nr_irqs:1216
[    0.000000] Console: colour VGA+ 80x25
[    0.000000] console [tty0] enabled
[    0.000000] allocated 125829120 bytes of page_cgroup
[    0.000000] please try 'cgroup_disable=memory' option if you don't want memory cgroups
[    0.000000] hpet clockevent registered
[    0.000000] Fast TSC calibration using PIT
[    0.010000] Detected 3073.921 MHz processor.
[    0.000007] Calibrating delay loop (skipped), value calculated using timer frequency.. 6147.84 BogoMIPS (lpj=30739210)
[    0.000010] pid_max: default: 32768 minimum: 301
[    0.000028] Security Framework initialized
[    0.000039] AppArmor: AppArmor initialized
[    0.000040] Yama: becoming mindful.
[    0.001310] Dentry cache hash table entries: 2097152 (order: 12, 16777216 bytes)
[    0.007034] Inode-cache hash table entries: 1048576 (order: 11, 8388608 bytes)
[    0.008214] Mount-cache hash table entries: 256
[    0.008311] Initializing cgroup subsys ns
[    0.008314] Initializing cgroup subsys cpuacct
[    0.008318] Initializing cgroup subsys memory
[    0.008324] Initializing cgroup subsys devices
[    0.008326] Initializing cgroup subsys freezer
[    0.008328] Initializing cgroup subsys net_cls
[    0.008347] CPU: Physical Processor ID: 0
[    0.008349] CPU: Processor Core ID: 0
[    0.008353] mce: CPU supports 9 MCE banks
[    0.008365] CPU0: Thermal monitoring enabled (TM1)
[    0.008373] using mwait in idle threads.
[    0.008375] Performance Events: PEBS fmt1+, Nehalem events, Intel PMU driver.
[    0.008381] ... version:                3
[    0.008382] ... bit width:              48
[    0.008383] ... generic registers:      4
[    0.008384] ... value mask:             0000ffffffffffff
[    0.008385] ... max period:             000000007fffffff
[    0.008386] ... fixed-purpose events:   3
[    0.008387] ... event mask:             000000070000000f
[    0.010228] ACPI: Core revision 20100428
[    0.050648] ftrace: converting mcount calls to 0f 1f 44 00 00
[    0.050656] ftrace: allocating 22688 entries in 89 pages
[    0.056500] Setting APIC routing to physical flat
[    0.056958] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.169956] CPU0: Intel(R) Core(TM) i7 CPU         950  @ 3.07GHz stepping 05
[    0.288892] APIC calibration not consistent with PM-Timer: 97ms instead of 100ms
[    0.288895] APIC delta adjusted to PM-Timer: 835223 (817607)
[    0.289029] Booting Node   0, Processors  #1 #2 #3 #4 #5 #6 #7
[    1.548408] Brought up 8 CPUs
[    1.548411] Total of 8 processors activated (48789.38 BogoMIPS).
[    1.552034] devtmpfs: initialized
[    1.552751] regulator: core version 0.5
[    1.552773] Time:  9:50:13  Date: 01/03/11
[    1.552796] NET: Registered protocol family 16
[    1.552859] Trying to unpack rootfs image as initramfs...
[    1.552871] ACPI: bus type pci registered
[    1.552921] PCI: MMCONFIG for domain 0000 [bus 00-ff] at [mem 0xe0000000-0xefffffff] (base 0xe0000000)
[    1.552923] PCI: not using MMCONFIG
[    1.552924] PCI: Using configuration type 1 for base access
[    1.553449] bio: create slab <bio-0> at 0
[    1.554641] ACPI: EC: Look up EC in DSDT
[    1.555791] ACPI: Executed 1 blocks of module-level executable AML code
[    1.600357] ACPI: SSDT 00000000bf7983a0 0223C (v01 DpgPmm  P001Ist 00000011 INTL 20060113)
[    1.600731] ACPI: Dynamic OEM Table Load:
[    1.600733] ACPI: SSDT (null) 0223C (v01 DpgPmm  P001Ist 00000011 INTL 20060113)
[    1.600918] ACPI: Interpreter enabled
[    1.600920] ACPI: (supports S0 S1 S3 S4 S5)
[    1.600937] ACPI: Using IOAPIC for interrupt routing
[    1.600981] PCI: MMCONFIG for domain 0000 [bus 00-ff] at [mem 0xe0000000-0xefffffff] (base 0xe0000000)
[    1.602669] PCI: MMCONFIG at [mem 0xe0000000-0xefffffff] reserved in ACPI motherboard resources
[    1.639758] ACPI: No dock devices found.
[    1.639761] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[    1.639879] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
[    1.640107] pci_root PNP0A08:00: host bridge window [io  0x0000-0x0cf7]
[    1.640109] pci_root PNP0A08:00: host bridge window [io  0x0d00-0xffff]
[    1.640111] pci_root PNP0A08:00: host bridge window [mem 0x000a0000-0x000bffff]
[    1.640112] pci_root PNP0A08:00: host bridge window [mem 0x000d0000-0x000dffff]
[    1.640114] pci_root PNP0A08:00: host bridge window [mem 0xc0000000-0xdfffffff]
[    1.640115] pci_root PNP0A08:00: host bridge window [mem 0xf0000000-0xfed8ffff]
[    1.640164] pci 0000:00:00.0: PME# supported from D0 D3hot D3cold
[    1.640167] pci 0000:00:00.0: PME# disabled
[    1.640219] pci 0000:00:01.0: PME# supported from D0 D3hot D3cold
[    1.640222] pci 0000:00:01.0: PME# disabled
[    1.640271] pci 0000:00:02.0: PME# supported from D0 D3hot D3cold
[    1.640274] pci 0000:00:02.0: PME# disabled
[    1.640322] pci 0000:00:03.0: PME# supported from D0 D3hot D3cold
[    1.640325] pci 0000:00:03.0: PME# disabled
[    1.640377] pci 0000:00:07.0: PME# supported from D0 D3hot D3cold
[    1.640379] pci 0000:00:07.0: PME# disabled
[    1.640574] pci 0000:00:1a.0: reg 20: [io  0xa800-0xa81f]
[    1.640630] pci 0000:00:1a.1: reg 20: [io  0xa880-0xa89f]
[    1.640686] pci 0000:00:1a.2: reg 20: [io  0xac00-0xac1f]
[    1.640742] pci 0000:00:1a.7: reg 10: [mem 0xf7dff000-0xf7dff3ff]
[    1.640790] pci 0000:00:1a.7: PME# supported from D0 D3hot D3cold
[    1.640793] pci 0000:00:1a.7: PME# disabled
[    1.640822] pci 0000:00:1b.0: reg 10: [mem 0xf7df8000-0xf7dfbfff 64bit]
[    1.640858] pci 0000:00:1b.0: PME# supported from D0 D3hot D3cold
[    1.640861] pci 0000:00:1b.0: PME# disabled
[    1.640917] pci 0000:00:1c.0: PME# supported from D0 D3hot D3cold
[    1.640919] pci 0000:00:1c.0: PME# disabled
[    1.640979] pci 0000:00:1c.4: PME# supported from D0 D3hot D3cold
[    1.640982] pci 0000:00:1c.4: PME# disabled
[    1.641026] pci 0000:00:1d.0: reg 20: [io  0xa080-0xa09f]
[    1.641083] pci 0000:00:1d.1: reg 20: [io  0xa400-0xa41f]
[    1.641139] pci 0000:00:1d.2: reg 20: [io  0xa480-0xa49f]
[    1.641194] pci 0000:00:1d.7: reg 10: [mem 0xf7dfe000-0xf7dfe3ff]
[    1.641242] pci 0000:00:1d.7: PME# supported from D0 D3hot D3cold
[    1.641246] pci 0000:00:1d.7: PME# disabled
[    1.641346] pci 0000:00:1f.0: quirk: [io  0x0800-0x087f] claimed by ICH6 ACPI/GPIO/TCO
[    1.641349] pci 0000:00:1f.0: quirk: [io  0x0500-0x053f] claimed by ICH6 GPIO
[    1.641352] pci 0000:00:1f.0: ICH7 LPC Generic IO decode 1 PIO at 0294 (mask 0003)
[    1.641395] pci 0000:00:1f.2: reg 10: [io  0x9000-0x9007]
[    1.641399] pci 0000:00:1f.2: reg 14: [io  0x8c00-0x8c03]
[    1.641404] pci 0000:00:1f.2: reg 18: [io  0x8880-0x8887]
[    1.641408] pci 0000:00:1f.2: reg 1c: [io  0x8800-0x8803]
[    1.641412] pci 0000:00:1f.2: reg 20: [io  0x8480-0x848f]
[    1.641417] pci 0000:00:1f.2: reg 24: [io  0x8400-0x840f]
[    1.641455] pci 0000:00:1f.3: reg 10: [mem 0xf7dfd000-0xf7dfd0ff 64bit]
[    1.641466] pci 0000:00:1f.3: reg 20: [io  0x1000-0x101f]
[    1.641498] pci 0000:00:1f.5: reg 10: [io  0xa000-0xa007]
[    1.641502] pci 0000:00:1f.5: reg 14: [io  0x9c00-0x9c03]
[    1.641507] pci 0000:00:1f.5: reg 18: [io  0x9880-0x9887]
[    1.641511] pci 0000:00:1f.5: reg 1c: [io  0x9800-0x9803]
[    1.641515] pci 0000:00:1f.5: reg 20: [io  0x9480-0x948f]
[    1.641520] pci 0000:00:1f.5: reg 24: [io  0x9400-0x940f]
[    1.641591] pci 0000:01:00.0: reg 10: [io  0xbc00-0xbc07]
[    1.641595] pci 0000:01:00.0: reg 14: [io  0xb880-0xb883]
[    1.641599] pci 0000:01:00.0: reg 18: [io  0xb800-0xb807]
[    1.641604] pci 0000:01:00.0: reg 1c: [io  0xb480-0xb483]
[    1.641608] pci 0000:01:00.0: reg 20: [io  0xb400-0xb40f]
[    1.641612] pci 0000:01:00.0: reg 24: [mem 0xf7eff800-0xf7efffff]
[    1.641617] pci 0000:01:00.0: reg 30: [mem 0xf7ee0000-0xf7eeffff pref]
[    1.641635] pci 0000:01:00.0: PME# supported from D3hot
[    1.641638] pci 0000:01:00.0: PME# disabled
[    1.658250] pci 0000:00:01.0: PCI bridge to [bus 01-01]
[    1.658254] pci 0000:00:01.0:   bridge window [io  0xb000-0xbfff]
[    1.658257] pci 0000:00:01.0:   bridge window [mem 0xf7e00000-0xf7efffff]
[    1.658261] pci 0000:00:01.0:   bridge window [mem 0xfff00000-0x000fffff pref] (disabled)
[    1.658321] pci 0000:02:00.0: reg 10: [mem 0xf7ffe000-0xf7ffffff 64bit]
[    1.658368] pci 0000:02:00.0: PME# supported from D0 D3hot D3cold
[    1.658372] pci 0000:02:00.0: PME# disabled
[    1.678243] pci 0000:00:02.0: PCI bridge to [bus 02-02]
[    1.678247] pci 0000:00:02.0:   bridge window [io  0xf000-0x0000] (disabled)
[    1.678250] pci 0000:00:02.0:   bridge window [mem 0xf7f00000-0xf7ffffff]
[    1.678254] pci 0000:00:02.0:   bridge window [mem 0xfff00000-0x000fffff pref] (disabled)
[    1.678303] pci 0000:03:00.0: reg 10: [mem 0xf8000000-0xf9ffffff]
[    1.678311] pci 0000:03:00.0: reg 14: [mem 0xd8000000-0xdfffffff 64bit pref]
[    1.678318] pci 0000:03:00.0: reg 1c: [mem 0xd4000000-0xd7ffffff 64bit pref]
[    1.678322] pci 0000:03:00.0: reg 24: [io  0xcc00-0xcc7f]
[    1.678326] pci 0000:03:00.0: reg 30: [mem 0xfbc00000-0xfbc7ffff pref]
[    1.678373] pci 0000:03:00.1: reg 10: [mem 0xfbcfc000-0xfbcfffff]
[    1.698232] pci 0000:00:03.0: PCI bridge to [bus 03-03]
[    1.698237] pci 0000:00:03.0:   bridge window [io  0xc000-0xcfff]
[    1.698239] pci 0000:00:03.0:   bridge window [mem 0xf8000000-0xfbcfffff]
[    1.698244] pci 0000:00:03.0:   bridge window [mem 0xd4000000-0xdfffffff 64bit pref]
[    1.698278] pci 0000:00:07.0: PCI bridge to [bus 04-04]
[    1.698280] pci 0000:00:07.0:   bridge window [io  0xf000-0x0000] (disabled)
[    1.698283] pci 0000:00:07.0:   bridge window [mem 0xfff00000-0x000fffff] (disabled)
[    1.698287] pci 0000:00:07.0:   bridge window [mem 0xfff00000-0x000fffff pref] (disabled)
[    1.698323] pci 0000:00:1c.0: PCI bridge to [bus 06-06]
[    1.698326] pci 0000:00:1c.0:   bridge window [io  0xf000-0x0000] (disabled)
[    1.698329] pci 0000:00:1c.0:   bridge window [mem 0xfff00000-0x000fffff] (disabled)
[    1.698333] pci 0000:00:1c.0:   bridge window [mem 0xf6f00000-0xf6ffffff 64bit pref]
[    1.698406] pci 0000:05:00.0: reg 10: [io  0xdc00-0xdc07]
[    1.698414] pci 0000:05:00.0: reg 14: [io  0xd880-0xd883]
[    1.698422] pci 0000:05:00.0: reg 18: [io  0xd800-0xd807]
[    1.698429] pci 0000:05:00.0: reg 1c: [io  0xd480-0xd483]
[    1.698437] pci 0000:05:00.0: reg 20: [io  0xd400-0xd40f]
[    1.698445] pci 0000:05:00.0: reg 24: [mem 0xfbdffc00-0xfbdffdff]
[    1.698453] pci 0000:05:00.0: reg 30: [mem 0x00000000-0x0000ffff pref]
[    1.698485] pci 0000:05:00.0: PME# supported from D3hot
[    1.698490] pci 0000:05:00.0: PME# disabled
[    1.719597] pci 0000:00:1c.4: PCI bridge to [bus 05-05]
[    1.719602] pci 0000:00:1c.4:   bridge window [io  0xd000-0xdfff]
[    1.719605] pci 0000:00:1c.4:   bridge window [mem 0xfbd00000-0xfbdfffff]
[    1.719610] pci 0000:00:1c.4:   bridge window [mem 0xfff00000-0x000fffff pref] (disabled)
[    1.719658] pci 0000:07:01.0: reg 10: [io  0xe800-0xe8ff]
[    1.719663] pci 0000:07:01.0: reg 14: [mem 0xfbeffc00-0xfbeffcff]
[    1.719685] pci 0000:07:01.0: reg 30: [mem 0xfbec0000-0xfbedffff pref]
[    1.719708] pci 0000:07:01.0: supports D1 D2
[    1.719709] pci 0000:07:01.0: PME# supported from D1 D2 D3hot D3cold
[    1.719713] pci 0000:07:01.0: PME# disabled
[    1.719740] pci 0000:07:02.0: reg 10: [mem 0xfbefe000-0xfbefe7ff]
[    1.719746] pci 0000:07:02.0: reg 14: [io  0xec00-0xec7f]
[    1.719785] pci 0000:07:02.0: supports D2
[    1.719786] pci 0000:07:02.0: PME# supported from D2 D3hot D3cold
[    1.719789] pci 0000:07:02.0: PME# disabled
[    1.719827] pci 0000:00:1e.0: PCI bridge to [bus 07-07] (subtractive decode)
[    1.719830] pci 0000:00:1e.0:   bridge window [io  0xe000-0xefff]
[    1.719833] pci 0000:00:1e.0:   bridge window [mem 0xfbe00000-0xfbefffff]
[    1.719838] pci 0000:00:1e.0:   bridge window [mem 0xfff00000-0x000fffff pref] (disabled)
[    1.719840] pci 0000:00:1e.0:   bridge window [io  0x0000-0x0cf7] (subtractive decode)
[    1.719841] pci 0000:00:1e.0:   bridge window [io  0x0d00-0xffff] (subtractive decode)
[    1.719843] pci 0000:00:1e.0:   bridge window [mem 0x000a0000-0x000bffff] (subtractive decode)
[    1.719845] pci 0000:00:1e.0:   bridge window [mem 0x000d0000-0x000dffff] (subtractive decode)
[    1.719846] pci 0000:00:1e.0:   bridge window [mem 0xc0000000-0xdfffffff] (subtractive decode)
[    1.719848] pci 0000:00:1e.0:   bridge window [mem 0xf0000000-0xfed8ffff] (subtractive decode)
[    1.719879] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]
[    1.720103] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.P0P1._PRT]
[    1.720190] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.P0P4._PRT]
[    1.720242] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.P0P8._PRT]
[    1.720298] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.NPE1._PRT]
[    1.720341] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.NPE2._PRT]
[    1.720384] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.NPE3._PRT]
[    1.720426] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.NPE7._PRT]
[    1.743036] ACPI: PCI Interrupt Link [LNKA] (IRQs 3 4 6 7 10 *11 12 14 15)
[    1.743134] ACPI: PCI Interrupt Link [LNKB] (IRQs 3 4 6 7 *10 11 12 14 15)
[    1.743229] ACPI: PCI Interrupt Link [LNKC] (IRQs 3 4 6 7 10 11 12 *14 15)
[    1.743328] ACPI: PCI Interrupt Link [LNKD] (IRQs *3 4 6 7 10 11 12 14 15)
[    1.743423] ACPI: PCI Interrupt Link [LNKE] (IRQs 3 4 6 7 10 11 12 14 *15)
[    1.743521] ACPI: PCI Interrupt Link [LNKF] (IRQs 3 4 6 *7 10 11 12 14 15)
[    1.743616] ACPI: PCI Interrupt Link [LNKG] (IRQs 3 4 *6 7 10 11 12 14 15)
[    1.743711] ACPI: PCI Interrupt Link [LNKH] (IRQs 3 4 6 7 *10 11 12 14 15)
[    1.743750] HEST: Table is not found!
[    1.743800] vgaarb: device added: PCI:0000:03:00.0,decodes=io+mem,owns=io+mem,locks=none
[    1.743802] vgaarb: loaded
[    1.743889] SCSI subsystem initialized
[    1.744004] libata version 3.00 loaded.
[    1.744035] usbcore: registered new interface driver usbfs
[    1.744041] usbcore: registered new interface driver hub
[    1.744057] usbcore: registered new device driver usb
[    1.744157] ACPI: WMI: Mapper loaded
[    1.744159] PCI: Using ACPI for IRQ routing
[    1.744160] PCI: pci_cache_line_size set to 64 bytes
[    1.744245] reserve RAM buffer: 000000000009fc00 - 000000000009ffff 
[    1.744246] reserve RAM buffer: 00000000bf780000 - 00000000bfffffff 
[    1.744305] NetLabel: Initializing
[    1.744306] NetLabel:  domain hash size = 128
[    1.744307] NetLabel:  protocols = UNLABELED CIPSOv4
[    1.744315] NetLabel:  unlabeled traffic allowed by default
[    1.744334] HPET: 4 timers in total, 0 timers will be used for per-cpu timer
[    1.744338] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0, 0
[    1.744341] hpet0: 4 comparators, 64-bit 14.318180 MHz counter
[    1.775170] Freeing initrd memory: 10740k freed
[    1.778323] Switching to clocksource tsc
[    1.783754] AppArmor: AppArmor Filesystem Enabled
[    1.783764] pnp: PnP ACPI init
[    1.783776] ACPI: bus type pnp registered
[    1.786139] pnp: PnP ACPI: found 16 devices
[    1.786140] ACPI: ACPI bus type pnp unregistered
[    1.786149] system 00:01: [mem 0xfbf00000-0xfbffffff] has been reserved
[    1.786150] system 00:01: [mem 0xfc000000-0xfcffffff] has been reserved
[    1.786152] system 00:01: [mem 0xfd000000-0xfdffffff] has been reserved
[    1.786154] system 00:01: [mem 0xfe000000-0xfebfffff] has been reserved
[    1.786155] system 00:01: [mem 0xfec8a000-0xfec8afff] could not be reserved
[    1.786157] system 00:01: [mem 0xfed10000-0xfed10fff] has been reserved
[    1.786161] system 00:06: [io  0x0290-0x029f] has been reserved
[    1.786165] system 00:07: [io  0x04d0-0x04d1] has been reserved
[    1.786166] system 00:07: [io  0x0800-0x087f] has been reserved
[    1.786168] system 00:07: [io  0x0500-0x057f] could not be reserved
[    1.786169] system 00:07: [io  0x0600-0x0607] has been reserved
[    1.786171] system 00:07: [mem 0xfed1c000-0xfed1ffff] has been reserved
[    1.786173] system 00:07: [mem 0xfed20000-0xfed3ffff] has been reserved
[    1.786175] system 00:07: [mem 0xfed40000-0xfed8ffff] has been reserved
[    1.786178] system 00:0a: [mem 0xffc00000-0xffdfffff] has been reserved
[    1.786181] system 00:0b: [mem 0xfec00000-0xfec00fff] could not be reserved
[    1.786182] system 00:0b: [mem 0xfee00000-0xfee00fff] has been reserved
[    1.786186] system 00:0e: [mem 0xe0000000-0xefffffff] has been reserved
[    1.786189] system 00:0f: [mem 0x00000000-0x0009ffff] could not be reserved
[    1.786190] system 00:0f: [mem 0x000c0000-0x000cffff] has been reserved
[    1.786194] system 00:0f: [mem 0x000e0000-0x000fffff] could not be reserved
[    1.786196] system 00:0f: [mem 0x00100000-0xbfffffff] could not be reserved
[    1.786197] system 00:0f: [mem 0xfed90000-0xffffffff] could not be reserved
[    1.794110] pci 0000:00:1c.0: BAR 14: assigned [mem 0xc0000000-0xc03fffff]
[    1.794113] pci 0000:00:1c.4: BAR 15: assigned [mem 0xc0400000-0xc05fffff pref]
[    1.794115] pci 0000:00:1c.0: BAR 13: assigned [io  0x2000-0x2fff]
[    1.794117] pci 0000:00:01.0: PCI bridge to [bus 01-01]
[    1.794119] pci 0000:00:01.0:   bridge window [io  0xb000-0xbfff]
[    1.794123] pci 0000:00:01.0:   bridge window [mem 0xf7e00000-0xf7efffff]
[    1.794125] pci 0000:00:01.0:   bridge window [mem pref disabled]
[    1.794129] pci 0000:00:02.0: PCI bridge to [bus 02-02]
[    1.794130] pci 0000:00:02.0:   bridge window [io  disabled]
[    1.794133] pci 0000:00:02.0:   bridge window [mem 0xf7f00000-0xf7ffffff]
[    1.794136] pci 0000:00:02.0:   bridge window [mem pref disabled]
[    1.794140] pci 0000:00:03.0: PCI bridge to [bus 03-03]
[    1.794142] pci 0000:00:03.0:   bridge window [io  0xc000-0xcfff]
[    1.794145] pci 0000:00:03.0:   bridge window [mem 0xf8000000-0xfbcfffff]
[    1.794148] pci 0000:00:03.0:   bridge window [mem 0xd4000000-0xdfffffff 64bit pref]
[    1.794152] pci 0000:00:07.0: PCI bridge to [bus 04-04]
[    1.794153] pci 0000:00:07.0:   bridge window [io  disabled]
[    1.794156] pci 0000:00:07.0:   bridge window [mem disabled]
[    1.794158] pci 0000:00:07.0:   bridge window [mem pref disabled]
[    1.794162] pci 0000:00:1c.0: PCI bridge to [bus 06-06]
[    1.794164] pci 0000:00:1c.0:   bridge window [io  0x2000-0x2fff]
[    1.794168] pci 0000:00:1c.0:   bridge window [mem 0xc0000000-0xc03fffff]
[    1.794171] pci 0000:00:1c.0:   bridge window [mem 0xf6f00000-0xf6ffffff 64bit pref]
[    1.794176] pci 0000:05:00.0: BAR 6: assigned [mem 0xc0400000-0xc040ffff pref]
[    1.794178] pci 0000:00:1c.4: PCI bridge to [bus 05-05]
[    1.794180] pci 0000:00:1c.4:   bridge window [io  0xd000-0xdfff]
[    1.794183] pci 0000:00:1c.4:   bridge window [mem 0xfbd00000-0xfbdfffff]
[    1.794186] pci 0000:00:1c.4:   bridge window [mem 0xc0400000-0xc05fffff pref]
[    1.794191] pci 0000:00:1e.0: PCI bridge to [bus 07-07]
[    1.794193] pci 0000:00:1e.0:   bridge window [io  0xe000-0xefff]
[    1.794197] pci 0000:00:1e.0:   bridge window [mem 0xfbe00000-0xfbefffff]
[    1.794199] pci 0000:00:1e.0:   bridge window [mem pref disabled]
[    1.794211] pci 0000:00:01.0: setting latency timer to 64
[    1.794218] pci 0000:00:02.0: setting latency timer to 64
[    1.794224] pci 0000:00:03.0: setting latency timer to 64
[    1.794231] pci 0000:00:07.0: setting latency timer to 64
[    1.794236] pci 0000:00:1c.0: enabling device (0106 -> 0107)
[    1.794241]   alloc irq_desc for 17 on node -1
[    1.794243]   alloc kstat_irqs on node -1
[    1.794248] pci 0000:00:1c.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17
[    1.794251] pci 0000:00:1c.0: setting latency timer to 64
[    1.794257] pci 0000:00:1c.4: PCI INT A -> GSI 17 (level, low) -> IRQ 17
[    1.794260] pci 0000:00:1c.4: setting latency timer to 64
[    1.794265] pci 0000:00:1e.0: setting latency timer to 64
[    1.794268] pci_bus 0000:00: resource 4 [io  0x0000-0x0cf7]
[    1.794270] pci_bus 0000:00: resource 5 [io  0x0d00-0xffff]
[    1.794271] pci_bus 0000:00: resource 6 [mem 0x000a0000-0x000bffff]
[    1.794272] pci_bus 0000:00: resource 7 [mem 0x000d0000-0x000dffff]
[    1.794274] pci_bus 0000:00: resource 8 [mem 0xc0000000-0xdfffffff]
[    1.794275] pci_bus 0000:00: resource 9 [mem 0xf0000000-0xfed8ffff]
[    1.794276] pci_bus 0000:01: resource 0 [io  0xb000-0xbfff]
[    1.794278] pci_bus 0000:01: resource 1 [mem 0xf7e00000-0xf7efffff]
[    1.794279] pci_bus 0000:02: resource 1 [mem 0xf7f00000-0xf7ffffff]
[    1.794281] pci_bus 0000:03: resource 0 [io  0xc000-0xcfff]
[    1.794282] pci_bus 0000:03: resource 1 [mem 0xf8000000-0xfbcfffff]
[    1.794283] pci_bus 0000:03: resource 2 [mem 0xd4000000-0xdfffffff 64bit pref]
[    1.794285] pci_bus 0000:06: resource 0 [io  0x2000-0x2fff]
[    1.794286] pci_bus 0000:06: resource 1 [mem 0xc0000000-0xc03fffff]
[    1.794288] pci_bus 0000:06: resource 2 [mem 0xf6f00000-0xf6ffffff 64bit pref]
[    1.794289] pci_bus 0000:05: resource 0 [io  0xd000-0xdfff]
[    1.794290] pci_bus 0000:05: resource 1 [mem 0xfbd00000-0xfbdfffff]
[    1.794292] pci_bus 0000:05: resource 2 [mem 0xc0400000-0xc05fffff pref]
[    1.794293] pci_bus 0000:07: resource 0 [io  0xe000-0xefff]
[    1.794294] pci_bus 0000:07: resource 1 [mem 0xfbe00000-0xfbefffff]
[    1.794296] pci_bus 0000:07: resource 4 [io  0x0000-0x0cf7]
[    1.794297] pci_bus 0000:07: resource 5 [io  0x0d00-0xffff]
[    1.794298] pci_bus 0000:07: resource 6 [mem 0x000a0000-0x000bffff]
[    1.794300] pci_bus 0000:07: resource 7 [mem 0x000d0000-0x000dffff]
[    1.794301] pci_bus 0000:07: resource 8 [mem 0xc0000000-0xdfffffff]
[    1.794302] pci_bus 0000:07: resource 9 [mem 0xf0000000-0xfed8ffff]
[    1.794331] NET: Registered protocol family 2
[    1.794628] IP route cache hash table entries: 524288 (order: 10, 4194304 bytes)
[    1.795597] TCP established hash table entries: 524288 (order: 11, 8388608 bytes)
[    1.796765] TCP bind hash table entries: 65536 (order: 8, 1048576 bytes)
[    1.796887] TCP: Hash tables configured (established 524288 bind 65536)
[    1.796888] TCP reno registered
[    1.796907] UDP hash table entries: 8192 (order: 6, 262144 bytes)
[    1.796962] UDP-Lite hash table entries: 8192 (order: 6, 262144 bytes)
[    1.797077] NET: Registered protocol family 1
[    1.799280] pci 0000:02:00.0: xHCI HW did not halt within 2000 usec status = 0x0
[    1.799294] pci 0000:03:00.0: Boot video device
[    1.799307] PCI: CLS mismatch (256 != 64), using 64 bytes
[    1.799310] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
[    1.799312] Placing 64MB software IO TLB between ffff880001ffe000 - ffff880005ffe000
[    1.799313] software IO TLB at phys 0x1ffe000 - 0x5ffe000
[    1.799645] Scanning for low memory corruption every 60 seconds
[    1.799722] audit: initializing netlink socket (disabled)
[    1.799729] type=2000 audit(1294048212.600:1): initialized
[    4.617082] HugeTLB registered 2 MB page size, pre-allocated 0 pages
[    4.618067] VFS: Disk quotas dquot_6.5.2
[    4.618109] Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    4.618499] fuse init (API version 7.14)
[    4.618555] msgmni has been set to 24062
[    4.620031] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
[    4.620033] io scheduler noop registered
[    4.620034] io scheduler deadline registered
[    4.620060] io scheduler cfq registered (default)
[    4.620138] pcieport 0000:00:01.0: setting latency timer to 64
[    4.620163]   alloc irq_desc for 64 on node -1
[    4.620164]   alloc kstat_irqs on node -1
[    4.620174] pcieport 0000:00:01.0: irq 64 for MSI/MSI-X
[    4.620224] pcieport 0000:00:02.0: setting latency timer to 64
[    4.620246]   alloc irq_desc for 65 on node -1
[    4.620247]   alloc kstat_irqs on node -1
[    4.620252] pcieport 0000:00:02.0: irq 65 for MSI/MSI-X
[    4.620297] pcieport 0000:00:03.0: setting latency timer to 64
[    4.620319]   alloc irq_desc for 66 on node -1
[    4.620320]   alloc kstat_irqs on node -1
[    4.620325] pcieport 0000:00:03.0: irq 66 for MSI/MSI-X
[    4.620370] pcieport 0000:00:07.0: setting latency timer to 64
[    4.620392]   alloc irq_desc for 67 on node -1
[    4.620393]   alloc kstat_irqs on node -1
[    4.620397] pcieport 0000:00:07.0: irq 67 for MSI/MSI-X
[    4.620445] pcieport 0000:00:1c.0: setting latency timer to 64
[    4.620471]   alloc irq_desc for 68 on node -1
[    4.620471]   alloc kstat_irqs on node -1
[    4.620476] pcieport 0000:00:1c.0: irq 68 for MSI/MSI-X
[    4.620532] pcieport 0000:00:1c.4: setting latency timer to 64
[    4.620558]   alloc irq_desc for 69 on node -1
[    4.620559]   alloc kstat_irqs on node -1
[    4.620564] pcieport 0000:00:1c.4: irq 69 for MSI/MSI-X
[    4.620626] aer 0000:00:01.0:pcie02: AER service couldn't init device: no _OSC support
[    4.620630] aer 0000:00:02.0:pcie02: AER service couldn't init device: no _OSC support
[    4.620633] aer 0000:00:03.0:pcie02: AER service couldn't init device: no _OSC support
[    4.620636] aer 0000:00:07.0:pcie02: AER service couldn't init device: no _OSC support
[    4.620646] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[    4.620693] pciehp: PCI Express Hot Plug Controller Driver version: 0.4
[    4.620740] intel_idle: MWAIT substates: 0x1120
[    4.620741] intel_idle: v0.4 model 0x1A
[    4.620742] intel_idle: lapic_timer_reliable_states 0x2
[    4.620832] input: Power Button as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input0
[    4.620835] ACPI: Power Button [PWRB]
[    4.620861] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input1
[    4.620863] ACPI: Power Button [PWRF]
[    4.621123] ACPI: acpi_idle yielding to intel_idle
[    4.623228] ERST: Table is not found!
[    4.623363] Linux agpgart interface v0.103
[    4.623375] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    4.623462] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[    4.623711] 00:0c: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[    4.624371] brd: module loaded
[    4.624670] loop: module loaded
[    4.624766] ata_piix 0000:00:1f.2: version 2.13
[    4.624777]   alloc irq_desc for 20 on node -1
[    4.624778]   alloc kstat_irqs on node -1
[    4.624782] ata_piix 0000:00:1f.2: PCI INT B -> GSI 20 (level, low) -> IRQ 20
[    4.624787] ata_piix 0000:00:1f.2: MAP [ P0 P2 P1 P3 ]
[    4.624811] ata_piix 0000:00:1f.2: setting latency timer to 64
[    4.624851] scsi0 : ata_piix
[    4.624899] scsi1 : ata_piix
[    4.629095] ata1: SATA max UDMA/133 cmd 0x9000 ctl 0x8c00 bmdma 0x8480 irq 20
[    4.629100] ata2: SATA max UDMA/133 cmd 0x8880 ctl 0x8800 bmdma 0x8488 irq 20
[    4.629129] ata_piix 0000:00:1f.5: PCI INT B -> GSI 20 (level, low) -> IRQ 20
[    4.629133] ata_piix 0000:00:1f.5: MAP [ P0 -- P1 -- ]
[    4.629167] ata_piix 0000:00:1f.5: setting latency timer to 64
[    4.629196] scsi2 : ata_piix
[    4.629241] scsi3 : ata_piix
[    4.630056] ata3: SATA max UDMA/133 cmd 0xa000 ctl 0x9c00 bmdma 0x9480 irq 20
[    4.630059] ata4: SATA max UDMA/133 cmd 0x9880 ctl 0x9800 bmdma 0x9488 irq 20
[    4.630099]   alloc irq_desc for 28 on node -1
[    4.630101]   alloc kstat_irqs on node -1
[    4.630107] pata_acpi 0000:01:00.0: PCI INT A -> GSI 28 (level, low) -> IRQ 28
[    4.630121] pata_acpi 0000:01:00.0: setting latency timer to 64
[    4.630129] pata_acpi 0000:01:00.0: PCI INT A disabled
[    4.630285] Fixed MDIO Bus: probed
[    4.630304] PPP generic driver version 2.4.2
[    4.630338] tun: Universal TUN/TAP device driver, 1.6
[    4.630339] tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
[    4.630390] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    4.630403]   alloc irq_desc for 18 on node -1
[    4.630404]   alloc kstat_irqs on node -1
[    4.630407] ehci_hcd 0000:00:1a.7: PCI INT C -> GSI 18 (level, low) -> IRQ 18
[    4.630429] ehci_hcd 0000:00:1a.7: setting latency timer to 64
[    4.630432] ehci_hcd 0000:00:1a.7: EHCI Host Controller
[    4.630456] ehci_hcd 0000:00:1a.7: new USB bus registered, assigned bus number 1
[    4.630477] ehci_hcd 0000:00:1a.7: debug port 1
[    4.634370] ehci_hcd 0000:00:1a.7: cache line size of 64 is not supported
[    4.634382] ehci_hcd 0000:00:1a.7: irq 18, io mem 0xf7dff000
[    4.648529] ehci_hcd 0000:00:1a.7: USB 2.0 started, EHCI 1.00
[    4.648659] hub 1-0:1.0: USB hub found
[    4.648662] hub 1-0:1.0: 6 ports detected
[    4.648725]   alloc irq_desc for 23 on node -1
[    4.648727]   alloc kstat_irqs on node -1
[    4.648732] ehci_hcd 0000:00:1d.7: PCI INT A -> GSI 23 (level, low) -> IRQ 23
[    4.648751] ehci_hcd 0000:00:1d.7: setting latency timer to 64
[    4.648753] ehci_hcd 0000:00:1d.7: EHCI Host Controller
[    4.648780] ehci_hcd 0000:00:1d.7: new USB bus registered, assigned bus number 2
[    4.648799] ehci_hcd 0000:00:1d.7: debug port 1
[    4.652672] ehci_hcd 0000:00:1d.7: cache line size of 64 is not supported
[    4.652684] ehci_hcd 0000:00:1d.7: irq 23, io mem 0xf7dfe000
[    4.678516] ehci_hcd 0000:00:1d.7: USB 2.0 started, EHCI 1.00
[    4.678641] hub 2-0:1.0: USB hub found
[    4.678644] hub 2-0:1.0: 6 ports detected
[    4.678702] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    4.678711] uhci_hcd: USB Universal Host Controller Interface driver
[    4.678760]   alloc irq_desc for 16 on node -1
[    4.678761]   alloc kstat_irqs on node -1
[    4.678766] uhci_hcd 0000:00:1a.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
[    4.678772] uhci_hcd 0000:00:1a.0: setting latency timer to 64
[    4.678774] uhci_hcd 0000:00:1a.0: UHCI Host Controller
[    4.678798] uhci_hcd 0000:00:1a.0: new USB bus registered, assigned bus number 3
[    4.678828] uhci_hcd 0000:00:1a.0: irq 16, io base 0x0000a800
[    4.678895] hub 3-0:1.0: USB hub found
[    4.678898] hub 3-0:1.0: 2 ports detected
[    4.678937]   alloc irq_desc for 21 on node -1
[    4.678938]   alloc kstat_irqs on node -1
[    4.678941] uhci_hcd 0000:00:1a.1: PCI INT B -> GSI 21 (level, low) -> IRQ 21
[    4.678945] uhci_hcd 0000:00:1a.1: setting latency timer to 64
[    4.678948] uhci_hcd 0000:00:1a.1: UHCI Host Controller
[    4.678967] uhci_hcd 0000:00:1a.1: new USB bus registered, assigned bus number 4
[    4.678993] uhci_hcd 0000:00:1a.1: irq 21, io base 0x0000a880
[    4.679059] hub 4-0:1.0: USB hub found
[    4.679061] hub 4-0:1.0: 2 ports detected
[    4.679099]   alloc irq_desc for 19 on node -1
[    4.679100]   alloc kstat_irqs on node -1
[    4.679103] uhci_hcd 0000:00:1a.2: PCI INT D -> GSI 19 (level, low) -> IRQ 19
[    4.679108] uhci_hcd 0000:00:1a.2: setting latency timer to 64
[    4.679110] uhci_hcd 0000:00:1a.2: UHCI Host Controller
[    4.679131] uhci_hcd 0000:00:1a.2: new USB bus registered, assigned bus number 5
[    4.679157] uhci_hcd 0000:00:1a.2: irq 19, io base 0x0000ac00
[    4.679227] hub 5-0:1.0: USB hub found
[    4.679230] hub 5-0:1.0: 2 ports detected
[    4.679267] uhci_hcd 0000:00:1d.0: PCI INT A -> GSI 23 (level, low) -> IRQ 23
[    4.679271] uhci_hcd 0000:00:1d.0: setting latency timer to 64
[    4.679273] uhci_hcd 0000:00:1d.0: UHCI Host Controller
[    4.679295] uhci_hcd 0000:00:1d.0: new USB bus registered, assigned bus number 6
[    5.145479] uhci_hcd 0000:00:1d.0: irq 23, io base 0x0000a080
[    5.145603] hub 6-0:1.0: USB hub found
[    5.145606] hub 6-0:1.0: 2 ports detected
[    5.145657] uhci_hcd 0000:00:1d.1: PCI INT B -> GSI 19 (level, low) -> IRQ 19
[    5.145662] uhci_hcd 0000:00:1d.1: setting latency timer to 64
[    5.145665] uhci_hcd 0000:00:1d.1: UHCI Host Controller
[    5.145692] uhci_hcd 0000:00:1d.1: new USB bus registered, assigned bus number 7
[    5.145715] uhci_hcd 0000:00:1d.1: irq 19, io base 0x0000a400
[    5.145782] hub 7-0:1.0: USB hub found
[    5.145785] hub 7-0:1.0: 2 ports detected
[    5.145823] uhci_hcd 0000:00:1d.2: PCI INT C -> GSI 18 (level, low) -> IRQ 18
[    5.145827] uhci_hcd 0000:00:1d.2: setting latency timer to 64
[    5.145830] uhci_hcd 0000:00:1d.2: UHCI Host Controller
[    5.145849] uhci_hcd 0000:00:1d.2: new USB bus registered, assigned bus number 8
[    5.145869] uhci_hcd 0000:00:1d.2: irq 18, io base 0x0000a480
[    5.145933] hub 8-0:1.0: USB hub found
[    5.145936] hub 8-0:1.0: 2 ports detected
[    5.146012] PNP: PS/2 Controller [PNP0303:PS2K] at 0x60,0x64 irq 1
[    5.146013] PNP: PS/2 appears to have AUX port disabled, if this is incorrect please boot with i8042.nopnp
[    5.146487] serio: i8042 KBD port at 0x60,0x64 irq 1
[    5.146538] mice: PS/2 mouse device common for all mice
[    5.146609] rtc_cmos 00:03: RTC can wake from S4
[    5.146632] rtc_cmos 00:03: rtc core: registered rtc_cmos as rtc0
[    5.146654] rtc0: alarms up to one month, y3k, 114 bytes nvram, hpet irqs
[    5.146732] device-mapper: uevent: version 1.0.3
[    5.146806] device-mapper: ioctl: 4.17.0-ioctl (2010-03-05) initialised: dm-devel@redhat.com
[    5.146907] device-mapper: multipath: version 1.1.1 loaded
[    5.146914] device-mapper: multipath round-robin: version 1.0.0 loaded
[    5.147238] cpuidle: using governor ladder
[    5.147434] cpuidle: using governor menu
[    5.147617] TCP cubic registered
[    5.147695] NET: Registered protocol family 10
[    5.147946] lo: Disabled Privacy Extensions
[    5.148078] NET: Registered protocol family 17
[    5.150815] PM: Resume from disk failed.
[    5.150822] registered taskstats version 1
[    5.151136]   Magic number: 11:931:827
[    5.151308] rtc_cmos 00:03: setting system clock to 2011-01-03 09:50:16 UTC (1294048216)
[    5.151315] BIOS EDD facility v0.16 2004-Jun-25, 0 devices found
[    5.151317] EDD information not available.
[    5.170213] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input2
[    5.271176] ata3: SATA link down (SStatus 0 SControl 300)
[    5.281627] ata4: SATA link down (SStatus 0 SControl 300)
[    5.457039] usb 6-1: new low speed USB device using uhci_hcd and address 2
[    5.767048] ata2.00: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[    5.767063] ata2.01: SATA link down (SStatus 0 SControl 300)
[    5.767194] ata1.00: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[    5.767206] ata1.01: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
[    5.787870] ata2.00: ATA-8: WDC WD2001FASS-00W2B0, 05.01D05, max UDMA/133
[    5.787875] ata2.00: 3907029168 sectors, multi 16: LBA48 NCQ (depth 0/32)
[    5.807156] ata1.00: ATA-8: OCZ-VERTEX2, 1.24, max UDMA/133
[    5.807161] ata1.00: 468862128 sectors, multi 16: LBA48 NCQ (depth 0/32)
[    5.807195] ata1.01: ATAPI: HL-DT-ST BD-RE  BH10LS30, 1.00, max UDMA/133
[    5.807894] ata2.00: configured for UDMA/133
[    5.847112] ata1.00: configured for UDMA/133
[    5.887096] ata1.01: configured for UDMA/133
[    5.893043] scsi 0:0:0:0: Direct-Access     ATA      OCZ-VERTEX2      1.24 PQ: 0 ANSI: 5
[    5.893215] sd 0:0:0:0: Attached scsi generic sg0 type 0
[    5.902077] scsi 0:0:1:0: CD-ROM            HL-DT-ST BD-RE  BH10LS30  1.00 PQ: 0 ANSI: 5
[    5.902130] sd 0:0:0:0: [sda] 468862128 512-byte logical blocks: (240 GB/223 GiB)
[    5.941542] sd 0:0:0:0: [sda] Write Protect is off
[    5.941547] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    5.943814] sr0: scsi3-mmc drive: 40x/40x writer dvd-ram cd/rw xa/form2 cdda tray
[    5.943818] Uniform CD-ROM driver Revision: 3.20
[    5.943907] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    5.943962] sr 0:0:1:0: Attached scsi CD-ROM sr0
[    5.944004] sr 0:0:1:0: Attached scsi generic sg1 type 5
[    5.944030]  sda:
[    5.944186] scsi 1:0:0:0: Direct-Access     ATA      WDC WD2001FASS-0 05.0 PQ: 0 ANSI: 5
[    5.944289]  sda1 sda2
[    5.944347] sd 1:0:0:0: Attached scsi generic sg2 type 0
[    5.944395] sd 1:0:0:0: [sdb] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)
[    5.944449] sd 1:0:0:0: [sdb] Write Protect is off
[    5.944452] sd 1:0:0:0: [sdb] Mode Sense: 00 3a 00 00
[    5.944467] sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    5.944584] sd 0:0:0:0: [sda] Attached SCSI disk
[    5.944597]  sdb: sdb1 sdb2 sdb3
[    5.983532] sd 1:0:0:0: [sdb] Attached SCSI disk
[    5.983630] Freeing unused kernel memory: 908k freed
[    5.983763] Write protecting the kernel read-only data: 10240k
[    5.984389] Freeing unused kernel memory: 412k freed
[    5.987217] Freeing unused kernel memory: 1644k freed
[    6.001252] udev[155]: starting version 163
[    6.045611] ahci 0000:05:00.0: version 3.0
[    6.045629] ahci 0000:05:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
[    6.045721] ahci 0000:05:00.0: AHCI 0001.0100 32 slots 2 ports 3 Gbps 0x3 impl SATA mode
[    6.045724] ahci 0000:05:00.0: flags: 64bit ncq pm led clo pmp pio slum part 
[    6.045729] ahci 0000:05:00.0: setting latency timer to 64
[    6.045828] scsi4 : ahci
[    6.045882] scsi5 : ahci
[    6.045948] ata5: SATA max UDMA/133 abar m512@0xfbdffc00 port 0xfbdffd00 irq 16
[    6.045951] ata6: SATA max UDMA/133 abar m512@0xfbdffc00 port 0xfbdffd80 irq 16
[    6.050126] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
[    6.050136] r8169 0000:07:01.0: PCI INT A -> GSI 19 (level, low) -> IRQ 19
[    6.050207] r8169 0000:07:01.0: (unregistered net_device): no PCI Express capability
[    6.050223] usbcore: registered new interface driver hiddev
[    6.050676] r8169 0000:07:01.0: eth0: RTL8169sc/8110sc at 0xffffc90001870c00, bc:ae:c5:19:e7:49, XID 18000000 IRQ 19
[    6.067600] input: Logitech USB Receiver as /devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0/input/input3
[    6.067658] generic-usb 0003:046D:C50E.0001: input,hidraw0: USB HID v1.11 Mouse [Logitech USB Receiver] on usb-0000:00:1d.0-1/input0
[    6.067696] usbcore: registered new interface driver usbhid
[    6.067697] usbhid: USB HID core driver
[    6.279197] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[    6.386723] ata5: SATA link down (SStatus 0 SControl 300)
[    6.386762] ata6: SATA link down (SStatus 0 SControl 300)
[    6.507972] Adding 29296636k swap on /dev/sdb2.  Priority:-1 extents:1 across:29296636k 
[    6.544174] udev[442]: starting version 163
[    6.879390]   alloc irq_desc for 29 on node -1
[    6.879392]   alloc kstat_irqs on node -1
[    6.881848] xhci_hcd 0000:02:00.0: PCI INT A -> GSI 29 (level, low) -> IRQ 29
[    6.882034] xhci_hcd 0000:02:00.0: setting latency timer to 64
[    6.882037] xhci_hcd 0000:02:00.0: xHCI Host Controller
[    6.882087] xhci_hcd 0000:02:00.0: new USB bus registered, assigned bus number 9
[    6.882198] xhci_hcd 0000:02:00.0: irq 29, io mem 0xf7ffe000
[    6.885562] usb usb9: No SuperSpeed endpoint companion for config 1  interface 0 altsetting 0 ep 129: using minimum values
[    6.885612] xHCI xhci_add_endpoint called for root hub
[    6.885614] xHCI xhci_check_bandwidth called for root hub
[    6.885648] hub 9-0:1.0: USB hub found
[    6.885651] hub 9-0:1.0: 4 ports detected
[    6.984134]   alloc irq_desc for 22 on node -1
[    6.984136]   alloc kstat_irqs on node -1
[    6.984142] HDA Intel 0000:00:1b.0: PCI INT A -> GSI 22 (level, low) -> IRQ 22
[    6.984229]   alloc irq_desc for 70 on node -1
[    6.984231]   alloc kstat_irqs on node -1
[    6.984240] HDA Intel 0000:00:1b.0: irq 70 for MSI/MSI-X
[    6.984261] HDA Intel 0000:00:1b.0: setting latency timer to 64
[    6.989881] firewire_ohci 0000:07:02.0: PCI INT A -> GSI 18 (level, low) -> IRQ 18
[    6.995511] EDAC MC: Ver: 2.1.0 Nov 24 2010
[    6.998740] PCI: Discovered peer bus ff
[    7.105687] nvidia: module license 'NVIDIA' taints kernel.
[    7.105690] Disabling lock debugging due to kernel taint
[    7.122434] lp: driver loaded but no devices found
[    7.147326] firewire_ohci: Added fw-ohci device 0000:07:02.0, OHCI v1.10, 4 IR + 8 IT contexts, quirks 0x1
[    7.245328] type=1400 audit(1294048218.576:2): apparmor="STATUS" operation="profile_load" name="/sbin/dhclient3" pid=873 comm="apparmor_parser"
[    7.245673] type=1400 audit(1294048218.576:3): apparmor="STATUS" operation="profile_load" name="/usr/lib/NetworkManager/nm-dhcp-client.action" pid=873 comm="apparmor_parser"
[    7.245860] type=1400 audit(1294048218.576:4): apparmor="STATUS" operation="profile_load" name="/usr/lib/connman/scripts/dhclient-script" pid=873 comm="apparmor_parser"
[    7.264869] EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro
[    7.312413] EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: errors=remount-ro
[    7.452366]   alloc irq_desc for 24 on node -1
[    7.452369]   alloc kstat_irqs on node -1
[    7.452375] nvidia 0000:03:00.0: PCI INT A -> GSI 24 (level, low) -> IRQ 24
[    7.452381] nvidia 0000:03:00.0: setting latency timer to 64
[    7.452384] vgaarb: device changed decodes: PCI:0000:03:00.0,olddecodes=io+mem,decodes=none:owns=io+mem
[    7.452825] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  260.19.06  Mon Sep 13 04:29:19 PDT 2010
[    7.626328] firewire_core: created device fw0: GUID 001fc600000710d5, S400
[    7.629607] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: (null)
[    7.692308] EXT4-fs (sdb3): mounted filesystem with ordered data mode. Opts: (null)
[    7.713497] type=1400 audit(1294048219.046:5): apparmor="STATUS" operation="profile_load" name="/usr/share/gdm/guest-session/Xsession" pid=1027 comm="apparmor_parser"
[    7.713640] type=1400 audit(1294048219.046:6): apparmor="STATUS" operation="profile_replace" name="/sbin/dhclient3" pid=1028 comm="apparmor_parser"
[    7.714066] type=1400 audit(1294048219.046:7): apparmor="STATUS" operation="profile_replace" name="/usr/lib/NetworkManager/nm-dhcp-client.action" pid=1028 comm="apparmor_parser"
[    7.714307] type=1400 audit(1294048219.046:8): apparmor="STATUS" operation="profile_replace" name="/usr/lib/connman/scripts/dhclient-script" pid=1028 comm="apparmor_parser"
[    7.714569] type=1400 audit(1294048219.046:9): apparmor="STATUS" operation="profile_load" name="/usr/lib/cups/backend/cups-pdf" pid=1031 comm="apparmor_parser"
[    7.715019] type=1400 audit(1294048219.046:10): apparmor="STATUS" operation="profile_load" name="/usr/sbin/tcpdump" pid=1032 comm="apparmor_parser"
[    7.715114] type=1400 audit(1294048219.046:11): apparmor="STATUS" operation="profile_load" name="/usr/sbin/cupsd" pid=1031 comm="apparmor_parser"
[    7.725005] r8169 0000:07:01.0: eth0: link up
[    8.256659] hda_codec: ALC892: BIOS auto-probing.
[    8.261951] Too many connections
[    8.263269]   alloc irq_desc for 34 on node -1
[    8.263271]   alloc kstat_irqs on node -1
[    8.263278] HDA Intel 0000:03:00.1: PCI INT B -> GSI 34 (level, low) -> IRQ 34
[    8.263279] hda_intel: Disable MSI for Nvidia chipset
[    8.263387] HDA Intel 0000:03:00.1: setting latency timer to 64
[    8.263438] EDAC MC0: Giving out device to 'i7core_edac.c' 'i7 core #0': DEV 0000:ff:03.0
[    8.263456] EDAC PCI0: Giving out device to module 'i7core_edac' controller 'EDAC PCI controller': DEV '0000:ff:03.0' (POLLED)
[    8.263458] EDAC i7core: Driver loaded.

[-- Attachment #3: lsmod.txt --]
[-- Type: text/plain, Size: 1728 bytes --]

joris@Asus5:~$ lsmod
Module                  Size  Used by
parport_pc             30086  0 
ppdev                   6804  0 
snd_hda_codec_nvhdmi    15451  4 
binfmt_misc             7984  1 
vboxnetadp              5267  0 
vboxnetflt             14966  0 
vboxdrv              1792472  2 vboxnetadp,vboxnetflt
snd_hda_codec_realtek   299524  1 
nvidia              10221046  38 
lp                     10201  0 
asus_atk0110           12987  0 
i7core_edac            18090  0 
edac_core              46822  3 i7core_edac
parport                37032  3 parport_pc,ppdev,lp
firewire_ohci          24679  0 
snd_hda_intel          26019  1 
snd_hda_codec         100919  3 snd_hda_codec_nvhdmi,snd_hda_codec_realtek,snd_hda_intel
snd_hwdep               6660  1 snd_hda_codec
snd_pcm                89104  2 snd_hda_intel,snd_hda_codec
snd_seq_midi            5932  0 
snd_rawmidi            22207  1 snd_seq_midi
snd_seq_midi_event      7291  1 snd_seq_midi
snd_seq                57512  2 snd_seq_midi,snd_seq_midi_event
xhci_hcd               58578  0 
snd_timer              23850  2 snd_pcm,snd_seq
snd_seq_device          6912  3 snd_seq_midi,snd_rawmidi,snd_seq
snd                    64117  11 snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_rawmidi,snd_seq,snd_timer,snd_seq_device
soundcore               1240  1 snd
snd_page_alloc          8588  2 snd_hda_intel,snd_pcm
r8169                  42222  0 
usbhid                 42062  0 
firewire_core          54327  1 firewire_ohci
ahci                   21857  0 
libahci                26199  1 ahci
mii                     5261  1 r8169
hid                    84678  1 usbhid
crc_itu_t               1739  1 firewire_core
joris@Asus5:~$ 


[-- Attachment #4: sensors-detect.txt --]
[-- Type: text/plain, Size: 5022 bytes --]

joris@Asus5:~$ sudo sensors-detect
[sudo] password for joris: 
# sensors-detect revision 5818 (2010-01-18 17:22:07 +0100)
# System: System manufacturer System Product Name
# Board: ASUSTeK Computer INC. SABERTOOTH X58

This program will help you determine which kernel modules you need
to load to use lm_sensors most effectively. It is generally safe
and recommended to accept the default answers to all questions,
unless you know what you're doing.

Some south bridges, CPUs or memory controllers contain embedded sensors.
Do you want to scan for them? This is totally safe. (YES/no): 
Silicon Integrated Systems SIS5595...                       No
VIA VT82C686 Integrated Sensors...                          No
VIA VT8231 Integrated Sensors...                            No
AMD K8 thermal sensors...                                   No
AMD Family 10h thermal sensors...                           No
AMD Family 11h thermal sensors...                           No
Intel Core family thermal sensor...                         Success!
    (driver `coretemp')
Intel Atom thermal sensor...                                No
Intel AMB FB-DIMM thermal sensor...                         No
VIA C7 thermal sensor...                                    No
VIA Nano thermal sensor...                                  No

Some Super I/O chips contain embedded sensors. We have to write to
standard I/O ports to probe them. This is usually safe.
Do you want to scan for Super I/O sensors? (YES/no): 
Probing for Super-I/O at 0x2e/0x2f
Trying family `National Semiconductor'...                   No
Trying family `SMSC'...                                     No
Trying family `VIA/Winbond/Nuvoton/Fintek'...               Yes
Found `Winbond W83667HG Super IO Sensors'                   Success!
    (address 0x290, driver `w83627ehf')
Probing for Super-I/O at 0x4e/0x4f
Trying family `National Semiconductor'...                   No
Trying family `SMSC'...                                     No
Trying family `VIA/Winbond/Nuvoton/Fintek'...               No
Trying family `ITE'...                                      No

Some systems (mainly servers) implement IPMI, a set of common interfaces
through which system health data may be retrieved, amongst other things.
We first try to get the information from SMBIOS. If we don't find it
there, we have to read from arbitrary I/O ports to probe for such
interfaces. This is normally safe. Do you want to scan for IPMI
interfaces? (YES/no): 
Probing for `IPMI BMC KCS' at 0xca0...                      No
Probing for `IPMI BMC SMIC' at 0xca8...                     No

Some hardware monitoring chips are accessible through the ISA I/O ports.
We have to write to arbitrary I/O ports to probe them. This is usually
safe though. Yes, you do have ISA I/O ports even if you do not have any
ISA slots! Do you want to scan the ISA I/O ports? (yes/NO): 

Lastly, we can probe the I2C/SMBus adapters for connected hardware
monitoring devices. This is the most risky part, and while it works
reasonably well on most systems, it has been reported to cause trouble
on some systems.
Do you want to probe the I2C/SMBus adapters now? (YES/no): 
Using driver `i2c-i801' for device 0000:00:1f.3: Intel ICH10
Module i2c-i801 loaded successfully.
Module i2c-dev loaded successfully.

Next adapter: NVIDIA i2c adapter  (i2c-0)
Do you want to scan it? (YES/no/selectively): 

Next adapter: NVIDIA i2c adapter  (i2c-1)
Do you want to scan it? (YES/no/selectively): 

Next adapter: NVIDIA i2c adapter  (i2c-2)
Do you want to scan it? (YES/no/selectively): 

Next adapter: NVIDIA i2c adapter  (i2c-3)
Do you want to scan it? (YES/no/selectively): 

Next adapter: NVIDIA i2c adapter  (i2c-4)
Do you want to scan it? (YES/no/selectively): 

Next adapter: NVIDIA i2c adapter  (i2c-5)
Do you want to scan it? (YES/no/selectively): 

Next adapter: NVIDIA i2c adapter  (i2c-6)
Do you want to scan it? (YES/no/selectively): 
Client found at address 0x50
Probing for `Analog Devices ADM1033'...                     No
Probing for `Analog Devices ADM1034'...                     No
Probing for `SPD EEPROM'...                                 No
Probing for `EDID EEPROM'...                                Yes
    (confidence 8, not a hardware monitoring chip)

Next adapter: NVIDIA i2c adapter  (i2c-7)
Do you want to scan it? (YES/no/selectively): 

Now follows a summary of the probes I have just done.
Just press ENTER to continue: 

Driver `w83627ehf':
  * ISA bus, address 0x290
    Chip `Winbond W83667HG Super IO Sensors' (confidence: 9)

Driver `coretemp':
  * Chip `Intel Core family thermal sensor' (confidence: 9)

To load everything that is needed, add this to /etc/modules:
#----cut here----
# Chip drivers
coretemp
w83627ehf
#----cut here----
If you have some drivers built into your kernel, the list above will
contain too many modules. Skip the appropriate ones!

Do you want to add these lines automatically to /etc/modules? (yes/NO)

Unloading i2c-dev... OK
Unloading i2c-i801... OK

joris@Asus5:~$ 


[-- Attachment #5: Type: text/plain, Size: 153 bytes --]

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [lm-sensors] Erratic value of MCH temp. (0C),
  2011-01-03 11:07 [lm-sensors] Erratic value of MCH temp. (0C), Joris Creyghton
@ 2011-01-05 11:35 ` Luca Tettamanti
  2011-01-05 13:45 ` Joris Creyghton
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Luca Tettamanti @ 2011-01-05 11:35 UTC (permalink / raw)
  To: lm-sensors

On Mon, Jan 3, 2011 at 12:07 PM, Joris Creyghton <jorisctn@gmail.com> wrote:
> Dear reader,
>
> Problem:
> The sensors command reports 0C for the MCH temp., while the BIOS gives a
> reasonable value of about 40C.
>
> Output of sensors command:
>
> joris@Asus5:~$ sensors
> atk0110-acpi-0
[...]
> MCH Temperature:     +0.0°C  (high = +60.0°C, crit = +95.0°C)

Is it always 0 or does it jump up and down?

Please send a copy of /sys/firmware/acpi/tables/DSDT

Luca

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [lm-sensors] Erratic value of MCH temp. (0C),
  2011-01-03 11:07 [lm-sensors] Erratic value of MCH temp. (0C), Joris Creyghton
  2011-01-05 11:35 ` Luca Tettamanti
@ 2011-01-05 13:45 ` Joris Creyghton
  2011-01-05 14:08 ` Luca Tettamanti
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Joris Creyghton @ 2011-01-05 13:45 UTC (permalink / raw)
  To: lm-sensors


[-- Attachment #1.1: Type: text/plain, Size: 796 bytes --]

On Wed, 2011-01-05 at 12:35 +0100, Luca Tettamanti wrote:

> On Mon, Jan 3, 2011 at 12:07 PM, Joris Creyghton <jorisctn@gmail.com> wrote:
> > Dear reader,
> >
> > Problem:
> > The sensors command reports 0C for the MCH temp., while the BIOS gives a
> > reasonable value of about 40C.
> >
> > Output of sensors command:
> >
> > joris@Asus5:~$ sensors
> > atk0110-acpi-0
> [...]
> > MCH Temperature:     +0.0°C  (high = +60.0°C, crit = +95.0°C)
> 
> Is it always 0 or does it jump up and down?
> 
> Please send a copy of /sys/firmware/acpi/tables/DSDT
> 
> Luca



Dear Luca,


The MCH temp. is always 0 en never jumps.

Attached you'll find the file /sys/firmware/acpi/tables/DSDT

Thank you for paying attention to my problem,

kind regards,
Joris Creyghton

[-- Attachment #1.2: Type: text/html, Size: 1202 bytes --]

[-- Attachment #2: Type: application/octet-stream, Size: 50281 bytes --]

[-- Attachment #3: Type: text/plain, Size: 153 bytes --]

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [lm-sensors] Erratic value of MCH temp. (0C),
  2011-01-03 11:07 [lm-sensors] Erratic value of MCH temp. (0C), Joris Creyghton
  2011-01-05 11:35 ` Luca Tettamanti
  2011-01-05 13:45 ` Joris Creyghton
@ 2011-01-05 14:08 ` Luca Tettamanti
  2011-01-05 14:35 ` Joris Creyghton
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Luca Tettamanti @ 2011-01-05 14:08 UTC (permalink / raw)
  To: lm-sensors

On Wed, Jan 5, 2011 at 2:45 PM, Joris Creyghton <jorisctn@gmail.com> wrote:
> The MCH temp. is always 0 en never jumps.
>
> Attached you'll find the file /sys/firmware/acpi/tables/DSDT

Hum, it appears to be a bug in the ACPI code, the method that reads
the temperature does not know how to read the MCH temperature which
would be HWT2 (the entry is present in the enumeration though):

Method (TGET, 1, NotSerialized)
{
    If (LEqual (Arg0, Zero))
    {
        Return (^^SIOR.HWT1 ())
    }

    If (LEqual (Arg0, One))
    {
        Return (^^SIOR.HWT0 ())
    }
}

To complicate things the firmware provides both the old and the new
ATK0110 interfaces, and the driver selects the old one. The new one
seems to have the code to read all the sensors. I'll see what I can
do.

Luca

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [lm-sensors] Erratic value of MCH temp. (0C),
  2011-01-03 11:07 [lm-sensors] Erratic value of MCH temp. (0C), Joris Creyghton
                   ` (2 preceding siblings ...)
  2011-01-05 14:08 ` Luca Tettamanti
@ 2011-01-05 14:35 ` Joris Creyghton
  2011-01-06 21:01 ` Jean Delvare
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Joris Creyghton @ 2011-01-05 14:35 UTC (permalink / raw)
  To: lm-sensors


[-- Attachment #1.1: Type: text/plain, Size: 756 bytes --]

On Wed, 2011-01-05 at 15:08 +0100, Luca Tettamanti wrote:


> Hum, it appears to be a bug in the ACPI code, the method that reads
> the temperature does not know how to read the MCH temperature which
> would be HWT2 (the entry is present in the enumeration though):
> 
> Method (TGET, 1, NotSerialized)
> {
>     If (LEqual (Arg0, Zero))
>     {
>         Return (^^SIOR.HWT1 ())
>     }
> 
>     If (LEqual (Arg0, One))
>     {
>         Return (^^SIOR.HWT0 ())
>     }
> }
> 
> To complicate things the firmware provides both the old and the new
> ATK0110 interfaces, and the driver selects the old one. The new one
> seems to have the code to read all the sensors. I'll see what I can
> do.
> 
> Luca


Looking forward to your further findings.
Joris



[-- Attachment #1.2: Type: text/html, Size: 1015 bytes --]

[-- Attachment #2: Type: text/plain, Size: 153 bytes --]

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [lm-sensors] Erratic value of MCH temp. (0C),
  2011-01-03 11:07 [lm-sensors] Erratic value of MCH temp. (0C), Joris Creyghton
                   ` (3 preceding siblings ...)
  2011-01-05 14:35 ` Joris Creyghton
@ 2011-01-06 21:01 ` Jean Delvare
  2011-01-07 13:14 ` Luca Tettamanti
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Jean Delvare @ 2011-01-06 21:01 UTC (permalink / raw)
  To: lm-sensors

Hi Luca,

On Wed, 5 Jan 2011 15:08:44 +0100, Luca Tettamanti wrote:
> On Wed, Jan 5, 2011 at 2:45 PM, Joris Creyghton <jorisctn@gmail.com> wrote:
> > The MCH temp. is always 0 en never jumps.
> >
> > Attached you'll find the file /sys/firmware/acpi/tables/DSDT
> 
> Hum, it appears to be a bug in the ACPI code, the method that reads
> the temperature does not know how to read the MCH temperature which
> would be HWT2 (the entry is present in the enumeration though):
> 
> Method (TGET, 1, NotSerialized)
> {
>     If (LEqual (Arg0, Zero))
>     {
>         Return (^^SIOR.HWT1 ())
>     }
> 
>     If (LEqual (Arg0, One))
>     {
>         Return (^^SIOR.HWT0 ())
>     }
> }
> 
> To complicate things the firmware provides both the old and the new
> ATK0110 interfaces, and the driver selects the old one. The new one
> seems to have the code to read all the sensors. I'll see what I can
> do.

Would it make sense to add a module parameter to asus_atk0110 to let
the user force the interface when both are present? So that the user
can test the other one and report easily.

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [lm-sensors] Erratic value of MCH temp. (0C),
  2011-01-03 11:07 [lm-sensors] Erratic value of MCH temp. (0C), Joris Creyghton
                   ` (4 preceding siblings ...)
  2011-01-06 21:01 ` Jean Delvare
@ 2011-01-07 13:14 ` Luca Tettamanti
  2011-01-10 15:25 ` Luca Tettamanti
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Luca Tettamanti @ 2011-01-07 13:14 UTC (permalink / raw)
  To: lm-sensors

On Thu, Jan 6, 2011 at 10:01 PM, Jean Delvare <khali@linux-fr.org> wrote:
[...]
>> To complicate things the firmware provides both the old and the new
>> ATK0110 interfaces, and the driver selects the old one. The new one
>> seems to have the code to read all the sensors. I'll see what I can
>> do.
>
> Would it make sense to add a module parameter to asus_atk0110 to let
> the user force the interface when both are present? So that the user
> can test the other one and report easily.

Yes, I'm planning to do that. Plus maybe a DMI table to automatically
override the default logic.

Luca

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [lm-sensors] Erratic value of MCH temp. (0C),
  2011-01-03 11:07 [lm-sensors] Erratic value of MCH temp. (0C), Joris Creyghton
                   ` (5 preceding siblings ...)
  2011-01-07 13:14 ` Luca Tettamanti
@ 2011-01-10 15:25 ` Luca Tettamanti
  2011-01-10 18:48 ` Joris Creyghton
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Luca Tettamanti @ 2011-01-10 15:25 UTC (permalink / raw)
  To: lm-sensors

[-- Attachment #1: Type: text/plain, Size: 442 bytes --]

On Wed, Jan 5, 2011 at 3:08 PM, Luca Tettamanti <kronos.it@gmail.com> wrote:
> To complicate things the firmware provides both the old and the new
> ATK0110 interfaces, and the driver selects the old one. The new one
> seems to have the code to read all the sensors. I'll see what I can
> do.

I'm attaching a modified version of the driver; I've added a parameter
to override the default detection logic, to test load it with new_if=1

Luca

[-- Attachment #2: asus_atk0110.c --]
[-- Type: text/x-csrc, Size: 33575 bytes --]

/*
 * Copyright (C) 2007-2009 Luca Tettamanti <kronos.it@gmail.com>
 *
 * This file is released under the GPLv2
 * See COPYING in the top level directory of the kernel tree.
 */
#define DEBUG
#include <linux/debugfs.h>
#include <linux/kernel.h>
#include <linux/hwmon.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/slab.h>

#include <acpi/acpi.h>
#include <acpi/acpixf.h>
#include <acpi/acpi_drivers.h>
#include <acpi/acpi_bus.h>


#define ATK_HID "ATK0110"

static bool new_if;
module_param(new_if, bool, 0);
MODULE_PARM_DESC(new_if, "Override detection heuristic and for the use of the new ATK0110 interface");

/* Minimum time between readings, enforced in order to avoid
 * hogging the CPU.
 */
#define CACHE_TIME		HZ

#define BOARD_ID		"MBIF"
#define METHOD_ENUMERATE	"GGRP"
#define METHOD_READ		"GITM"
#define METHOD_WRITE		"SITM"
#define METHOD_OLD_READ_TMP	"RTMP"
#define METHOD_OLD_READ_VLT	"RVLT"
#define METHOD_OLD_READ_FAN	"RFAN"
#define METHOD_OLD_ENUM_TMP	"TSIF"
#define METHOD_OLD_ENUM_VLT	"VSIF"
#define METHOD_OLD_ENUM_FAN	"FSIF"

#define ATK_MUX_HWMON		0x00000006ULL
#define ATK_MUX_MGMT		0x00000011ULL

#define ATK_CLASS_MASK		0xff000000ULL
#define ATK_CLASS_FREQ_CTL	0x03000000ULL
#define ATK_CLASS_FAN_CTL	0x04000000ULL
#define ATK_CLASS_HWMON		0x06000000ULL
#define ATK_CLASS_MGMT		0x11000000ULL

#define ATK_TYPE_MASK		0x00ff0000ULL
#define HWMON_TYPE_VOLT		0x00020000ULL
#define HWMON_TYPE_TEMP		0x00030000ULL
#define HWMON_TYPE_FAN		0x00040000ULL

#define ATK_ELEMENT_ID_MASK	0x0000ffffULL

#define ATK_EC_ID		0x11060004ULL

enum atk_pack_member {
	HWMON_PACK_FLAGS,
	HWMON_PACK_NAME,
	HWMON_PACK_LIMIT1,
	HWMON_PACK_LIMIT2,
	HWMON_PACK_ENABLE
};

/* New package format */
#define _HWMON_NEW_PACK_SIZE	7
#define _HWMON_NEW_PACK_FLAGS	0
#define _HWMON_NEW_PACK_NAME	1
#define _HWMON_NEW_PACK_UNK1	2
#define _HWMON_NEW_PACK_UNK2	3
#define _HWMON_NEW_PACK_LIMIT1	4
#define _HWMON_NEW_PACK_LIMIT2	5
#define _HWMON_NEW_PACK_ENABLE	6

/* Old package format */
#define _HWMON_OLD_PACK_SIZE	5
#define _HWMON_OLD_PACK_FLAGS	0
#define _HWMON_OLD_PACK_NAME	1
#define _HWMON_OLD_PACK_LIMIT1	2
#define _HWMON_OLD_PACK_LIMIT2	3
#define _HWMON_OLD_PACK_ENABLE	4


struct atk_data {
	struct device *hwmon_dev;
	acpi_handle atk_handle;
	struct acpi_device *acpi_dev;

	bool old_interface;

	/* old interface */
	acpi_handle rtmp_handle;
	acpi_handle rvlt_handle;
	acpi_handle rfan_handle;
	/* new inteface */
	acpi_handle enumerate_handle;
	acpi_handle read_handle;
	acpi_handle write_handle;

	bool disable_ec;

	int voltage_count;
	int temperature_count;
	int fan_count;
	struct list_head sensor_list;

	struct {
		struct dentry *root;
		u32 id;
	} debugfs;
};


typedef ssize_t (*sysfs_show_func)(struct device *dev,
			struct device_attribute *attr, char *buf);

static const struct acpi_device_id atk_ids[] = {
	{ATK_HID, 0},
	{"", 0},
};
MODULE_DEVICE_TABLE(acpi, atk_ids);

#define ATTR_NAME_SIZE 16 /* Worst case is "tempN_input" */

struct atk_sensor_data {
	struct list_head list;
	struct atk_data *data;
	struct device_attribute label_attr;
	struct device_attribute input_attr;
	struct device_attribute limit1_attr;
	struct device_attribute limit2_attr;
	char label_attr_name[ATTR_NAME_SIZE];
	char input_attr_name[ATTR_NAME_SIZE];
	char limit1_attr_name[ATTR_NAME_SIZE];
	char limit2_attr_name[ATTR_NAME_SIZE];
	u64 id;
	u64 type;
	u64 limit1;
	u64 limit2;
	u64 cached_value;
	unsigned long last_updated; /* in jiffies */
	bool is_valid;
	char const *acpi_name;
};

/* Return buffer format:
 * [0-3] "value" is valid flag
 * [4-7] value
 * [8- ] unknown stuff on newer mobos
 */
struct atk_acpi_ret_buffer {
	u32 flags;
	u32 value;
	u8 data[];
};

/* Input buffer used for GITM and SITM methods */
struct atk_acpi_input_buf {
	u32 id;
	u32 param1;
	u32 param2;
};

static int atk_add(struct acpi_device *device);
static int atk_remove(struct acpi_device *device, int type);
static void atk_print_sensor(struct atk_data *data, union acpi_object *obj);
static int atk_read_value(struct atk_sensor_data *sensor, u64 *value);
static void atk_free_sensors(struct atk_data *data);

static struct acpi_driver atk_driver = {
	.name	= ATK_HID,
	.class	= "hwmon",
	.ids	= atk_ids,
	.ops	= {
		.add	= atk_add,
		.remove	= atk_remove,
	},
};

#define input_to_atk_sensor(attr) \
	container_of(attr, struct atk_sensor_data, input_attr)

#define label_to_atk_sensor(attr) \
	container_of(attr, struct atk_sensor_data, label_attr)

#define limit1_to_atk_sensor(attr) \
	container_of(attr, struct atk_sensor_data, limit1_attr)

#define limit2_to_atk_sensor(attr) \
	container_of(attr, struct atk_sensor_data, limit2_attr)

static ssize_t atk_input_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	struct atk_sensor_data *s = input_to_atk_sensor(attr);
	u64 value;
	int err;

	err = atk_read_value(s, &value);
	if (err)
		return err;

	if (s->type == HWMON_TYPE_TEMP)
		/* ACPI returns decidegree */
		value *= 100;

	return sprintf(buf, "%llu\n", value);
}

static ssize_t atk_label_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	struct atk_sensor_data *s = label_to_atk_sensor(attr);

	return sprintf(buf, "%s\n", s->acpi_name);
}

static ssize_t atk_limit1_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	struct atk_sensor_data *s = limit1_to_atk_sensor(attr);
	u64 value = s->limit1;

	if (s->type == HWMON_TYPE_TEMP)
		value *= 100;

	return sprintf(buf, "%lld\n", value);
}

static ssize_t atk_limit2_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	struct atk_sensor_data *s = limit2_to_atk_sensor(attr);
	u64 value = s->limit2;

	if (s->type == HWMON_TYPE_TEMP)
		value *= 100;

	return sprintf(buf, "%lld\n", value);
}

static ssize_t atk_name_show(struct device *dev,
				struct device_attribute *attr, char *buf)
{
	return sprintf(buf, "atk0110\n");
}
static struct device_attribute atk_name_attr =
		__ATTR(name, 0444, atk_name_show, NULL);

static void atk_init_attribute(struct device_attribute *attr, char *name,
		sysfs_show_func show)
{
	attr->attr.name = name;
	attr->attr.mode = 0444;
	attr->show = show;
	attr->store = NULL;
}


static union acpi_object *atk_get_pack_member(struct atk_data *data,
						union acpi_object *pack,
						enum atk_pack_member m)
{
	bool old_if = data->old_interface;
	int offset;

	switch (m) {
	case HWMON_PACK_FLAGS:
		offset = old_if ? _HWMON_OLD_PACK_FLAGS : _HWMON_NEW_PACK_FLAGS;
		break;
	case HWMON_PACK_NAME:
		offset = old_if ? _HWMON_OLD_PACK_NAME : _HWMON_NEW_PACK_NAME;
		break;
	case HWMON_PACK_LIMIT1:
		offset = old_if ? _HWMON_OLD_PACK_LIMIT1 :
				  _HWMON_NEW_PACK_LIMIT1;
		break;
	case HWMON_PACK_LIMIT2:
		offset = old_if ? _HWMON_OLD_PACK_LIMIT2 :
				  _HWMON_NEW_PACK_LIMIT2;
		break;
	case HWMON_PACK_ENABLE:
		offset = old_if ? _HWMON_OLD_PACK_ENABLE :
				  _HWMON_NEW_PACK_ENABLE;
		break;
	default:
		return NULL;
	}

	return &pack->package.elements[offset];
}


/* New package format is:
 * - flag (int)
 *	class - used for de-muxing the request to the correct GITn
 *	type (volt, temp, fan)
 *	sensor id |
 *	sensor id - used for de-muxing the request _inside_ the GITn
 * - name (str)
 * - unknown (int)
 * - unknown (int)
 * - limit1 (int)
 * - limit2 (int)
 * - enable (int)
 *
 * The old package has the same format but it's missing the two unknown fields.
 */
static int validate_hwmon_pack(struct atk_data *data, union acpi_object *obj)
{
	struct device *dev = &data->acpi_dev->dev;
	union acpi_object *tmp;
	bool old_if = data->old_interface;
	int const expected_size = old_if ? _HWMON_OLD_PACK_SIZE :
					   _HWMON_NEW_PACK_SIZE;

	if (obj->type != ACPI_TYPE_PACKAGE) {
		dev_warn(dev, "Invalid type: %d\n", obj->type);
		return -EINVAL;
	}

	if (obj->package.count != expected_size) {
		dev_warn(dev, "Invalid package size: %d, expected: %d\n",
				obj->package.count, expected_size);
		return -EINVAL;
	}

	tmp = atk_get_pack_member(data, obj, HWMON_PACK_FLAGS);
	if (tmp->type != ACPI_TYPE_INTEGER) {
		dev_warn(dev, "Invalid type (flag): %d\n", tmp->type);
		return -EINVAL;
	}

	tmp = atk_get_pack_member(data, obj, HWMON_PACK_NAME);
	if (tmp->type != ACPI_TYPE_STRING) {
		dev_warn(dev, "Invalid type (name): %d\n", tmp->type);
		return -EINVAL;
	}

	/* Don't check... we don't know what they're useful for anyway */
#if 0
	tmp = &obj->package.elements[HWMON_PACK_UNK1];
	if (tmp->type != ACPI_TYPE_INTEGER) {
		dev_warn(dev, "Invalid type (unk1): %d\n", tmp->type);
		return -EINVAL;
	}

	tmp = &obj->package.elements[HWMON_PACK_UNK2];
	if (tmp->type != ACPI_TYPE_INTEGER) {
		dev_warn(dev, "Invalid type (unk2): %d\n", tmp->type);
		return -EINVAL;
	}
#endif

	tmp = atk_get_pack_member(data, obj, HWMON_PACK_LIMIT1);
	if (tmp->type != ACPI_TYPE_INTEGER) {
		dev_warn(dev, "Invalid type (limit1): %d\n", tmp->type);
		return -EINVAL;
	}

	tmp = atk_get_pack_member(data, obj, HWMON_PACK_LIMIT2);
	if (tmp->type != ACPI_TYPE_INTEGER) {
		dev_warn(dev, "Invalid type (limit2): %d\n", tmp->type);
		return -EINVAL;
	}

	tmp = atk_get_pack_member(data, obj, HWMON_PACK_ENABLE);
	if (tmp->type != ACPI_TYPE_INTEGER) {
		dev_warn(dev, "Invalid type (enable): %d\n", tmp->type);
		return -EINVAL;
	}

	atk_print_sensor(data, obj);

	return 0;
}

#ifdef DEBUG
static char const *atk_sensor_type(union acpi_object *flags)
{
	u64 type = flags->integer.value & ATK_TYPE_MASK;
	char const *what;

	switch (type) {
	case HWMON_TYPE_VOLT:
		what = "voltage";
		break;
	case HWMON_TYPE_TEMP:
		what = "temperature";
		break;
	case HWMON_TYPE_FAN:
		what = "fan";
		break;
	default:
		what = "unknown";
		break;
	}

	return what;
}
#endif

static void atk_print_sensor(struct atk_data *data, union acpi_object *obj)
{
#ifdef DEBUG
	struct device *dev = &data->acpi_dev->dev;
	union acpi_object *flags;
	union acpi_object *name;
	union acpi_object *limit1;
	union acpi_object *limit2;
	union acpi_object *enable;
	char const *what;

	flags = atk_get_pack_member(data, obj, HWMON_PACK_FLAGS);
	name = atk_get_pack_member(data, obj, HWMON_PACK_NAME);
	limit1 = atk_get_pack_member(data, obj, HWMON_PACK_LIMIT1);
	limit2 = atk_get_pack_member(data, obj, HWMON_PACK_LIMIT2);
	enable = atk_get_pack_member(data, obj, HWMON_PACK_ENABLE);

	what = atk_sensor_type(flags);

	dev_dbg(dev, "%s: %#llx %s [%llu-%llu] %s\n", what,
			flags->integer.value,
			name->string.pointer,
			limit1->integer.value, limit2->integer.value,
			enable->integer.value ? "enabled" : "disabled");
#endif
}

static int atk_read_value_old(struct atk_sensor_data *sensor, u64 *value)
{
	struct atk_data *data = sensor->data;
	struct device *dev = &data->acpi_dev->dev;
	struct acpi_object_list params;
	union acpi_object id;
	acpi_status status;
	acpi_handle method;

	switch (sensor->type) {
	case HWMON_TYPE_VOLT:
		method = data->rvlt_handle;
		break;
	case HWMON_TYPE_TEMP:
		method = data->rtmp_handle;
		break;
	case HWMON_TYPE_FAN:
		method = data->rfan_handle;
		break;
	default:
		return -EINVAL;
	}

	id.type = ACPI_TYPE_INTEGER;
	id.integer.value = sensor->id;

	params.count = 1;
	params.pointer = &id;

	status = acpi_evaluate_integer(method, NULL, &params, value);
	if (status != AE_OK) {
		dev_warn(dev, "%s: ACPI exception: %s\n", __func__,
				acpi_format_exception(status));
		return -EIO;
	}

	return 0;
}

static union acpi_object *atk_ggrp(struct atk_data *data, u16 mux)
{
	struct device *dev = &data->acpi_dev->dev;
	struct acpi_buffer buf;
	acpi_status ret;
	struct acpi_object_list params;
	union acpi_object id;
	union acpi_object *pack;

	id.type = ACPI_TYPE_INTEGER;
	id.integer.value = mux;
	params.count = 1;
	params.pointer = &id;

	buf.length = ACPI_ALLOCATE_BUFFER;
	ret = acpi_evaluate_object(data->enumerate_handle, NULL, &params, &buf);
	if (ret != AE_OK) {
		dev_err(dev, "GGRP[%#x] ACPI exception: %s\n", mux,
				acpi_format_exception(ret));
		return ERR_PTR(-EIO);
	}
	pack = buf.pointer;
	if (pack->type != ACPI_TYPE_PACKAGE) {
		/* Execution was successful, but the id was not found */
		ACPI_FREE(pack);
		return ERR_PTR(-ENOENT);
	}

	if (pack->package.count < 1) {
		dev_err(dev, "GGRP[%#x] package is too small\n", mux);
		ACPI_FREE(pack);
		return ERR_PTR(-EIO);
	}
	return pack;
}

static union acpi_object *atk_gitm(struct atk_data *data, u64 id)
{
	struct device *dev = &data->acpi_dev->dev;
	struct atk_acpi_input_buf buf;
	union acpi_object tmp;
	struct acpi_object_list params;
	struct acpi_buffer ret;
	union acpi_object *obj;
	acpi_status status;

	buf.id = id;
	buf.param1 = 0;
	buf.param2 = 0;

	tmp.type = ACPI_TYPE_BUFFER;
	tmp.buffer.pointer = (u8 *)&buf;
	tmp.buffer.length = sizeof(buf);

	params.count = 1;
	params.pointer = (void *)&tmp;

	ret.length = ACPI_ALLOCATE_BUFFER;
	status = acpi_evaluate_object_typed(data->read_handle, NULL, &params,
			&ret, ACPI_TYPE_BUFFER);
	if (status != AE_OK) {
		dev_warn(dev, "GITM[%#llx] ACPI exception: %s\n", id,
				acpi_format_exception(status));
		return ERR_PTR(-EIO);
	}
	obj = ret.pointer;

	/* Sanity check */
	if (obj->buffer.length < 8) {
		dev_warn(dev, "Unexpected ASBF length: %u\n",
				obj->buffer.length);
		ACPI_FREE(obj);
		return ERR_PTR(-EIO);
	}
	return obj;
}

static union acpi_object *atk_sitm(struct atk_data *data,
		struct atk_acpi_input_buf *buf)
{
	struct device *dev = &data->acpi_dev->dev;
	struct acpi_object_list params;
	union acpi_object tmp;
	struct acpi_buffer ret;
	union acpi_object *obj;
	acpi_status status;

	tmp.type = ACPI_TYPE_BUFFER;
	tmp.buffer.pointer = (u8 *)buf;
	tmp.buffer.length = sizeof(*buf);

	params.count = 1;
	params.pointer = &tmp;

	ret.length = ACPI_ALLOCATE_BUFFER;
	status = acpi_evaluate_object_typed(data->write_handle, NULL, &params,
			&ret, ACPI_TYPE_BUFFER);
	if (status != AE_OK) {
		dev_warn(dev, "SITM[%#x] ACPI exception: %s\n", buf->id,
				acpi_format_exception(status));
		return ERR_PTR(-EIO);
	}
	obj = ret.pointer;

	/* Sanity check */
	if (obj->buffer.length < 8) {
		dev_warn(dev, "Unexpected ASBF length: %u\n",
				obj->buffer.length);
		ACPI_FREE(obj);
		return ERR_PTR(-EIO);
	}
	return obj;
}

static int atk_read_value_new(struct atk_sensor_data *sensor, u64 *value)
{
	struct atk_data *data = sensor->data;
	struct device *dev = &data->acpi_dev->dev;
	union acpi_object *obj;
	struct atk_acpi_ret_buffer *buf;
	int err = 0;

	obj = atk_gitm(data, sensor->id);
	if (IS_ERR(obj))
		return PTR_ERR(obj);

	buf = (struct atk_acpi_ret_buffer *)obj->buffer.pointer;
	if (buf->flags == 0) {
		/* The reading is not valid, possible causes:
		 * - sensor failure
		 * - enumeration was FUBAR (and we didn't notice)
		 */
		dev_warn(dev, "Read failed, sensor = %#llx\n", sensor->id);
		err = -EIO;
		goto out;
	}

	*value = buf->value;
out:
	ACPI_FREE(obj);
	return err;
}

static int atk_read_value(struct atk_sensor_data *sensor, u64 *value)
{
	int err;

	if (!sensor->is_valid ||
	    time_after(jiffies, sensor->last_updated + CACHE_TIME)) {
		if (sensor->data->old_interface)
			err = atk_read_value_old(sensor, value);
		else
			err = atk_read_value_new(sensor, value);

		sensor->is_valid = true;
		sensor->last_updated = jiffies;
		sensor->cached_value = *value;
	} else {
		*value = sensor->cached_value;
		err = 0;
	}

	return err;
}

#ifdef CONFIG_DEBUG_FS
static int atk_debugfs_gitm_get(void *p, u64 *val)
{
	struct atk_data *data = p;
	union acpi_object *ret;
	struct atk_acpi_ret_buffer *buf;
	int err = 0;

	if (!data->read_handle)
		return -ENODEV;

	if (!data->debugfs.id)
		return -EINVAL;

	ret = atk_gitm(data, data->debugfs.id);
	if (IS_ERR(ret))
		return PTR_ERR(ret);

	buf = (struct atk_acpi_ret_buffer *)ret->buffer.pointer;
	if (buf->flags)
		*val = buf->value;
	else
		err = -EIO;

	return err;
}

DEFINE_SIMPLE_ATTRIBUTE(atk_debugfs_gitm,
			atk_debugfs_gitm_get,
			NULL,
			"0x%08llx\n")

static int atk_acpi_print(char *buf, size_t sz, union acpi_object *obj)
{
	int ret = 0;

	switch (obj->type) {
	case ACPI_TYPE_INTEGER:
		ret = snprintf(buf, sz, "0x%08llx\n", obj->integer.value);
		break;
	case ACPI_TYPE_STRING:
		ret = snprintf(buf, sz, "%s\n", obj->string.pointer);
		break;
	}

	return ret;
}

static void atk_pack_print(char *buf, size_t sz, union acpi_object *pack)
{
	int ret;
	int i;

	for (i = 0; i < pack->package.count; i++) {
		union acpi_object *obj = &pack->package.elements[i];

		ret = atk_acpi_print(buf, sz, obj);
		if (ret >= sz)
			break;
		buf += ret;
		sz -= ret;
	}
}

static int atk_debugfs_ggrp_open(struct inode *inode, struct file *file)
{
	struct atk_data *data = inode->i_private;
	char *buf = NULL;
	union acpi_object *ret;
	u8 cls;
	int i;

	if (!data->enumerate_handle)
		return -ENODEV;
	if (!data->debugfs.id)
		return -EINVAL;

	cls = (data->debugfs.id & 0xff000000) >> 24;
	ret = atk_ggrp(data, cls);
	if (IS_ERR(ret))
		return PTR_ERR(ret);

	for (i = 0; i < ret->package.count; i++) {
		union acpi_object *pack = &ret->package.elements[i];
		union acpi_object *id;

		if (pack->type != ACPI_TYPE_PACKAGE)
			continue;
		if (!pack->package.count)
			continue;
		id = &pack->package.elements[0];
		if (id->integer.value == data->debugfs.id) {
			/* Print the package */
			buf = kzalloc(512, GFP_KERNEL);
			if (!buf) {
				ACPI_FREE(ret);
				return -ENOMEM;
			}
			atk_pack_print(buf, 512, pack);
			break;
		}
	}
	ACPI_FREE(ret);

	if (!buf)
		return -EINVAL;

	file->private_data = buf;

	return nonseekable_open(inode, file);
}

static ssize_t atk_debugfs_ggrp_read(struct file *file, char __user *buf,
		size_t count, loff_t *pos)
{
	char *str = file->private_data;
	size_t len = strlen(str);

	return simple_read_from_buffer(buf, count, pos, str, len);
}

static int atk_debugfs_ggrp_release(struct inode *inode, struct file *file)
{
	kfree(file->private_data);
	return 0;
}

static const struct file_operations atk_debugfs_ggrp_fops = {
	.read		= atk_debugfs_ggrp_read,
	.open		= atk_debugfs_ggrp_open,
	.release	= atk_debugfs_ggrp_release,
	.llseek		= no_llseek,
};

static void atk_debugfs_init(struct atk_data *data)
{
	struct dentry *d;
	struct dentry *f;

	data->debugfs.id = 0;

	d = debugfs_create_dir("asus_atk0110", NULL);
	if (!d || IS_ERR(d))
		return;

	f = debugfs_create_x32("id", S_IRUSR | S_IWUSR, d, &data->debugfs.id);
	if (!f || IS_ERR(f))
		goto cleanup;

	f = debugfs_create_file("gitm", S_IRUSR, d, data,
			&atk_debugfs_gitm);
	if (!f || IS_ERR(f))
		goto cleanup;

	f = debugfs_create_file("ggrp", S_IRUSR, d, data,
			&atk_debugfs_ggrp_fops);
	if (!f || IS_ERR(f))
		goto cleanup;

	data->debugfs.root = d;

	return;
cleanup:
	debugfs_remove_recursive(d);
}

static void atk_debugfs_cleanup(struct atk_data *data)
{
	debugfs_remove_recursive(data->debugfs.root);
}

#else /* CONFIG_DEBUG_FS */

static void atk_debugfs_init(struct atk_data *data)
{
}

static void atk_debugfs_cleanup(struct atk_data *data)
{
}
#endif

static int atk_add_sensor(struct atk_data *data, union acpi_object *obj)
{
	struct device *dev = &data->acpi_dev->dev;
	union acpi_object *flags;
	union acpi_object *name;
	union acpi_object *limit1;
	union acpi_object *limit2;
	union acpi_object *enable;
	struct atk_sensor_data *sensor;
	char const *base_name;
	char const *limit1_name;
	char const *limit2_name;
	u64 type;
	int err;
	int *num;
	int start;

	if (obj->type != ACPI_TYPE_PACKAGE) {
		/* wft is this? */
		dev_warn(dev, "Unknown type for ACPI object: (%d)\n",
				obj->type);
		return -EINVAL;
	}

	err = validate_hwmon_pack(data, obj);
	if (err)
		return err;

	/* Ok, we have a valid hwmon package */
	type = atk_get_pack_member(data, obj, HWMON_PACK_FLAGS)->integer.value
	       & ATK_TYPE_MASK;

	switch (type) {
	case HWMON_TYPE_VOLT:
		base_name = "in";
		limit1_name = "min";
		limit2_name = "max";
		num = &data->voltage_count;
		start = 0;
		break;
	case HWMON_TYPE_TEMP:
		base_name = "temp";
		limit1_name = "max";
		limit2_name = "crit";
		num = &data->temperature_count;
		start = 1;
		break;
	case HWMON_TYPE_FAN:
		base_name = "fan";
		limit1_name = "min";
		limit2_name = "max";
		num = &data->fan_count;
		start = 1;
		break;
	default:
		dev_warn(dev, "Unknown sensor type: %#llx\n", type);
		return -EINVAL;
	}

	enable = atk_get_pack_member(data, obj, HWMON_PACK_ENABLE);
	if (!enable->integer.value)
		/* sensor is disabled */
		return 0;

	flags = atk_get_pack_member(data, obj, HWMON_PACK_FLAGS);
	name = atk_get_pack_member(data, obj, HWMON_PACK_NAME);
	limit1 = atk_get_pack_member(data, obj, HWMON_PACK_LIMIT1);
	limit2 = atk_get_pack_member(data, obj, HWMON_PACK_LIMIT2);

	sensor = kzalloc(sizeof(*sensor), GFP_KERNEL);
	if (!sensor)
		return -ENOMEM;

	sensor->acpi_name = kstrdup(name->string.pointer, GFP_KERNEL);
	if (!sensor->acpi_name) {
		err = -ENOMEM;
		goto out;
	}

	INIT_LIST_HEAD(&sensor->list);
	sensor->type = type;
	sensor->data = data;
	sensor->id = flags->integer.value;
	sensor->limit1 = limit1->integer.value;
	if (data->old_interface)
		sensor->limit2 = limit2->integer.value;
	else
		/* The upper limit is expressed as delta from lower limit */
		sensor->limit2 = sensor->limit1 + limit2->integer.value;

	snprintf(sensor->input_attr_name, ATTR_NAME_SIZE,
			"%s%d_input", base_name, start + *num);
	atk_init_attribute(&sensor->input_attr,
			sensor->input_attr_name,
			atk_input_show);

	snprintf(sensor->label_attr_name, ATTR_NAME_SIZE,
			"%s%d_label", base_name, start + *num);
	atk_init_attribute(&sensor->label_attr,
			sensor->label_attr_name,
			atk_label_show);

	snprintf(sensor->limit1_attr_name, ATTR_NAME_SIZE,
			"%s%d_%s", base_name, start + *num, limit1_name);
	atk_init_attribute(&sensor->limit1_attr,
			sensor->limit1_attr_name,
			atk_limit1_show);

	snprintf(sensor->limit2_attr_name, ATTR_NAME_SIZE,
			"%s%d_%s", base_name, start + *num, limit2_name);
	atk_init_attribute(&sensor->limit2_attr,
			sensor->limit2_attr_name,
			atk_limit2_show);

	list_add(&sensor->list, &data->sensor_list);
	(*num)++;

	return 1;
out:
	kfree(sensor->acpi_name);
	kfree(sensor);
	return err;
}

static int atk_enumerate_old_hwmon(struct atk_data *data)
{
	struct device *dev = &data->acpi_dev->dev;
	struct acpi_buffer buf;
	union acpi_object *pack;
	acpi_status status;
	int i, ret;
	int count = 0;

	/* Voltages */
	buf.length = ACPI_ALLOCATE_BUFFER;
	status = acpi_evaluate_object_typed(data->atk_handle,
			METHOD_OLD_ENUM_VLT, NULL, &buf, ACPI_TYPE_PACKAGE);
	if (status != AE_OK) {
		dev_warn(dev, METHOD_OLD_ENUM_VLT ": ACPI exception: %s\n",
				acpi_format_exception(status));

		return -ENODEV;
	}

	pack = buf.pointer;
	for (i = 1; i < pack->package.count; i++) {
		union acpi_object *obj = &pack->package.elements[i];

		ret = atk_add_sensor(data, obj);
		if (ret > 0)
			count++;
	}
	ACPI_FREE(buf.pointer);

	/* Temperatures */
	buf.length = ACPI_ALLOCATE_BUFFER;
	status = acpi_evaluate_object_typed(data->atk_handle,
			METHOD_OLD_ENUM_TMP, NULL, &buf, ACPI_TYPE_PACKAGE);
	if (status != AE_OK) {
		dev_warn(dev, METHOD_OLD_ENUM_TMP ": ACPI exception: %s\n",
				acpi_format_exception(status));

		ret = -ENODEV;
		goto cleanup;
	}

	pack = buf.pointer;
	for (i = 1; i < pack->package.count; i++) {
		union acpi_object *obj = &pack->package.elements[i];

		ret = atk_add_sensor(data, obj);
		if (ret > 0)
			count++;
	}
	ACPI_FREE(buf.pointer);

	/* Fans */
	buf.length = ACPI_ALLOCATE_BUFFER;
	status = acpi_evaluate_object_typed(data->atk_handle,
			METHOD_OLD_ENUM_FAN, NULL, &buf, ACPI_TYPE_PACKAGE);
	if (status != AE_OK) {
		dev_warn(dev, METHOD_OLD_ENUM_FAN ": ACPI exception: %s\n",
				acpi_format_exception(status));

		ret = -ENODEV;
		goto cleanup;
	}

	pack = buf.pointer;
	for (i = 1; i < pack->package.count; i++) {
		union acpi_object *obj = &pack->package.elements[i];

		ret = atk_add_sensor(data, obj);
		if (ret > 0)
			count++;
	}
	ACPI_FREE(buf.pointer);

	return count;
cleanup:
	atk_free_sensors(data);
	return ret;
}

static int atk_ec_present(struct atk_data *data)
{
	struct device *dev = &data->acpi_dev->dev;
	union acpi_object *pack;
	union acpi_object *ec;
	int ret;
	int i;

	pack = atk_ggrp(data, ATK_MUX_MGMT);
	if (IS_ERR(pack)) {
		if (PTR_ERR(pack) == -ENOENT) {
			/* The MGMT class does not exists - that's ok */
			dev_dbg(dev, "Class %#llx not found\n", ATK_MUX_MGMT);
			return 0;
		}
		return PTR_ERR(pack);
	}

	/* Search the EC */
	ec = NULL;
	for (i = 0; i < pack->package.count; i++) {
		union acpi_object *obj = &pack->package.elements[i];
		union acpi_object *id;

		if (obj->type != ACPI_TYPE_PACKAGE)
			continue;

		id = &obj->package.elements[0];
		if (id->type != ACPI_TYPE_INTEGER)
			continue;

		if (id->integer.value == ATK_EC_ID) {
			ec = obj;
			break;
		}
	}

	ret = (ec != NULL);
	if (!ret)
		/* The system has no EC */
		dev_dbg(dev, "EC not found\n");

	ACPI_FREE(pack);
	return ret;
}

static int atk_ec_enabled(struct atk_data *data)
{
	struct device *dev = &data->acpi_dev->dev;
	union acpi_object *obj;
	struct atk_acpi_ret_buffer *buf;
	int err;

	obj = atk_gitm(data, ATK_EC_ID);
	if (IS_ERR(obj)) {
		dev_err(dev, "Unable to query EC status\n");
		return PTR_ERR(obj);
	}
	buf = (struct atk_acpi_ret_buffer *)obj->buffer.pointer;

	if (buf->flags == 0) {
		dev_err(dev, "Unable to query EC status\n");
		err = -EIO;
	} else {
		err = (buf->value != 0);
		dev_dbg(dev, "EC is %sabled\n",
				err ? "en" : "dis");
	}

	ACPI_FREE(obj);
	return err;
}

static int atk_ec_ctl(struct atk_data *data, int enable)
{
	struct device *dev = &data->acpi_dev->dev;
	union acpi_object *obj;
	struct atk_acpi_input_buf sitm;
	struct atk_acpi_ret_buffer *ec_ret;
	int err = 0;

	sitm.id = ATK_EC_ID;
	sitm.param1 = enable;
	sitm.param2 = 0;

	obj = atk_sitm(data, &sitm);
	if (IS_ERR(obj)) {
		dev_err(dev, "Failed to %sable the EC\n",
				enable ? "en" : "dis");
		return PTR_ERR(obj);
	}
	ec_ret = (struct atk_acpi_ret_buffer *)obj->buffer.pointer;
	if (ec_ret->flags == 0) {
		dev_err(dev, "Failed to %sable the EC\n",
				enable ? "en" : "dis");
		err = -EIO;
	} else {
		dev_info(dev, "EC %sabled\n",
				enable ? "en" : "dis");
	}

	ACPI_FREE(obj);
	return err;
}

static int atk_enumerate_new_hwmon(struct atk_data *data)
{
	struct device *dev = &data->acpi_dev->dev;
	union acpi_object *pack;
	int err;
	int i;

	err = atk_ec_present(data);
	if (err < 0)
		return err;
	if (err) {
		err = atk_ec_enabled(data);
		if (err < 0)
			return err;
		/* If the EC was disabled we will disable it again on unload */
		data->disable_ec = err;

		err = atk_ec_ctl(data, 1);
		if (err) {
			data->disable_ec = false;
			return err;
		}
	}

	dev_dbg(dev, "Enumerating hwmon sensors\n");

	pack = atk_ggrp(data, ATK_MUX_HWMON);
	if (IS_ERR(pack))
		return PTR_ERR(pack);

	for (i = 0; i < pack->package.count; i++) {
		union acpi_object *obj = &pack->package.elements[i];

		atk_add_sensor(data, obj);
	}

	err = data->voltage_count + data->temperature_count + data->fan_count;

	ACPI_FREE(pack);
	return err;
}

static int atk_create_files(struct atk_data *data)
{
	struct atk_sensor_data *s;
	int err;

	list_for_each_entry(s, &data->sensor_list, list) {
		sysfs_attr_init(&s->input_attr.attr);
		err = device_create_file(data->hwmon_dev, &s->input_attr);
		if (err)
			return err;
		sysfs_attr_init(&s->label_attr.attr);
		err = device_create_file(data->hwmon_dev, &s->label_attr);
		if (err)
			return err;
		sysfs_attr_init(&s->limit1_attr.attr);
		err = device_create_file(data->hwmon_dev, &s->limit1_attr);
		if (err)
			return err;
		sysfs_attr_init(&s->limit2_attr.attr);
		err = device_create_file(data->hwmon_dev, &s->limit2_attr);
		if (err)
			return err;
	}

	err = device_create_file(data->hwmon_dev, &atk_name_attr);

	return err;
}

static void atk_remove_files(struct atk_data *data)
{
	struct atk_sensor_data *s;

	list_for_each_entry(s, &data->sensor_list, list) {
		device_remove_file(data->hwmon_dev, &s->input_attr);
		device_remove_file(data->hwmon_dev, &s->label_attr);
		device_remove_file(data->hwmon_dev, &s->limit1_attr);
		device_remove_file(data->hwmon_dev, &s->limit2_attr);
	}
	device_remove_file(data->hwmon_dev, &atk_name_attr);
}

static void atk_free_sensors(struct atk_data *data)
{
	struct list_head *head = &data->sensor_list;
	struct atk_sensor_data *s, *tmp;

	list_for_each_entry_safe(s, tmp, head, list) {
		kfree(s->acpi_name);
		kfree(s);
	}
}

static int atk_register_hwmon(struct atk_data *data)
{
	struct device *dev = &data->acpi_dev->dev;
	int err;

	dev_dbg(dev, "registering hwmon device\n");
	data->hwmon_dev = hwmon_device_register(dev);
	if (IS_ERR(data->hwmon_dev))
		return PTR_ERR(data->hwmon_dev);

	dev_dbg(dev, "populating sysfs directory\n");
	err = atk_create_files(data);
	if (err)
		goto remove;

	return 0;
remove:
	/* Cleanup the registered files */
	atk_remove_files(data);
	hwmon_device_unregister(data->hwmon_dev);
	return err;
}

static int atk_probe_if(struct atk_data *data)
{
	struct device *dev = &data->acpi_dev->dev;
	acpi_handle ret;
	acpi_status status;
	int err = 0;

	/* RTMP: read temperature */
	status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_TMP, &ret);
	if (ACPI_SUCCESS(status))
		data->rtmp_handle = ret;
	else
		dev_dbg(dev, "method " METHOD_OLD_READ_TMP " not found: %s\n",
				acpi_format_exception(status));

	/* RVLT: read voltage */
	status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_VLT, &ret);
	if (ACPI_SUCCESS(status))
		data->rvlt_handle = ret;
	else
		dev_dbg(dev, "method " METHOD_OLD_READ_VLT " not found: %s\n",
				acpi_format_exception(status));

	/* RFAN: read fan status */
	status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_FAN, &ret);
	if (ACPI_SUCCESS(status))
		data->rfan_handle = ret;
	else
		dev_dbg(dev, "method " METHOD_OLD_READ_FAN " not found: %s\n",
				acpi_format_exception(status));

	/* Enumeration */
	status = acpi_get_handle(data->atk_handle, METHOD_ENUMERATE, &ret);
	if (ACPI_SUCCESS(status))
		data->enumerate_handle = ret;
	else
		dev_dbg(dev, "method " METHOD_ENUMERATE " not found: %s\n",
				acpi_format_exception(status));

	/* De-multiplexer (read) */
	status = acpi_get_handle(data->atk_handle, METHOD_READ, &ret);
	if (ACPI_SUCCESS(status))
		data->read_handle = ret;
	else
		dev_dbg(dev, "method " METHOD_READ " not found: %s\n",
				acpi_format_exception(status));

	/* De-multiplexer (write) */
	status = acpi_get_handle(data->atk_handle, METHOD_WRITE, &ret);
	if (ACPI_SUCCESS(status))
		data->write_handle = ret;
	else
		dev_dbg(dev, "method " METHOD_WRITE " not found: %s\n",
				 acpi_format_exception(status));

	/* Check for hwmon methods: first check "old" style methods; note that
	 * both may be present: in this case we stick to the old interface;
	 * analysis of multiple DSDTs indicates that when both interfaces
	 * are present the new one (GGRP/GITM) is not functional.
	 */
	if (new_if)
		dev_info(dev, "Overriding interface detection\n");
	if (data->rtmp_handle && data->rvlt_handle && data->rfan_handle && !new_if)
		data->old_interface = true;
	else if (data->enumerate_handle && data->read_handle &&
			data->write_handle)
		data->old_interface = false;
	else
		err = -ENODEV;

	return err;
}

static int atk_add(struct acpi_device *device)
{
	acpi_status ret;
	int err;
	struct acpi_buffer buf;
	union acpi_object *obj;
	struct atk_data *data;

	dev_dbg(&device->dev, "adding...\n");

	data = kzalloc(sizeof(*data), GFP_KERNEL);
	if (!data)
		return -ENOMEM;

	data->acpi_dev = device;
	data->atk_handle = device->handle;
	INIT_LIST_HEAD(&data->sensor_list);
	data->disable_ec = false;

	buf.length = ACPI_ALLOCATE_BUFFER;
	ret = acpi_evaluate_object_typed(data->atk_handle, BOARD_ID, NULL,
			&buf, ACPI_TYPE_PACKAGE);
	if (ret != AE_OK) {
		dev_dbg(&device->dev, "atk: method MBIF not found\n");
	} else {
		obj = buf.pointer;
		if (obj->package.count >= 2) {
			union acpi_object *id = &obj->package.elements[1];
			if (id->type == ACPI_TYPE_STRING)
				dev_dbg(&device->dev, "board ID = %s\n",
					id->string.pointer);
		}
		ACPI_FREE(buf.pointer);
	}

	err = atk_probe_if(data);
	if (err) {
		dev_err(&device->dev, "No usable hwmon interface detected\n");
		goto out;
	}

	if (data->old_interface) {
		dev_dbg(&device->dev, "Using old hwmon interface\n");
		err = atk_enumerate_old_hwmon(data);
	} else {
		dev_dbg(&device->dev, "Using new hwmon interface\n");
		err = atk_enumerate_new_hwmon(data);
	}
	if (err < 0)
		goto out;
	if (err == 0) {
		dev_info(&device->dev,
			 "No usable sensor detected, bailing out\n");
		err = -ENODEV;
		goto out;
	}

	err = atk_register_hwmon(data);
	if (err)
		goto cleanup;

	atk_debugfs_init(data);

	device->driver_data = data;
	return 0;
cleanup:
	atk_free_sensors(data);
out:
	if (data->disable_ec)
		atk_ec_ctl(data, 0);
	kfree(data);
	return err;
}

static int atk_remove(struct acpi_device *device, int type)
{
	struct atk_data *data = device->driver_data;
	dev_dbg(&device->dev, "removing...\n");

	device->driver_data = NULL;

	atk_debugfs_cleanup(data);

	atk_remove_files(data);
	atk_free_sensors(data);
	hwmon_device_unregister(data->hwmon_dev);

	if (data->disable_ec) {
		if (atk_ec_ctl(data, 0))
			dev_err(&device->dev, "Failed to disable EC\n");
	}

	kfree(data);

	return 0;
}

static int __init atk0110_init(void)
{
	int ret;

	/* Make sure it's safe to access the device through ACPI */
	if (!acpi_resources_are_enforced()) {
		pr_err("atk: Resources not safely usable due to "
		       "acpi_enforce_resources kernel parameter\n");
		return -EBUSY;
	}

	ret = acpi_bus_register_driver(&atk_driver);
	if (ret)
		pr_info("atk: acpi_bus_register_driver failed: %d\n", ret);

	return ret;
}

static void __exit atk0110_exit(void)
{
	acpi_bus_unregister_driver(&atk_driver);
}

module_init(atk0110_init);
module_exit(atk0110_exit);

MODULE_LICENSE("GPL");

[-- Attachment #3: Type: text/plain, Size: 153 bytes --]

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [lm-sensors] Erratic value of MCH temp. (0C),
  2011-01-03 11:07 [lm-sensors] Erratic value of MCH temp. (0C), Joris Creyghton
                   ` (6 preceding siblings ...)
  2011-01-10 15:25 ` Luca Tettamanti
@ 2011-01-10 18:48 ` Joris Creyghton
  2011-01-10 18:56 ` Jean Delvare
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Joris Creyghton @ 2011-01-10 18:48 UTC (permalink / raw)
  To: lm-sensors


[-- Attachment #1.1: Type: text/plain, Size: 1108 bytes --]

On Mon, 2011-01-10 at 16:25 +0100, Luca Tettamanti wrote:

> On Wed, Jan 5, 2011 at 3:08 PM, Luca Tettamanti <kronos.it@gmail.com> wrote:
> > To complicate things the firmware provides both the old and the new
> > ATK0110 interfaces, and the driver selects the old one. The new one
> > seems to have the code to read all the sensors. I'll see what I can
> > do.
> 
> I'm attaching a modified version of the driver; I've added a parameter
> to override the default detection logic, to test load it with new_if=1
> 
> Luca


Hello Luca,

Thank you for your work on the driver.
I really would like to test it ASAP, but I don't know how.
I'm a Linux newbie so I'm afraid I must ask you a recipe for this task.
Maybe you can point me to some links where the necessary steps are
explained.
I'm familiar with the process of compiling and linking to obtain
executable code but have no experience in testing drivers in Linux.

I'm planning to add an empty disc to my system and install a fresh
Ubuntu 10.10 64 bit desktop on it just for test purposes and to make
sure that I won't blow up my regular system.

Joris



[-- Attachment #1.2: Type: text/html, Size: 1480 bytes --]

[-- Attachment #2: Type: text/plain, Size: 153 bytes --]

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [lm-sensors] Erratic value of MCH temp. (0C),
  2011-01-03 11:07 [lm-sensors] Erratic value of MCH temp. (0C), Joris Creyghton
                   ` (7 preceding siblings ...)
  2011-01-10 18:48 ` Joris Creyghton
@ 2011-01-10 18:56 ` Jean Delvare
  2011-01-10 20:01 ` Joris Creyghton
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Jean Delvare @ 2011-01-10 18:56 UTC (permalink / raw)
  To: lm-sensors

Hi Joris,

On Mon, 10 Jan 2011 19:48:38 +0100, Joris Creyghton wrote:
> Thank you for your work on the driver.
> I really would like to test it ASAP, but I don't know how.
> I'm a Linux newbie so I'm afraid I must ask you a recipe for this task.
> Maybe you can point me to some links where the necessary steps are
> explained.
> I'm familiar with the process of compiling and linking to obtain
> executable code but have no experience in testing drivers in Linux.
> 
> I'm planning to add an empty disc to my system and install a fresh
> Ubuntu 10.10 64 bit desktop on it just for test purposes and to make
> sure that I won't blow up my regular system.

You can pick any example Makefile on my site, e.g.:
http://khali.linux-fr.org/devel/misc/w83795/Makefile

Change
  DRIVER := w83795
to
  DRIVER := asus_atk0110

put both files in a temporary directory, then type "make". You'll need
make, gcc and configured kernel headers installed. When the build is
successful, you can test the module as root with:

# rmmod asus_atk0110
# insmod ./asus_atk0110.ko

Hope that helps,
-- 
Jean Delvare
http://khali.linux-fr.org/wishlist.html

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [lm-sensors] Erratic value of MCH temp. (0C),
  2011-01-03 11:07 [lm-sensors] Erratic value of MCH temp. (0C), Joris Creyghton
                   ` (8 preceding siblings ...)
  2011-01-10 18:56 ` Jean Delvare
@ 2011-01-10 20:01 ` Joris Creyghton
  2011-01-11 14:07 ` Joris Creyghton
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Joris Creyghton @ 2011-01-10 20:01 UTC (permalink / raw)
  To: lm-sensors


[-- Attachment #1.1: Type: text/plain, Size: 1395 bytes --]

On Mon, 2011-01-10 at 19:56 +0100, Jean Delvare wrote:

> Hi Joris,
> 
> On Mon, 10 Jan 2011 19:48:38 +0100, Joris Creyghton wrote:
> > Thank you for your work on the driver.
> > I really would like to test it ASAP, but I don't know how.
> > I'm a Linux newbie so I'm afraid I must ask you a recipe for this task.
> > Maybe you can point me to some links where the necessary steps are
> > explained.
> > I'm familiar with the process of compiling and linking to obtain
> > executable code but have no experience in testing drivers in Linux.
> > 
> > I'm planning to add an empty disc to my system and install a fresh
> > Ubuntu 10.10 64 bit desktop on it just for test purposes and to make
> > sure that I won't blow up my regular system.
> 
> You can pick any example Makefile on my site, e.g.:
> http://khali.linux-fr.org/devel/misc/w83795/Makefile
> 
> Change
>   DRIVER := w83795
> to
>   DRIVER := asus_atk0110
> 
> put both files in a temporary directory, then type "make". You'll need
> make, gcc and configured kernel headers installed. When the build is
> successful, you can test the module as root with:
> 
> # rmmod asus_atk0110
> # insmod ./asus_atk0110.ko
> 
> Hope that helps,


Bon soir Jean,

Thank you for your suggestions!
I'll install the new disk and dummy system tomorrow morning and then try
your recipe.
I'll report the results or return with some more questions.

Joris

[-- Attachment #1.2: Type: text/html, Size: 1748 bytes --]

[-- Attachment #2: Type: text/plain, Size: 153 bytes --]

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [lm-sensors] Erratic value of MCH temp. (0C),
  2011-01-03 11:07 [lm-sensors] Erratic value of MCH temp. (0C), Joris Creyghton
                   ` (9 preceding siblings ...)
  2011-01-10 20:01 ` Joris Creyghton
@ 2011-01-11 14:07 ` Joris Creyghton
  2011-01-11 14:23 ` Luca Tettamanti
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Joris Creyghton @ 2011-01-11 14:07 UTC (permalink / raw)
  To: lm-sensors


[-- Attachment #1.1: Type: text/plain, Size: 899 bytes --]

Hello Luca,

With your modified version of the driver I have been able to test the
new ATK0110 interface and it indeed delivers a proper value of the MCH
temperature! The recipe of Jean Delvare was invaluable for me.
I have attached the output of the sensors command in both the old and
the new situations.

Now there remains the point of incorporating things properly, so that
one doesn't have to manually re-make the object with every new version
of the kernel headers.

Another point that drew my attention is that the two ATK0110 interfaces
don't agree on the naming of the fan sensors as you can tell from the
two attachments.
Both display 4 fan's, they agree about the CPU fan, but the new
interface assigns one value to a NB fan (North Bridge =? Memory Control
Hub (MCH)). There is no such fan on the Sabertooth board. There are 2
chassis fans and a power fan though.

Thanks so far,

Joris


[-- Attachment #1.2: Type: text/html, Size: 1184 bytes --]

[-- Attachment #2: sensors_new.txt --]
[-- Type: text/plain, Size: 734 bytes --]

atk0110-acpi-0
Adapter: ACPI interface
Vcore Voltage:      +0.93 V  (min =  +0.80 V, max =  +1.60 V)
+3.3V Voltage:      +3.31 V  (min =  +2.97 V, max =  +3.63 V)
+5V Voltage:        +5.12 V  (min =  +4.50 V, max =  +5.50 V)
+12V Voltage:      +12.25 V  (min = +10.20 V, max = +13.80 V)
CPU Fan Speed:     1028 RPM  (min =  600 RPM)
Chassis1 Fan Speed: 680 RPM  (min =  600 RPM)
Chassis2 Fan Speed: 496 RPM  (min =  600 RPM)
NB Fan Speed:       777 RPM  (min =  600 RPM)
Power Fan Speed:      0 RPM  (min =    0 RPM)
CPU Temperature:    +35.0°C  (high = +60.0°C, crit = +95.0°C)  
MB Temperature:     +32.0°C  (high = +45.0°C, crit = +75.0°C)  
NB Temperature:     +44.5°C  (high = +60.0°C, crit = +95.0°C)  


[-- Attachment #3: sensors_old.txt --]
[-- Type: text/plain, Size: 734 bytes --]

atk0110-acpi-0
Adapter: ACPI interface
Vcore Voltage:      +0.93 V  (min =  +0.80 V, max =  +1.60 V)
 +3.3 Voltage:      +3.31 V  (min =  +2.97 V, max =  +3.63 V)
 +5 Voltage:        +5.12 V  (min =  +4.50 V, max =  +5.50 V)
 +12 Voltage:      +12.25 V  (min = +10.20 V, max = +13.80 V)
CPU FAN Speed:      948 RPM  (min =  600 RPM)
CHASSIS1 FAN Speed: 680 RPM  (min =  600 RPM)
CHASSIS2 FAN Speed: 496 RPM  (min =  600 RPM)
CHASSIS3 FAN Speed:   0 RPM  (min =  600 RPM)
POWER FAN Speed:    774 RPM  (min =    0 RPM)
CPU Temperature:    +35.5°C  (high = +60.0°C, crit = +75.0°C)  
MB Temperature:     +32.0°C  (high = +45.0°C, crit = +75.0°C)  
MCH Temperature:     +0.0°C  (high = +60.0°C, crit = +95.0°C)  


[-- Attachment #4: Type: text/plain, Size: 153 bytes --]

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [lm-sensors] Erratic value of MCH temp. (0C),
  2011-01-03 11:07 [lm-sensors] Erratic value of MCH temp. (0C), Joris Creyghton
                   ` (10 preceding siblings ...)
  2011-01-11 14:07 ` Joris Creyghton
@ 2011-01-11 14:23 ` Luca Tettamanti
  2011-01-12 14:03 ` Luca Tettamanti
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Luca Tettamanti @ 2011-01-11 14:23 UTC (permalink / raw)
  To: lm-sensors

On Tue, Jan 11, 2011 at 3:07 PM, Joris Creyghton <jorisctn@gmail.com> wrote:
> Another point that drew my attention is that the two ATK0110 interfaces
> don't agree on the naming of the fan sensors as you can tell from the two
> attachments.

Sigh.

> Both display 4 fan's, they agree about the CPU fan, but the new interface
> assigns one value to a NB fan (North Bridge =? Memory Control Hub (MCH)).
> There is no such fan on the Sabertooth board. There are 2 chassis fans and a
> power fan though.

The names are supplied by the BIOS, so this is another bug.
HWF2 is named "CHASSIS3" in the old interface and "Power" in the new.
HWF4 is "POWER" in the old interface but "NB" in the new one.
They probably swapped the labels... you can try and raise the issue with Asus.

Luca

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [lm-sensors] Erratic value of MCH temp. (0C),
  2011-01-03 11:07 [lm-sensors] Erratic value of MCH temp. (0C), Joris Creyghton
                   ` (11 preceding siblings ...)
  2011-01-11 14:23 ` Luca Tettamanti
@ 2011-01-12 14:03 ` Luca Tettamanti
  2011-01-12 14:15 ` Jean Delvare
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Luca Tettamanti @ 2011-01-12 14:03 UTC (permalink / raw)
  To: lm-sensors

On Tue, Jan 11, 2011 at 3:23 PM, Luca Tettamanti <kronos.it@gmail.com> wrote:
> On Tue, Jan 11, 2011 at 3:07 PM, Joris Creyghton <jorisctn@gmail.com> wrote:
>> Both display 4 fan's, they agree about the CPU fan, but the new interface
>> assigns one value to a NB fan (North Bridge =? Memory Control Hub (MCH)).
>> There is no such fan on the Sabertooth board. There are 2 chassis fans and a
>> power fan though.
>
> The names are supplied by the BIOS, so this is another bug.
> HWF2 is named "CHASSIS3" in the old interface and "Power" in the new.
> HWF4 is "POWER" in the old interface but "NB" in the new one.
> They probably swapped the labels... you can try and raise the issue with Asus.

Oh, BTW: is there an updated BIOS for the board? This issue should be
visible also under Windows... I guess someone should have noticed.
It might make sense to let the user override the labels, Jean what do you think?

Joris, can you also send me the output of dmidecode?

L

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [lm-sensors] Erratic value of MCH temp. (0C),
  2011-01-03 11:07 [lm-sensors] Erratic value of MCH temp. (0C), Joris Creyghton
                   ` (12 preceding siblings ...)
  2011-01-12 14:03 ` Luca Tettamanti
@ 2011-01-12 14:15 ` Jean Delvare
  2011-01-12 14:30 ` Luca Tettamanti
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Jean Delvare @ 2011-01-12 14:15 UTC (permalink / raw)
  To: lm-sensors

On Wed, 12 Jan 2011 15:03:31 +0100, Luca Tettamanti wrote:
> On Tue, Jan 11, 2011 at 3:23 PM, Luca Tettamanti <kronos.it@gmail.com> wrote:
> > On Tue, Jan 11, 2011 at 3:07 PM, Joris Creyghton <jorisctn@gmail.com> wrote:
> >> Both display 4 fan's, they agree about the CPU fan, but the new interface
> >> assigns one value to a NB fan (North Bridge =? Memory Control Hub (MCH)).
> >> There is no such fan on the Sabertooth board. There are 2 chassis fans and a
> >> power fan though.
> >
> > The names are supplied by the BIOS, so this is another bug.
> > HWF2 is named "CHASSIS3" in the old interface and "Power" in the new.
> > HWF4 is "POWER" in the old interface but "NB" in the new one.
> > They probably swapped the labels... you can try and raise the issue with Asus.
> 
> Oh, BTW: is there an updated BIOS for the board? This issue should be
> visible also under Windows... I guess someone should have noticed.
> It might make sense to let the user override the labels, Jean what do you think?

It is already possible. Driver-provided labels are only a hint and a
bonus, it is still possible to specify labels in the traditional way
with a sensors3.conf file, for example:

chip "asus_atk0110-*"

    label fan4 "Chassis Fan 3"

Such definitions take precedence over driver-provided labels.

> Joris, can you also send me the output of dmidecode?

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [lm-sensors] Erratic value of MCH temp. (0C),
  2011-01-03 11:07 [lm-sensors] Erratic value of MCH temp. (0C), Joris Creyghton
                   ` (13 preceding siblings ...)
  2011-01-12 14:15 ` Jean Delvare
@ 2011-01-12 14:30 ` Luca Tettamanti
  2011-01-12 15:01 ` Joris Creyghton
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Luca Tettamanti @ 2011-01-12 14:30 UTC (permalink / raw)
  To: lm-sensors

On Wed, Jan 12, 2011 at 3:15 PM, Jean Delvare <khali@linux-fr.org> wrote:
> On Wed, 12 Jan 2011 15:03:31 +0100, Luca Tettamanti wrote:
>> It might make sense to let the user override the labels, Jean what do you think?
>
> It is already possible. Driver-provided labels are only a hint and a
> bonus, it is still possible to specify labels in the traditional way
> with a sensors3.conf file, for example:
[cut]

Ah, of course :) I was thinking about overwriting directly the sysfs
entry, but it's unnecessary.

Luca

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [lm-sensors] Erratic value of MCH temp. (0C),
  2011-01-03 11:07 [lm-sensors] Erratic value of MCH temp. (0C), Joris Creyghton
                   ` (14 preceding siblings ...)
  2011-01-12 14:30 ` Luca Tettamanti
@ 2011-01-12 15:01 ` Joris Creyghton
  2011-01-17 12:49 ` Luca Tettamanti
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Joris Creyghton @ 2011-01-12 15:01 UTC (permalink / raw)
  To: lm-sensors


[-- Attachment #1.1: Type: text/plain, Size: 1804 bytes --]

On Wed, 2011-01-12 at 15:03 +0100, Luca Tettamanti wrote:

> On Tue, Jan 11, 2011 at 3:23 PM, Luca Tettamanti <kronos.it@gmail.com> wrote:
> > On Tue, Jan 11, 2011 at 3:07 PM, Joris Creyghton <jorisctn@gmail.com> wrote:
> >> Both display 4 fan's, they agree about the CPU fan, but the new interface
> >> assigns one value to a NB fan (North Bridge =? Memory Control Hub (MCH)).
> >> There is no such fan on the Sabertooth board. There are 2 chassis fans and a
> >> power fan though.
> >
> > The names are supplied by the BIOS, so this is another bug.
> > HWF2 is named "CHASSIS3" in the old interface and "Power" in the new.
> > HWF4 is "POWER" in the old interface but "NB" in the new one.
> > They probably swapped the labels... you can try and raise the issue with Asus.
> 
> Oh, BTW: is there an updated BIOS for the board? This issue should be
> visible also under Windows... I guess someone should have noticed.
> It might make sense to let the user override the labels, Jean what do you think?
> 
> Joris, can you also send me the output of dmidecode?
> 
> L

Hi Luca,

I have attached the output of dmidecode of the unmodified system.

I have also  looked into the BIOS output, and the assignment of the fans
corresponds with the output of the sensors command on the system with
the new driver.
I read them from the BIOS screen output:


        CPU fan            927
        Chassis fan 1    629
        Chassis fan 2    484
        Power fan        [N/A]
        NB fan             760

I have the latest BIOS version (0603) for the Sabertooth X58 board.
However, the Asus site has a 2010/11/09 update with the same version
number, while mine says build date 10/29/10.
I don't know if there is any difference between the two.

I'm prepaired to look into that, if you think that makes sense.



[-- Attachment #1.2: Type: text/html, Size: 2484 bytes --]

[-- Attachment #2: dmidecode.txt --]
[-- Type: text/plain, Size: 23042 bytes --]

# dmidecode 2.9
SMBIOS 2.5 present.
80 structures occupying 3027 bytes.
Table at 0x000F0700.

Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
	Vendor: American Megatrends Inc.
	Version: 0603   
	Release Date: 10/29/2010
	Address: 0xF0000
	Runtime Size: 64 kB
	ROM Size: 2048 kB
	Characteristics:
		ISA is supported
		PCI is supported
		PNP is supported
		APM is supported
		BIOS is upgradeable
		BIOS shadowing is allowed
		ESCD support is available
		Boot from CD is supported
		Selectable boot is supported
		BIOS ROM is socketed
		EDD is supported
		5.25"/1.2 MB floppy services are supported (int 13h)
		3.5"/720 KB floppy services are supported (int 13h)
		3.5"/2.88 MB floppy services are supported (int 13h)
		Print screen service is supported (int 5h)
		8042 keyboard services are supported (int 9h)
		Serial services are supported (int 14h)
		Printer services are supported (int 17h)
		CGA/mono video services are supported (int 10h)
		ACPI is supported
		USB legacy is supported
		LS-120 boot is supported
		ATAPI Zip drive boot is supported
		BIOS boot specification is supported
		Targeted content distribution is supported
	BIOS Revision: 8.15

Handle 0x0001, DMI type 1, 27 bytes
System Information
	Manufacturer: System manufacturer
	Product Name: System Product Name
	Version: System Version
	Serial Number: System Serial Number
	UUID: C0A1001F-C600-0007-10D5-BCAEC519E749
	Wake-up Type: Power Switch
	SKU Number: To Be Filled By O.E.M.
	Family: To Be Filled By O.E.M.

Handle 0x0002, DMI type 2, 15 bytes
Base Board Information
	Manufacturer: ASUSTeK Computer INC.
	Product Name: SABERTOOTH X58
	Version: Rev 1.xx
	Serial Number: 107765870002617
	Asset Tag: To Be Filled By O.E.M.
	Features:
		Board is a hosting board
		Board is replaceable
	Location In Chassis: To Be Filled By O.E.M.
	Chassis Handle: 0x0003
	Type: Motherboard
	Contained Object Handles: 0

Handle 0x0003, DMI type 3, 21 bytes
Chassis Information
	Manufacturer: Chassis Manufacture
	Type: Desktop
	Lock: Not Present
	Version: Chassis Version
	Serial Number: Chassis Serial Number
	Asset Tag: Asset-1234567890
	Boot-up State: Safe
	Power Supply State: Safe
	Thermal State: Safe
	Security Status: None
	OEM Information: 0x00000001
	Height: Unspecified
	Number Of Power Cords: 1
	Contained Elements: 0

Handle 0x0004, DMI type 4, 40 bytes
Processor Information
	Socket Designation: LGA1366
	Type: Central Processor
	Family: <OUT OF SPEC>
	Manufacturer: Intel            
	ID: A5 06 01 00 FF FB EB BF
	Version: Intel(R) Core(TM) i7 CPU 950 @ 3.07GHz              
	Voltage: 1.2 V
	External Clock: 133 MHz
	Max Speed: 3066 MHz
	Current Speed: 3066 MHz
	Status: Populated, Enabled
	Upgrade: Other
	L1 Cache Handle: 0x0005
	L2 Cache Handle: 0x0006
	L3 Cache Handle: 0x0007
	Serial Number: To Be Filled By O.E.M.
	Asset Tag: To Be Filled By O.E.M.
	Part Number: To Be Filled By O.E.M.
	Core Count: 4
	Core Enabled: 4
	Thread Count: 8
	Characteristics:
		64-bit capable

Handle 0x0005, DMI type 7, 19 bytes
Cache Information
	Socket Designation: L1-Cache
	Configuration: Enabled, Not Socketed, Level 1
	Operational Mode: Write Through
	Location: Internal
	Installed Size: 256 KB
	Maximum Size: 256 KB
	Supported SRAM Types:
		Other
	Installed SRAM Type: Other
	Speed: Unknown
	Error Correction Type: Parity
	System Type: Instruction
	Associativity: 4-way Set-associative

Handle 0x0006, DMI type 7, 19 bytes
Cache Information
	Socket Designation: L2-Cache
	Configuration: Enabled, Not Socketed, Level 2
	Operational Mode: Write Through
	Location: Internal
	Installed Size: 1024 KB
	Maximum Size: 1024 KB
	Supported SRAM Types:
		Other
	Installed SRAM Type: Other
	Speed: Unknown
	Error Correction Type: Single-bit ECC
	System Type: Unified
	Associativity: 8-way Set-associative

Handle 0x0007, DMI type 7, 19 bytes
Cache Information
	Socket Designation: L3-Cache
	Configuration: Enabled, Not Socketed, Level 3
	Operational Mode: Write Back
	Location: Internal
	Installed Size: 8192 KB
	Maximum Size: 8192 KB
	Supported SRAM Types:
		Other
	Installed SRAM Type: Other
	Speed: Unknown
	Error Correction Type: Single-bit ECC
	System Type: Unified
	Associativity: 16-way Set-associative

Handle 0x0008, DMI type 5, 28 bytes
Memory Controller Information
	Error Detecting Method: 64-bit ECC
	Error Correcting Capabilities:
		None
	Supported Interleave: One-way Interleave
	Current Interleave: One-way Interleave
	Maximum Memory Module Size: 4096 MB
	Maximum Total Memory Size: 24576 MB
	Supported Speeds:
		70 ns
		60 ns
	Supported Memory Types:
		DIMM
		SDRAM
	Memory Module Voltage: 3.3 V
	Associated Memory Slots: 6
		0x0009
		0x000A
		0x000B
		0x000C
		0x000D
		0x000E
	Enabled Error Correcting Capabilities:
		None

Handle 0x0009, DMI type 6, 12 bytes
Memory Module Information
	Socket Designation: DIMM0
	Bank Connections: 1
	Current Speed: 1 ns
	Type: DIMM
	Installed Size: 2048 MB (Single-bank Connection)
	Enabled Size: 2048 MB (Single-bank Connection)
	Error Status: OK

Handle 0x000A, DMI type 6, 12 bytes
Memory Module Information
	Socket Designation: DIMM1
	Bank Connections: 2
	Current Speed: 1 ns
	Type: DIMM
	Installed Size: 2048 MB (Single-bank Connection)
	Enabled Size: 2048 MB (Single-bank Connection)
	Error Status: OK

Handle 0x000B, DMI type 6, 12 bytes
Memory Module Information
	Socket Designation: DIMM2
	Bank Connections: 3
	Current Speed: 1 ns
	Type: DIMM
	Installed Size: 2048 MB (Single-bank Connection)
	Enabled Size: 2048 MB (Single-bank Connection)
	Error Status: OK

Handle 0x000C, DMI type 6, 12 bytes
Memory Module Information
	Socket Designation: DIMM3
	Bank Connections: 4
	Current Speed: 1 ns
	Type: DIMM
	Installed Size: 2048 MB (Single-bank Connection)
	Enabled Size: 2048 MB (Single-bank Connection)
	Error Status: OK

Handle 0x000D, DMI type 6, 12 bytes
Memory Module Information
	Socket Designation: DIMM4
	Bank Connections: 5
	Current Speed: 1 ns
	Type: DIMM
	Installed Size: 2048 MB (Single-bank Connection)
	Enabled Size: 2048 MB (Single-bank Connection)
	Error Status: OK

Handle 0x000E, DMI type 6, 12 bytes
Memory Module Information
	Socket Designation: DIMM5
	Bank Connections: 6
	Current Speed: 1 ns
	Type: DIMM
	Installed Size: 2048 MB (Single-bank Connection)
	Enabled Size: 2048 MB (Single-bank Connection)
	Error Status: OK

Handle 0x000F, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: PS/2 Keyboard
	Internal Connector Type: None
	External Reference Designator: PS/2 Keyboard
	External Connector Type: PS/2
	Port Type: Keyboard Port

Handle 0x0010, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: PS/2 Mouse
	Internal Connector Type: None
	External Reference Designator: PS/2 Mouse
	External Connector Type: PS/2
	Port Type: Mouse Port

Handle 0x0011, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: USB12
	Internal Connector Type: None
	External Reference Designator: USB12
	External Connector Type: Access Bus (USB)
	Port Type: USB

Handle 0x0012, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: USB34
	Internal Connector Type: None
	External Reference Designator: USB34
	External Connector Type: Access Bus (USB)
	Port Type: USB

Handle 0x0013, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: USB_3_12
	Internal Connector Type: None
	External Reference Designator: USB56
	External Connector Type: Access Bus (USB)
	Port Type: USB

Handle 0x0014, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: IE1394_1
	Internal Connector Type: None
	External Reference Designator: IEEE1394 1
	External Connector Type: IEEE 1394
	Port Type: Firewire (IEEE P1394)

Handle 0x0015, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: LAN1
	Internal Connector Type: None
	External Reference Designator: GbE LAN 1
	External Connector Type: RJ-45
	Port Type: Network Port

Handle 0x0016, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: AUDIO
	Internal Connector Type: None
	External Reference Designator: AUDIO
	External Connector Type: Other
	Port Type: Audio Port

Handle 0x0017, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Audio Line Out1
	Internal Connector Type: None
	External Reference Designator: Audio Line Out1
	External Connector Type: Mini Jack (headphones)
	Port Type: Audio Port

Handle 0x0018, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Audio Line Out2
	Internal Connector Type: None
	External Reference Designator: Audio Line Out2
	External Connector Type: Mini Jack (headphones)
	Port Type: Audio Port

Handle 0x0019, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Audio Line Out3
	Internal Connector Type: None
	External Reference Designator: Audio Line Out3
	External Connector Type: Mini Jack (headphones)
	Port Type: Audio Port

Handle 0x001A, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Audio Line Out4
	Internal Connector Type: None
	External Reference Designator: Audio Line Out4
	External Connector Type: Mini Jack (headphones)
	Port Type: Audio Port

Handle 0x001B, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Audio Line Out5
	Internal Connector Type: None
	External Reference Designator: Audio Line Out5
	External Connector Type: Mini Jack (headphones)
	Port Type: Audio Port

Handle 0x001C, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Audio Line Out6
	Internal Connector Type: None
	External Reference Designator: Audio Line Out6
	External Connector Type: Mini Jack (headphones)
	Port Type: Audio Port

Handle 0x001D, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: F_ESATA
	Internal Connector Type: None
	External Reference Designator: F_ESATA
	External Connector Type: SAS/SATA Plug Receptacle
	Port Type: SATA

Handle 0x001E, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: ESATA
	Internal Connector Type: None
	External Reference Designator: ESATA
	External Connector Type: SAS/SATA Plug Receptacle
	Port Type: SATA

Handle 0x001F, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: SATA1
	Internal Connector Type: SAS/SATA Plug Receptacle
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: SATA

Handle 0x0020, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: SATA2
	Internal Connector Type: SAS/SATA Plug Receptacle
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: SATA

Handle 0x0021, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: SATA3
	Internal Connector Type: SAS/SATA Plug Receptacle
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: SATA

Handle 0x0022, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: SATA4
	Internal Connector Type: SAS/SATA Plug Receptacle
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: SATA

Handle 0x0023, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: SATA5
	Internal Connector Type: SAS/SATA Plug Receptacle
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: SATA

Handle 0x0024, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: SATA6
	Internal Connector Type: SAS/SATA Plug Receptacle
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: SATA

Handle 0x0025, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: SATA_6G_1
	Internal Connector Type: SAS/SATA Plug Receptacle
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: SATA

Handle 0x0026, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: SATA_6G_2
	Internal Connector Type: SAS/SATA Plug Receptacle
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: SATA

Handle 0x0027, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: USB56
	Internal Connector Type: Access Bus (USB)
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: USB

Handle 0x0028, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: USB78
	Internal Connector Type: Access Bus (USB)
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: USB

Handle 0x0029, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: USB910
	Internal Connector Type: Access Bus (USB)
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: USB

Handle 0x002A, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: USB1112
	Internal Connector Type: Access Bus (USB)
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: USB

Handle 0x002B, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: IE1394_2
	Internal Connector Type: IEEE 1394
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Firewire (IEEE P1394)

Handle 0x002C, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: AAFP
	Internal Connector Type: Mini Jack (headphones)
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Audio Port

Handle 0x002D, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: CPU_FAN
	Internal Connector Type: Other
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Other

Handle 0x002E, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: PWR_FAN
	Internal Connector Type: Other
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Other

Handle 0x002F, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: CHA_FAN1
	Internal Connector Type: Other
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Other

Handle 0x0030, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: CHA_FAN2
	Internal Connector Type: Other
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Other

Handle 0x0031, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: CHA_FAN3
	Internal Connector Type: Other
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Other

Handle 0x0032, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: NB_FAN
	Internal Connector Type: Other
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Other

Handle 0x0033, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: SPDIF_OUT
	Internal Connector Type: On Board Sound Input From CD-ROM
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Audio Port

Handle 0x0034, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: FP_AUDIO
	Internal Connector Type: On Board Sound Input From CD-ROM
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Audio Port

Handle 0x0035, DMI type 9, 13 bytes
System Slot Information
	Designation: PCIEX1_1
	Type: 64-bit PCI Express
	Current Usage: In Use
	Length: Short
	ID: 1
	Characteristics:
		3.3 V is provided
		Opening is shared
		PME signal is supported

Handle 0x0036, DMI type 9, 13 bytes
System Slot Information
	Designation: PCIEX1_2
	Type: 32-bit PCI Express
	Current Usage: In Use
	Length: Short
	ID: 2
	Characteristics:
		3.3 V is provided
		Opening is shared
		PME signal is supported

Handle 0x0037, DMI type 9, 13 bytes
System Slot Information
	Designation: PCI1
	Type: 32-bit PCI
	Current Usage: Available
	Length: Short
	ID: 3
	Characteristics:
		3.3 V is provided
		Opening is shared
		PME signal is supported

Handle 0x0038, DMI type 9, 13 bytes
System Slot Information
	Designation: PCIEX16_1
	Type: 32-bit PCI
	Current Usage: Available
	Length: Short
	ID: 4
	Characteristics:
		3.3 V is provided
		Opening is shared
		PME signal is supported

Handle 0x0039, DMI type 9, 13 bytes
System Slot Information
	Designation: PCIEX16_2
	Type: 32-bit PCI Express
	Current Usage: Available
	Length: Short
	ID: 5
	Characteristics:
		3.3 V is provided
		Opening is shared
		PME signal is supported

Handle 0x003A, DMI type 9, 13 bytes
System Slot Information
	Designation: PCIEX16_3
	Type: 32-bit PCI Express
	Current Usage: Available
	Length: Short
	ID: 6
	Characteristics:
		3.3 V is provided
		Opening is shared
		PME signal is supported

Handle 0x003B, DMI type 10, 6 bytes
On Board Device Information
	Type: Ethernet
	Status: Enabled
	Description:  Onboard Ethernet

Handle 0x003C, DMI type 11, 5 bytes
OEM Strings
	String 1: To Be Filled By O.E.M.
	String 2: To Be Filled By O.E.M.
	String 3: To Be Filled By O.E.M.
	String 4: To Be Filled By O.E.M.

Handle 0x003D, DMI type 13, 22 bytes
BIOS Language Information
	Installable Languages: 6
		en|US|iso8859-1
		zh|ZH|iso8859-1
		de|DE|iso8859-1
		cn|CN|iso8859-1
		fr|FR|iso8859-1
		ja|JP|unicode-1
	Currently Installed Language: en|US|iso8859-1

Handle 0x003E, DMI type 15, 55 bytes
System Event Log
	Area Length: 1008 bytes
	Header Start Offset: 0x2010
	Data Start Offset: 0x2010
	Access Method: OEM-specific
	Access Address: Unknown
	Status: Valid, Not Full
	Change Token: 0x00000000
	Header Format: No Header
	Supported Log Type Descriptors: 1
	Descriptor 1: OEM-specific
	Data Format 1: POST results bitmap

Handle 0x003F, DMI type 16, 15 bytes
Physical Memory Array
	Location: System Board Or Motherboard
	Use: System Memory
	Error Correction Type: Multi-bit ECC
	Maximum Capacity: 24 GB
	Error Information Handle: Not Provided
	Number Of Devices: 6

Handle 0x0040, DMI type 19, 15 bytes
Memory Array Mapped Address
	Starting Address: 0x00000000000
	Ending Address: 0x000000003FF
	Range Size: 1 kB
	Physical Array Handle: 0x003F
	Partition Width: 0

Handle 0x0041, DMI type 17, 27 bytes
Memory Device
	Array Handle: 0x003F
	Error Information Handle: Not Provided
	Total Width: 72 bits
	Data Width: 64 bits
	Size: 2048 MB
	Form Factor: DIMM
	Set: None
	Locator: DIMM0
	Bank Locator: BANK0
	Type: Other
	Type Detail: Other
	Speed: 1066 MHz (0.9 ns)
	Manufacturer: Manufacturer00
	Serial Number: SerNum00
	Asset Tag: AssetTagNum0
	Part Number: ModulePartNumber00

Handle 0x0042, DMI type 20, 19 bytes
Memory Device Mapped Address
	Starting Address: 0x00000000000
	Ending Address: 0x000000003FF
	Range Size: 1 kB
	Physical Device Handle: 0x0041
	Memory Array Mapped Address Handle: 0x0040
	Partition Row Position: 1
	Interleave Position: Unknown
	Interleaved Data Depth: 2

Handle 0x0043, DMI type 17, 27 bytes
Memory Device
	Array Handle: 0x003F
	Error Information Handle: Not Provided
	Total Width: 72 bits
	Data Width: 64 bits
	Size: 2048 MB
	Form Factor: DIMM
	Set: None
	Locator: DIMM1
	Bank Locator: BANK1
	Type: Other
	Type Detail: Other
	Speed: 1066 MHz (0.9 ns)
	Manufacturer: Manufacturer01
	Serial Number: SerNum01
	Asset Tag: AssetTagNum1
	Part Number: ModulePartNumber01

Handle 0x0044, DMI type 20, 19 bytes
Memory Device Mapped Address
	Starting Address: 0x00000000000
	Ending Address: 0x000000003FF
	Range Size: 1 kB
	Physical Device Handle: 0x0043
	Memory Array Mapped Address Handle: 0x0040
	Partition Row Position: 1
	Interleave Position: Unknown
	Interleaved Data Depth: 2

Handle 0x0045, DMI type 17, 27 bytes
Memory Device
	Array Handle: 0x003F
	Error Information Handle: Not Provided
	Total Width: 72 bits
	Data Width: 64 bits
	Size: 2048 MB
	Form Factor: DIMM
	Set: None
	Locator: DIMM2
	Bank Locator: BANK2
	Type: Other
	Type Detail: Other
	Speed: 1066 MHz (0.9 ns)
	Manufacturer: Manufacturer02
	Serial Number: SerNum02
	Asset Tag: AssetTagNum2
	Part Number: ModulePartNumber02

Handle 0x0046, DMI type 20, 19 bytes
Memory Device Mapped Address
	Starting Address: 0x00000000000
	Ending Address: 0x000000003FF
	Range Size: 1 kB
	Physical Device Handle: 0x0045
	Memory Array Mapped Address Handle: 0x0040
	Partition Row Position: 1
	Interleave Position: Unknown
	Interleaved Data Depth: 2

Handle 0x0047, DMI type 17, 27 bytes
Memory Device
	Array Handle: 0x003F
	Error Information Handle: Not Provided
	Total Width: 72 bits
	Data Width: 64 bits
	Size: 2048 MB
	Form Factor: DIMM
	Set: None
	Locator: DIMM3
	Bank Locator: BANK3
	Type: Other
	Type Detail: Other
	Speed: 1066 MHz (0.9 ns)
	Manufacturer: Manufacturer03
	Serial Number: SerNum03
	Asset Tag: AssetTagNum3
	Part Number: ModulePartNumber03

Handle 0x0048, DMI type 20, 19 bytes
Memory Device Mapped Address
	Starting Address: 0x00000000000
	Ending Address: 0x000000003FF
	Range Size: 1 kB
	Physical Device Handle: 0x0047
	Memory Array Mapped Address Handle: 0x0040
	Partition Row Position: 1
	Interleave Position: Unknown
	Interleaved Data Depth: 2

Handle 0x0049, DMI type 17, 27 bytes
Memory Device
	Array Handle: 0x003F
	Error Information Handle: Not Provided
	Total Width: 72 bits
	Data Width: 64 bits
	Size: 2048 MB
	Form Factor: DIMM
	Set: None
	Locator: DIMM4
	Bank Locator: BANK4
	Type: Other
	Type Detail: Other
	Speed: 1066 MHz (0.9 ns)
	Manufacturer: Manufacturer04
	Serial Number: SerNum04
	Asset Tag: AssetTagNum4
	Part Number: ModulePartNumber04

Handle 0x004A, DMI type 20, 19 bytes
Memory Device Mapped Address
	Starting Address: 0x00000000000
	Ending Address: 0x000000003FF
	Range Size: 1 kB
	Physical Device Handle: 0x0049
	Memory Array Mapped Address Handle: 0x0040
	Partition Row Position: 1
	Interleave Position: Unknown
	Interleaved Data Depth: 2

Handle 0x004B, DMI type 17, 27 bytes
Memory Device
	Array Handle: 0x003F
	Error Information Handle: Not Provided
	Total Width: 72 bits
	Data Width: 64 bits
	Size: 2048 MB
	Form Factor: DIMM
	Set: None
	Locator: DIMM5
	Bank Locator: BANK5
	Type: Other
	Type Detail: Other
	Speed: 1066 MHz (0.9 ns)
	Manufacturer: Manufacturer05
	Serial Number: SerNum05
	Asset Tag: AssetTagNum5
	Part Number: ModulePartNumber05

Handle 0x004C, DMI type 20, 19 bytes
Memory Device Mapped Address
	Starting Address: 0x00000000000
	Ending Address: 0x000000003FF
	Range Size: 1 kB
	Physical Device Handle: 0x004B
	Memory Array Mapped Address Handle: 0x0040
	Partition Row Position: 1
	Interleave Position: Unknown
	Interleaved Data Depth: 2

Handle 0x004D, DMI type 32, 20 bytes
System Boot Information
	Status: No errors detected

Handle 0x004E, DMI type 139, 54 bytes
OEM-specific Type
	Header and Data:
		8B 36 4E 00 00 1F C6 00 00 07 10 D5 04 04 32 55
		F8 00 A2 02 A1 00 40 63 43 10 FE 81 03 DF 40 B2
		00 20 00 73 3C 10 08 00 00 00 00 00 00 00 00 00
		00 00 00 00 00 01
	Strings:
		V1394GUID

Handle 0x004F, DMI type 127, 4 bytes
End Of Table


[-- Attachment #3: Type: text/plain, Size: 153 bytes --]

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [lm-sensors] Erratic value of MCH temp. (0C),
  2011-01-03 11:07 [lm-sensors] Erratic value of MCH temp. (0C), Joris Creyghton
                   ` (15 preceding siblings ...)
  2011-01-12 15:01 ` Joris Creyghton
@ 2011-01-17 12:49 ` Luca Tettamanti
  2011-01-17 20:17 ` Joris Creyghton
  2011-01-18 14:40 ` Luca Tettamanti
  18 siblings, 0 replies; 20+ messages in thread
From: Luca Tettamanti @ 2011-01-17 12:49 UTC (permalink / raw)
  To: lm-sensors

[-- Attachment #1: Type: text/plain, Size: 593 bytes --]

On Wed, Jan 12, 2011 at 4:01 PM, Joris Creyghton <jorisctn@gmail.com> wrote:
> I have attached the output of dmidecode of the unmodified system.

Sorry for the delay :)
I've updated the driver to automatically select the correct interface
on your board.
Compile and load it without any additional parameter.

> I have the latest BIOS version (0603) for the Sabertooth X58 board.
> However, the Asus site has a 2010/11/09 update with the same version number,
> while mine says build date 10/29/10.
> I don't know if there is any difference between the two.

Nah, they should be the same.

Luca

[-- Attachment #2: asus_atk0110.c --]
[-- Type: text/x-csrc, Size: 33916 bytes --]

/*
 * Copyright (C) 2007-2009 Luca Tettamanti <kronos.it@gmail.com>
 *
 * This file is released under the GPLv2
 * See COPYING in the top level directory of the kernel tree.
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#define DEBUG

#include <linux/debugfs.h>
#include <linux/kernel.h>
#include <linux/hwmon.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/dmi.h>

#include <acpi/acpi.h>
#include <acpi/acpixf.h>
#include <acpi/acpi_drivers.h>
#include <acpi/acpi_bus.h>


#define ATK_HID "ATK0110"

static bool new_if;
module_param(new_if, bool, 0);
MODULE_PARM_DESC(new_if, "Override detection heuristic and force the use of the new ATK0110 interface");

static const struct dmi_system_id __initconst atk_force_new_if[] = {
	{
		/* Old interface has broken fan monitoring */
		.ident = "Asus Sabertooth X58",
		.matches = {
			DMI_MATCH(DMI_BOARD_NAME, "SABERTOOTH X58")
		}
	},
	{ }
};

/* Minimum time between readings, enforced in order to avoid
 * hogging the CPU.
 */
#define CACHE_TIME		HZ

#define BOARD_ID		"MBIF"
#define METHOD_ENUMERATE	"GGRP"
#define METHOD_READ		"GITM"
#define METHOD_WRITE		"SITM"
#define METHOD_OLD_READ_TMP	"RTMP"
#define METHOD_OLD_READ_VLT	"RVLT"
#define METHOD_OLD_READ_FAN	"RFAN"
#define METHOD_OLD_ENUM_TMP	"TSIF"
#define METHOD_OLD_ENUM_VLT	"VSIF"
#define METHOD_OLD_ENUM_FAN	"FSIF"

#define ATK_MUX_HWMON		0x00000006ULL
#define ATK_MUX_MGMT		0x00000011ULL

#define ATK_CLASS_MASK		0xff000000ULL
#define ATK_CLASS_FREQ_CTL	0x03000000ULL
#define ATK_CLASS_FAN_CTL	0x04000000ULL
#define ATK_CLASS_HWMON		0x06000000ULL
#define ATK_CLASS_MGMT		0x11000000ULL

#define ATK_TYPE_MASK		0x00ff0000ULL
#define HWMON_TYPE_VOLT		0x00020000ULL
#define HWMON_TYPE_TEMP		0x00030000ULL
#define HWMON_TYPE_FAN		0x00040000ULL

#define ATK_ELEMENT_ID_MASK	0x0000ffffULL

#define ATK_EC_ID		0x11060004ULL

enum atk_pack_member {
	HWMON_PACK_FLAGS,
	HWMON_PACK_NAME,
	HWMON_PACK_LIMIT1,
	HWMON_PACK_LIMIT2,
	HWMON_PACK_ENABLE
};

/* New package format */
#define _HWMON_NEW_PACK_SIZE	7
#define _HWMON_NEW_PACK_FLAGS	0
#define _HWMON_NEW_PACK_NAME	1
#define _HWMON_NEW_PACK_UNK1	2
#define _HWMON_NEW_PACK_UNK2	3
#define _HWMON_NEW_PACK_LIMIT1	4
#define _HWMON_NEW_PACK_LIMIT2	5
#define _HWMON_NEW_PACK_ENABLE	6

/* Old package format */
#define _HWMON_OLD_PACK_SIZE	5
#define _HWMON_OLD_PACK_FLAGS	0
#define _HWMON_OLD_PACK_NAME	1
#define _HWMON_OLD_PACK_LIMIT1	2
#define _HWMON_OLD_PACK_LIMIT2	3
#define _HWMON_OLD_PACK_ENABLE	4


struct atk_data {
	struct device *hwmon_dev;
	acpi_handle atk_handle;
	struct acpi_device *acpi_dev;

	bool old_interface;

	/* old interface */
	acpi_handle rtmp_handle;
	acpi_handle rvlt_handle;
	acpi_handle rfan_handle;
	/* new inteface */
	acpi_handle enumerate_handle;
	acpi_handle read_handle;
	acpi_handle write_handle;

	bool disable_ec;

	int voltage_count;
	int temperature_count;
	int fan_count;
	struct list_head sensor_list;

	struct {
		struct dentry *root;
		u32 id;
	} debugfs;
};


typedef ssize_t (*sysfs_show_func)(struct device *dev,
			struct device_attribute *attr, char *buf);

static const struct acpi_device_id atk_ids[] = {
	{ATK_HID, 0},
	{"", 0},
};
MODULE_DEVICE_TABLE(acpi, atk_ids);

#define ATTR_NAME_SIZE 16 /* Worst case is "tempN_input" */

struct atk_sensor_data {
	struct list_head list;
	struct atk_data *data;
	struct device_attribute label_attr;
	struct device_attribute input_attr;
	struct device_attribute limit1_attr;
	struct device_attribute limit2_attr;
	char label_attr_name[ATTR_NAME_SIZE];
	char input_attr_name[ATTR_NAME_SIZE];
	char limit1_attr_name[ATTR_NAME_SIZE];
	char limit2_attr_name[ATTR_NAME_SIZE];
	u64 id;
	u64 type;
	u64 limit1;
	u64 limit2;
	u64 cached_value;
	unsigned long last_updated; /* in jiffies */
	bool is_valid;
	char const *acpi_name;
};

/* Return buffer format:
 * [0-3] "value" is valid flag
 * [4-7] value
 * [8- ] unknown stuff on newer mobos
 */
struct atk_acpi_ret_buffer {
	u32 flags;
	u32 value;
	u8 data[];
};

/* Input buffer used for GITM and SITM methods */
struct atk_acpi_input_buf {
	u32 id;
	u32 param1;
	u32 param2;
};

static int atk_add(struct acpi_device *device);
static int atk_remove(struct acpi_device *device, int type);
static void atk_print_sensor(struct atk_data *data, union acpi_object *obj);
static int atk_read_value(struct atk_sensor_data *sensor, u64 *value);
static void atk_free_sensors(struct atk_data *data);

static struct acpi_driver atk_driver = {
	.name	= ATK_HID,
	.class	= "hwmon",
	.ids	= atk_ids,
	.ops	= {
		.add	= atk_add,
		.remove	= atk_remove,
	},
};

#define input_to_atk_sensor(attr) \
	container_of(attr, struct atk_sensor_data, input_attr)

#define label_to_atk_sensor(attr) \
	container_of(attr, struct atk_sensor_data, label_attr)

#define limit1_to_atk_sensor(attr) \
	container_of(attr, struct atk_sensor_data, limit1_attr)

#define limit2_to_atk_sensor(attr) \
	container_of(attr, struct atk_sensor_data, limit2_attr)

static ssize_t atk_input_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	struct atk_sensor_data *s = input_to_atk_sensor(attr);
	u64 value;
	int err;

	err = atk_read_value(s, &value);
	if (err)
		return err;

	if (s->type == HWMON_TYPE_TEMP)
		/* ACPI returns decidegree */
		value *= 100;

	return sprintf(buf, "%llu\n", value);
}

static ssize_t atk_label_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	struct atk_sensor_data *s = label_to_atk_sensor(attr);

	return sprintf(buf, "%s\n", s->acpi_name);
}

static ssize_t atk_limit1_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	struct atk_sensor_data *s = limit1_to_atk_sensor(attr);
	u64 value = s->limit1;

	if (s->type == HWMON_TYPE_TEMP)
		value *= 100;

	return sprintf(buf, "%lld\n", value);
}

static ssize_t atk_limit2_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	struct atk_sensor_data *s = limit2_to_atk_sensor(attr);
	u64 value = s->limit2;

	if (s->type == HWMON_TYPE_TEMP)
		value *= 100;

	return sprintf(buf, "%lld\n", value);
}

static ssize_t atk_name_show(struct device *dev,
				struct device_attribute *attr, char *buf)
{
	return sprintf(buf, "atk0110\n");
}
static struct device_attribute atk_name_attr =
		__ATTR(name, 0444, atk_name_show, NULL);

static void atk_init_attribute(struct device_attribute *attr, char *name,
		sysfs_show_func show)
{
	attr->attr.name = name;
	attr->attr.mode = 0444;
	attr->show = show;
	attr->store = NULL;
}


static union acpi_object *atk_get_pack_member(struct atk_data *data,
						union acpi_object *pack,
						enum atk_pack_member m)
{
	bool old_if = data->old_interface;
	int offset;

	switch (m) {
	case HWMON_PACK_FLAGS:
		offset = old_if ? _HWMON_OLD_PACK_FLAGS : _HWMON_NEW_PACK_FLAGS;
		break;
	case HWMON_PACK_NAME:
		offset = old_if ? _HWMON_OLD_PACK_NAME : _HWMON_NEW_PACK_NAME;
		break;
	case HWMON_PACK_LIMIT1:
		offset = old_if ? _HWMON_OLD_PACK_LIMIT1 :
				  _HWMON_NEW_PACK_LIMIT1;
		break;
	case HWMON_PACK_LIMIT2:
		offset = old_if ? _HWMON_OLD_PACK_LIMIT2 :
				  _HWMON_NEW_PACK_LIMIT2;
		break;
	case HWMON_PACK_ENABLE:
		offset = old_if ? _HWMON_OLD_PACK_ENABLE :
				  _HWMON_NEW_PACK_ENABLE;
		break;
	default:
		return NULL;
	}

	return &pack->package.elements[offset];
}


/* New package format is:
 * - flag (int)
 *	class - used for de-muxing the request to the correct GITn
 *	type (volt, temp, fan)
 *	sensor id |
 *	sensor id - used for de-muxing the request _inside_ the GITn
 * - name (str)
 * - unknown (int)
 * - unknown (int)
 * - limit1 (int)
 * - limit2 (int)
 * - enable (int)
 *
 * The old package has the same format but it's missing the two unknown fields.
 */
static int validate_hwmon_pack(struct atk_data *data, union acpi_object *obj)
{
	struct device *dev = &data->acpi_dev->dev;
	union acpi_object *tmp;
	bool old_if = data->old_interface;
	int const expected_size = old_if ? _HWMON_OLD_PACK_SIZE :
					   _HWMON_NEW_PACK_SIZE;

	if (obj->type != ACPI_TYPE_PACKAGE) {
		dev_warn(dev, "Invalid type: %d\n", obj->type);
		return -EINVAL;
	}

	if (obj->package.count != expected_size) {
		dev_warn(dev, "Invalid package size: %d, expected: %d\n",
				obj->package.count, expected_size);
		return -EINVAL;
	}

	tmp = atk_get_pack_member(data, obj, HWMON_PACK_FLAGS);
	if (tmp->type != ACPI_TYPE_INTEGER) {
		dev_warn(dev, "Invalid type (flag): %d\n", tmp->type);
		return -EINVAL;
	}

	tmp = atk_get_pack_member(data, obj, HWMON_PACK_NAME);
	if (tmp->type != ACPI_TYPE_STRING) {
		dev_warn(dev, "Invalid type (name): %d\n", tmp->type);
		return -EINVAL;
	}

	/* Don't check... we don't know what they're useful for anyway */
#if 0
	tmp = &obj->package.elements[HWMON_PACK_UNK1];
	if (tmp->type != ACPI_TYPE_INTEGER) {
		dev_warn(dev, "Invalid type (unk1): %d\n", tmp->type);
		return -EINVAL;
	}

	tmp = &obj->package.elements[HWMON_PACK_UNK2];
	if (tmp->type != ACPI_TYPE_INTEGER) {
		dev_warn(dev, "Invalid type (unk2): %d\n", tmp->type);
		return -EINVAL;
	}
#endif

	tmp = atk_get_pack_member(data, obj, HWMON_PACK_LIMIT1);
	if (tmp->type != ACPI_TYPE_INTEGER) {
		dev_warn(dev, "Invalid type (limit1): %d\n", tmp->type);
		return -EINVAL;
	}

	tmp = atk_get_pack_member(data, obj, HWMON_PACK_LIMIT2);
	if (tmp->type != ACPI_TYPE_INTEGER) {
		dev_warn(dev, "Invalid type (limit2): %d\n", tmp->type);
		return -EINVAL;
	}

	tmp = atk_get_pack_member(data, obj, HWMON_PACK_ENABLE);
	if (tmp->type != ACPI_TYPE_INTEGER) {
		dev_warn(dev, "Invalid type (enable): %d\n", tmp->type);
		return -EINVAL;
	}

	atk_print_sensor(data, obj);

	return 0;
}

#ifdef DEBUG
static char const *atk_sensor_type(union acpi_object *flags)
{
	u64 type = flags->integer.value & ATK_TYPE_MASK;
	char const *what;

	switch (type) {
	case HWMON_TYPE_VOLT:
		what = "voltage";
		break;
	case HWMON_TYPE_TEMP:
		what = "temperature";
		break;
	case HWMON_TYPE_FAN:
		what = "fan";
		break;
	default:
		what = "unknown";
		break;
	}

	return what;
}
#endif

static void atk_print_sensor(struct atk_data *data, union acpi_object *obj)
{
#ifdef DEBUG
	struct device *dev = &data->acpi_dev->dev;
	union acpi_object *flags;
	union acpi_object *name;
	union acpi_object *limit1;
	union acpi_object *limit2;
	union acpi_object *enable;
	char const *what;

	flags = atk_get_pack_member(data, obj, HWMON_PACK_FLAGS);
	name = atk_get_pack_member(data, obj, HWMON_PACK_NAME);
	limit1 = atk_get_pack_member(data, obj, HWMON_PACK_LIMIT1);
	limit2 = atk_get_pack_member(data, obj, HWMON_PACK_LIMIT2);
	enable = atk_get_pack_member(data, obj, HWMON_PACK_ENABLE);

	what = atk_sensor_type(flags);

	dev_dbg(dev, "%s: %#llx %s [%llu-%llu] %s\n", what,
			flags->integer.value,
			name->string.pointer,
			limit1->integer.value, limit2->integer.value,
			enable->integer.value ? "enabled" : "disabled");
#endif
}

static int atk_read_value_old(struct atk_sensor_data *sensor, u64 *value)
{
	struct atk_data *data = sensor->data;
	struct device *dev = &data->acpi_dev->dev;
	struct acpi_object_list params;
	union acpi_object id;
	acpi_status status;
	acpi_handle method;

	switch (sensor->type) {
	case HWMON_TYPE_VOLT:
		method = data->rvlt_handle;
		break;
	case HWMON_TYPE_TEMP:
		method = data->rtmp_handle;
		break;
	case HWMON_TYPE_FAN:
		method = data->rfan_handle;
		break;
	default:
		return -EINVAL;
	}

	id.type = ACPI_TYPE_INTEGER;
	id.integer.value = sensor->id;

	params.count = 1;
	params.pointer = &id;

	status = acpi_evaluate_integer(method, NULL, &params, value);
	if (status != AE_OK) {
		dev_warn(dev, "%s: ACPI exception: %s\n", __func__,
				acpi_format_exception(status));
		return -EIO;
	}

	return 0;
}

static union acpi_object *atk_ggrp(struct atk_data *data, u16 mux)
{
	struct device *dev = &data->acpi_dev->dev;
	struct acpi_buffer buf;
	acpi_status ret;
	struct acpi_object_list params;
	union acpi_object id;
	union acpi_object *pack;

	id.type = ACPI_TYPE_INTEGER;
	id.integer.value = mux;
	params.count = 1;
	params.pointer = &id;

	buf.length = ACPI_ALLOCATE_BUFFER;
	ret = acpi_evaluate_object(data->enumerate_handle, NULL, &params, &buf);
	if (ret != AE_OK) {
		dev_err(dev, "GGRP[%#x] ACPI exception: %s\n", mux,
				acpi_format_exception(ret));
		return ERR_PTR(-EIO);
	}
	pack = buf.pointer;
	if (pack->type != ACPI_TYPE_PACKAGE) {
		/* Execution was successful, but the id was not found */
		ACPI_FREE(pack);
		return ERR_PTR(-ENOENT);
	}

	if (pack->package.count < 1) {
		dev_err(dev, "GGRP[%#x] package is too small\n", mux);
		ACPI_FREE(pack);
		return ERR_PTR(-EIO);
	}
	return pack;
}

static union acpi_object *atk_gitm(struct atk_data *data, u64 id)
{
	struct device *dev = &data->acpi_dev->dev;
	struct atk_acpi_input_buf buf;
	union acpi_object tmp;
	struct acpi_object_list params;
	struct acpi_buffer ret;
	union acpi_object *obj;
	acpi_status status;

	buf.id = id;
	buf.param1 = 0;
	buf.param2 = 0;

	tmp.type = ACPI_TYPE_BUFFER;
	tmp.buffer.pointer = (u8 *)&buf;
	tmp.buffer.length = sizeof(buf);

	params.count = 1;
	params.pointer = (void *)&tmp;

	ret.length = ACPI_ALLOCATE_BUFFER;
	status = acpi_evaluate_object_typed(data->read_handle, NULL, &params,
			&ret, ACPI_TYPE_BUFFER);
	if (status != AE_OK) {
		dev_warn(dev, "GITM[%#llx] ACPI exception: %s\n", id,
				acpi_format_exception(status));
		return ERR_PTR(-EIO);
	}
	obj = ret.pointer;

	/* Sanity check */
	if (obj->buffer.length < 8) {
		dev_warn(dev, "Unexpected ASBF length: %u\n",
				obj->buffer.length);
		ACPI_FREE(obj);
		return ERR_PTR(-EIO);
	}
	return obj;
}

static union acpi_object *atk_sitm(struct atk_data *data,
		struct atk_acpi_input_buf *buf)
{
	struct device *dev = &data->acpi_dev->dev;
	struct acpi_object_list params;
	union acpi_object tmp;
	struct acpi_buffer ret;
	union acpi_object *obj;
	acpi_status status;

	tmp.type = ACPI_TYPE_BUFFER;
	tmp.buffer.pointer = (u8 *)buf;
	tmp.buffer.length = sizeof(*buf);

	params.count = 1;
	params.pointer = &tmp;

	ret.length = ACPI_ALLOCATE_BUFFER;
	status = acpi_evaluate_object_typed(data->write_handle, NULL, &params,
			&ret, ACPI_TYPE_BUFFER);
	if (status != AE_OK) {
		dev_warn(dev, "SITM[%#x] ACPI exception: %s\n", buf->id,
				acpi_format_exception(status));
		return ERR_PTR(-EIO);
	}
	obj = ret.pointer;

	/* Sanity check */
	if (obj->buffer.length < 8) {
		dev_warn(dev, "Unexpected ASBF length: %u\n",
				obj->buffer.length);
		ACPI_FREE(obj);
		return ERR_PTR(-EIO);
	}
	return obj;
}

static int atk_read_value_new(struct atk_sensor_data *sensor, u64 *value)
{
	struct atk_data *data = sensor->data;
	struct device *dev = &data->acpi_dev->dev;
	union acpi_object *obj;
	struct atk_acpi_ret_buffer *buf;
	int err = 0;

	obj = atk_gitm(data, sensor->id);
	if (IS_ERR(obj))
		return PTR_ERR(obj);

	buf = (struct atk_acpi_ret_buffer *)obj->buffer.pointer;
	if (buf->flags == 0) {
		/* The reading is not valid, possible causes:
		 * - sensor failure
		 * - enumeration was FUBAR (and we didn't notice)
		 */
		dev_warn(dev, "Read failed, sensor = %#llx\n", sensor->id);
		err = -EIO;
		goto out;
	}

	*value = buf->value;
out:
	ACPI_FREE(obj);
	return err;
}

static int atk_read_value(struct atk_sensor_data *sensor, u64 *value)
{
	int err;

	if (!sensor->is_valid ||
	    time_after(jiffies, sensor->last_updated + CACHE_TIME)) {
		if (sensor->data->old_interface)
			err = atk_read_value_old(sensor, value);
		else
			err = atk_read_value_new(sensor, value);

		sensor->is_valid = true;
		sensor->last_updated = jiffies;
		sensor->cached_value = *value;
	} else {
		*value = sensor->cached_value;
		err = 0;
	}

	return err;
}

#ifdef CONFIG_DEBUG_FS
static int atk_debugfs_gitm_get(void *p, u64 *val)
{
	struct atk_data *data = p;
	union acpi_object *ret;
	struct atk_acpi_ret_buffer *buf;
	int err = 0;

	if (!data->read_handle)
		return -ENODEV;

	if (!data->debugfs.id)
		return -EINVAL;

	ret = atk_gitm(data, data->debugfs.id);
	if (IS_ERR(ret))
		return PTR_ERR(ret);

	buf = (struct atk_acpi_ret_buffer *)ret->buffer.pointer;
	if (buf->flags)
		*val = buf->value;
	else
		err = -EIO;

	return err;
}

DEFINE_SIMPLE_ATTRIBUTE(atk_debugfs_gitm,
			atk_debugfs_gitm_get,
			NULL,
			"0x%08llx\n")

static int atk_acpi_print(char *buf, size_t sz, union acpi_object *obj)
{
	int ret = 0;

	switch (obj->type) {
	case ACPI_TYPE_INTEGER:
		ret = snprintf(buf, sz, "0x%08llx\n", obj->integer.value);
		break;
	case ACPI_TYPE_STRING:
		ret = snprintf(buf, sz, "%s\n", obj->string.pointer);
		break;
	}

	return ret;
}

static void atk_pack_print(char *buf, size_t sz, union acpi_object *pack)
{
	int ret;
	int i;

	for (i = 0; i < pack->package.count; i++) {
		union acpi_object *obj = &pack->package.elements[i];

		ret = atk_acpi_print(buf, sz, obj);
		if (ret >= sz)
			break;
		buf += ret;
		sz -= ret;
	}
}

static int atk_debugfs_ggrp_open(struct inode *inode, struct file *file)
{
	struct atk_data *data = inode->i_private;
	char *buf = NULL;
	union acpi_object *ret;
	u8 cls;
	int i;

	if (!data->enumerate_handle)
		return -ENODEV;
	if (!data->debugfs.id)
		return -EINVAL;

	cls = (data->debugfs.id & 0xff000000) >> 24;
	ret = atk_ggrp(data, cls);
	if (IS_ERR(ret))
		return PTR_ERR(ret);

	for (i = 0; i < ret->package.count; i++) {
		union acpi_object *pack = &ret->package.elements[i];
		union acpi_object *id;

		if (pack->type != ACPI_TYPE_PACKAGE)
			continue;
		if (!pack->package.count)
			continue;
		id = &pack->package.elements[0];
		if (id->integer.value == data->debugfs.id) {
			/* Print the package */
			buf = kzalloc(512, GFP_KERNEL);
			if (!buf) {
				ACPI_FREE(ret);
				return -ENOMEM;
			}
			atk_pack_print(buf, 512, pack);
			break;
		}
	}
	ACPI_FREE(ret);

	if (!buf)
		return -EINVAL;

	file->private_data = buf;

	return nonseekable_open(inode, file);
}

static ssize_t atk_debugfs_ggrp_read(struct file *file, char __user *buf,
		size_t count, loff_t *pos)
{
	char *str = file->private_data;
	size_t len = strlen(str);

	return simple_read_from_buffer(buf, count, pos, str, len);
}

static int atk_debugfs_ggrp_release(struct inode *inode, struct file *file)
{
	kfree(file->private_data);
	return 0;
}

static const struct file_operations atk_debugfs_ggrp_fops = {
	.read		= atk_debugfs_ggrp_read,
	.open		= atk_debugfs_ggrp_open,
	.release	= atk_debugfs_ggrp_release,
	.llseek		= no_llseek,
};

static void atk_debugfs_init(struct atk_data *data)
{
	struct dentry *d;
	struct dentry *f;

	data->debugfs.id = 0;

	d = debugfs_create_dir("asus_atk0110", NULL);
	if (!d || IS_ERR(d))
		return;

	f = debugfs_create_x32("id", S_IRUSR | S_IWUSR, d, &data->debugfs.id);
	if (!f || IS_ERR(f))
		goto cleanup;

	f = debugfs_create_file("gitm", S_IRUSR, d, data,
			&atk_debugfs_gitm);
	if (!f || IS_ERR(f))
		goto cleanup;

	f = debugfs_create_file("ggrp", S_IRUSR, d, data,
			&atk_debugfs_ggrp_fops);
	if (!f || IS_ERR(f))
		goto cleanup;

	data->debugfs.root = d;

	return;
cleanup:
	debugfs_remove_recursive(d);
}

static void atk_debugfs_cleanup(struct atk_data *data)
{
	debugfs_remove_recursive(data->debugfs.root);
}

#else /* CONFIG_DEBUG_FS */

static void atk_debugfs_init(struct atk_data *data)
{
}

static void atk_debugfs_cleanup(struct atk_data *data)
{
}
#endif

static int atk_add_sensor(struct atk_data *data, union acpi_object *obj)
{
	struct device *dev = &data->acpi_dev->dev;
	union acpi_object *flags;
	union acpi_object *name;
	union acpi_object *limit1;
	union acpi_object *limit2;
	union acpi_object *enable;
	struct atk_sensor_data *sensor;
	char const *base_name;
	char const *limit1_name;
	char const *limit2_name;
	u64 type;
	int err;
	int *num;
	int start;

	if (obj->type != ACPI_TYPE_PACKAGE) {
		/* wft is this? */
		dev_warn(dev, "Unknown type for ACPI object: (%d)\n",
				obj->type);
		return -EINVAL;
	}

	err = validate_hwmon_pack(data, obj);
	if (err)
		return err;

	/* Ok, we have a valid hwmon package */
	type = atk_get_pack_member(data, obj, HWMON_PACK_FLAGS)->integer.value
	       & ATK_TYPE_MASK;

	switch (type) {
	case HWMON_TYPE_VOLT:
		base_name = "in";
		limit1_name = "min";
		limit2_name = "max";
		num = &data->voltage_count;
		start = 0;
		break;
	case HWMON_TYPE_TEMP:
		base_name = "temp";
		limit1_name = "max";
		limit2_name = "crit";
		num = &data->temperature_count;
		start = 1;
		break;
	case HWMON_TYPE_FAN:
		base_name = "fan";
		limit1_name = "min";
		limit2_name = "max";
		num = &data->fan_count;
		start = 1;
		break;
	default:
		dev_warn(dev, "Unknown sensor type: %#llx\n", type);
		return -EINVAL;
	}

	enable = atk_get_pack_member(data, obj, HWMON_PACK_ENABLE);
	if (!enable->integer.value)
		/* sensor is disabled */
		return 0;

	flags = atk_get_pack_member(data, obj, HWMON_PACK_FLAGS);
	name = atk_get_pack_member(data, obj, HWMON_PACK_NAME);
	limit1 = atk_get_pack_member(data, obj, HWMON_PACK_LIMIT1);
	limit2 = atk_get_pack_member(data, obj, HWMON_PACK_LIMIT2);

	sensor = kzalloc(sizeof(*sensor), GFP_KERNEL);
	if (!sensor)
		return -ENOMEM;

	sensor->acpi_name = kstrdup(name->string.pointer, GFP_KERNEL);
	if (!sensor->acpi_name) {
		err = -ENOMEM;
		goto out;
	}

	INIT_LIST_HEAD(&sensor->list);
	sensor->type = type;
	sensor->data = data;
	sensor->id = flags->integer.value;
	sensor->limit1 = limit1->integer.value;
	if (data->old_interface)
		sensor->limit2 = limit2->integer.value;
	else
		/* The upper limit is expressed as delta from lower limit */
		sensor->limit2 = sensor->limit1 + limit2->integer.value;

	snprintf(sensor->input_attr_name, ATTR_NAME_SIZE,
			"%s%d_input", base_name, start + *num);
	atk_init_attribute(&sensor->input_attr,
			sensor->input_attr_name,
			atk_input_show);

	snprintf(sensor->label_attr_name, ATTR_NAME_SIZE,
			"%s%d_label", base_name, start + *num);
	atk_init_attribute(&sensor->label_attr,
			sensor->label_attr_name,
			atk_label_show);

	snprintf(sensor->limit1_attr_name, ATTR_NAME_SIZE,
			"%s%d_%s", base_name, start + *num, limit1_name);
	atk_init_attribute(&sensor->limit1_attr,
			sensor->limit1_attr_name,
			atk_limit1_show);

	snprintf(sensor->limit2_attr_name, ATTR_NAME_SIZE,
			"%s%d_%s", base_name, start + *num, limit2_name);
	atk_init_attribute(&sensor->limit2_attr,
			sensor->limit2_attr_name,
			atk_limit2_show);

	list_add(&sensor->list, &data->sensor_list);
	(*num)++;

	return 1;
out:
	kfree(sensor->acpi_name);
	kfree(sensor);
	return err;
}

static int atk_enumerate_old_hwmon(struct atk_data *data)
{
	struct device *dev = &data->acpi_dev->dev;
	struct acpi_buffer buf;
	union acpi_object *pack;
	acpi_status status;
	int i, ret;
	int count = 0;

	/* Voltages */
	buf.length = ACPI_ALLOCATE_BUFFER;
	status = acpi_evaluate_object_typed(data->atk_handle,
			METHOD_OLD_ENUM_VLT, NULL, &buf, ACPI_TYPE_PACKAGE);
	if (status != AE_OK) {
		dev_warn(dev, METHOD_OLD_ENUM_VLT ": ACPI exception: %s\n",
				acpi_format_exception(status));

		return -ENODEV;
	}

	pack = buf.pointer;
	for (i = 1; i < pack->package.count; i++) {
		union acpi_object *obj = &pack->package.elements[i];

		ret = atk_add_sensor(data, obj);
		if (ret > 0)
			count++;
	}
	ACPI_FREE(buf.pointer);

	/* Temperatures */
	buf.length = ACPI_ALLOCATE_BUFFER;
	status = acpi_evaluate_object_typed(data->atk_handle,
			METHOD_OLD_ENUM_TMP, NULL, &buf, ACPI_TYPE_PACKAGE);
	if (status != AE_OK) {
		dev_warn(dev, METHOD_OLD_ENUM_TMP ": ACPI exception: %s\n",
				acpi_format_exception(status));

		ret = -ENODEV;
		goto cleanup;
	}

	pack = buf.pointer;
	for (i = 1; i < pack->package.count; i++) {
		union acpi_object *obj = &pack->package.elements[i];

		ret = atk_add_sensor(data, obj);
		if (ret > 0)
			count++;
	}
	ACPI_FREE(buf.pointer);

	/* Fans */
	buf.length = ACPI_ALLOCATE_BUFFER;
	status = acpi_evaluate_object_typed(data->atk_handle,
			METHOD_OLD_ENUM_FAN, NULL, &buf, ACPI_TYPE_PACKAGE);
	if (status != AE_OK) {
		dev_warn(dev, METHOD_OLD_ENUM_FAN ": ACPI exception: %s\n",
				acpi_format_exception(status));

		ret = -ENODEV;
		goto cleanup;
	}

	pack = buf.pointer;
	for (i = 1; i < pack->package.count; i++) {
		union acpi_object *obj = &pack->package.elements[i];

		ret = atk_add_sensor(data, obj);
		if (ret > 0)
			count++;
	}
	ACPI_FREE(buf.pointer);

	return count;
cleanup:
	atk_free_sensors(data);
	return ret;
}

static int atk_ec_present(struct atk_data *data)
{
	struct device *dev = &data->acpi_dev->dev;
	union acpi_object *pack;
	union acpi_object *ec;
	int ret;
	int i;

	pack = atk_ggrp(data, ATK_MUX_MGMT);
	if (IS_ERR(pack)) {
		if (PTR_ERR(pack) == -ENOENT) {
			/* The MGMT class does not exists - that's ok */
			dev_dbg(dev, "Class %#llx not found\n", ATK_MUX_MGMT);
			return 0;
		}
		return PTR_ERR(pack);
	}

	/* Search the EC */
	ec = NULL;
	for (i = 0; i < pack->package.count; i++) {
		union acpi_object *obj = &pack->package.elements[i];
		union acpi_object *id;

		if (obj->type != ACPI_TYPE_PACKAGE)
			continue;

		id = &obj->package.elements[0];
		if (id->type != ACPI_TYPE_INTEGER)
			continue;

		if (id->integer.value == ATK_EC_ID) {
			ec = obj;
			break;
		}
	}

	ret = (ec != NULL);
	if (!ret)
		/* The system has no EC */
		dev_dbg(dev, "EC not found\n");

	ACPI_FREE(pack);
	return ret;
}

static int atk_ec_enabled(struct atk_data *data)
{
	struct device *dev = &data->acpi_dev->dev;
	union acpi_object *obj;
	struct atk_acpi_ret_buffer *buf;
	int err;

	obj = atk_gitm(data, ATK_EC_ID);
	if (IS_ERR(obj)) {
		dev_err(dev, "Unable to query EC status\n");
		return PTR_ERR(obj);
	}
	buf = (struct atk_acpi_ret_buffer *)obj->buffer.pointer;

	if (buf->flags == 0) {
		dev_err(dev, "Unable to query EC status\n");
		err = -EIO;
	} else {
		err = (buf->value != 0);
		dev_dbg(dev, "EC is %sabled\n",
				err ? "en" : "dis");
	}

	ACPI_FREE(obj);
	return err;
}

static int atk_ec_ctl(struct atk_data *data, int enable)
{
	struct device *dev = &data->acpi_dev->dev;
	union acpi_object *obj;
	struct atk_acpi_input_buf sitm;
	struct atk_acpi_ret_buffer *ec_ret;
	int err = 0;

	sitm.id = ATK_EC_ID;
	sitm.param1 = enable;
	sitm.param2 = 0;

	obj = atk_sitm(data, &sitm);
	if (IS_ERR(obj)) {
		dev_err(dev, "Failed to %sable the EC\n",
				enable ? "en" : "dis");
		return PTR_ERR(obj);
	}
	ec_ret = (struct atk_acpi_ret_buffer *)obj->buffer.pointer;
	if (ec_ret->flags == 0) {
		dev_err(dev, "Failed to %sable the EC\n",
				enable ? "en" : "dis");
		err = -EIO;
	} else {
		dev_info(dev, "EC %sabled\n",
				enable ? "en" : "dis");
	}

	ACPI_FREE(obj);
	return err;
}

static int atk_enumerate_new_hwmon(struct atk_data *data)
{
	struct device *dev = &data->acpi_dev->dev;
	union acpi_object *pack;
	int err;
	int i;

	err = atk_ec_present(data);
	if (err < 0)
		return err;
	if (err) {
		err = atk_ec_enabled(data);
		if (err < 0)
			return err;
		/* If the EC was disabled we will disable it again on unload */
		data->disable_ec = err;

		err = atk_ec_ctl(data, 1);
		if (err) {
			data->disable_ec = false;
			return err;
		}
	}

	dev_dbg(dev, "Enumerating hwmon sensors\n");

	pack = atk_ggrp(data, ATK_MUX_HWMON);
	if (IS_ERR(pack))
		return PTR_ERR(pack);

	for (i = 0; i < pack->package.count; i++) {
		union acpi_object *obj = &pack->package.elements[i];

		atk_add_sensor(data, obj);
	}

	err = data->voltage_count + data->temperature_count + data->fan_count;

	ACPI_FREE(pack);
	return err;
}

static int atk_create_files(struct atk_data *data)
{
	struct atk_sensor_data *s;
	int err;

	list_for_each_entry(s, &data->sensor_list, list) {
		sysfs_attr_init(&s->input_attr.attr);
		err = device_create_file(data->hwmon_dev, &s->input_attr);
		if (err)
			return err;
		sysfs_attr_init(&s->label_attr.attr);
		err = device_create_file(data->hwmon_dev, &s->label_attr);
		if (err)
			return err;
		sysfs_attr_init(&s->limit1_attr.attr);
		err = device_create_file(data->hwmon_dev, &s->limit1_attr);
		if (err)
			return err;
		sysfs_attr_init(&s->limit2_attr.attr);
		err = device_create_file(data->hwmon_dev, &s->limit2_attr);
		if (err)
			return err;
	}

	err = device_create_file(data->hwmon_dev, &atk_name_attr);

	return err;
}

static void atk_remove_files(struct atk_data *data)
{
	struct atk_sensor_data *s;

	list_for_each_entry(s, &data->sensor_list, list) {
		device_remove_file(data->hwmon_dev, &s->input_attr);
		device_remove_file(data->hwmon_dev, &s->label_attr);
		device_remove_file(data->hwmon_dev, &s->limit1_attr);
		device_remove_file(data->hwmon_dev, &s->limit2_attr);
	}
	device_remove_file(data->hwmon_dev, &atk_name_attr);
}

static void atk_free_sensors(struct atk_data *data)
{
	struct list_head *head = &data->sensor_list;
	struct atk_sensor_data *s, *tmp;

	list_for_each_entry_safe(s, tmp, head, list) {
		kfree(s->acpi_name);
		kfree(s);
	}
}

static int atk_register_hwmon(struct atk_data *data)
{
	struct device *dev = &data->acpi_dev->dev;
	int err;

	dev_dbg(dev, "registering hwmon device\n");
	data->hwmon_dev = hwmon_device_register(dev);
	if (IS_ERR(data->hwmon_dev))
		return PTR_ERR(data->hwmon_dev);

	dev_dbg(dev, "populating sysfs directory\n");
	err = atk_create_files(data);
	if (err)
		goto remove;

	return 0;
remove:
	/* Cleanup the registered files */
	atk_remove_files(data);
	hwmon_device_unregister(data->hwmon_dev);
	return err;
}

static int atk_probe_if(struct atk_data *data)
{
	struct device *dev = &data->acpi_dev->dev;
	acpi_handle ret;
	acpi_status status;
	int err = 0;

	/* RTMP: read temperature */
	status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_TMP, &ret);
	if (ACPI_SUCCESS(status))
		data->rtmp_handle = ret;
	else
		dev_dbg(dev, "method " METHOD_OLD_READ_TMP " not found: %s\n",
				acpi_format_exception(status));

	/* RVLT: read voltage */
	status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_VLT, &ret);
	if (ACPI_SUCCESS(status))
		data->rvlt_handle = ret;
	else
		dev_dbg(dev, "method " METHOD_OLD_READ_VLT " not found: %s\n",
				acpi_format_exception(status));

	/* RFAN: read fan status */
	status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_FAN, &ret);
	if (ACPI_SUCCESS(status))
		data->rfan_handle = ret;
	else
		dev_dbg(dev, "method " METHOD_OLD_READ_FAN " not found: %s\n",
				acpi_format_exception(status));

	/* Enumeration */
	status = acpi_get_handle(data->atk_handle, METHOD_ENUMERATE, &ret);
	if (ACPI_SUCCESS(status))
		data->enumerate_handle = ret;
	else
		dev_dbg(dev, "method " METHOD_ENUMERATE " not found: %s\n",
				acpi_format_exception(status));

	/* De-multiplexer (read) */
	status = acpi_get_handle(data->atk_handle, METHOD_READ, &ret);
	if (ACPI_SUCCESS(status))
		data->read_handle = ret;
	else
		dev_dbg(dev, "method " METHOD_READ " not found: %s\n",
				acpi_format_exception(status));

	/* De-multiplexer (write) */
	status = acpi_get_handle(data->atk_handle, METHOD_WRITE, &ret);
	if (ACPI_SUCCESS(status))
		data->write_handle = ret;
	else
		dev_dbg(dev, "method " METHOD_WRITE " not found: %s\n",
				 acpi_format_exception(status));

	/* Check for hwmon methods: first check "old" style methods; note that
	 * both may be present: in this case we stick to the old interface;
	 * analysis of multiple DSDTs indicates that when both interfaces
	 * are present the new one (GGRP/GITM) is not functional.
	 */
	if (new_if)
		dev_info(dev, "Overriding interface detection\n");
	if (data->rtmp_handle && data->rvlt_handle && data->rfan_handle && !new_if)
		data->old_interface = true;
	else if (data->enumerate_handle && data->read_handle &&
			data->write_handle)
		data->old_interface = false;
	else
		err = -ENODEV;

	return err;
}

static int atk_add(struct acpi_device *device)
{
	acpi_status ret;
	int err;
	struct acpi_buffer buf;
	union acpi_object *obj;
	struct atk_data *data;

	dev_dbg(&device->dev, "adding...\n");

	data = kzalloc(sizeof(*data), GFP_KERNEL);
	if (!data)
		return -ENOMEM;

	data->acpi_dev = device;
	data->atk_handle = device->handle;
	INIT_LIST_HEAD(&data->sensor_list);
	data->disable_ec = false;

	buf.length = ACPI_ALLOCATE_BUFFER;
	ret = acpi_evaluate_object_typed(data->atk_handle, BOARD_ID, NULL,
			&buf, ACPI_TYPE_PACKAGE);
	if (ret != AE_OK) {
		dev_dbg(&device->dev, "atk: method MBIF not found\n");
	} else {
		obj = buf.pointer;
		if (obj->package.count >= 2) {
			union acpi_object *id = &obj->package.elements[1];
			if (id->type == ACPI_TYPE_STRING)
				dev_dbg(&device->dev, "board ID = %s\n",
					id->string.pointer);
		}
		ACPI_FREE(buf.pointer);
	}

	err = atk_probe_if(data);
	if (err) {
		dev_err(&device->dev, "No usable hwmon interface detected\n");
		goto out;
	}

	if (data->old_interface) {
		dev_dbg(&device->dev, "Using old hwmon interface\n");
		err = atk_enumerate_old_hwmon(data);
	} else {
		dev_dbg(&device->dev, "Using new hwmon interface\n");
		err = atk_enumerate_new_hwmon(data);
	}
	if (err < 0)
		goto out;
	if (err == 0) {
		dev_info(&device->dev,
			 "No usable sensor detected, bailing out\n");
		err = -ENODEV;
		goto out;
	}

	err = atk_register_hwmon(data);
	if (err)
		goto cleanup;

	atk_debugfs_init(data);

	device->driver_data = data;
	return 0;
cleanup:
	atk_free_sensors(data);
out:
	if (data->disable_ec)
		atk_ec_ctl(data, 0);
	kfree(data);
	return err;
}

static int atk_remove(struct acpi_device *device, int type)
{
	struct atk_data *data = device->driver_data;
	dev_dbg(&device->dev, "removing...\n");

	device->driver_data = NULL;

	atk_debugfs_cleanup(data);

	atk_remove_files(data);
	atk_free_sensors(data);
	hwmon_device_unregister(data->hwmon_dev);

	if (data->disable_ec) {
		if (atk_ec_ctl(data, 0))
			dev_err(&device->dev, "Failed to disable EC\n");
	}

	kfree(data);

	return 0;
}

static int __init atk0110_init(void)
{
	int ret;

	/* Make sure it's safe to access the device through ACPI */
	if (!acpi_resources_are_enforced()) {
		pr_err("Resources not safely usable due to acpi_enforce_resources kernel parameter\n");
		return -EBUSY;
	}

	if (dmi_check_system(atk_force_new_if))
		new_if = true;

	ret = acpi_bus_register_driver(&atk_driver);
	if (ret)
		pr_info("acpi_bus_register_driver failed: %d\n", ret);

	return ret;
}

static void __exit atk0110_exit(void)
{
	acpi_bus_unregister_driver(&atk_driver);
}

module_init(atk0110_init);
module_exit(atk0110_exit);

MODULE_LICENSE("GPL");

[-- Attachment #3: Type: text/plain, Size: 153 bytes --]

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [lm-sensors] Erratic value of MCH temp. (0C),
  2011-01-03 11:07 [lm-sensors] Erratic value of MCH temp. (0C), Joris Creyghton
                   ` (16 preceding siblings ...)
  2011-01-17 12:49 ` Luca Tettamanti
@ 2011-01-17 20:17 ` Joris Creyghton
  2011-01-18 14:40 ` Luca Tettamanti
  18 siblings, 0 replies; 20+ messages in thread
From: Joris Creyghton @ 2011-01-17 20:17 UTC (permalink / raw)
  To: lm-sensors


[-- Attachment #1.1: Type: text/plain, Size: 1237 bytes --]

Hi Luca,

On Mon, 2011-01-17 at 13:49 +0100, Luca Tettamanti wrote:


> Sorry for the delay :)

No problem :-) 

> I've updated the driver to automatically select the correct interface
> on your board.
> Compile and load it without any additional parameter.

It's working fine.

I have looked into your source and would like to suggest to change the
comment in line 33, which reads:

    /* Old interface has broken fan monitoring */

The main problem with the old interface was that it didn't communicate
the MCH temperature. The MCH happens to be the hottest component on this
MB, so I want to keep an eye on it.

The confusion about the labeling of the different fans is rather
trivial.
There are 6 fan connectors on the MB, all properly labeled. One of them
has the label NB_fan, although there is no North Bridge fan on this
board. That's just careless of Asus. I think I connected one of the
chassis fans to this connector.

So I would suggest that you change the comment in line 33 to:

    /* Old interface has broken MCH temperature monitoring */

When you think it is usefull I can verify whether the different fan
connector labels are properly displayed in the BIOS output and in the
output of the sensors command.

Joris





[-- Attachment #1.2: Type: text/html, Size: 1688 bytes --]

[-- Attachment #2: Type: text/plain, Size: 153 bytes --]

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [lm-sensors] Erratic value of MCH temp. (0C),
  2011-01-03 11:07 [lm-sensors] Erratic value of MCH temp. (0C), Joris Creyghton
                   ` (17 preceding siblings ...)
  2011-01-17 20:17 ` Joris Creyghton
@ 2011-01-18 14:40 ` Luca Tettamanti
  18 siblings, 0 replies; 20+ messages in thread
From: Luca Tettamanti @ 2011-01-18 14:40 UTC (permalink / raw)
  To: lm-sensors

On Mon, Jan 17, 2011 at 9:17 PM, Joris Creyghton <jorisctn@gmail.com> wrote:
> It's working fine.

Excellent :) I'll send a patch upstream.

>
> I have looked into your source and would like to suggest to change the
> comment in line 33, which reads:
>
>     /* Old interface has broken fan monitoring */
>
> The main problem with the old interface was that it didn't communicate the
> MCH temperature.

Yes, it was a thinko on my part :-)

Luca

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2011-01-18 14:40 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-03 11:07 [lm-sensors] Erratic value of MCH temp. (0C), Joris Creyghton
2011-01-05 11:35 ` Luca Tettamanti
2011-01-05 13:45 ` Joris Creyghton
2011-01-05 14:08 ` Luca Tettamanti
2011-01-05 14:35 ` Joris Creyghton
2011-01-06 21:01 ` Jean Delvare
2011-01-07 13:14 ` Luca Tettamanti
2011-01-10 15:25 ` Luca Tettamanti
2011-01-10 18:48 ` Joris Creyghton
2011-01-10 18:56 ` Jean Delvare
2011-01-10 20:01 ` Joris Creyghton
2011-01-11 14:07 ` Joris Creyghton
2011-01-11 14:23 ` Luca Tettamanti
2011-01-12 14:03 ` Luca Tettamanti
2011-01-12 14:15 ` Jean Delvare
2011-01-12 14:30 ` Luca Tettamanti
2011-01-12 15:01 ` Joris Creyghton
2011-01-17 12:49 ` Luca Tettamanti
2011-01-17 20:17 ` Joris Creyghton
2011-01-18 14:40 ` Luca Tettamanti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.