diff options
| -rw-r--r-- | arch/x86/kernel/cpu/cyrix.c | 20 | ||||
| -rw-r--r-- | arch/x86/kernel/cpu/intel_cacheinfo.c | 169 | ||||
| -rw-r--r-- | include/asm-x86/processor-cyrix.h | 8 |
3 files changed, 165 insertions, 32 deletions
diff --git a/arch/x86/kernel/cpu/cyrix.c b/arch/x86/kernel/cpu/cyrix.c index 3fd7a67bb06a..db5868cd2443 100644 --- a/arch/x86/kernel/cpu/cyrix.c +++ b/arch/x86/kernel/cpu/cyrix.c | |||
| @@ -116,7 +116,7 @@ static void __cpuinit set_cx86_reorder(void) | |||
| 116 | setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */ | 116 | setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */ |
| 117 | 117 | ||
| 118 | /* Load/Store Serialize to mem access disable (=reorder it) */ | 118 | /* Load/Store Serialize to mem access disable (=reorder it) */ |
| 119 | setCx86(CX86_PCR0, getCx86(CX86_PCR0) & ~0x80); | 119 | setCx86_old(CX86_PCR0, getCx86_old(CX86_PCR0) & ~0x80); |
| 120 | /* set load/store serialize from 1GB to 4GB */ | 120 | /* set load/store serialize from 1GB to 4GB */ |
| 121 | ccr3 |= 0xe0; | 121 | ccr3 |= 0xe0; |
| 122 | setCx86(CX86_CCR3, ccr3); | 122 | setCx86(CX86_CCR3, ccr3); |
| @@ -127,11 +127,11 @@ static void __cpuinit set_cx86_memwb(void) | |||
| 127 | printk(KERN_INFO "Enable Memory-Write-back mode on Cyrix/NSC processor.\n"); | 127 | printk(KERN_INFO "Enable Memory-Write-back mode on Cyrix/NSC processor.\n"); |
| 128 | 128 | ||
| 129 | /* CCR2 bit 2: unlock NW bit */ | 129 | /* CCR2 bit 2: unlock NW bit */ |
| 130 | setCx86(CX86_CCR2, getCx86(CX86_CCR2) & ~0x04); | 130 | setCx86_old(CX86_CCR2, getCx86_old(CX86_CCR2) & ~0x04); |
| 131 | /* set 'Not Write-through' */ | 131 | /* set 'Not Write-through' */ |
| 132 | write_cr0(read_cr0() | X86_CR0_NW); | 132 | write_cr0(read_cr0() | X86_CR0_NW); |
| 133 | /* CCR2 bit 2: lock NW bit and set WT1 */ | 133 | /* CCR2 bit 2: lock NW bit and set WT1 */ |
| 134 | setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x14); | 134 | setCx86_old(CX86_CCR2, getCx86_old(CX86_CCR2) | 0x14); |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | static void __cpuinit set_cx86_inc(void) | 137 | static void __cpuinit set_cx86_inc(void) |
| @@ -144,10 +144,10 @@ static void __cpuinit set_cx86_inc(void) | |||
| 144 | setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */ | 144 | setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */ |
| 145 | /* PCR1 -- Performance Control */ | 145 | /* PCR1 -- Performance Control */ |
| 146 | /* Incrementor on, whatever that is */ | 146 | /* Incrementor on, whatever that is */ |
| 147 | setCx86(CX86_PCR1, getCx86(CX86_PCR1) | 0x02); | 147 | setCx86_old(CX86_PCR1, getCx86_old(CX86_PCR1) | 0x02); |
| 148 | /* PCR0 -- Performance Control */ | 148 | /* PCR0 -- Performance Control */ |
| 149 | /* Incrementor Margin 10 */ | 149 | /* Incrementor Margin 10 */ |
| 150 | setCx86(CX86_PCR0, getCx86(CX86_PCR0) | 0x04); | 150 | setCx86_old(CX86_PCR0, getCx86_old(CX86_PCR0) | 0x04); |
| 151 | setCx86(CX86_CCR3, ccr3); /* disable MAPEN */ | 151 | setCx86(CX86_CCR3, ccr3); /* disable MAPEN */ |
| 152 | } | 152 | } |
| 153 | 153 | ||
| @@ -162,14 +162,14 @@ static void __cpuinit geode_configure(void) | |||
| 162 | local_irq_save(flags); | 162 | local_irq_save(flags); |
| 163 | 163 | ||
| 164 | /* Suspend on halt power saving and enable #SUSP pin */ | 164 | /* Suspend on halt power saving and enable #SUSP pin */ |
| 165 | setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x88); | 165 | setCx86_old(CX86_CCR2, getCx86_old(CX86_CCR2) | 0x88); |
| 166 | 166 | ||
| 167 | ccr3 = getCx86(CX86_CCR3); | 167 | ccr3 = getCx86(CX86_CCR3); |
| 168 | setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */ | 168 | setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */ |
| 169 | 169 | ||
| 170 | 170 | ||
| 171 | /* FPU fast, DTE cache, Mem bypass */ | 171 | /* FPU fast, DTE cache, Mem bypass */ |
| 172 | setCx86(CX86_CCR4, getCx86(CX86_CCR4) | 0x38); | 172 | setCx86_old(CX86_CCR4, getCx86_old(CX86_CCR4) | 0x38); |
| 173 | setCx86(CX86_CCR3, ccr3); /* disable MAPEN */ | 173 | setCx86(CX86_CCR3, ccr3); /* disable MAPEN */ |
| 174 | 174 | ||
| 175 | set_cx86_memwb(); | 175 | set_cx86_memwb(); |
| @@ -286,7 +286,7 @@ static void __cpuinit init_cyrix(struct cpuinfo_x86 *c) | |||
| 286 | /* GXm supports extended cpuid levels 'ala' AMD */ | 286 | /* GXm supports extended cpuid levels 'ala' AMD */ |
| 287 | if (c->cpuid_level == 2) { | 287 | if (c->cpuid_level == 2) { |
| 288 | /* Enable cxMMX extensions (GX1 Datasheet 54) */ | 288 | /* Enable cxMMX extensions (GX1 Datasheet 54) */ |
| 289 | setCx86(CX86_CCR7, getCx86(CX86_CCR7) | 1); | 289 | setCx86_old(CX86_CCR7, getCx86_old(CX86_CCR7) | 1); |
| 290 | 290 | ||
| 291 | /* | 291 | /* |
| 292 | * GXm : 0x30 ... 0x5f GXm datasheet 51 | 292 | * GXm : 0x30 ... 0x5f GXm datasheet 51 |
| @@ -309,7 +309,7 @@ static void __cpuinit init_cyrix(struct cpuinfo_x86 *c) | |||
| 309 | if (dir1 > 7) { | 309 | if (dir1 > 7) { |
| 310 | dir0_msn++; /* M II */ | 310 | dir0_msn++; /* M II */ |
| 311 | /* Enable MMX extensions (App note 108) */ | 311 | /* Enable MMX extensions (App note 108) */ |
| 312 | setCx86(CX86_CCR7, getCx86(CX86_CCR7)|1); | 312 | setCx86_old(CX86_CCR7, getCx86_old(CX86_CCR7)|1); |
| 313 | } else { | 313 | } else { |
| 314 | c->coma_bug = 1; /* 6x86MX, it has the bug. */ | 314 | c->coma_bug = 1; /* 6x86MX, it has the bug. */ |
| 315 | } | 315 | } |
| @@ -424,7 +424,7 @@ static void __cpuinit cyrix_identify(struct cpuinfo_x86 *c) | |||
| 424 | local_irq_save(flags); | 424 | local_irq_save(flags); |
| 425 | ccr3 = getCx86(CX86_CCR3); | 425 | ccr3 = getCx86(CX86_CCR3); |
| 426 | setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */ | 426 | setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */ |
| 427 | setCx86(CX86_CCR4, getCx86(CX86_CCR4) | 0x80); /* enable cpuid */ | 427 | setCx86_old(CX86_CCR4, getCx86_old(CX86_CCR4) | 0x80); /* enable cpuid */ |
| 428 | setCx86(CX86_CCR3, ccr3); /* disable MAPEN */ | 428 | setCx86(CX86_CCR3, ccr3); /* disable MAPEN */ |
| 429 | local_irq_restore(flags); | 429 | local_irq_restore(flags); |
| 430 | } | 430 | } |
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c index 6b0a10b002f1..3f46afbb1cf1 100644 --- a/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Routines to indentify caches on Intel CPU. | 2 | * Routines to indentify caches on Intel CPU. |
| 3 | * | 3 | * |
| 4 | * Changes: | 4 | * Changes: |
| 5 | * Venkatesh Pallipadi : Adding cache identification through cpuid(4) | 5 | * Venkatesh Pallipadi : Adding cache identification through cpuid(4) |
| 6 | * Ashok Raj <ashok.raj@intel.com>: Work with CPU hotplug infrastructure. | 6 | * Ashok Raj <ashok.raj@intel.com>: Work with CPU hotplug infrastructure. |
| 7 | * Andi Kleen / Andreas Herrmann : CPUID4 emulation on AMD. | 7 | * Andi Kleen / Andreas Herrmann : CPUID4 emulation on AMD. |
| 8 | */ | 8 | */ |
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <linux/compiler.h> | 13 | #include <linux/compiler.h> |
| 14 | #include <linux/cpu.h> | 14 | #include <linux/cpu.h> |
| 15 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
| 16 | #include <linux/pci.h> | ||
| 16 | 17 | ||
| 17 | #include <asm/processor.h> | 18 | #include <asm/processor.h> |
| 18 | #include <asm/smp.h> | 19 | #include <asm/smp.h> |
| @@ -130,9 +131,18 @@ struct _cpuid4_info { | |||
| 130 | union _cpuid4_leaf_ebx ebx; | 131 | union _cpuid4_leaf_ebx ebx; |
| 131 | union _cpuid4_leaf_ecx ecx; | 132 | union _cpuid4_leaf_ecx ecx; |
| 132 | unsigned long size; | 133 | unsigned long size; |
| 134 | unsigned long can_disable; | ||
| 133 | cpumask_t shared_cpu_map; /* future?: only cpus/node is needed */ | 135 | cpumask_t shared_cpu_map; /* future?: only cpus/node is needed */ |
| 134 | }; | 136 | }; |
| 135 | 137 | ||
| 138 | #ifdef CONFIG_PCI | ||
| 139 | static struct pci_device_id k8_nb_id[] = { | ||
| 140 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, 0x1103) }, | ||
| 141 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, 0x1203) }, | ||
| 142 | {} | ||
| 143 | }; | ||
| 144 | #endif | ||
| 145 | |||
| 136 | unsigned short num_cache_leaves; | 146 | unsigned short num_cache_leaves; |
| 137 | 147 | ||
| 138 | /* AMD doesn't have CPUID4. Emulate it here to report the same | 148 | /* AMD doesn't have CPUID4. Emulate it here to report the same |
| @@ -182,9 +192,10 @@ static unsigned short assocs[] __cpuinitdata = { | |||
| 182 | static unsigned char levels[] __cpuinitdata = { 1, 1, 2, 3 }; | 192 | static unsigned char levels[] __cpuinitdata = { 1, 1, 2, 3 }; |
| 183 | static unsigned char types[] __cpuinitdata = { 1, 2, 3, 3 }; | 193 | static unsigned char types[] __cpuinitdata = { 1, 2, 3, 3 }; |
| 184 | 194 | ||
| 185 | static void __cpuinit amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax, | 195 | static void __cpuinit |
| 186 | union _cpuid4_leaf_ebx *ebx, | 196 | amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax, |
| 187 | union _cpuid4_leaf_ecx *ecx) | 197 | union _cpuid4_leaf_ebx *ebx, |
| 198 | union _cpuid4_leaf_ecx *ecx) | ||
| 188 | { | 199 | { |
| 189 | unsigned dummy; | 200 | unsigned dummy; |
| 190 | unsigned line_size, lines_per_tag, assoc, size_in_kb; | 201 | unsigned line_size, lines_per_tag, assoc, size_in_kb; |
| @@ -251,27 +262,40 @@ static void __cpuinit amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax, | |||
| 251 | (ebx->split.ways_of_associativity + 1) - 1; | 262 | (ebx->split.ways_of_associativity + 1) - 1; |
| 252 | } | 263 | } |
| 253 | 264 | ||
| 254 | static int __cpuinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_leaf) | 265 | static void __cpuinit |
| 266 | amd_check_l3_disable(int index, struct _cpuid4_info *this_leaf) | ||
| 267 | { | ||
| 268 | if (index < 3) | ||
| 269 | return; | ||
| 270 | this_leaf->can_disable = 1; | ||
| 271 | } | ||
| 272 | |||
| 273 | static int | ||
| 274 | __cpuinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_leaf) | ||
| 255 | { | 275 | { |
| 256 | union _cpuid4_leaf_eax eax; | 276 | union _cpuid4_leaf_eax eax; |
| 257 | union _cpuid4_leaf_ebx ebx; | 277 | union _cpuid4_leaf_ebx ebx; |
| 258 | union _cpuid4_leaf_ecx ecx; | 278 | union _cpuid4_leaf_ecx ecx; |
| 259 | unsigned edx; | 279 | unsigned edx; |
| 260 | 280 | ||
| 261 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) | 281 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) { |
| 262 | amd_cpuid4(index, &eax, &ebx, &ecx); | 282 | amd_cpuid4(index, &eax, &ebx, &ecx); |
| 263 | else | 283 | if (boot_cpu_data.x86 >= 0x10) |
| 264 | cpuid_count(4, index, &eax.full, &ebx.full, &ecx.full, &edx); | 284 | amd_check_l3_disable(index, this_leaf); |
| 285 | } else { | ||
| 286 | cpuid_count(4, index, &eax.full, &ebx.full, &ecx.full, &edx); | ||
| 287 | } | ||
| 288 | |||
| 265 | if (eax.split.type == CACHE_TYPE_NULL) | 289 | if (eax.split.type == CACHE_TYPE_NULL) |
| 266 | return -EIO; /* better error ? */ | 290 | return -EIO; /* better error ? */ |
| 267 | 291 | ||
| 268 | this_leaf->eax = eax; | 292 | this_leaf->eax = eax; |
| 269 | this_leaf->ebx = ebx; | 293 | this_leaf->ebx = ebx; |
| 270 | this_leaf->ecx = ecx; | 294 | this_leaf->ecx = ecx; |
| 271 | this_leaf->size = (ecx.split.number_of_sets + 1) * | 295 | this_leaf->size = (ecx.split.number_of_sets + 1) * |
| 272 | (ebx.split.coherency_line_size + 1) * | 296 | (ebx.split.coherency_line_size + 1) * |
| 273 | (ebx.split.physical_line_partition + 1) * | 297 | (ebx.split.physical_line_partition + 1) * |
| 274 | (ebx.split.ways_of_associativity + 1); | 298 | (ebx.split.ways_of_associativity + 1); |
| 275 | return 0; | 299 | return 0; |
| 276 | } | 300 | } |
| 277 | 301 | ||
| @@ -453,7 +477,7 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c) | |||
| 453 | 477 | ||
| 454 | /* pointer to _cpuid4_info array (for each cache leaf) */ | 478 | /* pointer to _cpuid4_info array (for each cache leaf) */ |
| 455 | static DEFINE_PER_CPU(struct _cpuid4_info *, cpuid4_info); | 479 | static DEFINE_PER_CPU(struct _cpuid4_info *, cpuid4_info); |
| 456 | #define CPUID4_INFO_IDX(x, y) (&((per_cpu(cpuid4_info, x))[y])) | 480 | #define CPUID4_INFO_IDX(x, y) (&((per_cpu(cpuid4_info, x))[y])) |
| 457 | 481 | ||
| 458 | #ifdef CONFIG_SMP | 482 | #ifdef CONFIG_SMP |
| 459 | static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) | 483 | static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) |
| @@ -490,7 +514,7 @@ static void __cpuinit cache_remove_shared_cpu_map(unsigned int cpu, int index) | |||
| 490 | 514 | ||
| 491 | this_leaf = CPUID4_INFO_IDX(cpu, index); | 515 | this_leaf = CPUID4_INFO_IDX(cpu, index); |
| 492 | for_each_cpu_mask_nr(sibling, this_leaf->shared_cpu_map) { | 516 | for_each_cpu_mask_nr(sibling, this_leaf->shared_cpu_map) { |
| 493 | sibling_leaf = CPUID4_INFO_IDX(sibling, index); | 517 | sibling_leaf = CPUID4_INFO_IDX(sibling, index); |
| 494 | cpu_clear(cpu, sibling_leaf->shared_cpu_map); | 518 | cpu_clear(cpu, sibling_leaf->shared_cpu_map); |
| 495 | } | 519 | } |
| 496 | } | 520 | } |
| @@ -572,7 +596,7 @@ struct _index_kobject { | |||
| 572 | 596 | ||
| 573 | /* pointer to array of kobjects for cpuX/cache/indexY */ | 597 | /* pointer to array of kobjects for cpuX/cache/indexY */ |
| 574 | static DEFINE_PER_CPU(struct _index_kobject *, index_kobject); | 598 | static DEFINE_PER_CPU(struct _index_kobject *, index_kobject); |
| 575 | #define INDEX_KOBJECT_PTR(x, y) (&((per_cpu(index_kobject, x))[y])) | 599 | #define INDEX_KOBJECT_PTR(x, y) (&((per_cpu(index_kobject, x))[y])) |
| 576 | 600 | ||
| 577 | #define show_one_plus(file_name, object, val) \ | 601 | #define show_one_plus(file_name, object, val) \ |
| 578 | static ssize_t show_##file_name \ | 602 | static ssize_t show_##file_name \ |
| @@ -637,6 +661,99 @@ static ssize_t show_type(struct _cpuid4_info *this_leaf, char *buf) { | |||
| 637 | } | 661 | } |
| 638 | } | 662 | } |
| 639 | 663 | ||
| 664 | #define to_object(k) container_of(k, struct _index_kobject, kobj) | ||
| 665 | #define to_attr(a) container_of(a, struct _cache_attr, attr) | ||
| 666 | |||
| 667 | #ifdef CONFIG_PCI | ||
| 668 | static struct pci_dev *get_k8_northbridge(int node) | ||
| 669 | { | ||
| 670 | struct pci_dev *dev = NULL; | ||
| 671 | int i; | ||
| 672 | |||
| 673 | for (i = 0; i <= node; i++) { | ||
| 674 | do { | ||
| 675 | dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev); | ||
| 676 | if (!dev) | ||
| 677 | break; | ||
| 678 | } while (!pci_match_id(&k8_nb_id[0], dev)); | ||
| 679 | if (!dev) | ||
| 680 | break; | ||
| 681 | } | ||
| 682 | return dev; | ||
| 683 | } | ||
| 684 | #else | ||
| 685 | static struct pci_dev *get_k8_northbridge(int node) | ||
| 686 | { | ||
| 687 | return NULL; | ||
| 688 | } | ||
| 689 | #endif | ||
| 690 | |||
| 691 | static ssize_t show_cache_disable(struct _cpuid4_info *this_leaf, char *buf) | ||
| 692 | { | ||
| 693 | int node = cpu_to_node(first_cpu(this_leaf->shared_cpu_map)); | ||
| 694 | struct pci_dev *dev = NULL; | ||
| 695 | ssize_t ret = 0; | ||
| 696 | int i; | ||
| 697 | |||
| 698 | if (!this_leaf->can_disable) | ||
| 699 | return sprintf(buf, "Feature not enabled\n"); | ||
| 700 | |||
| 701 | dev = get_k8_northbridge(node); | ||
| 702 | if (!dev) { | ||
| 703 | printk(KERN_ERR "Attempting AMD northbridge operation on a system with no northbridge\n"); | ||
| 704 | return -EINVAL; | ||
| 705 | } | ||
| 706 | |||
| 707 | for (i = 0; i < 2; i++) { | ||
| 708 | unsigned int reg; | ||
| 709 | |||
| 710 | pci_read_config_dword(dev, 0x1BC + i * 4, ®); | ||
| 711 | |||
| 712 | ret += sprintf(buf, "%sEntry: %d\n", buf, i); | ||
| 713 | ret += sprintf(buf, "%sReads: %s\tNew Entries: %s\n", | ||
| 714 | buf, | ||
| 715 | reg & 0x80000000 ? "Disabled" : "Allowed", | ||
| 716 | reg & 0x40000000 ? "Disabled" : "Allowed"); | ||
| 717 | ret += sprintf(buf, "%sSubCache: %x\tIndex: %x\n", | ||
| 718 | buf, (reg & 0x30000) >> 16, reg & 0xfff); | ||
| 719 | } | ||
| 720 | return ret; | ||
| 721 | } | ||
| 722 | |||
| 723 | static ssize_t | ||
| 724 | store_cache_disable(struct _cpuid4_info *this_leaf, const char *buf, | ||
| 725 | size_t count) | ||
| 726 | { | ||
| 727 | int node = cpu_to_node(first_cpu(this_leaf->shared_cpu_map)); | ||
| 728 | struct pci_dev *dev = NULL; | ||
| 729 | unsigned int ret, index, val; | ||
| 730 | |||
| 731 | if (!this_leaf->can_disable) | ||
| 732 | return 0; | ||
| 733 | |||
| 734 | if (strlen(buf) > 15) | ||
| 735 | return -EINVAL; | ||
| 736 | |||
| 737 | ret = sscanf(buf, "%x %x", &index, &val); | ||
| 738 | if (ret != 2) | ||
| 739 | return -EINVAL; | ||
| 740 | if (index > 1) | ||
| 741 | return -EINVAL; | ||
| 742 | |||
| 743 | val |= 0xc0000000; | ||
| 744 | dev = get_k8_northbridge(node); | ||
| 745 | if (!dev) { | ||
| 746 | printk(KERN_ERR "Attempting AMD northbridge operation on a system with no northbridge\n"); | ||
| 747 | return -EINVAL; | ||
| 748 | } | ||
| 749 | |||
| 750 | pci_write_config_dword(dev, 0x1BC + index * 4, val & ~0x40000000); | ||
| 751 | wbinvd(); | ||
| 752 | pci_write_config_dword(dev, 0x1BC + index * 4, val); | ||
| 753 | |||
| 754 | return 1; | ||
| 755 | } | ||
| 756 | |||
| 640 | struct _cache_attr { | 757 | struct _cache_attr { |
| 641 | struct attribute attr; | 758 | struct attribute attr; |
| 642 | ssize_t (*show)(struct _cpuid4_info *, char *); | 759 | ssize_t (*show)(struct _cpuid4_info *, char *); |
| @@ -657,6 +774,8 @@ define_one_ro(size); | |||
| 657 | define_one_ro(shared_cpu_map); | 774 | define_one_ro(shared_cpu_map); |
| 658 | define_one_ro(shared_cpu_list); | 775 | define_one_ro(shared_cpu_list); |
| 659 | 776 | ||
| 777 | static struct _cache_attr cache_disable = __ATTR(cache_disable, 0644, show_cache_disable, store_cache_disable); | ||
| 778 | |||
| 660 | static struct attribute * default_attrs[] = { | 779 | static struct attribute * default_attrs[] = { |
| 661 | &type.attr, | 780 | &type.attr, |
| 662 | &level.attr, | 781 | &level.attr, |
| @@ -667,12 +786,10 @@ static struct attribute * default_attrs[] = { | |||
| 667 | &size.attr, | 786 | &size.attr, |
| 668 | &shared_cpu_map.attr, | 787 | &shared_cpu_map.attr, |
| 669 | &shared_cpu_list.attr, | 788 | &shared_cpu_list.attr, |
| 789 | &cache_disable.attr, | ||
| 670 | NULL | 790 | NULL |
| 671 | }; | 791 | }; |
| 672 | 792 | ||
| 673 | #define to_object(k) container_of(k, struct _index_kobject, kobj) | ||
| 674 | #define to_attr(a) container_of(a, struct _cache_attr, attr) | ||
| 675 | |||
| 676 | static ssize_t show(struct kobject * kobj, struct attribute * attr, char * buf) | 793 | static ssize_t show(struct kobject * kobj, struct attribute * attr, char * buf) |
| 677 | { | 794 | { |
| 678 | struct _cache_attr *fattr = to_attr(attr); | 795 | struct _cache_attr *fattr = to_attr(attr); |
| @@ -682,14 +799,22 @@ static ssize_t show(struct kobject * kobj, struct attribute * attr, char * buf) | |||
| 682 | ret = fattr->show ? | 799 | ret = fattr->show ? |
| 683 | fattr->show(CPUID4_INFO_IDX(this_leaf->cpu, this_leaf->index), | 800 | fattr->show(CPUID4_INFO_IDX(this_leaf->cpu, this_leaf->index), |
| 684 | buf) : | 801 | buf) : |
| 685 | 0; | 802 | 0; |
| 686 | return ret; | 803 | return ret; |
| 687 | } | 804 | } |
| 688 | 805 | ||
| 689 | static ssize_t store(struct kobject * kobj, struct attribute * attr, | 806 | static ssize_t store(struct kobject * kobj, struct attribute * attr, |
| 690 | const char * buf, size_t count) | 807 | const char * buf, size_t count) |
| 691 | { | 808 | { |
| 692 | return 0; | 809 | struct _cache_attr *fattr = to_attr(attr); |
| 810 | struct _index_kobject *this_leaf = to_object(kobj); | ||
| 811 | ssize_t ret; | ||
| 812 | |||
| 813 | ret = fattr->store ? | ||
| 814 | fattr->store(CPUID4_INFO_IDX(this_leaf->cpu, this_leaf->index), | ||
| 815 | buf, count) : | ||
| 816 | 0; | ||
| 817 | return ret; | ||
| 693 | } | 818 | } |
| 694 | 819 | ||
| 695 | static struct sysfs_ops sysfs_ops = { | 820 | static struct sysfs_ops sysfs_ops = { |
diff --git a/include/asm-x86/processor-cyrix.h b/include/asm-x86/processor-cyrix.h index 97568ada1f97..1198f2a0e42c 100644 --- a/include/asm-x86/processor-cyrix.h +++ b/include/asm-x86/processor-cyrix.h | |||
| @@ -28,3 +28,11 @@ static inline void setCx86(u8 reg, u8 data) | |||
| 28 | outb(reg, 0x22); | 28 | outb(reg, 0x22); |
| 29 | outb(data, 0x23); | 29 | outb(data, 0x23); |
| 30 | } | 30 | } |
| 31 | |||
| 32 | #define getCx86_old(reg) ({ outb((reg), 0x22); inb(0x23); }) | ||
| 33 | |||
| 34 | #define setCx86_old(reg, data) do { \ | ||
| 35 | outb((reg), 0x22); \ | ||
| 36 | outb((data), 0x23); \ | ||
| 37 | } while (0) | ||
| 38 | |||
