Commit 5afffee2 authored by Linus Torvalds's avatar Linus Torvalds

Merge

parents de6639d2 6823c0fe
List of maintainers and how to submit kernel changes List of maintainers and how to submit kernel changes
Please try to follow the guidelines below. This will make things Please try to follow the guidelines below. This will make things
...@@ -261,7 +262,6 @@ BFS FILE SYSTEM ...@@ -261,7 +262,6 @@ BFS FILE SYSTEM
P: Tigran A. Aivazian P: Tigran A. Aivazian
M: tigran@veritas.com M: tigran@veritas.com
L: linux-kernel@vger.kernel.org L: linux-kernel@vger.kernel.org
W: http://www.ocston.org/~tigran/patches/bfs
S: Maintained S: Maintained
BLOCK LAYER BLOCK LAYER
...@@ -654,8 +654,8 @@ W: http://www.nyx.net/~arobinso ...@@ -654,8 +654,8 @@ W: http://www.nyx.net/~arobinso
S: Maintained S: Maintained
HFS FILESYSTEM HFS FILESYSTEM
P: Adrian Sun P: Oliver Neukum
M: asun@cobaltnet.com M: oliver@neukum.org
L: linux-kernel@vger.kernel.org L: linux-kernel@vger.kernel.org
S: Maintained S: Maintained
......
...@@ -453,6 +453,7 @@ fi ...@@ -453,6 +453,7 @@ fi
bool 'Kernel debugging' CONFIG_DEBUG_KERNEL bool 'Kernel debugging' CONFIG_DEBUG_KERNEL
if [ "$CONFIG_DEBUG_KERNEL" != "n" ]; then if [ "$CONFIG_DEBUG_KERNEL" != "n" ]; then
bool ' Check for stack overflows' CONFIG_DEBUG_STACKOVERFLOW
bool ' Debug memory allocations' CONFIG_DEBUG_SLAB bool ' Debug memory allocations' CONFIG_DEBUG_SLAB
bool ' Memory mapped I/O debugging' CONFIG_DEBUG_IOVIRT bool ' Memory mapped I/O debugging' CONFIG_DEBUG_IOVIRT
bool ' Magic SysRq key' CONFIG_MAGIC_SYSRQ bool ' Magic SysRq key' CONFIG_MAGIC_SYSRQ
......
...@@ -300,7 +300,6 @@ static void mce_checkregs (void *info) ...@@ -300,7 +300,6 @@ static void mce_checkregs (void *info)
static void do_mce_timer(void *data) static void do_mce_timer(void *data)
{ {
mce_checkregs(NULL);
smp_call_function (mce_checkregs, NULL, 1, 1); smp_call_function (mce_checkregs, NULL, 1, 1);
} }
......
...@@ -42,6 +42,21 @@ static void __init init_amd(struct cpuinfo_x86 *c) ...@@ -42,6 +42,21 @@ static void __init init_amd(struct cpuinfo_x86 *c)
switch(c->x86) switch(c->x86)
{ {
case 4:
/*
* General Systems BIOSen alias the cpu frequency registers
* of the Elan at 0x000df000. Unfortuantly, one of the Linux
* drivers subsequently pokes it, and changes the CPU speed.
* Workaround : Remove the unneeded alias.
*/
#define CBAR (0xfffc) /* Configuration Base Address (32-bit) */
#define CBAR_ENB (0x80000000)
#define CBAR_KEY (0X000000CB)
if (c->x86_model==9 || c->x86_model == 10) {
if (inl (CBAR) & CBAR_ENB)
outl (0 | CBAR_KEY, CBAR);
}
case 5: case 5:
if( c->x86_model < 6 ) if( c->x86_model < 6 )
{ {
......
...@@ -328,8 +328,22 @@ asmlinkage unsigned int do_IRQ(struct pt_regs regs) ...@@ -328,8 +328,22 @@ asmlinkage unsigned int do_IRQ(struct pt_regs regs)
irq_desc_t *desc = irq_desc + irq; irq_desc_t *desc = irq_desc + irq;
struct irqaction * action; struct irqaction * action;
unsigned int status; unsigned int status;
long esp;
irq_enter(); irq_enter();
#ifdef CONFIG_DEBUG_STACKOVERFLOW
/* Debugging check for stack overflow: is there less than 1KB free? */
__asm__ __volatile__("andl %%esp,%0" : "=r" (esp) : "0" (8191));
if (unlikely(esp < (sizeof(struct task_struct) + 1024))) {
extern void show_stack(unsigned long *);
printk("do_IRQ: stack overflow: %ld\n",
esp - sizeof(struct task_struct));
__asm__ __volatile__("movl %%esp,%0" : "=r" (esp));
show_stack((void *)esp);
}
#endif
kstat.irqs[cpu][irq]++; kstat.irqs[cpu][irq]++;
spin_lock(&desc->lock); spin_lock(&desc->lock);
desc->handler->ack(irq); desc->handler->ack(irq);
......
...@@ -260,7 +260,7 @@ static void do_update_one(void *unused) ...@@ -260,7 +260,7 @@ static void do_update_one(void *unused)
if (microcode[i].rev < rev) { if (microcode[i].rev < rev) {
spin_unlock_irqrestore(&microcode_update_lock, flags); spin_unlock_irqrestore(&microcode_update_lock, flags);
printk(KERN_ERR printk(KERN_INFO
"microcode: CPU%d not 'upgrading' to earlier revision" "microcode: CPU%d not 'upgrading' to earlier revision"
" %d (current=%d)\n", cpu_num, microcode[i].rev, rev); " %d (current=%d)\n", cpu_num, microcode[i].rev, rev);
return; return;
...@@ -268,7 +268,7 @@ static void do_update_one(void *unused) ...@@ -268,7 +268,7 @@ static void do_update_one(void *unused)
/* notify the caller of success on this cpu */ /* notify the caller of success on this cpu */
req->err = 0; req->err = 0;
spin_unlock_irqrestore(&microcode_update_lock, flags); spin_unlock_irqrestore(&microcode_update_lock, flags);
printk(KERN_ERR printk(KERN_INFO
"microcode: CPU%d already at revision" "microcode: CPU%d already at revision"
" %d (current=%d)\n", cpu_num, microcode[i].rev, rev); " %d (current=%d)\n", cpu_num, microcode[i].rev, rev);
return; return;
......
...@@ -482,7 +482,7 @@ void __init mem_init(void) ...@@ -482,7 +482,7 @@ void __init mem_init(void)
datasize = (unsigned long) &_edata - (unsigned long) &_etext; datasize = (unsigned long) &_edata - (unsigned long) &_etext;
initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
printk("Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init, %ldk highmem)\n", printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init, %ldk highmem)\n",
(unsigned long) nr_free_pages() << (PAGE_SHIFT-10), (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
num_physpages << (PAGE_SHIFT-10), num_physpages << (PAGE_SHIFT-10),
codesize >> 10, codesize >> 10,
...@@ -584,14 +584,14 @@ void free_initmem(void) ...@@ -584,14 +584,14 @@ void free_initmem(void)
free_page(addr); free_page(addr);
totalram_pages++; totalram_pages++;
} }
printk ("Freeing unused kernel memory: %dk freed\n", (&__init_end - &__init_begin) >> 10); printk (KERN_INFO "Freeing unused kernel memory: %dk freed\n", (&__init_end - &__init_begin) >> 10);
} }
#ifdef CONFIG_BLK_DEV_INITRD #ifdef CONFIG_BLK_DEV_INITRD
void free_initrd_mem(unsigned long start, unsigned long end) void free_initrd_mem(unsigned long start, unsigned long end)
{ {
if (start < end) if (start < end)
printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); printk (KERN_INFO "Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
for (; start < end; start += PAGE_SIZE) { for (; start < end; start += PAGE_SIZE) {
ClearPageReserved(virt_to_page(start)); ClearPageReserved(virt_to_page(start));
set_page_count(virt_to_page(start), 1); set_page_count(virt_to_page(start), 1);
......
...@@ -291,7 +291,7 @@ void pcibios_set_master(struct pci_dev *dev) ...@@ -291,7 +291,7 @@ void pcibios_set_master(struct pci_dev *dev)
lat = pcibios_max_latency; lat = pcibios_max_latency;
else else
return; return;
printk("PCI: Setting latency timer of device %s to %d\n", dev->slot_name, lat); printk(KERN_DEBUG "PCI: Setting latency timer of device %s to %d\n", dev->slot_name, lat);
pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat); pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
} }
......
...@@ -3763,12 +3763,15 @@ do_smb_super_data_conv(void *raw_data) ...@@ -3763,12 +3763,15 @@ do_smb_super_data_conv(void *raw_data)
struct smb_mount_data *s = (struct smb_mount_data *)raw_data; struct smb_mount_data *s = (struct smb_mount_data *)raw_data;
struct smb_mount_data32 *s32 = (struct smb_mount_data32 *)raw_data; struct smb_mount_data32 *s32 = (struct smb_mount_data32 *)raw_data;
if (s32->version != SMB_MOUNT_OLDVERSION)
goto out;
s->version = s32->version; s->version = s32->version;
s->mounted_uid = s32->mounted_uid; s->mounted_uid = s32->mounted_uid;
s->uid = s32->uid; s->uid = s32->uid;
s->gid = s32->gid; s->gid = s32->gid;
s->file_mode = s32->file_mode; s->file_mode = s32->file_mode;
s->dir_mode = s32->dir_mode; s->dir_mode = s32->dir_mode;
out:
return raw_data; return raw_data;
} }
......
...@@ -333,12 +333,15 @@ static void *do_smb_super_data_conv(void *raw_data) ...@@ -333,12 +333,15 @@ static void *do_smb_super_data_conv(void *raw_data)
struct smb_mount_data *s = (struct smb_mount_data *)raw_data; struct smb_mount_data *s = (struct smb_mount_data *)raw_data;
struct smb_mount_data32 *s32 = (struct smb_mount_data32 *)raw_data; struct smb_mount_data32 *s32 = (struct smb_mount_data32 *)raw_data;
if (s32->version != SMB_MOUNT_OLDVERSION)
goto out;
s->version = s32->version; s->version = s32->version;
s->mounted_uid = s32->mounted_uid; s->mounted_uid = s32->mounted_uid;
s->uid = s32->uid; s->uid = s32->uid;
s->gid = s32->gid; s->gid = s32->gid;
s->file_mode = s32->file_mode; s->file_mode = s32->file_mode;
s->dir_mode = s32->dir_mode; s->dir_mode = s32->dir_mode;
out:
return raw_data; return raw_data;
} }
......
...@@ -1563,12 +1563,15 @@ static void *do_smb_super_data_conv(void *raw_data) ...@@ -1563,12 +1563,15 @@ static void *do_smb_super_data_conv(void *raw_data)
struct smb_mount_data *s = (struct smb_mount_data *)raw_data; struct smb_mount_data *s = (struct smb_mount_data *)raw_data;
struct smb_mount_data32 *s32 = (struct smb_mount_data32 *)raw_data; struct smb_mount_data32 *s32 = (struct smb_mount_data32 *)raw_data;
if (s32->version != SMB_MOUNT_OLDVERSION)
goto out;
s->version = s32->version; s->version = s32->version;
s->mounted_uid = low2highuid(s32->mounted_uid); s->mounted_uid = low2highuid(s32->mounted_uid);
s->uid = low2highuid(s32->uid); s->uid = low2highuid(s32->uid);
s->gid = low2highgid(s32->gid); s->gid = low2highgid(s32->gid);
s->file_mode = s32->file_mode; s->file_mode = s32->file_mode;
s->dir_mode = s32->dir_mode; s->dir_mode = s32->dir_mode;
out:
return raw_data; return raw_data;
} }
......
...@@ -1582,6 +1582,8 @@ static void *do_smb_super_data_conv(void *raw_data) ...@@ -1582,6 +1582,8 @@ static void *do_smb_super_data_conv(void *raw_data)
struct smb_mount_data news, *s = &news; struct smb_mount_data news, *s = &news;
struct smb_mount_data32 *s32 = (struct smb_mount_data32 *)raw_data; struct smb_mount_data32 *s32 = (struct smb_mount_data32 *)raw_data;
if (s32->version != SMB_MOUNT_OLDVERSION)
goto out;
s->version = s32->version; s->version = s32->version;
s->mounted_uid = low2highuid(s32->mounted_uid); s->mounted_uid = low2highuid(s32->mounted_uid);
s->uid = low2highuid(s32->uid); s->uid = low2highuid(s32->uid);
...@@ -1589,6 +1591,7 @@ static void *do_smb_super_data_conv(void *raw_data) ...@@ -1589,6 +1591,7 @@ static void *do_smb_super_data_conv(void *raw_data)
s->file_mode = s32->file_mode; s->file_mode = s32->file_mode;
s->dir_mode = s32->dir_mode; s->dir_mode = s32->dir_mode;
memcpy(raw_data, s, sizeof(struct smb_mount_data)); memcpy(raw_data, s, sizeof(struct smb_mount_data));
out:
return raw_data; return raw_data;
} }
......
/* x86-64 MTRR (Memory Type Range Register) driver. /* x86-64 MTRR (Memory Type Range Register) driver.
Based largely upon arch/i386/kernel/mtrr.c Based largely upon arch/i386/kernel/mtrr.c
Copyright (C) 1997-2000 Richard Gooch Copyright (C) 1997-2000 Richard Gooch
Copyright (C) 2002 Dave Jones. Copyright (C) 2002 Dave Jones.
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
(For earlier history, see arch/i386/kernel/mtrr.c) (For earlier history, see arch/i386/kernel/mtrr.c)
v2.00 September 2001 Dave Jones <davej@suse.de> v2.00 September 2001 Dave Jones <davej@suse.de>
Initial rewrite for x86-64. Initial rewrite for x86-64.
Removal of non-Intel style MTRR code. Removal of non-Intel style MTRR code.
v2.01 June 2002 Dave Jones <davej@suse.de> v2.01 June 2002 Dave Jones <davej@suse.de>
Removal of redundant abstraction layer. Removal of redundant abstraction layer.
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
typedef u8 mtrr_type; typedef u8 mtrr_type;
#define LINE_SIZE 80 #define LINE_SIZE 80
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
#define set_mtrr(reg,base,size,type) set_mtrr_smp (reg, base, size, type) #define set_mtrr(reg,base,size,type) set_mtrr_smp (reg, base, size, type)
...@@ -124,42 +124,42 @@ static void set_mtrr_prepare (struct set_mtrr_context *ctxt) ...@@ -124,42 +124,42 @@ static void set_mtrr_prepare (struct set_mtrr_context *ctxt)
local_irq_save(ctxt->flags); local_irq_save(ctxt->flags);
local_irq_disable(); local_irq_disable();
/* Save value of CR4 and clear Page Global Enable (bit 7) */ /* Save value of CR4 and clear Page Global Enable (bit 7) */
if (cpu_has_pge) { if (cpu_has_pge) {
ctxt->cr4val = read_cr4(); ctxt->cr4val = read_cr4();
write_cr4(ctxt->cr4val & ~(1UL << 7)); write_cr4(ctxt->cr4val & ~(1UL << 7));
} }
/* Disable and flush caches. Note that wbinvd flushes the TLBs as /* Disable and flush caches. Note that wbinvd flushes the TLBs as
a side-effect */ a side-effect */
cr0 = read_cr0() | 0x40000000; cr0 = read_cr0() | 0x40000000;
wbinvd(); wbinvd();
write_cr0(cr0); write_cr0(cr0);
wbinvd(); wbinvd();
/* Disable MTRRs, and set the default type to uncached */ /* Disable MTRRs, and set the default type to uncached */
rdmsr(MSR_MTRRdefType, ctxt->deftype_lo, ctxt->deftype_hi); rdmsr(MSR_MTRRdefType, ctxt->deftype_lo, ctxt->deftype_hi);
wrmsr(MSR_MTRRdefType, ctxt->deftype_lo & 0xf300UL, ctxt->deftype_hi); wrmsr(MSR_MTRRdefType, ctxt->deftype_lo & 0xf300UL, ctxt->deftype_hi);
} }
/* Restore the processor after a set_mtrr_prepare */ /* Restore the processor after a set_mtrr_prepare */
static void set_mtrr_done (struct set_mtrr_context *ctxt) static void set_mtrr_done (struct set_mtrr_context *ctxt)
{ {
/* Flush caches and TLBs */ /* Flush caches and TLBs */
wbinvd(); wbinvd();
/* Restore MTRRdefType */ /* Restore MTRRdefType */
wrmsr(MSR_MTRRdefType, ctxt->deftype_lo, ctxt->deftype_hi); wrmsr(MSR_MTRRdefType, ctxt->deftype_lo, ctxt->deftype_hi);
/* Enable caches */ /* Enable caches */
write_cr0(read_cr0() & 0xbfffffff); write_cr0(read_cr0() & 0xbfffffff);
/* Restore value of CR4 */ /* Restore value of CR4 */
if (cpu_has_pge) if (cpu_has_pge)
write_cr4 (ctxt->cr4val); write_cr4 (ctxt->cr4val);
/* Re-enable interrupts locally (if enabled previously) */ /* Re-enable interrupts locally (if enabled previously) */
local_irq_restore(ctxt->flags); local_irq_restore(ctxt->flags);
} }
...@@ -193,21 +193,21 @@ static void get_mtrr (unsigned int reg, u64 *base, u32 *size, mtrr_type * type) ...@@ -193,21 +193,21 @@ static void get_mtrr (unsigned int reg, u64 *base, u32 *size, mtrr_type * type)
rdmsr (MSR_MTRRphysMask(reg), mask_lo, mask_hi); rdmsr (MSR_MTRRphysMask(reg), mask_lo, mask_hi);
if ((mask_lo & 0x800) == 0) { if ((mask_lo & 0x800) == 0) {
/* Invalid (i.e. free) range */ /* Invalid (i.e. free) range */
*base = 0; *base = 0;
*size = 0; *size = 0;
*type = 0; *type = 0;
return; return;
} }
rdmsr (MSR_MTRRphysBase(reg), base_lo, base_hi); rdmsr (MSR_MTRRphysBase(reg), base_lo, base_hi);
/* Work out the shifted address mask. */ /* Work out the shifted address mask. */
newsize = (u64) mask_hi << 32 | (mask_lo & ~0x800); newsize = (u64) mask_hi << 32 | (mask_lo & ~0x800);
newsize = ~newsize+1; newsize = ~newsize+1;
*size = (u32) newsize >> PAGE_SHIFT; *size = (u32) newsize >> PAGE_SHIFT;
*base = base_hi << (32 - PAGE_SHIFT) | base_lo >> PAGE_SHIFT; *base = base_hi << (32 - PAGE_SHIFT) | base_lo >> PAGE_SHIFT;
*type = base_lo & 0xff; *type = base_lo & 0xff;
} }
...@@ -224,7 +224,7 @@ static void get_mtrr (unsigned int reg, u64 *base, u32 *size, mtrr_type * type) ...@@ -224,7 +224,7 @@ static void get_mtrr (unsigned int reg, u64 *base, u32 *size, mtrr_type * type)
static void set_mtrr_up (unsigned int reg, u64 base, static void set_mtrr_up (unsigned int reg, u64 base,
u32 size, mtrr_type type, int do_safe) u32 size, mtrr_type type, int do_safe)
{ {
struct set_mtrr_context ctxt; struct set_mtrr_context ctxt;
u64 base64; u64 base64;
u64 size64; u64 size64;
...@@ -232,8 +232,8 @@ static void set_mtrr_up (unsigned int reg, u64 base, ...@@ -232,8 +232,8 @@ static void set_mtrr_up (unsigned int reg, u64 base,
set_mtrr_prepare (&ctxt); set_mtrr_prepare (&ctxt);
if (size == 0) { if (size == 0) {
/* The invalid bit is kept in the mask, so we simply clear the /* The invalid bit is kept in the mask, so we simply clear the
relevant mask register to disable a range. */ relevant mask register to disable a range. */
wrmsr (MSR_MTRRphysMask(reg), 0, 0); wrmsr (MSR_MTRRphysMask(reg), 0, 0);
} else { } else {
base64 = (base << PAGE_SHIFT) & size_and_mask; base64 = (base << PAGE_SHIFT) & size_and_mask;
...@@ -242,7 +242,7 @@ static void set_mtrr_up (unsigned int reg, u64 base, ...@@ -242,7 +242,7 @@ static void set_mtrr_up (unsigned int reg, u64 base,
size64 = ~((size << PAGE_SHIFT) - 1); size64 = ~((size << PAGE_SHIFT) - 1);
size64 = size64 & size_and_mask; size64 = size64 & size_and_mask;
wrmsr (MSR_MTRRphysMask(reg), (u32) (size64 | 0x800), (u32) (size64 >> 32)); wrmsr (MSR_MTRRphysMask(reg), (u32) (size64 | 0x800), (u32) (size64 >> 32));
} }
if (do_safe) if (do_safe)
set_mtrr_done (&ctxt); set_mtrr_done (&ctxt);
} }
...@@ -259,7 +259,7 @@ struct mtrr_var_range { ...@@ -259,7 +259,7 @@ struct mtrr_var_range {
/* Get the MSR pair relating to a var range */ /* Get the MSR pair relating to a var range */
static void __init get_mtrr_var_range (unsigned int index, static void __init get_mtrr_var_range (unsigned int index,
struct mtrr_var_range *vr) struct mtrr_var_range *vr)
{ {
rdmsr (MSR_MTRRphysBase(index), vr->base_lo, vr->base_hi); rdmsr (MSR_MTRRphysBase(index), vr->base_lo, vr->base_hi);
rdmsr (MSR_MTRRphysMask(index), vr->mask_lo, vr->mask_hi); rdmsr (MSR_MTRRphysMask(index), vr->mask_lo, vr->mask_hi);
...@@ -272,35 +272,35 @@ static int __init set_mtrr_var_range_testing (unsigned int index, ...@@ -272,35 +272,35 @@ static int __init set_mtrr_var_range_testing (unsigned int index,
struct mtrr_var_range *vr) struct mtrr_var_range *vr)
{ {
u32 lo, hi; u32 lo, hi;
int changed = FALSE; int changed = FALSE;
rdmsr (MSR_MTRRphysBase(index), lo, hi); rdmsr (MSR_MTRRphysBase(index), lo, hi);
if ((vr->base_lo & 0xfffff0ff) != (lo & 0xfffff0ff) || if ((vr->base_lo & 0xfffff0ff) != (lo & 0xfffff0ff) ||
(vr->base_hi & 0x000fffff) != (hi & 0x000fffff)) { (vr->base_hi & 0x000fffff) != (hi & 0x000fffff)) {
wrmsr (MSR_MTRRphysBase(index), vr->base_lo, vr->base_hi); wrmsr (MSR_MTRRphysBase(index), vr->base_lo, vr->base_hi);
changed = TRUE; changed = TRUE;
} }
rdmsr (MSR_MTRRphysMask(index), lo, hi); rdmsr (MSR_MTRRphysMask(index), lo, hi);
if ((vr->mask_lo & 0xfffff800) != (lo & 0xfffff800) || if ((vr->mask_lo & 0xfffff800) != (lo & 0xfffff800) ||
(vr->mask_hi & 0x000fffff) != (hi & 0x000fffff)) { (vr->mask_hi & 0x000fffff) != (hi & 0x000fffff)) {
wrmsr (MSR_MTRRphysMask(index), vr->mask_lo, vr->mask_hi); wrmsr (MSR_MTRRphysMask(index), vr->mask_lo, vr->mask_hi);
changed = TRUE; changed = TRUE;
} }
return changed; return changed;
} }
static void __init get_fixed_ranges (mtrr_type * frs) static void __init get_fixed_ranges (mtrr_type * frs)
{ {
u32 *p = (u32 *) frs; u32 *p = (u32 *) frs;
int i; int i;
rdmsr (MSR_MTRRfix64K_00000, p[0], p[1]); rdmsr (MSR_MTRRfix64K_00000, p[0], p[1]);
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
rdmsr (MSR_MTRRfix16K_80000 + i, p[2 + i * 2], p[3 + i * 2]); rdmsr (MSR_MTRRfix16K_80000 + i, p[2 + i * 2], p[3 + i * 2]);
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
rdmsr (MSR_MTRRfix4K_C0000 + i, p[6 + i * 2], p[7 + i * 2]); rdmsr (MSR_MTRRfix4K_C0000 + i, p[6 + i * 2], p[7 + i * 2]);
} }
...@@ -308,8 +308,8 @@ static void __init get_fixed_ranges (mtrr_type * frs) ...@@ -308,8 +308,8 @@ static void __init get_fixed_ranges (mtrr_type * frs)
static int __init set_fixed_ranges_testing (mtrr_type * frs) static int __init set_fixed_ranges_testing (mtrr_type * frs)
{ {
u32 *p = (u32 *) frs; u32 *p = (u32 *) frs;
int changed = FALSE; int changed = FALSE;
int i; int i;
u32 lo, hi; u32 lo, hi;
printk (KERN_INFO "mtrr: rdmsr 64K_00000\n"); printk (KERN_INFO "mtrr: rdmsr 64K_00000\n");
...@@ -317,8 +317,8 @@ static int __init set_fixed_ranges_testing (mtrr_type * frs) ...@@ -317,8 +317,8 @@ static int __init set_fixed_ranges_testing (mtrr_type * frs)
if (p[0] != lo || p[1] != hi) { if (p[0] != lo || p[1] != hi) {
printk (KERN_INFO "mtrr: Writing %x:%x to 64K MSR. lohi were %x:%x\n", p[0], p[1], lo, hi); printk (KERN_INFO "mtrr: Writing %x:%x to 64K MSR. lohi were %x:%x\n", p[0], p[1], lo, hi);
wrmsr (MSR_MTRRfix64K_00000, p[0], p[1]); wrmsr (MSR_MTRRfix64K_00000, p[0], p[1]);
changed = TRUE; changed = TRUE;
} }
printk (KERN_INFO "mtrr: rdmsr 16K_80000\n"); printk (KERN_INFO "mtrr: rdmsr 16K_80000\n");
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
...@@ -326,9 +326,9 @@ static int __init set_fixed_ranges_testing (mtrr_type * frs) ...@@ -326,9 +326,9 @@ static int __init set_fixed_ranges_testing (mtrr_type * frs)
if (p[2 + i * 2] != lo || p[3 + i * 2] != hi) { if (p[2 + i * 2] != lo || p[3 + i * 2] != hi) {
printk (KERN_INFO "mtrr: Writing %x:%x to 16K MSR%d. lohi were %x:%x\n", p[2 + i * 2], p[3 + i * 2], i, lo, hi ); printk (KERN_INFO "mtrr: Writing %x:%x to 16K MSR%d. lohi were %x:%x\n", p[2 + i * 2], p[3 + i * 2], i, lo, hi );
wrmsr (MSR_MTRRfix16K_80000 + i, p[2 + i * 2], p[3 + i * 2]); wrmsr (MSR_MTRRfix16K_80000 + i, p[2 + i * 2], p[3 + i * 2]);
changed = TRUE; changed = TRUE;
}
} }
}
printk (KERN_INFO "mtrr: rdmsr 4K_C0000\n"); printk (KERN_INFO "mtrr: rdmsr 4K_C0000\n");
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
...@@ -337,18 +337,18 @@ static int __init set_fixed_ranges_testing (mtrr_type * frs) ...@@ -337,18 +337,18 @@ static int __init set_fixed_ranges_testing (mtrr_type * frs)
if (p[6 + i * 2] != lo || p[7 + i * 2] != hi) { if (p[6 + i * 2] != lo || p[7 + i * 2] != hi) {
printk (KERN_INFO "mtrr: Writing %x:%x to 4K MSR%d. lohi were %x:%x\n", p[6 + i * 2], p[7 + i * 2], i, lo, hi); printk (KERN_INFO "mtrr: Writing %x:%x to 4K MSR%d. lohi were %x:%x\n", p[6 + i * 2], p[7 + i * 2], i, lo, hi);
wrmsr (MSR_MTRRfix4K_C0000 + i, p[6 + i * 2], p[7 + i * 2]); wrmsr (MSR_MTRRfix4K_C0000 + i, p[6 + i * 2], p[7 + i * 2]);
changed = TRUE; changed = TRUE;
}
} }
} return changed;
return changed;
} }
struct mtrr_state { struct mtrr_state {
unsigned int num_var_ranges; unsigned int num_var_ranges;
struct mtrr_var_range *var_ranges; struct mtrr_var_range *var_ranges;
mtrr_type fixed_ranges[NUM_FIXED_RANGES]; mtrr_type fixed_ranges[NUM_FIXED_RANGES];
mtrr_type def_type; mtrr_type def_type;
unsigned char enabled; unsigned char enabled;
}; };
...@@ -356,23 +356,23 @@ struct mtrr_state { ...@@ -356,23 +356,23 @@ struct mtrr_state {
/* Grab all of the MTRR state for this CPU into *state */ /* Grab all of the MTRR state for this CPU into *state */
static void __init get_mtrr_state (struct mtrr_state *state) static void __init get_mtrr_state (struct mtrr_state *state)
{ {
unsigned int nvrs, i; unsigned int nvrs, i;
struct mtrr_var_range *vrs; struct mtrr_var_range *vrs;
u32 lo, dummy; u32 lo, dummy;
nvrs = state->num_var_ranges = get_num_var_ranges(); nvrs = state->num_var_ranges = get_num_var_ranges();
vrs = state->var_ranges vrs = state->var_ranges
= kmalloc (nvrs * sizeof (struct mtrr_var_range), GFP_KERNEL); = kmalloc (nvrs * sizeof (struct mtrr_var_range), GFP_KERNEL);
if (vrs == NULL) if (vrs == NULL)
nvrs = state->num_var_ranges = 0; nvrs = state->num_var_ranges = 0;
for (i = 0; i < nvrs; i++) for (i = 0; i < nvrs; i++)
get_mtrr_var_range (i, &vrs[i]); get_mtrr_var_range (i, &vrs[i]);
get_fixed_ranges (state->fixed_ranges); get_fixed_ranges (state->fixed_ranges);
rdmsr (MSR_MTRRdefType, lo, dummy); rdmsr (MSR_MTRRdefType, lo, dummy);
state->def_type = (lo & 0xff); state->def_type = (lo & 0xff);
state->enabled = (lo & 0xc00) >> 10; state->enabled = (lo & 0xc00) >> 10;
} }
...@@ -392,26 +392,26 @@ static void __init finalize_mtrr_state (struct mtrr_state *state) ...@@ -392,26 +392,26 @@ static void __init finalize_mtrr_state (struct mtrr_state *state)
* [RETURNS] 0 if no changes made, else a mask indication what was changed. * [RETURNS] 0 if no changes made, else a mask indication what was changed.
*/ */
static u64 __init set_mtrr_state (struct mtrr_state *state, static u64 __init set_mtrr_state (struct mtrr_state *state,
struct set_mtrr_context *ctxt) struct set_mtrr_context *ctxt)
{ {
unsigned int i; unsigned int i;
u64 change_mask = 0; u64 change_mask = 0;
for (i = 0; i < state->num_var_ranges; i++) for (i = 0; i < state->num_var_ranges; i++)
if (set_mtrr_var_range_testing (i, &state->var_ranges[i])) if (set_mtrr_var_range_testing (i, &state->var_ranges[i]))
change_mask |= MTRR_CHANGE_MASK_VARIABLE; change_mask |= MTRR_CHANGE_MASK_VARIABLE;
if (set_fixed_ranges_testing (state->fixed_ranges)) if (set_fixed_ranges_testing (state->fixed_ranges))
change_mask |= MTRR_CHANGE_MASK_FIXED; change_mask |= MTRR_CHANGE_MASK_FIXED;
/* Set_mtrr_restore restores the old value of MTRRdefType, /* Set_mtrr_restore restores the old value of MTRRdefType,
so to set it we fiddle with the saved value */ so to set it we fiddle with the saved value */
if ((ctxt->deftype_lo & 0xff) != state->def_type if ((ctxt->deftype_lo & 0xff) != state->def_type
|| ((ctxt->deftype_lo & 0xc00) >> 10) != state->enabled) { || ((ctxt->deftype_lo & 0xc00) >> 10) != state->enabled) {
ctxt->deftype_lo |= (state->def_type | state->enabled << 10); ctxt->deftype_lo |= (state->def_type | state->enabled << 10);
change_mask |= MTRR_CHANGE_MASK_DEFTYPE; change_mask |= MTRR_CHANGE_MASK_DEFTYPE;
} }
return change_mask; return change_mask;
} }
...@@ -422,8 +422,8 @@ static volatile int wait_barrier_cache_enable = FALSE; ...@@ -422,8 +422,8 @@ static volatile int wait_barrier_cache_enable = FALSE;
struct set_mtrr_data { struct set_mtrr_data {
u64 smp_base; u64 smp_base;
u32 smp_size; u32 smp_size;
unsigned int smp_reg; unsigned int smp_reg;
mtrr_type smp_type; mtrr_type smp_type;
}; };
/* /*
...@@ -431,67 +431,67 @@ struct set_mtrr_data { ...@@ -431,67 +431,67 @@ struct set_mtrr_data {
*/ */
static void ipi_handler (void *info) static void ipi_handler (void *info)
{ {
struct set_mtrr_data *data = info; struct set_mtrr_data *data = info;
struct set_mtrr_context ctxt; struct set_mtrr_context ctxt;
set_mtrr_prepare (&ctxt); set_mtrr_prepare (&ctxt);
/* Notify master that I've flushed and disabled my cache */ /* Notify master that I've flushed and disabled my cache */
atomic_dec (&undone_count); atomic_dec (&undone_count);
while (wait_barrier_execute) while (wait_barrier_execute)
barrier (); barrier ();
/* The master has cleared me to execute */ /* The master has cleared me to execute */
set_mtrr_up (data->smp_reg, data->smp_base, data->smp_size, set_mtrr_up (data->smp_reg, data->smp_base, data->smp_size,
data->smp_type, FALSE); data->smp_type, FALSE);
/* Notify master CPU that I've executed the function */ /* Notify master CPU that I've executed the function */
atomic_dec (&undone_count); atomic_dec (&undone_count);
/* Wait for master to clear me to enable cache and return */ /* Wait for master to clear me to enable cache and return */
while (wait_barrier_cache_enable) while (wait_barrier_cache_enable)
barrier (); barrier ();
set_mtrr_done (&ctxt); set_mtrr_done (&ctxt);
} }
static void set_mtrr_smp (unsigned int reg, u64 base, u32 size, mtrr_type type) static void set_mtrr_smp (unsigned int reg, u64 base, u32 size, mtrr_type type)
{ {
struct set_mtrr_data data; struct set_mtrr_data data;
struct set_mtrr_context ctxt; struct set_mtrr_context ctxt;
data.smp_reg = reg; data.smp_reg = reg;
data.smp_base = base; data.smp_base = base;
data.smp_size = size; data.smp_size = size;
data.smp_type = type; data.smp_type = type;
wait_barrier_execute = TRUE; wait_barrier_execute = TRUE;
wait_barrier_cache_enable = TRUE; wait_barrier_cache_enable = TRUE;
atomic_set (&undone_count, num_online_cpus() - 1); atomic_set (&undone_count, num_online_cpus() - 1);
/* Start the ball rolling on other CPUs */ /* Start the ball rolling on other CPUs */
if (smp_call_function (ipi_handler, &data, 1, 0) != 0) if (smp_call_function (ipi_handler, &data, 1, 0) != 0)
panic ("mtrr: timed out waiting for other CPUs\n"); panic ("mtrr: timed out waiting for other CPUs\n");
/* Flush and disable the local CPU's cache */ /* Flush and disable the local CPU's cache */
set_mtrr_prepare (&ctxt); set_mtrr_prepare (&ctxt);
/* Wait for all other CPUs to flush and disable their caches */ /* Wait for all other CPUs to flush and disable their caches */
while (atomic_read (&undone_count) > 0) while (atomic_read (&undone_count) > 0)
barrier (); barrier ();
/* Set up for completion wait and then release other CPUs to change MTRRs */ /* Set up for completion wait and then release other CPUs to change MTRRs */
atomic_set (&undone_count, num_online_cpus() - 1); atomic_set (&undone_count, num_online_cpus() - 1);
wait_barrier_execute = FALSE; wait_barrier_execute = FALSE;
set_mtrr_up (reg, base, size, type, FALSE); set_mtrr_up (reg, base, size, type, FALSE);
/* Now wait for other CPUs to complete the function */ /* Now wait for other CPUs to complete the function */
while (atomic_read (&undone_count) > 0) while (atomic_read (&undone_count) > 0)
barrier (); barrier ();
/* Now all CPUs should have finished the function. Release the barrier to /* Now all CPUs should have finished the function. Release the barrier to
allow them to re-enable their caches and return from their interrupt, allow them to re-enable their caches and return from their interrupt,
then enable the local cache and return */ then enable the local cache and return */
wait_barrier_cache_enable = FALSE; wait_barrier_cache_enable = FALSE;
set_mtrr_done (&ctxt); set_mtrr_done (&ctxt);
} }
...@@ -500,44 +500,44 @@ static void __init mtrr_state_warn (u32 mask) ...@@ -500,44 +500,44 @@ static void __init mtrr_state_warn (u32 mask)
{ {
if (!mask) if (!mask)
return; return;
if (mask & MTRR_CHANGE_MASK_FIXED) if (mask & MTRR_CHANGE_MASK_FIXED)
printk ("mtrr: your CPUs had inconsistent fixed MTRR settings\n"); printk ("mtrr: your CPUs had inconsistent fixed MTRR settings\n");
if (mask & MTRR_CHANGE_MASK_VARIABLE) if (mask & MTRR_CHANGE_MASK_VARIABLE)
printk ("mtrr: your CPUs had inconsistent variable MTRR settings\n"); printk ("mtrr: your CPUs had inconsistent variable MTRR settings\n");
if (mask & MTRR_CHANGE_MASK_DEFTYPE) if (mask & MTRR_CHANGE_MASK_DEFTYPE)
printk ("mtrr: your CPUs had inconsistent MTRRdefType settings\n"); printk ("mtrr: your CPUs had inconsistent MTRRdefType settings\n");
printk ("mtrr: probably your BIOS does not setup all CPUs\n"); printk ("mtrr: probably your BIOS does not setup all CPUs\n");
} }
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
static inline char * attrib_to_str (int x) static inline char * attrib_to_str (int x)
{ {
return (x <= 6) ? mtrr_strings[x] : "?"; return (x <= 6) ? mtrr_strings[x] : "?";
} }
static void __init init_table (void) static void __init init_table (void)
{ {
int i, max; int i, max;
max = get_num_var_ranges (); max = get_num_var_ranges ();
if ((usage_table = kmalloc (max * sizeof *usage_table, GFP_KERNEL))==NULL) { if ((usage_table = kmalloc (max * sizeof *usage_table, GFP_KERNEL))==NULL) {
printk ("mtrr: could not allocate\n"); printk ("mtrr: could not allocate\n");
return; return;
} }
for (i = 0; i < max; i++) for (i = 0; i < max; i++)
usage_table[i] = 1; usage_table[i] = 1;
#ifdef USERSPACE_INTERFACE #ifdef USERSPACE_INTERFACE
if ((ascii_buffer = kmalloc (max * LINE_SIZE, GFP_KERNEL)) == NULL) { if ((ascii_buffer = kmalloc (max * LINE_SIZE, GFP_KERNEL)) == NULL) {
printk ("mtrr: could not allocate\n"); printk ("mtrr: could not allocate\n");
return; return;
} }
ascii_buf_bytes = 0; ascii_buf_bytes = 0;
compute_ascii (); compute_ascii ();
#endif #endif
} }
...@@ -548,18 +548,18 @@ static void __init init_table (void) ...@@ -548,18 +548,18 @@ static void __init init_table (void)
*/ */
static int get_free_region(void) static int get_free_region(void)
{ {
int i, max; int i, max;
mtrr_type ltype; mtrr_type ltype;
u64 lbase; u64 lbase;
u32 lsize; u32 lsize;
max = get_num_var_ranges (); max = get_num_var_ranges ();
for (i = 0; i < max; ++i) { for (i = 0; i < max; ++i) {
get_mtrr (i, &lbase, &lsize, &ltype); get_mtrr (i, &lbase, &lsize, &ltype);
if (lsize == 0) if (lsize == 0)
return i; return i;
} }
return -ENOSPC; return -ENOSPC;
} }
...@@ -597,16 +597,16 @@ static int get_free_region(void) ...@@ -597,16 +597,16 @@ static int get_free_region(void)
int mtrr_add_page (u64 base, u32 size, unsigned int type, char increment) int mtrr_add_page (u64 base, u32 size, unsigned int type, char increment)
{ {
int i, max; int i, max;
mtrr_type ltype; mtrr_type ltype;
u64 lbase, last; u64 lbase, last;
u32 lsize; u32 lsize;
if (base + size < 0x100) { if (base + size < 0x100) {
printk (KERN_WARNING printk (KERN_WARNING
"mtrr: cannot set region below 1 MiB (0x%Lx000,0x%x000)\n", "mtrr: cannot set region below 1 MiB (0x%Lx000,0x%x000)\n",
base, size); base, size);
return -EINVAL; return -EINVAL;
} }
#if defined(__x86_64__) && defined(CONFIG_AGP) #if defined(__x86_64__) && defined(CONFIG_AGP)
...@@ -621,7 +621,7 @@ int mtrr_add_page (u64 base, u32 size, unsigned int type, char increment) ...@@ -621,7 +621,7 @@ int mtrr_add_page (u64 base, u32 size, unsigned int type, char increment)
#endif #endif
/* Check upper bits of base and last are equal and lower bits are 0 /* Check upper bits of base and last are equal and lower bits are 0
for base and 1 for last */ for base and 1 for last */
last = base + size - 1; last = base + size - 1;
for (lbase = base; !(lbase & 1) && (last & 1); for (lbase = base; !(lbase & 1) && (last & 1);
lbase = lbase >> 1, last = last >> 1) ; lbase = lbase >> 1, last = last >> 1) ;
...@@ -630,35 +630,36 @@ int mtrr_add_page (u64 base, u32 size, unsigned int type, char increment) ...@@ -630,35 +630,36 @@ int mtrr_add_page (u64 base, u32 size, unsigned int type, char increment)
printk (KERN_WARNING printk (KERN_WARNING
"mtrr: base(0x%Lx000) is not aligned on a size(0x%x000) boundary\n", "mtrr: base(0x%Lx000) is not aligned on a size(0x%x000) boundary\n",
base, size); base, size);
return -EINVAL; return -EINVAL;
} }
if (type >= MTRR_NUM_TYPES) { if (type >= MTRR_NUM_TYPES) {
printk ("mtrr: type: %u illegal\n", type); printk ("mtrr: type: %u illegal\n", type);
return -EINVAL; return -EINVAL;
} }
/* If the type is WC, check that this processor supports it */ /* If the type is WC, check that this processor supports it */
if ((type == MTRR_TYPE_WRCOMB) && !have_wrcomb()) { if ((type == MTRR_TYPE_WRCOMB) && !have_wrcomb()) {
printk (KERN_WARNING printk (KERN_WARNING
"mtrr: your processor doesn't support write-combining\n"); "mtrr: your processor doesn't support write-combining\n");
return -ENOSYS; return -ENOSYS;
} }
if (base & (size_or_mask>>PAGE_SHIFT)) { if (base & (size_or_mask>>PAGE_SHIFT)) {
printk (KERN_WARNING "mtrr: base(%lx) exceeds the MTRR width(%lx)\n", printk (KERN_WARNING "mtrr: base(%lx) exceeds the MTRR width(%lx)\n",
base, (size_or_mask>>PAGE_SHIFT)); (unsigned long) base,
(unsigned long) (size_or_mask>>PAGE_SHIFT));
return -EINVAL; return -EINVAL;
} }
if (size & (size_or_mask>>PAGE_SHIFT)) { if (size & (size_or_mask>>PAGE_SHIFT)) {
printk (KERN_WARNING "mtrr: size exceeds the MTRR width\n"); printk (KERN_WARNING "mtrr: size exceeds the MTRR width\n");
return -EINVAL; return -EINVAL;
} }
increment = increment ? 1 : 0; increment = increment ? 1 : 0;
max = get_num_var_ranges (); max = get_num_var_ranges ();
/* Search for existing MTRR */ /* Search for existing MTRR */
down (&mtrr_lock); down (&mtrr_lock);
for (i = 0; i < max; ++i) { for (i = 0; i < max; ++i) {
get_mtrr (i, &lbase, &lsize, &ltype); get_mtrr (i, &lbase, &lsize, &ltype);
...@@ -667,15 +668,15 @@ int mtrr_add_page (u64 base, u32 size, unsigned int type, char increment) ...@@ -667,15 +668,15 @@ int mtrr_add_page (u64 base, u32 size, unsigned int type, char increment)
if ((base < lbase) && (base + size <= lbase)) if ((base < lbase) && (base + size <= lbase))
continue; continue;
/* At this point we know there is some kind of overlap/enclosure */ /* At this point we know there is some kind of overlap/enclosure */
if ((base < lbase) || (base + size > lbase + lsize)) { if ((base < lbase) || (base + size > lbase + lsize)) {
up (&mtrr_lock); up (&mtrr_lock);
printk (KERN_WARNING printk (KERN_WARNING
"mtrr: 0x%Lx000,0x%x000 overlaps existing" "mtrr: 0x%Lx000,0x%x000 overlaps existing"
" 0x%Lx000,0x%x000\n", base, size, lbase, lsize); " 0x%Lx000,0x%x000\n", base, size, lbase, lsize);
return -EINVAL; return -EINVAL;
} }
/* New region is enclosed by an existing region */ /* New region is enclosed by an existing region */
if (ltype != type) { if (ltype != type) {
if (type == MTRR_TYPE_UNCACHABLE) if (type == MTRR_TYPE_UNCACHABLE)
continue; continue;
...@@ -685,26 +686,26 @@ int mtrr_add_page (u64 base, u32 size, unsigned int type, char increment) ...@@ -685,26 +686,26 @@ int mtrr_add_page (u64 base, u32 size, unsigned int type, char increment)
base, size, base, size,
attrib_to_str (ltype), attrib_to_str (ltype),
attrib_to_str (type)); attrib_to_str (type));
return -EINVAL; return -EINVAL;
} }
if (increment) if (increment)
++usage_table[i]; ++usage_table[i];
compute_ascii (); compute_ascii ();
up (&mtrr_lock); up (&mtrr_lock);
return i; return i;
} }
/* Search for an empty MTRR */ /* Search for an empty MTRR */
i = get_free_region(); i = get_free_region();
if (i < 0) { if (i < 0) {
up (&mtrr_lock); up (&mtrr_lock);
printk ("mtrr: no more MTRRs available\n"); printk ("mtrr: no more MTRRs available\n");
return i; return i;
} }
set_mtrr (i, base, size, type); set_mtrr (i, base, size, type);
usage_table[i] = 1; usage_table[i] = 1;
compute_ascii (); compute_ascii ();
up (&mtrr_lock); up (&mtrr_lock);
return i; return i;
} }
...@@ -744,10 +745,10 @@ int mtrr_add_page (u64 base, u32 size, unsigned int type, char increment) ...@@ -744,10 +745,10 @@ int mtrr_add_page (u64 base, u32 size, unsigned int type, char increment)
int mtrr_add (u64 base, u32 size, unsigned int type, char increment) int mtrr_add (u64 base, u32 size, unsigned int type, char increment)
{ {
if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1))) { if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1))) {
printk ("mtrr: size and base must be multiples of 4 kiB\n"); printk ("mtrr: size and base must be multiples of 4 kiB\n");
printk ("mtrr: size: 0x%x base: 0x%Lx\n", size, base); printk ("mtrr: size: 0x%x base: 0x%Lx\n", size, base);
return -EINVAL; return -EINVAL;
} }
return mtrr_add_page (base >> PAGE_SHIFT, size >> PAGE_SHIFT, type, return mtrr_add_page (base >> PAGE_SHIFT, size >> PAGE_SHIFT, type,
increment); increment);
} }
...@@ -767,56 +768,56 @@ int mtrr_add (u64 base, u32 size, unsigned int type, char increment) ...@@ -767,56 +768,56 @@ int mtrr_add (u64 base, u32 size, unsigned int type, char increment)
* On success the register is returned, on failure a negative error * On success the register is returned, on failure a negative error
* code. * code.
*/ */
int mtrr_del_page (int reg, u64 base, u32 size) int mtrr_del_page (int reg, u64 base, u32 size)
{ {
int i, max; int i, max;
mtrr_type ltype; mtrr_type ltype;
u64 lbase; u64 lbase;
u32 lsize; u32 lsize;
max = get_num_var_ranges (); max = get_num_var_ranges ();
down (&mtrr_lock); down (&mtrr_lock);
if (reg < 0) { if (reg < 0) {
/* Search for existing MTRR */ /* Search for existing MTRR */
for (i = 0; i < max; ++i) { for (i = 0; i < max; ++i) {
get_mtrr (i, &lbase, &lsize, &ltype); get_mtrr (i, &lbase, &lsize, &ltype);
if (lbase == base && lsize == size) { if (lbase == base && lsize == size) {
reg = i; reg = i;
break; break;
} }
} }
if (reg < 0) { if (reg < 0) {
up (&mtrr_lock); up (&mtrr_lock);
printk ("mtrr: no MTRR for %Lx000,%x000 found\n", base, size); printk ("mtrr: no MTRR for %Lx000,%x000 found\n", base, size);
return -EINVAL; return -EINVAL;
}
} }
}
if (reg >= max) { if (reg >= max) {
up (&mtrr_lock); up (&mtrr_lock);
printk ("mtrr: register: %d too big\n", reg); printk ("mtrr: register: %d too big\n", reg);
return -EINVAL; return -EINVAL;
} }
get_mtrr (reg, &lbase, &lsize, &ltype); get_mtrr (reg, &lbase, &lsize, &ltype);
if (lsize < 1) { if (lsize < 1) {
up (&mtrr_lock); up (&mtrr_lock);
printk ("mtrr: MTRR %d not used\n", reg); printk ("mtrr: MTRR %d not used\n", reg);
return -EINVAL; return -EINVAL;
} }
if (usage_table[reg] < 1) { if (usage_table[reg] < 1) {
up (&mtrr_lock); up (&mtrr_lock);
printk ("mtrr: reg: %d has count=0\n", reg); printk ("mtrr: reg: %d has count=0\n", reg);
return -EINVAL; return -EINVAL;
} }
if (--usage_table[reg] < 1) if (--usage_table[reg] < 1)
set_mtrr (reg, 0, 0, 0); set_mtrr (reg, 0, 0, 0);
compute_ascii (); compute_ascii ();
up (&mtrr_lock); up (&mtrr_lock);
return reg; return reg;
} }
...@@ -834,14 +835,14 @@ int mtrr_del_page (int reg, u64 base, u32 size) ...@@ -834,14 +835,14 @@ int mtrr_del_page (int reg, u64 base, u32 size)
* On success the register is returned, on failure a negative error * On success the register is returned, on failure a negative error
* code. * code.
*/ */
int mtrr_del (int reg, u64 base, u32 size) int mtrr_del (int reg, u64 base, u32 size)
{ {
if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1))) { if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1))) {
printk ("mtrr: size and base must be multiples of 4 kiB\n"); printk ("mtrr: size and base must be multiples of 4 kiB\n");
printk ("mtrr: size: 0x%x base: 0x%Lx\n", size, base); printk ("mtrr: size: 0x%x base: 0x%Lx\n", size, base);
return -EINVAL; return -EINVAL;
} }
return mtrr_del_page (reg, base >> PAGE_SHIFT, size >> PAGE_SHIFT); return mtrr_del_page (reg, base >> PAGE_SHIFT, size >> PAGE_SHIFT);
} }
...@@ -851,64 +852,64 @@ int mtrr_del (int reg, u64 base, u32 size) ...@@ -851,64 +852,64 @@ int mtrr_del (int reg, u64 base, u32 size)
static int mtrr_file_add (u64 base, u32 size, unsigned int type, static int mtrr_file_add (u64 base, u32 size, unsigned int type,
struct file *file, int page) struct file *file, int page)
{ {
int reg, max; int reg, max;
unsigned int *fcount = file->private_data; unsigned int *fcount = file->private_data;
max = get_num_var_ranges (); max = get_num_var_ranges ();
if (fcount == NULL) { if (fcount == NULL) {
if ((fcount = if ((fcount =
kmalloc (max * sizeof *fcount, GFP_KERNEL)) == NULL) { kmalloc (max * sizeof *fcount, GFP_KERNEL)) == NULL) {
printk ("mtrr: could not allocate\n"); printk ("mtrr: could not allocate\n");
return -ENOMEM; return -ENOMEM;
}
memset (fcount, 0, max * sizeof *fcount);
file->private_data = fcount;
} }
memset (fcount, 0, max * sizeof *fcount);
file->private_data = fcount;
}
if (!page) { if (!page) {
if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1))) { if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1))) {
printk printk
("mtrr: size and base must be multiples of 4 kiB\n"); ("mtrr: size and base must be multiples of 4 kiB\n");
printk ("mtrr: size: 0x%x base: 0x%Lx\n", size, base); printk ("mtrr: size: 0x%x base: 0x%Lx\n", size, base);
return -EINVAL; return -EINVAL;
}
base >>= PAGE_SHIFT;
size >>= PAGE_SHIFT;
} }
base >>= PAGE_SHIFT;
size >>= PAGE_SHIFT;
}
reg = mtrr_add_page (base, size, type, 1); reg = mtrr_add_page (base, size, type, 1);
if (reg >= 0) if (reg >= 0)
++fcount[reg]; ++fcount[reg];
return reg; return reg;
} }
static int mtrr_file_del (u64 base, u32 size, static int mtrr_file_del (u64 base, u32 size,
struct file *file, int page) struct file *file, int page)
{ {
int reg; int reg;
unsigned int *fcount = file->private_data; unsigned int *fcount = file->private_data;
if (!page) { if (!page) {
if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1))) { if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1))) {
printk printk
("mtrr: size and base must be multiples of 4 kiB\n"); ("mtrr: size and base must be multiples of 4 kiB\n");
printk ("mtrr: size: 0x%x base: 0x%Lx\n", size, base); printk ("mtrr: size: 0x%x base: 0x%Lx\n", size, base);
return -EINVAL; return -EINVAL;
}
base >>= PAGE_SHIFT;
size >>= PAGE_SHIFT;
} }
base >>= PAGE_SHIFT; reg = mtrr_del_page (-1, base, size);
size >>= PAGE_SHIFT;
}
reg = mtrr_del_page (-1, base, size);
if (reg < 0) if (reg < 0)
return reg; return reg;
if (fcount == NULL) if (fcount == NULL)
return reg; return reg;
if (fcount[reg] < 1) if (fcount[reg] < 1)
return -EINVAL; return -EINVAL;
--fcount[reg]; --fcount[reg];
return reg; return reg;
} }
...@@ -924,8 +925,8 @@ static ssize_t mtrr_read (struct file *file, char *buf, size_t len, ...@@ -924,8 +925,8 @@ static ssize_t mtrr_read (struct file *file, char *buf, size_t len,
if (copy_to_user (buf, ascii_buffer + *ppos, len)) if (copy_to_user (buf, ascii_buffer + *ppos, len))
return -EFAULT; return -EFAULT;
*ppos += len; *ppos += len;
return len; return len;
} }
...@@ -939,240 +940,240 @@ static ssize_t mtrr_write (struct file *file, const char *buf, ...@@ -939,240 +940,240 @@ static ssize_t mtrr_write (struct file *file, const char *buf,
int i, err, reg; int i, err, reg;
u64 base; u64 base;
u32 size; u32 size;
char *ptr; char *ptr;
char line[LINE_SIZE]; char line[LINE_SIZE];
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
/* Can't seek (pwrite) on this device */ /* Can't seek (pwrite) on this device */
if (ppos != &file->f_pos) if (ppos != &file->f_pos)
return -ESPIPE; return -ESPIPE;
memset (line, 0, LINE_SIZE); memset (line, 0, LINE_SIZE);
if (len > LINE_SIZE) if (len > LINE_SIZE)
len = LINE_SIZE; len = LINE_SIZE;
if (copy_from_user (line, buf, len - 1)) if (copy_from_user (line, buf, len - 1))
return -EFAULT; return -EFAULT;
ptr = line + strlen (line) - 1; ptr = line + strlen (line) - 1;
if (*ptr == '\n') if (*ptr == '\n')
*ptr = '\0'; *ptr = '\0';
if (!strncmp (line, "disable=", 8)) { if (!strncmp (line, "disable=", 8)) {
reg = simple_strtoul (line + 8, &ptr, 0); reg = simple_strtoul (line + 8, &ptr, 0);
err = mtrr_del_page (reg, 0, 0); err = mtrr_del_page (reg, 0, 0);
if (err < 0) if (err < 0)
return err; return err;
return len; return len;
} }
if (strncmp (line, "base=", 5)) { if (strncmp (line, "base=", 5)) {
printk ("mtrr: no \"base=\" in line: \"%s\"\n", line); printk ("mtrr: no \"base=\" in line: \"%s\"\n", line);
return -EINVAL; return -EINVAL;
} }
base = simple_strtoull (line + 5, &ptr, 0); base = simple_strtoull (line + 5, &ptr, 0);
for (; isspace (*ptr); ++ptr) ; for (; isspace (*ptr); ++ptr) ;
if (strncmp (ptr, "size=", 5)) { if (strncmp (ptr, "size=", 5)) {
printk ("mtrr: no \"size=\" in line: \"%s\"\n", line); printk ("mtrr: no \"size=\" in line: \"%s\"\n", line);
return -EINVAL; return -EINVAL;
} }
size = simple_strtoull (ptr + 5, &ptr, 0); size = simple_strtoull (ptr + 5, &ptr, 0);
if ((base & 0xfff) || (size & 0xfff)) { if ((base & 0xfff) || (size & 0xfff)) {
printk ("mtrr: size and base must be multiples of 4 kiB\n"); printk ("mtrr: size and base must be multiples of 4 kiB\n");
printk ("mtrr: size: 0x%x base: 0x%Lx\n", size, base); printk ("mtrr: size: 0x%x base: 0x%Lx\n", size, base);
return -EINVAL; return -EINVAL;
} }
for (; isspace (*ptr); ++ptr) ; for (; isspace (*ptr); ++ptr) ;
if (strncmp (ptr, "type=", 5)) { if (strncmp (ptr, "type=", 5)) {
printk ("mtrr: no \"type=\" in line: \"%s\"\n", line); printk ("mtrr: no \"type=\" in line: \"%s\"\n", line);
return -EINVAL; return -EINVAL;
} }
ptr += 5; ptr += 5;
for (; isspace (*ptr); ++ptr) ; for (; isspace (*ptr); ++ptr) ;
for (i = 0; i < MTRR_NUM_TYPES; ++i) { for (i = 0; i < MTRR_NUM_TYPES; ++i) {
if (strcmp (ptr, mtrr_strings[i])) if (strcmp (ptr, mtrr_strings[i]))
continue; continue;
base >>= PAGE_SHIFT; base >>= PAGE_SHIFT;
size >>= PAGE_SHIFT; size >>= PAGE_SHIFT;
err = mtrr_add_page ((u64) base, size, i, 1); err = mtrr_add_page ((u64) base, size, i, 1);
if (err < 0) if (err < 0)
return err; return err;
return len; return len;
} }
printk ("mtrr: illegal type: \"%s\"\n", ptr); printk ("mtrr: illegal type: \"%s\"\n", ptr);
return -EINVAL; return -EINVAL;
} }
static int mtrr_ioctl (struct inode *inode, struct file *file, static int mtrr_ioctl (struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
int err; int err;
mtrr_type type; mtrr_type type;
struct mtrr_sentry sentry; struct mtrr_sentry sentry;
struct mtrr_gentry gentry; struct mtrr_gentry gentry;
switch (cmd) { switch (cmd) {
default: default:
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
case MTRRIOC_ADD_ENTRY: case MTRRIOC_ADD_ENTRY:
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
if (copy_from_user (&sentry, (void *) arg, sizeof sentry)) if (copy_from_user (&sentry, (void *) arg, sizeof sentry))
return -EFAULT; return -EFAULT;
err = mtrr_file_add (sentry.base, sentry.size, sentry.type, err = mtrr_file_add (sentry.base, sentry.size, sentry.type,
file, 0); file, 0);
if (err < 0) if (err < 0)
return err; return err;
break; break;
case MTRRIOC_SET_ENTRY: case MTRRIOC_SET_ENTRY:
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
if (copy_from_user (&sentry, (void *) arg, sizeof sentry)) if (copy_from_user (&sentry, (void *) arg, sizeof sentry))
return -EFAULT; return -EFAULT;
err = mtrr_add (sentry.base, sentry.size, sentry.type, 0); err = mtrr_add (sentry.base, sentry.size, sentry.type, 0);
if (err < 0) if (err < 0)
return err; return err;
break; break;
case MTRRIOC_DEL_ENTRY: case MTRRIOC_DEL_ENTRY:
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
if (copy_from_user (&sentry, (void *) arg, sizeof sentry)) if (copy_from_user (&sentry, (void *) arg, sizeof sentry))
return -EFAULT; return -EFAULT;
err = mtrr_file_del (sentry.base, sentry.size, file, 0); err = mtrr_file_del (sentry.base, sentry.size, file, 0);
if (err < 0) if (err < 0)
return err; return err;
break; break;
case MTRRIOC_KILL_ENTRY: case MTRRIOC_KILL_ENTRY:
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
if (copy_from_user (&sentry, (void *) arg, sizeof sentry)) if (copy_from_user (&sentry, (void *) arg, sizeof sentry))
return -EFAULT; return -EFAULT;
err = mtrr_del (-1, sentry.base, sentry.size); err = mtrr_del (-1, sentry.base, sentry.size);
if (err < 0) if (err < 0)
return err; return err;
break; break;
case MTRRIOC_GET_ENTRY: case MTRRIOC_GET_ENTRY:
if (copy_from_user (&gentry, (void *) arg, sizeof gentry)) if (copy_from_user (&gentry, (void *) arg, sizeof gentry))
return -EFAULT; return -EFAULT;
if (gentry.regnum >= get_num_var_ranges ()) if (gentry.regnum >= get_num_var_ranges ())
return -EINVAL; return -EINVAL;
get_mtrr (gentry.regnum, (u64*) &gentry.base, &gentry.size, &type); get_mtrr (gentry.regnum, (u64*) &gentry.base, &gentry.size, &type);
/* Hide entries that go above 4GB */ /* Hide entries that go above 4GB */
if (gentry.base + gentry.size > 0x100000 if (gentry.base + gentry.size > 0x100000
|| gentry.size == 0x100000) || gentry.size == 0x100000)
gentry.base = gentry.size = gentry.type = 0; gentry.base = gentry.size = gentry.type = 0;
else { else {
gentry.base <<= PAGE_SHIFT; gentry.base <<= PAGE_SHIFT;
gentry.size <<= PAGE_SHIFT; gentry.size <<= PAGE_SHIFT;
gentry.type = type; gentry.type = type;
} }
if (copy_to_user ((void *) arg, &gentry, sizeof gentry)) if (copy_to_user ((void *) arg, &gentry, sizeof gentry))
return -EFAULT; return -EFAULT;
break; break;
case MTRRIOC_ADD_PAGE_ENTRY: case MTRRIOC_ADD_PAGE_ENTRY:
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
if (copy_from_user (&sentry, (void *) arg, sizeof sentry)) if (copy_from_user (&sentry, (void *) arg, sizeof sentry))
return -EFAULT; return -EFAULT;
err = mtrr_file_add (sentry.base, sentry.size, sentry.type, file, 1); err = mtrr_file_add (sentry.base, sentry.size, sentry.type, file, 1);
if (err < 0) if (err < 0)
return err; return err;
break; break;
case MTRRIOC_SET_PAGE_ENTRY: case MTRRIOC_SET_PAGE_ENTRY:
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
if (copy_from_user (&sentry, (void *) arg, sizeof sentry)) if (copy_from_user (&sentry, (void *) arg, sizeof sentry))
return -EFAULT; return -EFAULT;
err = mtrr_add_page (sentry.base, sentry.size, sentry.type, 0); err = mtrr_add_page (sentry.base, sentry.size, sentry.type, 0);
if (err < 0) if (err < 0)
return err; return err;
break; break;
case MTRRIOC_DEL_PAGE_ENTRY: case MTRRIOC_DEL_PAGE_ENTRY:
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
if (copy_from_user (&sentry, (void *) arg, sizeof sentry)) if (copy_from_user (&sentry, (void *) arg, sizeof sentry))
return -EFAULT; return -EFAULT;
err = mtrr_file_del (sentry.base, sentry.size, file, 1); err = mtrr_file_del (sentry.base, sentry.size, file, 1);
if (err < 0) if (err < 0)
return err; return err;
break; break;
case MTRRIOC_KILL_PAGE_ENTRY: case MTRRIOC_KILL_PAGE_ENTRY:
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
if (copy_from_user (&sentry, (void *) arg, sizeof sentry)) if (copy_from_user (&sentry, (void *) arg, sizeof sentry))
return -EFAULT; return -EFAULT;
err = mtrr_del_page (-1, sentry.base, sentry.size); err = mtrr_del_page (-1, sentry.base, sentry.size);
if (err < 0) if (err < 0)
return err; return err;
break; break;
case MTRRIOC_GET_PAGE_ENTRY: case MTRRIOC_GET_PAGE_ENTRY:
if (copy_from_user (&gentry, (void *) arg, sizeof gentry)) if (copy_from_user (&gentry, (void *) arg, sizeof gentry))
return -EFAULT; return -EFAULT;
if (gentry.regnum >= get_num_var_ranges ()) if (gentry.regnum >= get_num_var_ranges ())
return -EINVAL; return -EINVAL;
get_mtrr (gentry.regnum, (u64*) &gentry.base, &gentry.size, &type); get_mtrr (gentry.regnum, (u64*) &gentry.base, &gentry.size, &type);
gentry.type = type; gentry.type = type;
if (copy_to_user ((void *) arg, &gentry, sizeof gentry)) if (copy_to_user ((void *) arg, &gentry, sizeof gentry))
return -EFAULT; return -EFAULT;
break; break;
} }
return 0; return 0;
} }
static int mtrr_close (struct inode *ino, struct file *file) static int mtrr_close (struct inode *ino, struct file *file)
{ {
int i, max; int i, max;
unsigned int *fcount = file->private_data; unsigned int *fcount = file->private_data;
if (fcount == NULL) if (fcount == NULL)
return 0; return 0;
lock_kernel (); lock_kernel ();
max = get_num_var_ranges (); max = get_num_var_ranges ();
for (i = 0; i < max; ++i) { for (i = 0; i < max; ++i) {
while (fcount[i] > 0) { while (fcount[i] > 0) {
if (mtrr_del (i, 0, 0) < 0) if (mtrr_del (i, 0, 0) < 0)
printk ("mtrr: reg %d not used\n", i); printk ("mtrr: reg %d not used\n", i);
--fcount[i]; --fcount[i];
}
} }
}
unlock_kernel (); unlock_kernel ();
kfree (fcount); kfree (fcount);
file->private_data = NULL; file->private_data = NULL;
return 0; return 0;
} }
static struct file_operations mtrr_fops = { static struct file_operations mtrr_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.read = mtrr_read, .read = mtrr_read,
.write = mtrr_write, .write = mtrr_write,
.ioctl = mtrr_ioctl, .ioctl = mtrr_ioctl,
.release = mtrr_close, .release = mtrr_close,
}; };
...@@ -1185,38 +1186,38 @@ static devfs_handle_t devfs_handle; ...@@ -1185,38 +1186,38 @@ static devfs_handle_t devfs_handle;
static void compute_ascii (void) static void compute_ascii (void)
{ {
char factor; char factor;
int i, max; int i, max;
mtrr_type type; mtrr_type type;
u64 base; u64 base;
u32 size; u32 size;
ascii_buf_bytes = 0; ascii_buf_bytes = 0;
max = get_num_var_ranges (); max = get_num_var_ranges ();
for (i = 0; i < max; i++) { for (i = 0; i < max; i++) {
get_mtrr (i, &base, &size, &type); get_mtrr (i, &base, &size, &type);
if (size == 0) if (size == 0)
usage_table[i] = 0; usage_table[i] = 0;
else { else {
if (size < (0x100000 >> PAGE_SHIFT)) { if (size < (0x100000 >> PAGE_SHIFT)) {
/* less than 1MB */ /* less than 1MB */
factor = 'K'; factor = 'K';
size <<= PAGE_SHIFT - 10; size <<= PAGE_SHIFT - 10;
} else { } else {
factor = 'M'; factor = 'M';
size >>= 20 - PAGE_SHIFT; size >>= 20 - PAGE_SHIFT;
} }
sprintf (ascii_buffer + ascii_buf_bytes, sprintf (ascii_buffer + ascii_buf_bytes,
"reg%02i: base=0x%05Lx000 (%4iMB), size=%4i%cB: %s, count=%d\n", "reg%02i: base=0x%05Lx000 (%4iMB), size=%4i%cB: %s, count=%d\n",
i, base, (u32) base >> (20 - PAGE_SHIFT), size, factor, i, base, (u32) base >> (20 - PAGE_SHIFT), size, factor,
attrib_to_str (type), usage_table[i]); attrib_to_str (type), usage_table[i]);
ascii_buf_bytes += strlen (ascii_buffer + ascii_buf_bytes); ascii_buf_bytes += strlen (ascii_buffer + ascii_buf_bytes);
}
} }
} devfs_set_file_size (devfs_handle, ascii_buf_bytes);
devfs_set_file_size (devfs_handle, ascii_buf_bytes);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
if (proc_root_mtrr) if (proc_root_mtrr)
proc_root_mtrr->size = ascii_buf_bytes; proc_root_mtrr->size = ascii_buf_bytes;
#endif #endif
} }
...@@ -1225,7 +1226,7 @@ static void compute_ascii (void) ...@@ -1225,7 +1226,7 @@ static void compute_ascii (void)
EXPORT_SYMBOL (mtrr_add); EXPORT_SYMBOL (mtrr_add);
EXPORT_SYMBOL (mtrr_del); EXPORT_SYMBOL (mtrr_del);
static void __init mtrr_setup (void) static void __init mtrr_setup (void)
{ {
printk ("mtrr: v%s)\n", MTRR_VERSION); printk ("mtrr: v%s)\n", MTRR_VERSION);
...@@ -1234,7 +1235,7 @@ static void __init mtrr_setup (void) ...@@ -1234,7 +1235,7 @@ static void __init mtrr_setup (void)
/* Query the width (in bits) of the physical /* Query the width (in bits) of the physical
addressable memory on the Hammer family. */ addressable memory on the Hammer family. */
if ((cpuid_eax (0x80000000) >= 0x80000008)) { if ((cpuid_eax (0x80000000) >= 0x80000008)) {
u32 phys_addr; u32 phys_addr;
phys_addr = cpuid_eax (0x80000008) & 0xff; phys_addr = cpuid_eax (0x80000008) & 0xff;
size_or_mask = ~((1L << phys_addr) - 1); size_or_mask = ~((1L << phys_addr) - 1);
/* /*
...@@ -1263,30 +1264,30 @@ void __init mtrr_init_secondary_cpu (void) ...@@ -1263,30 +1264,30 @@ void __init mtrr_init_secondary_cpu (void)
{ {
u64 mask; u64 mask;
int count; int count;
struct set_mtrr_context ctxt; struct set_mtrr_context ctxt;
/* Note that this is not ideal, since the cache is only flushed/disabled /* Note that this is not ideal, since the cache is only flushed/disabled
for this CPU while the MTRRs are changed, but changing this requires for this CPU while the MTRRs are changed, but changing this requires
more invasive changes to the way the kernel boots */ more invasive changes to the way the kernel boots */
set_mtrr_prepare (&ctxt); set_mtrr_prepare (&ctxt);
mask = set_mtrr_state (&smp_mtrr_state, &ctxt); mask = set_mtrr_state (&smp_mtrr_state, &ctxt);
set_mtrr_done (&ctxt); set_mtrr_done (&ctxt);
/* Use the atomic bitops to update the global mask */ /* Use the atomic bitops to update the global mask */
for (count = 0; count < sizeof mask * 8; ++count) { for (count = 0; count < sizeof mask * 8; ++count) {
if (mask & 0x01) if (mask & 0x01)
set_bit (count, &smp_changes_mask); set_bit (count, &smp_changes_mask);
mask >>= 1; mask >>= 1;
} }
} }
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
int __init mtrr_init (void) int __init mtrr_init (void)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
/* mtrr_setup() should already have been called from mtrr_init_boot_cpu() */ /* mtrr_setup() should already have been called from mtrr_init_boot_cpu() */
finalize_mtrr_state (&smp_mtrr_state); finalize_mtrr_state (&smp_mtrr_state);
mtrr_state_warn (smp_changes_mask); mtrr_state_warn (smp_changes_mask);
...@@ -1295,17 +1296,17 @@ int __init mtrr_init (void) ...@@ -1295,17 +1296,17 @@ int __init mtrr_init (void)
#endif #endif
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
proc_root_mtrr = create_proc_entry ("mtrr", S_IWUSR | S_IRUGO, &proc_root); proc_root_mtrr = create_proc_entry ("mtrr", S_IWUSR | S_IRUGO, &proc_root);
if (proc_root_mtrr) { if (proc_root_mtrr) {
proc_root_mtrr->owner = THIS_MODULE; proc_root_mtrr->owner = THIS_MODULE;
proc_root_mtrr->proc_fops = &mtrr_fops; proc_root_mtrr->proc_fops = &mtrr_fops;
} }
#endif #endif
#ifdef CONFIG_DEVFS_FS #ifdef CONFIG_DEVFS_FS
devfs_handle = devfs_register (NULL, "cpu/mtrr", DEVFS_FL_DEFAULT, 0, 0, devfs_handle = devfs_register (NULL, "cpu/mtrr", DEVFS_FL_DEFAULT, 0, 0,
S_IFREG | S_IRUGO | S_IWUSR, S_IFREG | S_IRUGO | S_IWUSR,
&mtrr_fops, NULL); &mtrr_fops, NULL);
#endif #endif
init_table (); init_table ();
return 0; return 0;
} }
...@@ -304,7 +304,6 @@ static void epat_log_adapter( PIA *pi, char * scratch, int verbose ) ...@@ -304,7 +304,6 @@ static void epat_log_adapter( PIA *pi, char * scratch, int verbose )
static void epat_init_proto( PIA *pi) static void epat_init_proto( PIA *pi)
{ MOD_INC_USE_COUNT; { MOD_INC_USE_COUNT;
printk("epat_init_proto");
} }
static void epat_release_proto( PIA *pi) static void epat_release_proto( PIA *pi)
......
...@@ -90,7 +90,7 @@ static struct block_device *rd_bdev[NUM_RAMDISKS];/* Protected device data */ ...@@ -90,7 +90,7 @@ static struct block_device *rd_bdev[NUM_RAMDISKS];/* Protected device data */
*/ */
int rd_size = CONFIG_BLK_DEV_RAM_SIZE; /* Size of the RAM disks */ int rd_size = CONFIG_BLK_DEV_RAM_SIZE; /* Size of the RAM disks */
/* /*
* It would be very desiderable to have a soft-blocksize (that in the case * It would be very desirable to have a soft-blocksize (that in the case
* of the ramdisk driver is also the hardblocksize ;) of PAGE_SIZE because * of the ramdisk driver is also the hardblocksize ;) of PAGE_SIZE because
* doing that we'll achieve a far better MM footprint. Using a rd_blocksize of * doing that we'll achieve a far better MM footprint. Using a rd_blocksize of
* BLOCK_SIZE in the worst case we'll make PAGE_SIZE/BLOCK_SIZE buffer-pages * BLOCK_SIZE in the worst case we'll make PAGE_SIZE/BLOCK_SIZE buffer-pages
......
...@@ -268,7 +268,7 @@ static void __do_gscd_request(unsigned long dummy) ...@@ -268,7 +268,7 @@ static void __do_gscd_request(unsigned long dummy)
goto out; goto out;
if (req->cmd != READ) { if (req->cmd != READ) {
printk("GSCD: bad cmd %p\n", req->cmd); printk("GSCD: bad cmd %d\n", req->cmd);
end_request(req, 0); end_request(req, 0);
goto repeat; goto repeat;
} }
......
...@@ -354,6 +354,13 @@ ...@@ -354,6 +354,13 @@
* Marcin Dalecki * Marcin Dalecki
*/ */
/*
* Add bio/kdev_t changes for 2.5.x required to make it work again.
* Still room for improvement in the request handling here if anyone
* actually cares. Bring your own chainsaw. Paul G. 02/2002
*/
#include <linux/module.h> #include <linux/module.h>
#include <linux/version.h> #include <linux/version.h>
...@@ -463,6 +470,8 @@ MODULE_PARM(max_drives, "i"); ...@@ -463,6 +470,8 @@ MODULE_PARM(max_drives, "i");
#define NUM_PROBE (sizeof(sbpcd) / sizeof(int)) #define NUM_PROBE (sizeof(sbpcd) / sizeof(int))
static spinlock_t sbpcd_lock = SPIN_LOCK_UNLOCKED;
/*==========================================================================*/ /*==========================================================================*/
#define INLINE inline #define INLINE inline
...@@ -4856,21 +4865,19 @@ static void do_sbpcd_request(request_queue_t * q) ...@@ -4856,21 +4865,19 @@ static void do_sbpcd_request(request_queue_t * q)
printk(" do_sbpcd_request[%di](%p:%ld+%ld), Pid:%d, Time:%li\n", printk(" do_sbpcd_request[%di](%p:%ld+%ld), Pid:%d, Time:%li\n",
xnr, req, req->sector, req->nr_sectors, current->pid, jiffies); xnr, req, req->sector, req->nr_sectors, current->pid, jiffies);
#endif #endif
if (blk_queue_empty(q)) if (blk_queue_empty(q))
return; return;
req = elv_next_request(q); /* take out our request so no other */ req = elv_next_request(q); /* take out our request so no other */
blkdev_dequeue_request(req); /* task can fuck it up GTL */
if (req -> sector == -1) if (req -> sector == -1)
end_request(req, 0); end_request(req, 0);
spin_unlock_irq(q->queue_lock); spin_unlock_irq(q->queue_lock);
down(&ioctl_read_sem); down(&ioctl_read_sem);
if (req->cmd != READ) if (rq_data_dir(CURRENT) != READ)
{ {
msg(DBG_INF, "bad cmd %d\n", req->cmd); msg(DBG_INF, "bad cmd %d\n", req->cmd[0]);
goto err_done; goto err_done;
} }
p = req->rq_disk->private_data; p = req->rq_disk->private_data;
...@@ -5775,6 +5782,12 @@ int __init sbpcd_init(void) ...@@ -5775,6 +5782,12 @@ int __init sbpcd_init(void)
if (i>=0) p->CD_changed=1; if (i>=0) p->CD_changed=1;
} }
if (!request_region(CDo_command,4,major_name))
{
printk(KERN_WARNING "sbpcd: Unable to request region 0x%x\n", CDo_command);
return -EIO;
}
/* /*
* Turn on the CD audio channels. * Turn on the CD audio channels.
* The addresses are obtained from SOUND_BASE (see sbpcd.h). * The addresses are obtained from SOUND_BASE (see sbpcd.h).
...@@ -5795,9 +5808,8 @@ int __init sbpcd_init(void) ...@@ -5795,9 +5808,8 @@ int __init sbpcd_init(void)
} }
blk_init_queue(&sbpcd_queue, do_sbpcd_request, &sbpcd_lock); blk_init_queue(&sbpcd_queue, do_sbpcd_request, &sbpcd_lock);
request_region(CDo_command,4,major_name);
devfs_handle = devfs_mk_dir (NULL, "sbp", NULL); devfs_handle = devfs_mk_dir (NULL, "sbp", NULL);
for (j=0;j<NR_SBPCD;j++) for (j=0;j<NR_SBPCD;j++)
{ {
struct cdrom_device_info * sbpcd_infop; struct cdrom_device_info * sbpcd_infop;
...@@ -5908,6 +5920,7 @@ void sbpcd_exit(void) ...@@ -5908,6 +5920,7 @@ void sbpcd_exit(void)
msg(DBG_INF, "%s module released.\n", major_name); msg(DBG_INF, "%s module released.\n", major_name);
} }
module_init(__sbpcd_init) /*HACK!*/; module_init(__sbpcd_init) /*HACK!*/;
module_exit(sbpcd_exit); module_exit(sbpcd_exit);
...@@ -5922,8 +5935,7 @@ static int sbpcd_media_changed(struct cdrom_device_info *cdi, int disc_nr) ...@@ -5922,8 +5935,7 @@ static int sbpcd_media_changed(struct cdrom_device_info *cdi, int disc_nr)
{ {
p->CD_changed=0; p->CD_changed=0;
msg(DBG_CHK,"medium changed (drive %s)\n", cdi->name); msg(DBG_CHK,"medium changed (drive %s)\n", cdi->name);
/* BUG! Should invalidate buffers! --AJK */ invalidate_buffers(full_dev);
/* Why should it do the above at all?! --mdcki */
current_drive->diskstate_flags &= ~toc_bit; current_drive->diskstate_flags &= ~toc_bit;
current_drive->diskstate_flags &= ~cd_size_bit; current_drive->diskstate_flags &= ~cd_size_bit;
#if SAFE_MIXED #if SAFE_MIXED
......
...@@ -40,93 +40,6 @@ CONFIG_MWAVE ...@@ -40,93 +40,6 @@ CONFIG_MWAVE
The module will be called mwave.o. If you want to compile it as The module will be called mwave.o. If you want to compile it as
a module, say M here and read Documentation/modules.txt. a module, say M here and read Documentation/modules.txt.
CONFIG_AGP
AGP (Accelerated Graphics Port) is a bus system mainly used to
connect graphics cards to the rest of the system.
If you have an AGP system and you say Y here, it will be possible to
use the AGP features of your 3D rendering video card. This code acts
as a sort of "AGP driver" for the motherboard's chipset.
If you need more texture memory than you can get with the AGP GART
(theoretically up to 256 MB, but in practice usually 64 or 128 MB
due to kernel allocation issues), you could use PCI accesses
and have up to a couple gigs of texture space.
Note that this is the only means to have XFree4/GLX use
write-combining with MTRR support on the AGP bus. Without it, OpenGL
direct rendering will be a lot slower but still faster than PIO.
You should say Y here if you use XFree86 3.3.6 or 4.x and want to
use GLX or DRI. If unsure, say N.
This driver is available as a module. If you want to compile it as
a module, say M here and read <file:Documentation/modules.txt>. The
module will be called agpgart.o.
CONFIG_AGP_INTEL
This option gives you AGP support for the GLX component of the
XFree86 4.x on Intel 440LX/BX/GX, 815, 820, 830, 840, 845, 850 and 860 chipsets.
You should say Y here if you use XFree86 3.3.6 or 4.x and want to
use GLX or DRI. If unsure, say N.
CONFIG_AGP_I810
This option gives you AGP support for the Xserver on the Intel 810
815 and 830m chipset boards for their on-board integrated graphics. This
is required to do any useful video modes with these boards.
CONFIG_AGP_I460
This option gives you AGP GART support for the Intel 460GX chipset
for IA64 processors.
CONFIG_AGP_VIA
This option gives you AGP support for the GLX component of the
XFree86 4.x on VIA MPV3/Apollo Pro chipsets.
You should say Y here if you use XFree86 3.3.6 or 4.x and want to
use GLX or DRI. If unsure, say N.
CONFIG_AGP_AMD
This option gives you AGP support for the GLX component of the
XFree86 4.x on AMD Irongate, 761, and 762 chipsets.
You should say Y here if you use XFree86 3.3.6 or 4.x and want to
use GLX or DRI. If unsure, say N.
CONFIG_AGP_SIS
This option gives you AGP support for the GLX component of the "soon
to be released" XFree86 4.x on Silicon Integrated Systems [SiS]
chipsets.
Note that 5591/5592 AGP chipsets are NOT supported.
You should say Y here if you use XFree86 3.3.6 or 4.x and want to
use GLX or DRI. If unsure, say N.
CONFIG_AGP_SWORKS
Say Y here to support the Serverworks AGP card. See
<http://www.serverworks.com/> for product descriptions and images.
CONFIG_AGP_ALI
This option gives you AGP support for the GLX component of the
XFree86 4.x on the following ALi chipsets. The supported chipsets
include M1541, M1621, M1631, M1632, M1641,M1647,and M1651.
For the ALi-chipset question, ALi suggests you refer to
<http://www.ali.com.tw/eng/support/index.shtml>.
The M1541 chipset can do AGP 1x and 2x, but note that there is an
acknowledged incompatibility with Matrox G200 cards. Due to
timing issues, this chipset cannot do AGP 2x with the G200.
This is a hardware limitation. AGP 1x seems to be fine, though.
You should say Y here if you use XFree86 3.3.6 or 4.x and want to
use GLX or DRI. If unsure, say N.
CONFIG_AGP_HP_ZX1
This option gives you AGP GART support for the HP ZX1 chipset
for IA64 processors.
CONFIG_I810_TCO CONFIG_I810_TCO
Hardware driver for the TCO timer built into the Intel i810 and i815 Hardware driver for the TCO timer built into the Intel i810 and i815
chipset family. The TCO (Total Cost of Ownership) timer is a chipset family. The TCO (Total Cost of Ownership) timer is a
......
...@@ -50,15 +50,16 @@ set_t *setInit(void) ...@@ -50,15 +50,16 @@ set_t *setInit(void)
set_t *set; set_t *set;
set = (set_t *)MALLOC(sizeof(set_t)); set = (set_t *)MALLOC(sizeof(set_t));
for(i = 0; i < SET_SIZE; i++){ if (set) {
set->list[i].free_next = i+1; for(i = 0; i < SET_SIZE; i++){
set->list[i].alloc_next = -1; set->list[i].free_next = i+1;
} set->list[i].alloc_next = -1;
set->list[SET_SIZE-1].free_next = -1; }
set->free = 0; set->list[SET_SIZE-1].free_next = -1;
set->alloc = -1; set->free = 0;
set->trace = -1; set->alloc = -1;
set->trace = -1;
}
return set; return set;
} }
...@@ -172,7 +173,8 @@ static void *calloc(size_t nmemb, size_t size) ...@@ -172,7 +173,8 @@ static void *calloc(size_t nmemb, size_t size)
{ {
void *addr; void *addr;
addr = kmalloc(nmemb*size, GFP_KERNEL); addr = kmalloc(nmemb*size, GFP_KERNEL);
memset(addr, 0, nmemb*size); if (addr)
memset(addr, 0, nmemb*size);
return addr; return addr;
} }
#define free(n) kfree(n) #define free(n) kfree(n)
......
...@@ -71,7 +71,7 @@ typedef struct { ...@@ -71,7 +71,7 @@ typedef struct {
/* Count nr of 1's in pattern. /* Count nr of 1's in pattern.
*/ */
extern inline int count_ones(unsigned long mask) static inline int count_ones(unsigned long mask)
{ {
int bits; int bits;
......
...@@ -168,11 +168,11 @@ extern int zft_fake_volume_headers (eof_mark_union *eof_map, ...@@ -168,11 +168,11 @@ extern int zft_fake_volume_headers (eof_mark_union *eof_map,
extern int zft_weof (unsigned int count, zft_position *pos); extern int zft_weof (unsigned int count, zft_position *pos);
extern void zft_move_past_eof (zft_position *pos); extern void zft_move_past_eof (zft_position *pos);
extern inline int zft_tape_at_eod (const zft_position *pos); static inline int zft_tape_at_eod (const zft_position *pos);
extern inline int zft_tape_at_lbot (const zft_position *pos); static inline int zft_tape_at_lbot (const zft_position *pos);
extern inline void zft_position_before_eof (zft_position *pos, static inline void zft_position_before_eof (zft_position *pos,
const zft_volinfo *volume); const zft_volinfo *volume);
extern inline __s64 zft_check_for_eof(const zft_volinfo *vtbl, static inline __s64 zft_check_for_eof(const zft_volinfo *vtbl,
const zft_position *pos); const zft_position *pos);
/* this function decrements the zft_seg_pos counter if we are right /* this function decrements the zft_seg_pos counter if we are right
...@@ -180,7 +180,7 @@ extern inline __s64 zft_check_for_eof(const zft_volinfo *vtbl, ...@@ -180,7 +180,7 @@ extern inline __s64 zft_check_for_eof(const zft_volinfo *vtbl,
* need to position before the eof mark. NOTE: zft_tape_pos is not * need to position before the eof mark. NOTE: zft_tape_pos is not
* changed * changed
*/ */
extern inline void zft_position_before_eof(zft_position *pos, static inline void zft_position_before_eof(zft_position *pos,
const zft_volinfo *volume) const zft_volinfo *volume)
{ {
TRACE_FUN(ft_t_flow); TRACE_FUN(ft_t_flow);
...@@ -195,7 +195,7 @@ extern inline void zft_position_before_eof(zft_position *pos, ...@@ -195,7 +195,7 @@ extern inline void zft_position_before_eof(zft_position *pos,
/* Mmmh. Is the position at the end of the last volume, that is right /* Mmmh. Is the position at the end of the last volume, that is right
* before the last EOF mark also logical an EOD condition? * before the last EOF mark also logical an EOD condition?
*/ */
extern inline int zft_tape_at_eod(const zft_position *pos) static inline int zft_tape_at_eod(const zft_position *pos)
{ {
TRACE_FUN(ft_t_any); TRACE_FUN(ft_t_any);
...@@ -207,7 +207,7 @@ extern inline int zft_tape_at_eod(const zft_position *pos) ...@@ -207,7 +207,7 @@ extern inline int zft_tape_at_eod(const zft_position *pos)
} }
} }
extern inline int zft_tape_at_lbot(const zft_position *pos) static inline int zft_tape_at_lbot(const zft_position *pos)
{ {
if (zft_qic_mode) { if (zft_qic_mode) {
return (pos->seg_pos <= zft_first_vtbl->start_seg && return (pos->seg_pos <= zft_first_vtbl->start_seg &&
...@@ -220,7 +220,7 @@ extern inline int zft_tape_at_lbot(const zft_position *pos) ...@@ -220,7 +220,7 @@ extern inline int zft_tape_at_lbot(const zft_position *pos)
/* This one checks for EOF. return remaing space (may be negative) /* This one checks for EOF. return remaing space (may be negative)
*/ */
extern inline __s64 zft_check_for_eof(const zft_volinfo *vtbl, static inline __s64 zft_check_for_eof(const zft_volinfo *vtbl,
const zft_position *pos) const zft_position *pos)
{ {
return (__s64)(vtbl->size - pos->volume_pos); return (__s64)(vtbl->size - pos->volume_pos);
......
...@@ -122,7 +122,7 @@ struct miscdevice isiloader_device = { ...@@ -122,7 +122,7 @@ struct miscdevice isiloader_device = {
}; };
extern inline int WaitTillCardIsFree(unsigned short base) static inline int WaitTillCardIsFree(unsigned short base)
{ {
unsigned long count=0; unsigned long count=0;
while( (!(inw(base+0xe) & 0x1)) && (count++ < 6000000)); while( (!(inw(base+0xe) & 0x1)) && (count++ < 6000000));
...@@ -358,7 +358,7 @@ static inline int isicom_paranoia_check(struct isi_port const * port, kdev_t dev ...@@ -358,7 +358,7 @@ static inline int isicom_paranoia_check(struct isi_port const * port, kdev_t dev
return 0; return 0;
} }
extern inline void schedule_bh(struct isi_port * port) static inline void schedule_bh(struct isi_port * port)
{ {
queue_task(&port->bh_tqueue, &tq_isicom); queue_task(&port->bh_tqueue, &tq_isicom);
mark_bh(ISICOM_BH); mark_bh(ISICOM_BH);
...@@ -823,7 +823,7 @@ static void isicom_config_port(struct isi_port * port) ...@@ -823,7 +823,7 @@ static void isicom_config_port(struct isi_port * port)
/* open et all */ /* open et all */
extern inline void isicom_setup_board(struct isi_board * bp) static inline void isicom_setup_board(struct isi_board * bp)
{ {
int channel; int channel;
struct isi_port * port; struct isi_port * port;
...@@ -1091,7 +1091,7 @@ static int isicom_open(struct tty_struct * tty, struct file * filp) ...@@ -1091,7 +1091,7 @@ static int isicom_open(struct tty_struct * tty, struct file * filp)
/* close et all */ /* close et all */
extern inline void isicom_shutdown_board(struct isi_board * bp) static inline void isicom_shutdown_board(struct isi_board * bp)
{ {
int channel; int channel;
struct isi_port * port; struct isi_port * port;
...@@ -1353,7 +1353,7 @@ static int isicom_chars_in_buffer(struct tty_struct * tty) ...@@ -1353,7 +1353,7 @@ static int isicom_chars_in_buffer(struct tty_struct * tty)
} }
/* ioctl et all */ /* ioctl et all */
extern inline void isicom_send_break(struct isi_port * port, unsigned long length) static inline void isicom_send_break(struct isi_port * port, unsigned long length)
{ {
struct isi_board * card = port->card; struct isi_board * card = port->card;
short wait = 10; short wait = 10;
......
...@@ -239,28 +239,28 @@ static inline int sx_paranoia_check(struct specialix_port const * port, ...@@ -239,28 +239,28 @@ static inline int sx_paranoia_check(struct specialix_port const * port,
*/ */
/* Get board number from pointer */ /* Get board number from pointer */
extern inline int board_No (struct specialix_board * bp) static inline int board_No (struct specialix_board * bp)
{ {
return bp - sx_board; return bp - sx_board;
} }
/* Get port number from pointer */ /* Get port number from pointer */
extern inline int port_No (struct specialix_port const * port) static inline int port_No (struct specialix_port const * port)
{ {
return SX_PORT(port - sx_port); return SX_PORT(port - sx_port);
} }
/* Get pointer to board from pointer to port */ /* Get pointer to board from pointer to port */
extern inline struct specialix_board * port_Board(struct specialix_port const * port) static inline struct specialix_board * port_Board(struct specialix_port const * port)
{ {
return &sx_board[SX_BOARD(port - sx_port)]; return &sx_board[SX_BOARD(port - sx_port)];
} }
/* Input Byte from CL CD186x register */ /* Input Byte from CL CD186x register */
extern inline unsigned char sx_in(struct specialix_board * bp, unsigned short reg) static inline unsigned char sx_in(struct specialix_board * bp, unsigned short reg)
{ {
bp->reg = reg | 0x80; bp->reg = reg | 0x80;
outb (reg | 0x80, bp->base + SX_ADDR_REG); outb (reg | 0x80, bp->base + SX_ADDR_REG);
...@@ -269,7 +269,7 @@ extern inline unsigned char sx_in(struct specialix_board * bp, unsigned short r ...@@ -269,7 +269,7 @@ extern inline unsigned char sx_in(struct specialix_board * bp, unsigned short r
/* Output Byte to CL CD186x register */ /* Output Byte to CL CD186x register */
extern inline void sx_out(struct specialix_board * bp, unsigned short reg, static inline void sx_out(struct specialix_board * bp, unsigned short reg,
unsigned char val) unsigned char val)
{ {
bp->reg = reg | 0x80; bp->reg = reg | 0x80;
...@@ -279,7 +279,7 @@ extern inline void sx_out(struct specialix_board * bp, unsigned short reg, ...@@ -279,7 +279,7 @@ extern inline void sx_out(struct specialix_board * bp, unsigned short reg,
/* Input Byte from CL CD186x register */ /* Input Byte from CL CD186x register */
extern inline unsigned char sx_in_off(struct specialix_board * bp, unsigned short reg) static inline unsigned char sx_in_off(struct specialix_board * bp, unsigned short reg)
{ {
bp->reg = reg; bp->reg = reg;
outb (reg, bp->base + SX_ADDR_REG); outb (reg, bp->base + SX_ADDR_REG);
...@@ -288,7 +288,7 @@ extern inline unsigned char sx_in_off(struct specialix_board * bp, unsigned sho ...@@ -288,7 +288,7 @@ extern inline unsigned char sx_in_off(struct specialix_board * bp, unsigned sho
/* Output Byte to CL CD186x register */ /* Output Byte to CL CD186x register */
extern inline void sx_out_off(struct specialix_board * bp, unsigned short reg, static inline void sx_out_off(struct specialix_board * bp, unsigned short reg,
unsigned char val) unsigned char val)
{ {
bp->reg = reg; bp->reg = reg;
...@@ -298,7 +298,7 @@ extern inline void sx_out_off(struct specialix_board * bp, unsigned short reg, ...@@ -298,7 +298,7 @@ extern inline void sx_out_off(struct specialix_board * bp, unsigned short reg,
/* Wait for Channel Command Register ready */ /* Wait for Channel Command Register ready */
extern inline void sx_wait_CCR(struct specialix_board * bp) static inline void sx_wait_CCR(struct specialix_board * bp)
{ {
unsigned long delay; unsigned long delay;
...@@ -311,7 +311,7 @@ extern inline void sx_wait_CCR(struct specialix_board * bp) ...@@ -311,7 +311,7 @@ extern inline void sx_wait_CCR(struct specialix_board * bp)
/* Wait for Channel Command Register ready */ /* Wait for Channel Command Register ready */
extern inline void sx_wait_CCR_off(struct specialix_board * bp) static inline void sx_wait_CCR_off(struct specialix_board * bp)
{ {
unsigned long delay; unsigned long delay;
...@@ -327,13 +327,13 @@ extern inline void sx_wait_CCR_off(struct specialix_board * bp) ...@@ -327,13 +327,13 @@ extern inline void sx_wait_CCR_off(struct specialix_board * bp)
* specialix IO8+ IO range functions. * specialix IO8+ IO range functions.
*/ */
extern inline int sx_check_io_range(struct specialix_board * bp) static inline int sx_check_io_range(struct specialix_board * bp)
{ {
return check_region (bp->base, SX_IO_SPACE); return check_region (bp->base, SX_IO_SPACE);
} }
extern inline void sx_request_io_range(struct specialix_board * bp) static inline void sx_request_io_range(struct specialix_board * bp)
{ {
request_region(bp->base, request_region(bp->base,
bp->flags&SX_BOARD_IS_PCI?SX_PCI_IO_SPACE:SX_IO_SPACE, bp->flags&SX_BOARD_IS_PCI?SX_PCI_IO_SPACE:SX_IO_SPACE,
...@@ -341,7 +341,7 @@ extern inline void sx_request_io_range(struct specialix_board * bp) ...@@ -341,7 +341,7 @@ extern inline void sx_request_io_range(struct specialix_board * bp)
} }
extern inline void sx_release_io_range(struct specialix_board * bp) static inline void sx_release_io_range(struct specialix_board * bp)
{ {
release_region(bp->base, release_region(bp->base,
bp->flags&SX_BOARD_IS_PCI?SX_PCI_IO_SPACE:SX_IO_SPACE); bp->flags&SX_BOARD_IS_PCI?SX_PCI_IO_SPACE:SX_IO_SPACE);
...@@ -351,7 +351,7 @@ extern inline void sx_release_io_range(struct specialix_board * bp) ...@@ -351,7 +351,7 @@ extern inline void sx_release_io_range(struct specialix_board * bp)
/* Must be called with enabled interrupts */ /* Must be called with enabled interrupts */
/* Ugly. Very ugly. Don't use this for anything else than initialization /* Ugly. Very ugly. Don't use this for anything else than initialization
code */ code */
extern inline void sx_long_delay(unsigned long delay) static inline void sx_long_delay(unsigned long delay)
{ {
unsigned long i; unsigned long i;
...@@ -599,7 +599,7 @@ static int sx_probe(struct specialix_board *bp) ...@@ -599,7 +599,7 @@ static int sx_probe(struct specialix_board *bp)
* Interrupt processing routines. * Interrupt processing routines.
* */ * */
extern inline void sx_mark_event(struct specialix_port * port, int event) static inline void sx_mark_event(struct specialix_port * port, int event)
{ {
/* /*
* I'm not quite happy with current scheme all serial * I'm not quite happy with current scheme all serial
...@@ -616,7 +616,7 @@ extern inline void sx_mark_event(struct specialix_port * port, int event) ...@@ -616,7 +616,7 @@ extern inline void sx_mark_event(struct specialix_port * port, int event)
} }
extern inline struct specialix_port * sx_get_port(struct specialix_board * bp, static inline struct specialix_port * sx_get_port(struct specialix_board * bp,
unsigned char const * what) unsigned char const * what)
{ {
unsigned char channel; unsigned char channel;
...@@ -635,7 +635,7 @@ extern inline struct specialix_port * sx_get_port(struct specialix_board * bp, ...@@ -635,7 +635,7 @@ extern inline struct specialix_port * sx_get_port(struct specialix_board * bp,
} }
extern inline void sx_receive_exc(struct specialix_board * bp) static inline void sx_receive_exc(struct specialix_board * bp)
{ {
struct specialix_port *port; struct specialix_port *port;
struct tty_struct *tty; struct tty_struct *tty;
...@@ -701,7 +701,7 @@ extern inline void sx_receive_exc(struct specialix_board * bp) ...@@ -701,7 +701,7 @@ extern inline void sx_receive_exc(struct specialix_board * bp)
} }
extern inline void sx_receive(struct specialix_board * bp) static inline void sx_receive(struct specialix_board * bp)
{ {
struct specialix_port *port; struct specialix_port *port;
struct tty_struct *tty; struct tty_struct *tty;
...@@ -732,7 +732,7 @@ extern inline void sx_receive(struct specialix_board * bp) ...@@ -732,7 +732,7 @@ extern inline void sx_receive(struct specialix_board * bp)
} }
extern inline void sx_transmit(struct specialix_board * bp) static inline void sx_transmit(struct specialix_board * bp)
{ {
struct specialix_port *port; struct specialix_port *port;
struct tty_struct *tty; struct tty_struct *tty;
...@@ -802,7 +802,7 @@ extern inline void sx_transmit(struct specialix_board * bp) ...@@ -802,7 +802,7 @@ extern inline void sx_transmit(struct specialix_board * bp)
} }
extern inline void sx_check_modem(struct specialix_board * bp) static inline void sx_check_modem(struct specialix_board * bp)
{ {
struct specialix_port *port; struct specialix_port *port;
struct tty_struct *tty; struct tty_struct *tty;
...@@ -962,7 +962,7 @@ void turn_ints_on (struct specialix_board *bp) ...@@ -962,7 +962,7 @@ void turn_ints_on (struct specialix_board *bp)
/* Called with disabled interrupts */ /* Called with disabled interrupts */
extern inline int sx_setup_board(struct specialix_board * bp) static inline int sx_setup_board(struct specialix_board * bp)
{ {
int error; int error;
...@@ -986,7 +986,7 @@ extern inline int sx_setup_board(struct specialix_board * bp) ...@@ -986,7 +986,7 @@ extern inline int sx_setup_board(struct specialix_board * bp)
/* Called with disabled interrupts */ /* Called with disabled interrupts */
extern inline void sx_shutdown_board(struct specialix_board *bp) static inline void sx_shutdown_board(struct specialix_board *bp)
{ {
if (!(bp->flags & SX_BOARD_ACTIVE)) if (!(bp->flags & SX_BOARD_ACTIVE))
return; return;
...@@ -1867,7 +1867,7 @@ static int sx_set_modem_info(struct specialix_port * port, unsigned int cmd, ...@@ -1867,7 +1867,7 @@ static int sx_set_modem_info(struct specialix_port * port, unsigned int cmd,
} }
extern inline void sx_send_break(struct specialix_port * port, unsigned long length) static inline void sx_send_break(struct specialix_port * port, unsigned long length)
{ {
struct specialix_board *bp = port_Board(port); struct specialix_board *bp = port_Board(port);
unsigned long flags; unsigned long flags;
...@@ -1886,7 +1886,7 @@ extern inline void sx_send_break(struct specialix_port * port, unsigned long len ...@@ -1886,7 +1886,7 @@ extern inline void sx_send_break(struct specialix_port * port, unsigned long len
} }
extern inline int sx_set_serial_info(struct specialix_port * port, static inline int sx_set_serial_info(struct specialix_port * port,
struct serial_struct * newinfo) struct serial_struct * newinfo)
{ {
struct serial_struct tmp; struct serial_struct tmp;
...@@ -1942,7 +1942,7 @@ extern inline int sx_set_serial_info(struct specialix_port * port, ...@@ -1942,7 +1942,7 @@ extern inline int sx_set_serial_info(struct specialix_port * port,
} }
extern inline int sx_get_serial_info(struct specialix_port * port, static inline int sx_get_serial_info(struct specialix_port * port,
struct serial_struct * retinfo) struct serial_struct * retinfo)
{ {
struct serial_struct tmp; struct serial_struct tmp;
......
...@@ -75,11 +75,11 @@ typedef int (*__init_module_func_t)(void); ...@@ -75,11 +75,11 @@ typedef int (*__init_module_func_t)(void);
typedef void (*__cleanup_module_func_t)(void); typedef void (*__cleanup_module_func_t)(void);
#define module_init(x) \ #define module_init(x) \
int init_module(void) __attribute__((alias(#x))); \ int init_module(void) __attribute__((alias(#x))); \
extern inline __init_module_func_t __init_module_inline(void) \ static inline __init_module_func_t __init_module_inline(void) \
{ return x; } { return x; }
#define module_exit(x) \ #define module_exit(x) \
void cleanup_module(void) __attribute__((alias(#x))); \ void cleanup_module(void) __attribute__((alias(#x))); \
extern inline __cleanup_module_func_t __cleanup_module_inline(void) \ static inline __cleanup_module_func_t __cleanup_module_inline(void) \
{ return x; } { return x; }
#else #else
......
...@@ -72,7 +72,7 @@ struct nubus_board* nubus_boards; ...@@ -72,7 +72,7 @@ struct nubus_board* nubus_boards;
Etcetera, etcetera. Hopefully this clears up some confusion over Etcetera, etcetera. Hopefully this clears up some confusion over
what the following code actually does. */ what the following code actually does. */
extern inline int not_useful(void *p, int map) static inline int not_useful(void *p, int map)
{ {
unsigned long pv=(unsigned long)p; unsigned long pv=(unsigned long)p;
pv &= 3; pv &= 3;
...@@ -148,14 +148,14 @@ static void nubus_move(unsigned char **ptr, int len, int map) ...@@ -148,14 +148,14 @@ static void nubus_move(unsigned char **ptr, int len, int map)
have to expand it from a 24-bit signed number to a 32-bit signed have to expand it from a 24-bit signed number to a 32-bit signed
number. */ number. */
extern inline long nubus_expand32(long foo) static inline long nubus_expand32(long foo)
{ {
if(foo & 0x00800000) /* 24bit negative */ if(foo & 0x00800000) /* 24bit negative */
foo |= 0xFF000000; foo |= 0xFF000000;
return foo; return foo;
} }
extern inline void *nubus_rom_addr(int slot) static inline void *nubus_rom_addr(int slot)
{ {
/* /*
* Returns the first byte after the card. We then walk * Returns the first byte after the card. We then walk
......
...@@ -289,7 +289,7 @@ static inline void esp_advance_phase(Scsi_Cmnd *s, int newphase) ...@@ -289,7 +289,7 @@ static inline void esp_advance_phase(Scsi_Cmnd *s, int newphase)
#endif #endif
#ifdef DEBUG_ESP_CMDS #ifdef DEBUG_ESP_CMDS
extern inline void esp_cmd(struct NCR_ESP *esp, struct ESP_regs *eregs, inline void esp_cmd(struct NCR_ESP *esp, struct ESP_regs *eregs,
unchar cmd) unchar cmd)
{ {
esp->espcmdlog[esp->espcmdent] = cmd; esp->espcmdlog[esp->espcmdent] = cmd;
......
...@@ -378,7 +378,7 @@ static inline void esp_advance_phase(Scsi_Cmnd *s, int newphase) ...@@ -378,7 +378,7 @@ static inline void esp_advance_phase(Scsi_Cmnd *s, int newphase)
#endif #endif
#ifdef DEBUG_ESP_CMDS #ifdef DEBUG_ESP_CMDS
extern inline void esp_cmd(struct esp *esp, u8 cmd) static inline void esp_cmd(struct esp *esp, u8 cmd)
{ {
esp->espcmdlog[esp->espcmdent] = cmd; esp->espcmdlog[esp->espcmdent] = cmd;
esp->espcmdent = (esp->espcmdent + 1) & 31; esp->espcmdent = (esp->espcmdent + 1) & 31;
......
...@@ -395,7 +395,7 @@ struct usb_audio_state { ...@@ -395,7 +395,7 @@ struct usb_audio_state {
/* prevent picking up a bogus abs macro */ /* prevent picking up a bogus abs macro */
#undef abs #undef abs
extern inline int abs(int x) static inline int abs(int x)
{ {
if (x < 0) if (x < 0)
return -x; return -x;
...@@ -404,7 +404,7 @@ extern inline int abs(int x) ...@@ -404,7 +404,7 @@ extern inline int abs(int x)
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
extern inline unsigned ld2(unsigned int x) static inline unsigned ld2(unsigned int x)
{ {
unsigned r = 0; unsigned r = 0;
...@@ -1939,13 +1939,13 @@ static void release(struct usb_audio_state *s) ...@@ -1939,13 +1939,13 @@ static void release(struct usb_audio_state *s)
kfree(s); kfree(s);
} }
extern inline int prog_dmabuf_in(struct usb_audiodev *as) static inline int prog_dmabuf_in(struct usb_audiodev *as)
{ {
usbin_stop(as); usbin_stop(as);
return dmabuf_init(&as->usbin.dma); return dmabuf_init(&as->usbin.dma);
} }
extern inline int prog_dmabuf_out(struct usb_audiodev *as) static inline int prog_dmabuf_out(struct usb_audiodev *as)
{ {
usbout_stop(as); usbout_stop(as);
return dmabuf_init(&as->usbout.dma); return dmabuf_init(&as->usbout.dma);
...@@ -3253,7 +3253,7 @@ static void prepmixch(struct consmixstate *state) ...@@ -3253,7 +3253,7 @@ static void prepmixch(struct consmixstate *state)
static void usb_audio_recurseunit(struct consmixstate *state, unsigned char unitid); static void usb_audio_recurseunit(struct consmixstate *state, unsigned char unitid);
extern inline int checkmixbmap(unsigned char *bmap, unsigned char flg, unsigned int inidx, unsigned int numoch) static inline int checkmixbmap(unsigned char *bmap, unsigned char flg, unsigned int inidx, unsigned int numoch)
{ {
unsigned int idx; unsigned int idx;
......
...@@ -305,7 +305,7 @@ static LIST_HEAD(devs); ...@@ -305,7 +305,7 @@ static LIST_HEAD(devs);
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
extern inline unsigned ld2(unsigned int x) static inline unsigned ld2(unsigned int x)
{ {
unsigned r = 0; unsigned r = 0;
...@@ -510,7 +510,7 @@ static void waitcodec(struct ac97_codec *codec) ...@@ -510,7 +510,7 @@ static void waitcodec(struct ac97_codec *codec)
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
extern inline void stop_adc(struct it8172_state *s) static inline void stop_adc(struct it8172_state *s)
{ {
struct dmabuf* db = &s->dma_adc; struct dmabuf* db = &s->dma_adc;
unsigned long flags; unsigned long flags;
...@@ -534,7 +534,7 @@ extern inline void stop_adc(struct it8172_state *s) ...@@ -534,7 +534,7 @@ extern inline void stop_adc(struct it8172_state *s)
spin_unlock_irqrestore(&s->lock, flags); spin_unlock_irqrestore(&s->lock, flags);
} }
extern inline void stop_dac(struct it8172_state *s) static inline void stop_dac(struct it8172_state *s)
{ {
struct dmabuf* db = &s->dma_dac; struct dmabuf* db = &s->dma_dac;
unsigned long flags; unsigned long flags;
...@@ -633,7 +633,7 @@ static void start_adc(struct it8172_state *s) ...@@ -633,7 +633,7 @@ static void start_adc(struct it8172_state *s)
#define DMABUF_DEFAULTORDER (17-PAGE_SHIFT) #define DMABUF_DEFAULTORDER (17-PAGE_SHIFT)
#define DMABUF_MINORDER 1 #define DMABUF_MINORDER 1
extern inline void dealloc_dmabuf(struct it8172_state *s, struct dmabuf *db) static inline void dealloc_dmabuf(struct it8172_state *s, struct dmabuf *db)
{ {
struct page *page, *pend; struct page *page, *pend;
...@@ -709,7 +709,7 @@ static int prog_dmabuf(struct it8172_state *s, struct dmabuf *db, ...@@ -709,7 +709,7 @@ static int prog_dmabuf(struct it8172_state *s, struct dmabuf *db,
return 0; return 0;
} }
extern inline int prog_dmabuf_adc(struct it8172_state *s) static inline int prog_dmabuf_adc(struct it8172_state *s)
{ {
stop_adc(s); stop_adc(s);
return prog_dmabuf(s, &s->dma_adc, s->adcrate, return prog_dmabuf(s, &s->dma_adc, s->adcrate,
...@@ -717,7 +717,7 @@ extern inline int prog_dmabuf_adc(struct it8172_state *s) ...@@ -717,7 +717,7 @@ extern inline int prog_dmabuf_adc(struct it8172_state *s)
IT_AC_CAPCC); IT_AC_CAPCC);
} }
extern inline int prog_dmabuf_dac(struct it8172_state *s) static inline int prog_dmabuf_dac(struct it8172_state *s)
{ {
stop_dac(s); stop_dac(s);
return prog_dmabuf(s, &s->dma_dac, s->dacrate, return prog_dmabuf(s, &s->dma_dac, s->dacrate,
......
...@@ -113,14 +113,14 @@ struct channel_info { ...@@ -113,14 +113,14 @@ struct channel_info {
#if OPEN_READ == FMODE_READ && OPEN_WRITE == FMODE_WRITE #if OPEN_READ == FMODE_READ && OPEN_WRITE == FMODE_WRITE
extern __inline__ int translate_mode(struct file *file) static inline int translate_mode(struct file *file)
{ {
return file->f_mode; return file->f_mode;
} }
#else #else
extern __inline__ int translate_mode(struct file *file) static inline int translate_mode(struct file *file)
{ {
return ((file->f_mode & FMODE_READ) ? OPEN_READ : 0) | return ((file->f_mode & FMODE_READ) ? OPEN_READ : 0) |
((file->f_mode & FMODE_WRITE) ? OPEN_WRITE : 0); ((file->f_mode & FMODE_WRITE) ? OPEN_WRITE : 0);
......
...@@ -593,7 +593,7 @@ static void snd_es1371_codec_write(ac97_t *ac97, ...@@ -593,7 +593,7 @@ static void snd_es1371_codec_write(ac97_t *ac97,
} }
spin_unlock_irqrestore(&ensoniq->reg_lock, flags); spin_unlock_irqrestore(&ensoniq->reg_lock, flags);
} }
snd_printk("codec write timeout at 0x%lx [0x%x]\n", ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC))); snd_printk("codec write timeout at 0x%lx [0x%lx]\n", ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC)));
} }
static unsigned short snd_es1371_codec_read(ac97_t *ac97, static unsigned short snd_es1371_codec_read(ac97_t *ac97,
...@@ -641,14 +641,14 @@ static unsigned short snd_es1371_codec_read(ac97_t *ac97, ...@@ -641,14 +641,14 @@ static unsigned short snd_es1371_codec_read(ac97_t *ac97,
} }
spin_unlock_irqrestore(&ensoniq->reg_lock, flags); spin_unlock_irqrestore(&ensoniq->reg_lock, flags);
if (++fail > 10) { if (++fail > 10) {
snd_printk("codec read timeout (final) at 0x%lx, reg = 0x%x [0x%x]\n", ES_REG(ensoniq, 1371_CODEC), reg, inl(ES_REG(ensoniq, 1371_CODEC))); snd_printk("codec read timeout (final) at 0x%lx, reg = 0x%x [0x%lx]\n", ES_REG(ensoniq, 1371_CODEC), reg, inl(ES_REG(ensoniq, 1371_CODEC)));
return 0; return 0;
} }
goto __again; goto __again;
} }
spin_unlock_irqrestore(&ensoniq->reg_lock, flags); spin_unlock_irqrestore(&ensoniq->reg_lock, flags);
} }
snd_printk("es1371: codec read timeout at 0x%lx [0x%x]\n", ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC))); snd_printk("es1371: codec read timeout at 0x%lx [0x%lx]\n", ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC)));
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment