Commit df038637 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

v2.4.9.2 -> v2.4.9.3

  - Johannes Erdfelt, Oliver Neukum: USB printer driver race fix
  - John Byrne: fix stupid i386-SMP irq stack layout bug
  - Andreas Bombe, me: yenta IO window fix
  - Neil Brown: raid1 buffer state fix
  - David Miller, Paul Mackerras: fix up sparc and ppc respectively for kmap/kbd_rate
  - Matija Nalis: umsdos fixes, and make it possible to boot up with umsdos
  - Francois Romieu: fix bugs in dscc4 driver
  - Andy Grover: new PCI config space access functions (eventually for ACPI)
  - Albert Cranford: fix incorrect e2fsprog data from ver_linux script
  - Dave Jones: re-sync x86 setup code, fix macsonic kmalloc use
  - Johannes Erdfelt: remove obsolete plusb USB driver
  - Andries Brouwer: fix USB compact flash version info, add blksize ioctls
parent 87f504e5
......@@ -11690,19 +11690,6 @@ CONFIG_USB_USBNET
The module will be called usbnet.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
 
PLUSB driver
CONFIG_USB_PLUSB
A driver for the Prolific PL-2302 USB-to-USB network device. This
'USB cable' connects two hosts via a point-to-point network with
bandwidth of 5 Mbit/s. Configure this driver after connecting the
USB cable via ifconfig plusb0 10.0.0.1 pointopoint 10.0.0.2 (and
vice versa on the other host).
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called plusb.o. If you want to compile it as a
module, say M here and read Documentation/modules.txt.
USB Diamond Rio500 support
CONFIG_USB_RIO500
Say Y here if you want to connect a USB Rio500 mp3 player to your
......
VERSION = 2
PATCHLEVEL = 4
SUBLEVEL = 10
EXTRAVERSION =-pre2
EXTRAVERSION =-pre3
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
......
......@@ -742,7 +742,7 @@ CONFIG_USB_STORAGE=y
# CONFIG_USB_PEGASUS is not set
# CONFIG_USB_CATC is not set
# CONFIG_USB_KAWETH is not set
# CONFIG_USB_NET1080 is not set
# CONFIG_USB_USBNET is not set
#
# USB port drivers
......
......@@ -19,7 +19,7 @@ static void intel_machine_check(struct pt_regs * regs, long error_code)
u32 mcgstl, mcgsth;
int i;
rdmsr(0x17a, mcgstl, mcgsth);
rdmsr(MSR_IA32_MCG_STATUS, mcgstl, mcgsth);
if(mcgstl&(1<<0)) /* Recoverable ? */
recover=0;
......@@ -27,7 +27,7 @@ static void intel_machine_check(struct pt_regs * regs, long error_code)
for(i=0;i<banks;i++)
{
rdmsr(0x401+i*4,low, high);
rdmsr(MSR_IA32_MC0_STATUS+i*4,low, high);
if(high&(1<<31))
{
if(high&(1<<29))
......@@ -38,18 +38,18 @@ static void intel_machine_check(struct pt_regs * regs, long error_code)
high&=~(1<<31);
if(high&(1<<27))
{
rdmsr(0x402+i*4, alow, ahigh);
rdmsr(MSR_IA32_MC0_ADDR+i*4, alow, ahigh);
printk("[%08x%08x]", alow, ahigh);
}
if(high&(1<<26))
{
rdmsr(0x402+i*4, alow, ahigh);
rdmsr(MSR_IA32_MC0_ADDR+i*4, alow, ahigh);
printk(" at %08x%08x",
high, low);
}
printk("\n");
/* Clear it */
wrmsr(0x401+i*4, 0UL, 0UL);
wrmsr(MSR_IA32_MC0_STATUS+i*4, 0UL, 0UL);
/* Serialize */
wmb();
}
......@@ -61,7 +61,7 @@ static void intel_machine_check(struct pt_regs * regs, long error_code)
panic("Unable to continue");
printk(KERN_EMERG "Attempting to continue.\n");
mcgstl&=~(1<<2);
wrmsr(0x17a,mcgstl, mcgsth);
wrmsr(MSR_IA32_MCG_STATUS,mcgstl, mcgsth);
}
/*
......@@ -71,8 +71,8 @@ static void intel_machine_check(struct pt_regs * regs, long error_code)
static void pentium_machine_check(struct pt_regs * regs, long error_code)
{
u32 loaddr, hi, lotype;
rdmsr(0x0, loaddr, hi);
rdmsr(0x1, lotype, hi);
rdmsr(MSR_IA32_P5_MC_ADDR, loaddr, hi);
rdmsr(MSR_IA32_P5_MC_TYPE, lotype, hi);
printk(KERN_EMERG "CPU#%d: Machine Check Exception: 0x%8X (type 0x%8X).\n", smp_processor_id(), loaddr, lotype);
if(lotype&(1<<5))
printk(KERN_EMERG "CPU#%d: Possible thermal failure (CPU on fire ?).\n", smp_processor_id());
......@@ -133,8 +133,8 @@ void __init intel_mcheck_init(struct cpuinfo_x86 *c)
machine_check_vector = pentium_machine_check;
wmb();
/* Read registers before enabling */
rdmsr(0x0, l, h);
rdmsr(0x1, l, h);
rdmsr(MSR_IA32_P5_MC_ADDR, l, h);
rdmsr(MSR_IA32_P5_MC_TYPE, l, h);
if(done==0)
printk(KERN_INFO "Intel old style machine check architecture supported.\n");
/* Enable MCE */
......@@ -161,17 +161,17 @@ void __init intel_mcheck_init(struct cpuinfo_x86 *c)
if(done==0)
printk(KERN_INFO "Intel machine check architecture supported.\n");
rdmsr(0x179, l, h);
rdmsr(MSR_IA32_MCG_CAP, l, h);
if(l&(1<<8))
wrmsr(0x17b, 0xffffffff, 0xffffffff);
wrmsr(MSR_IA32_MCG_CTL, 0xffffffff, 0xffffffff);
banks = l&0xff;
for(i=1;i<banks;i++)
{
wrmsr(0x400+4*i, 0xffffffff, 0xffffffff);
wrmsr(MSR_IA32_MC0_CTL+4*i, 0xffffffff, 0xffffffff);
}
for(i=0;i<banks;i++)
{
wrmsr(0x401+4*i, 0x0, 0x0);
wrmsr(MSR_IA32_MC0_STATUS+4*i, 0x0, 0x0);
}
set_in_cr4(X86_CR4_MCE);
printk(KERN_INFO "Intel machine check reporting enabled on CPU#%d.\n", smp_processor_id());
......@@ -191,10 +191,10 @@ static void __init winchip_mcheck_init(struct cpuinfo_x86 *c)
/* Winchip C6 */
machine_check_vector = winchip_machine_check;
wmb();
rdmsr(0x107, lo, hi);
rdmsr(MSR_IDT_FCR1, lo, hi);
lo|= (1<<2); /* Enable EIERRINT (int 18 MCE) */
lo&= ~(1<<4); /* Enable MCE */
wrmsr(0x107, lo, hi);
wrmsr(MSR_IDT_FCR1, lo, hi);
__asm__ __volatile__ (
"movl %%cr4, %%eax\n\t"
"orl $0x40, %%eax\n\t"
......@@ -236,6 +236,6 @@ void __init mcheck_init(struct cpuinfo_x86 *c)
static int __init mcheck_disable(char *str)
{
mce_disabled = 1;
return 1;
return 0;
}
__setup("nomce", mcheck_disable);
......@@ -389,21 +389,19 @@ static void set_mtrr_prepare (struct set_mtrr_context *ctxt)
return;
/* Save value of CR4 and clear Page Global Enable (bit 7) */
if ( test_bit(X86_FEATURE_PGE, &boot_cpu_data.x86_capability) )
asm volatile ("movl %%cr4, %0\n\t"
"movl %0, %1\n\t"
"andb $0x7f, %b1\n\t"
"movl %1, %%cr4\n\t"
: "=r" (ctxt->cr4val), "=q" (tmp) : : "memory");
if ( test_bit(X86_FEATURE_PGE, &boot_cpu_data.x86_capability) ) {
ctxt->cr4val = read_cr4();
write_cr4(ctxt->cr4val & (unsigned char) ~(1<<7));
}
/* Disable and flush caches. Note that wbinvd flushes the TLBs as
a side-effect */
asm volatile ("movl %%cr0, %0\n\t"
"orl $0x40000000, %0\n\t"
"wbinvd\n\t"
"movl %0, %%cr0\n\t"
"wbinvd\n\t"
: "=r" (tmp) : : "memory");
{
unsigned int cr0 = read_cr0() | 0x40000000;
wbinvd();
write_cr0( cr0 );
wbinvd();
}
if ( mtrr_if == MTRR_IF_INTEL ) {
/* Disable MTRRs, and set the default type to uncached */
......@@ -420,15 +418,13 @@ static void set_mtrr_prepare (struct set_mtrr_context *ctxt)
/* Restore the processor after a set_mtrr_prepare */
static void set_mtrr_done (struct set_mtrr_context *ctxt)
{
unsigned long tmp;
if ( mtrr_if != MTRR_IF_INTEL && mtrr_if != MTRR_IF_CYRIX_ARR ) {
__restore_flags (ctxt->flags);
return;
}
/* Flush caches and TLBs */
asm volatile ("wbinvd" : : : "memory" );
wbinvd();
/* Restore MTRRdefType */
if ( mtrr_if == MTRR_IF_INTEL ) {
......@@ -440,15 +436,11 @@ static void set_mtrr_done (struct set_mtrr_context *ctxt)
}
/* Enable caches */
asm volatile ("movl %%cr0, %0\n\t"
"andl $0xbfffffff, %0\n\t"
"movl %0, %%cr0\n\t"
: "=r" (tmp) : : "memory");
write_cr0( read_cr0() & 0xbfffffff );
/* Restore value of CR4 */
if ( test_bit(X86_FEATURE_PGE, &boot_cpu_data.x86_capability) )
asm volatile ("movl %0, %%cr4"
: : "r" (ctxt->cr4val) : "memory");
write_cr4(ctxt->cr4val);
/* Re-enable interrupts locally (if enabled previously) */
__restore_flags (ctxt->flags);
......@@ -607,7 +599,7 @@ static void amd_get_mtrr (unsigned int reg, unsigned long *base,
{
unsigned long low, high;
rdmsr (0xC0000085, low, high);
rdmsr (MSR_K6_UWCCR, low, high);
/* Upper dword is region 1, lower is region 0 */
if (reg == 1) low = high;
/* The base masks off on the right alignment */
......@@ -771,7 +763,7 @@ static void amd_set_mtrr_up (unsigned int reg, unsigned long base,
/*
* Low is MTRR0 , High MTRR 1
*/
rdmsr (0xC0000085, regs[0], regs[1]);
rdmsr (MSR_K6_UWCCR, regs[0], regs[1]);
/*
* Blank to disable
*/
......@@ -792,8 +784,8 @@ static void amd_set_mtrr_up (unsigned int reg, unsigned long base,
* The writeback rule is quite specific. See the manual. Its
* disable local interrupts, write back the cache, set the mtrr
*/
__asm__ __volatile__ ("wbinvd" : : : "memory");
wrmsr (0xC0000085, regs[0], regs[1]);
wbinvd();
wrmsr (MSR_K6_UWCCR, regs[0], regs[1]);
if (do_safe) set_mtrr_done (&ctxt);
} /* End Function amd_set_mtrr_up */
......@@ -826,7 +818,7 @@ static void centaur_set_mcr_up (unsigned int reg, unsigned long base,
}
centaur_mcr[reg].high = high;
centaur_mcr[reg].low = low;
wrmsr (0x110 + reg, low, high);
wrmsr (MSR_IDT_MCR0 + reg, low, high);
if (do_safe) set_mtrr_done( &ctxt );
} /* End Function centaur_set_mtrr_up */
......@@ -2012,12 +2004,12 @@ static void __init centaur_mcr1_init(void)
* find out what the bios might have done.
*/
rdmsr(0x120, lo, hi);
rdmsr(MSR_IDT_MCR_CTRL, lo, hi);
if(((lo>>17)&7)==1) /* Type 1 Winchip2 MCR */
{
lo&= ~0x1C0; /* clear key */
lo|= 0x040; /* set key to 1 */
wrmsr(0x120, lo, hi); /* unlock MCR */
wrmsr(MSR_IDT_MCR_CTRL, lo, hi); /* unlock MCR */
}
centaur_mcr_type = 1;
......@@ -2031,7 +2023,7 @@ static void __init centaur_mcr1_init(void)
if(centaur_mcr[i]. high == 0 && centaur_mcr[i].low == 0)
{
if(!(lo & (1<<(9+i))))
wrmsr (0x110 + i , 0, 0);
wrmsr (MSR_IDT_MCR0 + i , 0, 0);
else
/*
* If the BIOS set up an MCR we cannot see it
......@@ -2047,7 +2039,7 @@ static void __init centaur_mcr1_init(void)
*/
lo |= 15; /* Write combine enables */
wrmsr(0x120, lo, hi);
wrmsr(MSR_IDT_MCR_CTRL, lo, hi);
} /* End Function centaur_mcr1_init */
/*
......@@ -2071,10 +2063,10 @@ static void __init centaur_mcr0_init(void)
for (i = 0; i < 8; ++i)
{
if(centaur_mcr[i]. high == 0 && centaur_mcr[i].low == 0)
wrmsr (0x110 + i , 0, 0);
wrmsr (MSR_IDT_MCR0 + i , 0, 0);
}
wrmsr(0x120, 0x01F0001F, 0); /* Write only */
wrmsr(MSR_IDT_MCR_CTRL, 0x01F0001F, 0); /* Write only */
} /* End Function centaur_mcr0_init */
/*
......@@ -2231,6 +2223,8 @@ void __init mtrr_init_secondary_cpu(void)
*/
cyrix_arr_init_secondary ();
break;
case MTRR_IF_NONE:
break;
default:
/* I see no MTRRs I can support in SMP mode... */
printk ("mtrr: SMP support incomplete for this vendor\n");
......
......@@ -20,65 +20,145 @@
unsigned int pci_probe = PCI_PROBE_BIOS | PCI_PROBE_CONF1 | PCI_PROBE_CONF2;
int pcibios_last_bus = -1;
struct pci_bus *pci_root_bus;
struct pci_ops *pci_root_ops;
struct pci_bus *pci_root_bus = NULL;
struct pci_ops *pci_root_ops = NULL;
int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value) = NULL;
int (*pci_config_write)(int seg, int bus, int dev, int fn, int reg, int len, u32 value) = NULL;
/*
* Direct access to PCI hardware...
* This interrupt-safe spinlock protects all accesses to PCI
* configuration space.
*/
spinlock_t pci_config_lock = SPIN_LOCK_UNLOCKED;
#ifdef CONFIG_PCI_DIRECT
/*
* Functions for accessing PCI configuration space with type 1 accesses
*/
#define CONFIG_CMD(dev, where) (0x80000000 | (dev->bus->number << 16) | (dev->devfn << 8) | (where & ~3))
#ifdef CONFIG_PCI_DIRECT
#define PCI_CONF1_ADDRESS(bus, dev, fn, reg) \
(0x80000000 | (bus << 16) | (dev << 11) | (fn << 8) | (reg & ~3))
static int pci_conf1_read (int seg, int bus, int dev, int fn, int reg, int len, u32 *value)
{
unsigned long flags;
if (!value || (bus > 255) || (dev > 31) || (fn > 7) || (reg > 255))
return -EINVAL;
spin_lock_irqsave(&pci_config_lock, flags);
outl(PCI_CONF1_ADDRESS(bus, dev, fn, reg), 0xCF8);
switch (len) {
case 1:
*value = inb(0xCFC + (reg & 3));
break;
case 2:
*value = inw(0xCFC + (reg & 2));
break;
case 4:
*value = inl(0xCFC);
break;
}
spin_unlock_irqrestore(&pci_config_lock, flags);
return 0;
}
static int pci_conf1_write (int seg, int bus, int dev, int fn, int reg, int len, u32 value)
{
unsigned long flags;
if ((bus > 255) || (dev > 31) || (fn > 7) || (reg > 255))
return -EINVAL;
spin_lock_irqsave(&pci_config_lock, flags);
outl(PCI_CONF1_ADDRESS(bus, dev, fn, reg), 0xCF8);
switch (len) {
case 1:
outb((u8)value, 0xCFC + (reg & 3));
break;
case 2:
outw((u16)value, 0xCFC + (reg & 2));
break;
case 4:
outl((u32)value, 0xCFC);
break;
}
spin_unlock_irqrestore(&pci_config_lock, flags);
return 0;
}
#undef PCI_CONF1_ADDRESS
static int pci_conf1_read_config_byte(struct pci_dev *dev, int where, u8 *value)
{
outl(CONFIG_CMD(dev,where), 0xCF8);
*value = inb(0xCFC + (where&3));
return PCIBIOS_SUCCESSFUL;
int result;
u32 data;
if (!value)
return -EINVAL;
result = pci_conf1_read(0, dev->bus->number, PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn), where, 1, &data);
*value = (u8)data;
return result;
}
static int pci_conf1_read_config_word(struct pci_dev *dev, int where, u16 *value)
{
outl(CONFIG_CMD(dev,where), 0xCF8);
*value = inw(0xCFC + (where&2));
return PCIBIOS_SUCCESSFUL;
int result;
u32 data;
if (!value)
return -EINVAL;
result = pci_conf1_read(0, dev->bus->number, PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn), where, 2, &data);
*value = (u16)data;
return result;
}
static int pci_conf1_read_config_dword(struct pci_dev *dev, int where, u32 *value)
{
outl(CONFIG_CMD(dev,where), 0xCF8);
*value = inl(0xCFC);
return PCIBIOS_SUCCESSFUL;
if (!value)
return -EINVAL;
return pci_conf1_read(0, dev->bus->number, PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn), where, 4, value);
}
static int pci_conf1_write_config_byte(struct pci_dev *dev, int where, u8 value)
{
outl(CONFIG_CMD(dev,where), 0xCF8);
outb(value, 0xCFC + (where&3));
return PCIBIOS_SUCCESSFUL;
return pci_conf1_write(0, dev->bus->number, PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn), where, 1, value);
}
static int pci_conf1_write_config_word(struct pci_dev *dev, int where, u16 value)
{
outl(CONFIG_CMD(dev,where), 0xCF8);
outw(value, 0xCFC + (where&2));
return PCIBIOS_SUCCESSFUL;
return pci_conf1_write(0, dev->bus->number, PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn), where, 2, value);
}
static int pci_conf1_write_config_dword(struct pci_dev *dev, int where, u32 value)
{
outl(CONFIG_CMD(dev,where), 0xCF8);
outl(value, 0xCFC);
return PCIBIOS_SUCCESSFUL;
return pci_conf1_write(0, dev->bus->number, PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn), where, 4, value);
}
#undef CONFIG_CMD
static struct pci_ops pci_direct_conf1 = {
pci_conf1_read_config_byte,
pci_conf1_read_config_word,
......@@ -88,68 +168,131 @@ static struct pci_ops pci_direct_conf1 = {
pci_conf1_write_config_dword
};
/*
* Functions for accessing PCI configuration space with type 2 accesses
*/
#define IOADDR(devfn, where) ((0xC000 | ((devfn & 0x78) << 5)) + where)
#define FUNC(devfn) (((devfn & 7) << 1) | 0xf0)
#define SET(dev) if (dev->devfn & 0x80) return PCIBIOS_DEVICE_NOT_FOUND; \
outb(FUNC(dev->devfn), 0xCF8); \
outb(dev->bus->number, 0xCFA);
#define PCI_CONF2_ADDRESS(dev, reg) (u16)(0xC000 | (dev << 8) | reg)
static int pci_conf2_read_config_byte(struct pci_dev *dev, int where, u8 *value)
static int pci_conf2_read (int seg, int bus, int dev, int fn, int reg, int len, u32 *value)
{
SET(dev);
*value = inb(IOADDR(dev->devfn,where));
unsigned long flags;
if (!value || (bus > 255) || (dev > 31) || (fn > 7) || (reg > 255))
return -EINVAL;
if (dev & 0x10)
return PCIBIOS_DEVICE_NOT_FOUND;
spin_lock_irqsave(&pci_config_lock, flags);
outb((u8)(0xF0 | (fn << 1)), 0xCF8);
outb((u8)bus, 0xCFA);
switch (len) {
case 1:
*value = inb(PCI_CONF2_ADDRESS(dev, reg));
break;
case 2:
*value = inw(PCI_CONF2_ADDRESS(dev, reg));
break;
case 4:
*value = inl(PCI_CONF2_ADDRESS(dev, reg));
break;
}
outb (0, 0xCF8);
return PCIBIOS_SUCCESSFUL;
spin_unlock_irqrestore(&pci_config_lock, flags);
return 0;
}
static int pci_conf2_write (int seg, int bus, int dev, int fn, int reg, int len, u32 value)
{
unsigned long flags;
if ((bus > 255) || (dev > 31) || (fn > 7) || (reg > 255))
return -EINVAL;
if (dev & 0x10)
return PCIBIOS_DEVICE_NOT_FOUND;
spin_lock_irqsave(&pci_config_lock, flags);
outb((u8)(0xF0 | (fn << 1)), 0xCF8);
outb((u8)bus, 0xCFA);
switch (len) {
case 1:
outb ((u8)value, PCI_CONF2_ADDRESS(dev, reg));
break;
case 2:
outw ((u16)value, PCI_CONF2_ADDRESS(dev, reg));
break;
case 4:
outl ((u32)value, PCI_CONF2_ADDRESS(dev, reg));
break;
}
outb (0, 0xCF8);
spin_unlock_irqrestore(&pci_config_lock, flags);
return 0;
}
#undef PCI_CONF2_ADDRESS
static int pci_conf2_read_config_byte(struct pci_dev *dev, int where, u8 *value)
{
int result;
u32 data;
result = pci_conf2_read(0, dev->bus->number, PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn), where, 1, &data);
*value = (u8)data;
return result;
}
static int pci_conf2_read_config_word(struct pci_dev *dev, int where, u16 *value)
{
SET(dev);
*value = inw(IOADDR(dev->devfn,where));
outb (0, 0xCF8);
return PCIBIOS_SUCCESSFUL;
int result;
u32 data;
result = pci_conf2_read(0, dev->bus->number, PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn), where, 2, &data);
*value = (u8)data;
return result;
}
static int pci_conf2_read_config_dword(struct pci_dev *dev, int where, u32 *value)
{
SET(dev);
*value = inl (IOADDR(dev->devfn,where));
outb (0, 0xCF8);
return PCIBIOS_SUCCESSFUL;
int result;
u32 data;
result = pci_conf2_read(0, dev->bus->number, PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn), where, 4, &data);
*value = (u8)data;
return result;
}
static int pci_conf2_write_config_byte(struct pci_dev *dev, int where, u8 value)
{
SET(dev);
outb (value, IOADDR(dev->devfn,where));
outb (0, 0xCF8);
return PCIBIOS_SUCCESSFUL;
return pci_conf2_write(0, dev->bus->number, PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn), where, 1, value);
}
static int pci_conf2_write_config_word(struct pci_dev *dev, int where, u16 value)
{
SET(dev);
outw (value, IOADDR(dev->devfn,where));
outb (0, 0xCF8);
return PCIBIOS_SUCCESSFUL;
return pci_conf2_write(0, dev->bus->number, PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn), where, 2, value);
}
static int pci_conf2_write_config_dword(struct pci_dev *dev, int where, u32 value)
{
SET(dev);
outl (value, IOADDR(dev->devfn,where));
outb (0, 0xCF8);
return PCIBIOS_SUCCESSFUL;
return pci_conf2_write(0, dev->bus->number, PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn), where, 4, value);
}
#undef SET
#undef IOADDR
#undef FUNC
static struct pci_ops pci_direct_conf2 = {
pci_conf2_read_config_byte,
pci_conf2_read_config_word,
......@@ -159,6 +302,7 @@ static struct pci_ops pci_direct_conf2 = {
pci_conf2_write_config_dword
};
/*
* Before we decide to use direct hardware access mechanisms, we try to do some
* trivial checks to ensure it at least _seems_ to be working -- we just test
......@@ -420,114 +564,176 @@ static int __init pci_bios_find_device (unsigned short vendor, unsigned short de
return (int) (ret & 0xff00) >> 8;
}
static int pci_bios_read (int seg, int bus, int dev, int fn, int reg, int len, u32 *value)
{
unsigned long result = 0;
unsigned long flags;
unsigned long bx = ((bus << 8) | (dev << 3) | fn);
if (!value || (bus > 255) || (dev > 31) || (fn > 7) || (reg > 255))
return -EINVAL;
spin_lock_irqsave(&pci_config_lock, flags);
switch (len) {
case 1:
__asm__("lcall (%%esi); cld\n\t"
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
: "=c" (*value),
"=a" (result)
: "1" (PCIBIOS_READ_CONFIG_BYTE),
"b" (bx),
"D" ((long)reg),
"S" (&pci_indirect));
break;
case 2:
__asm__("lcall (%%esi); cld\n\t"
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
: "=c" (*value),
"=a" (result)
: "1" (PCIBIOS_READ_CONFIG_WORD),
"b" (bx),
"D" ((long)reg),
"S" (&pci_indirect));
break;
case 4:
__asm__("lcall (%%esi); cld\n\t"
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
: "=c" (*value),
"=a" (result)
: "1" (PCIBIOS_READ_CONFIG_DWORD),
"b" (bx),
"D" ((long)reg),
"S" (&pci_indirect));
break;
}
spin_unlock_irqrestore(&pci_config_lock, flags);
return (int)((result & 0xff00) >> 8);
}
static int pci_bios_write (int seg, int bus, int dev, int fn, int reg, int len, u32 value)
{
unsigned long result = 0;
unsigned long flags;
unsigned long bx = ((bus << 8) | (dev << 3) | fn);
if ((bus > 255) || (dev > 31) || (fn > 7) || (reg > 255))
return -EINVAL;
spin_lock_irqsave(&pci_config_lock, flags);
switch (len) {
case 1:
__asm__("lcall (%%esi); cld\n\t"
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
: "=a" (result)
: "0" (PCIBIOS_WRITE_CONFIG_BYTE),
"c" (value),
"b" (bx),
"D" ((long)reg),
"S" (&pci_indirect));
break;
case 2:
__asm__("lcall (%%esi); cld\n\t"
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
: "=a" (result)
: "0" (PCIBIOS_WRITE_CONFIG_WORD),
"c" (value),
"b" (bx),
"D" ((long)reg),
"S" (&pci_indirect));
break;
case 4:
__asm__("lcall (%%esi); cld\n\t"
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
: "=a" (result)
: "0" (PCIBIOS_WRITE_CONFIG_DWORD),
"c" (value),
"b" (bx),
"D" ((long)reg),
"S" (&pci_indirect));
break;
}
spin_unlock_irqrestore(&pci_config_lock, flags);
return (int)((result & 0xff00) >> 8);
}
static int pci_bios_read_config_byte(struct pci_dev *dev, int where, u8 *value)
{
unsigned long ret;
unsigned long bx = (dev->bus->number << 8) | dev->devfn;
int result;
u32 data;
__asm__("lcall (%%esi); cld\n\t"
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
: "=c" (*value),
"=a" (ret)
: "1" (PCIBIOS_READ_CONFIG_BYTE),
"b" (bx),
"D" ((long) where),
"S" (&pci_indirect));
return (int) (ret & 0xff00) >> 8;
if (!value)
return -EINVAL;
result = pci_bios_read(0, dev->bus->number, PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn), where, 1, &data);
*value = (u8)data;
return result;
}
static int pci_bios_read_config_word(struct pci_dev *dev, int where, u16 *value)
{
unsigned long ret;
unsigned long bx = (dev->bus->number << 8) | dev->devfn;
int result;
u32 data;
__asm__("lcall (%%esi); cld\n\t"
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
: "=c" (*value),
"=a" (ret)
: "1" (PCIBIOS_READ_CONFIG_WORD),
"b" (bx),
"D" ((long) where),
"S" (&pci_indirect));
return (int) (ret & 0xff00) >> 8;
if (!value)
return -EINVAL;
result = pci_bios_read(0, dev->bus->number, PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn), where, 2, &data);
*value = (u16)data;
return result;
}
static int pci_bios_read_config_dword(struct pci_dev *dev, int where, u32 *value)
{
unsigned long ret;
unsigned long bx = (dev->bus->number << 8) | dev->devfn;
__asm__("lcall (%%esi); cld\n\t"
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
: "=c" (*value),
"=a" (ret)
: "1" (PCIBIOS_READ_CONFIG_DWORD),
"b" (bx),
"D" ((long) where),
"S" (&pci_indirect));
return (int) (ret & 0xff00) >> 8;
if (!value)
return -EINVAL;
return pci_bios_read(0, dev->bus->number, PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn), where, 4, value);
}
static int pci_bios_write_config_byte(struct pci_dev *dev, int where, u8 value)
{
unsigned long ret;
unsigned long bx = (dev->bus->number << 8) | dev->devfn;
__asm__("lcall (%%esi); cld\n\t"
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
: "=a" (ret)
: "0" (PCIBIOS_WRITE_CONFIG_BYTE),
"c" (value),
"b" (bx),
"D" ((long) where),
"S" (&pci_indirect));
return (int) (ret & 0xff00) >> 8;
return pci_bios_write(0, dev->bus->number, PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn), where, 1, value);
}
static int pci_bios_write_config_word(struct pci_dev *dev, int where, u16 value)
{
unsigned long ret;
unsigned long bx = (dev->bus->number << 8) | dev->devfn;
__asm__("lcall (%%esi); cld\n\t"
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
: "=a" (ret)
: "0" (PCIBIOS_WRITE_CONFIG_WORD),
"c" (value),
"b" (bx),
"D" ((long) where),
"S" (&pci_indirect));
return (int) (ret & 0xff00) >> 8;
return pci_bios_write(0, dev->bus->number, PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn), where, 2, value);
}
static int pci_bios_write_config_dword(struct pci_dev *dev, int where, u32 value)
{
unsigned long ret;
unsigned long bx = (dev->bus->number << 8) | dev->devfn;
__asm__("lcall (%%esi); cld\n\t"
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
: "=a" (ret)
: "0" (PCIBIOS_WRITE_CONFIG_DWORD),
"c" (value),
"b" (bx),
"D" ((long) where),
"S" (&pci_indirect));
return (int) (ret & 0xff00) >> 8;
return pci_bios_write(0, dev->bus->number, PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn), where, 4, value);
}
/*
* Function table for BIOS32 access
*/
......@@ -981,34 +1187,47 @@ void __init pcibios_fixup_bus(struct pci_bus *b)
pci_read_bridge_bases(b);
}
/*
* Initialization. Try all known PCI access methods. Note that we support
* using both PCI BIOS and direct access: in such cases, we use I/O ports
* to access config space, but we still keep BIOS order of cards to be
* compatible with 2.0.X. This should go away some day.
*/
void __init pcibios_init(void)
void __init pcibios_config_init(void)
{
struct pci_ops *bios = NULL;
struct pci_ops *dir = NULL;
/*
* Try all known PCI access methods. Note that we support using
* both PCI BIOS and direct access, with a preference for direct.
*/
#ifdef CONFIG_PCI_BIOS
if ((pci_probe & PCI_PROBE_BIOS) && ((bios = pci_find_bios()))) {
if ((pci_probe & PCI_PROBE_BIOS)
&& ((pci_root_ops = pci_find_bios()))) {
pci_probe |= PCI_BIOS_SORT;
pci_bios_present = 1;
pci_config_read = pci_bios_read;
pci_config_write = pci_bios_write;
}
#endif
#ifdef CONFIG_PCI_DIRECT
if (pci_probe & (PCI_PROBE_CONF1 | PCI_PROBE_CONF2))
dir = pci_check_direct();
if ((pci_probe & (PCI_PROBE_CONF1 | PCI_PROBE_CONF2))
&& (pci_root_ops = pci_check_direct())) {
if (pci_root_ops == &pci_direct_conf1) {
pci_config_read = pci_conf1_read;
pci_config_write = pci_conf1_write;
}
else {
pci_config_read = pci_conf2_read;
pci_config_write = pci_conf2_write;
}
}
#endif
if (dir)
pci_root_ops = dir;
else if (bios)
pci_root_ops = bios;
else {
printk("PCI: No PCI bus detected\n");
return;
}
void __init pcibios_init(void)
{
if (!pci_root_ops)
pcibios_config_init();
if (!pci_root_ops) {
printk("PCI: System does not support PCI\n");
return;
}
......
......@@ -64,6 +64,9 @@
*
* VIA C3 Support.
* Dave Jones <davej@suse.de>, March 2001
*
* AMD Athlon/Duron/Thunderbird bluesmoke support.
* Dave Jones <davej@suse.de>, April 2001.
*/
/*
......@@ -93,6 +96,7 @@
#include <linux/bootmem.h>
#include <asm/processor.h>
#include <linux/console.h>
#include <asm/mtrr.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/io.h>
......@@ -145,9 +149,9 @@ struct e820map e820;
unsigned char aux_device_present;
extern void mcheck_init(struct cpuinfo_x86 *c);
extern int root_mountflags;
extern char _text, _etext, _edata, _end;
extern unsigned long cpu_khz;
static int disable_x86_serial_nr __initdata = 1;
static int disable_x86_fxsr __initdata = 0;
......@@ -1088,11 +1092,18 @@ static void __init display_cacheinfo(struct cpuinfo_x86 *c)
l2size = ecx >> 16;
/* AMD errata T13 (order #21922) */
if (c->x86_vendor == X86_VENDOR_AMD &&
c->x86 == 6 &&
c->x86_model == 3 &&
c->x86_mask == 0) {
l2size = 64;
if ((c->x86_vendor == X86_VENDOR_AMD) && (c->x86 == 6)) {
if (c->x86_model == 3 && c->x86_mask == 0) /* Duron Rev A0 */
l2size = 64;
if (c->x86_model == 4 &&
(c->x86_mask==0 || c->x86_mask==1)) /* Tbird rev A1/A2 */
l2size = 256;
}
/* VIA C3 CPUs (670-68F) need further shifting. */
if (c->x86_vendor == X86_VENDOR_CENTAUR && (c->x86 == 6) &&
((c->x86_model == 7) || (c->x86_model == 8))) {
l2size = l2size >> 8;
}
if ( l2size == 0 )
......@@ -1109,7 +1120,7 @@ static void __init display_cacheinfo(struct cpuinfo_x86 *c)
* misexecution of code under Linux. Owners of such processors should
* contact AMD for precise details and a CPU swap.
*
* See http://www.mygale.com/~poulot/k6bug.html
* See http://www.multimania.com/poulot/k6bug.html
* http://www.amd.com/K6/k6docs/revgd.html
*
* The following test is erm.. interesting. AMD neglected to up
......@@ -1126,6 +1137,12 @@ static int __init init_amd(struct cpuinfo_x86 *c)
int mbytes = max_mapnr >> (20-PAGE_SHIFT);
int r;
/*
* FIXME: We should handle the K5 here. Set up the write
* range and also turn on MSR 83 bits 4 and 31 (write alloc,
* no bus pipeline)
*/
/* Bit 31 in normal CPUID used for nonstandard 3DNow ID;
3DNow is IDd by bit 31 in extended CPUID (1*32+31) anyway */
clear_bit(0*32+31, &c->x86_capability);
......@@ -1185,13 +1202,13 @@ static int __init init_amd(struct cpuinfo_x86 *c)
if(mbytes>508)
mbytes=508;
rdmsr(0xC0000082, l, h);
rdmsr(MSR_K6_WHCR, l, h);
if ((l&0x0000FFFF)==0) {
unsigned long flags;
l=(1<<0)|((mbytes/4)<<1);
local_irq_save(flags);
__asm__ __volatile__ ("wbinvd": : :"memory");
wrmsr(0xC0000082, l, h);
wbinvd();
wrmsr(MSR_K6_WHCR, l, h);
local_irq_restore(flags);
printk(KERN_INFO "Enabling old style K6 write allocation for %d Mb\n",
mbytes);
......@@ -1206,13 +1223,13 @@ static int __init init_amd(struct cpuinfo_x86 *c)
if(mbytes>4092)
mbytes=4092;
rdmsr(0xC0000082, l, h);
rdmsr(MSR_K6_WHCR, l, h);
if ((l&0xFFFF0000)==0) {
unsigned long flags;
l=((mbytes>>2)<<22)|(1<<16);
local_irq_save(flags);
__asm__ __volatile__ ("wbinvd": : :"memory");
wrmsr(0xC0000082, l, h);
wbinvd();
wrmsr(MSR_K6_WHCR, l, h);
local_irq_restore(flags);
printk(KERN_INFO "Enabling new style K6 write allocation for %d Mb\n",
mbytes);
......@@ -1226,10 +1243,10 @@ static int __init init_amd(struct cpuinfo_x86 *c)
set_bit(X86_FEATURE_K6_MTRR, &c->x86_capability);
break;
}
break;
case 6: /* An Athlon/Duron. We can trust the BIOS probably */
mcheck_init(c);
break;
}
......@@ -1312,9 +1329,10 @@ extern void calibrate_delay(void) __init;
static void __init check_cx686_slop(struct cpuinfo_x86 *c)
{
unsigned long flags;
if (Cx86_dir0_msb == 3) {
unsigned char ccr3, ccr5;
unsigned long flags;
local_irq_save(flags);
ccr3 = getCx86(CX86_CCR3);
......@@ -1551,14 +1569,12 @@ static void __init init_centaur(struct cpuinfo_x86 *c)
name="??";
}
/* get FCR */
rdmsr(0x107, lo, hi);
rdmsr(MSR_IDT_FCR1, lo, hi);
newlo=(lo|fcr_set) & (~fcr_clr);
if (newlo!=lo) {
printk(KERN_INFO "Centaur FCR was 0x%X now 0x%X\n", lo, newlo );
wrmsr(0x107, newlo, hi );
wrmsr(MSR_IDT_FCR1, newlo, hi );
} else {
printk(KERN_INFO "Centaur FCR is 0x%X\n",lo);
}
......@@ -1577,14 +1593,15 @@ static void __init init_centaur(struct cpuinfo_x86 *c)
c->x86_cache_size = (cc>>24)+(dd>>24);
}
sprintf( c->x86_model_id, "WinChip %s", name );
mcheck_init(c);
break;
case 6:
switch (c->x86_model) {
case 6 ... 7: /* Cyrix III or C3 */
rdmsr (0x1107, lo, hi);
rdmsr (MSR_VIA_FCR, lo, hi);
lo |= (1<<1 | 1<<7); /* Report CX8 & enable PGE */
wrmsr (0x1107, lo, hi);
wrmsr (MSR_VIA_FCR, lo, hi);
set_bit(X86_FEATURE_CX8, &c->x86_capability);
set_bit(X86_FEATURE_3DNOW, &c->x86_capability);
......@@ -1595,7 +1612,6 @@ static void __init init_centaur(struct cpuinfo_x86 *c)
}
break;
}
}
......@@ -1668,7 +1684,6 @@ static void __init init_rise(struct cpuinfo_x86 *c)
if (c->x86_model > 2)
printk(" II");
printk("\n");
printk("If you have one of these please email davej@suse.de\n");
/* Unhide possibly hidden capability flags
The mp6 iDragon family don't have MSRs.
......@@ -1694,7 +1709,6 @@ static void __init init_intel(struct cpuinfo_x86 *c)
#ifndef CONFIG_M686
static int f00f_workaround_enabled = 0;
#endif
extern void mcheck_init(struct cpuinfo_x86 *c);
char *p = NULL;
unsigned int l1i = 0, l1d = 0, l2 = 0, l3 = 0; /* Cache sizes */
......@@ -1989,9 +2003,9 @@ static void __init squash_the_stupid_serial_number(struct cpuinfo_x86 *c)
disable_x86_serial_nr ) {
/* Disable processor serial number */
unsigned long lo,hi;
rdmsr(0x119,lo,hi);
rdmsr(MSR_IA32_BBL_CR_CTL,lo,hi);
lo |= 0x200000;
wrmsr(0x119,lo,hi);
wrmsr(MSR_IA32_BBL_CR_CTL,lo,hi);
printk(KERN_NOTICE "CPU serial number disabled.\n");
clear_bit(X86_FEATURE_PN, &c->x86_capability);
......
......@@ -770,6 +770,8 @@ static struct ioctl32_list ioctl32_handler_table[] = {
IOCTL32_HANDLER(BLKPG, blkpg_ioctl_trans),
IOCTL32_DEFAULT(BLKELVGET),
IOCTL32_DEFAULT(BLKELVSET),
IOCTL32_DEFAULT(BLKBSZGET),
IOCTL32_DEFAULT(BLKBSZSET),
#ifdef CONFIG_MD
/* status */
......
/*
* BK Id: SCCS/s.chrp_setup.c 1.32 08/20/01 22:58:32 paulus
* BK Id: SCCS/s.chrp_setup.c 1.34 08/29/01 10:07:29 paulus
*/
/*
* linux/arch/ppc/kernel/setup.c
......@@ -78,7 +78,6 @@ extern int pckbd_translate(unsigned char scancode, unsigned char *keycode,
char raw_mode);
extern char pckbd_unexpected_up(unsigned char keycode);
extern void pckbd_leds(unsigned char leds);
extern int pckbd_rate(struct kbd_repeat *rep);
extern void pckbd_init_hw(void);
extern unsigned char pckbd_sysrq_xlate[128];
extern void select_adb_keyboard(void);
......@@ -546,7 +545,6 @@ chrp_init(unsigned long r3, unsigned long r4, unsigned long r5,
ppc_md.kbd_translate = pckbd_translate;
ppc_md.kbd_unexpected_up = pckbd_unexpected_up;
ppc_md.kbd_leds = pckbd_leds;
ppc_md.kbd_rate_fn = pckbd_rate;
ppc_md.kbd_init_hw = pckbd_init_hw;
#ifdef CONFIG_MAGIC_SYSRQ
ppc_md.ppc_kbd_sysrq_xlate = pckbd_sysrq_xlate;
......
/*
* BK Id: SCCS/s.head_8xx.S 1.19 08/16/01 23:00:17 paulus
* BK Id: SCCS/s.head_8xx.S 1.21 08/28/01 16:27:27 trini
*/
/*
* arch/ppc/kernel/except_8xx.S
......@@ -823,8 +823,8 @@ initial_mmu:
mtspr DC_CST, r8
lis r8, IDC_ENABLE@h
mtspr DC_CST, r8
blr
#endif
blr
/*
......
/*
* BK Id: SCCS/s.pmac_setup.c 1.35 08/20/01 22:37:37 paulus
* BK Id: SCCS/s.pmac_setup.c 1.37 08/29/01 10:07:29 paulus
*/
/*
* linux/arch/ppc/kernel/setup.c
......@@ -728,7 +728,6 @@ select_adb_keyboard(void)
ppc_md.kbd_setkeycode = 0;
ppc_md.kbd_getkeycode = 0;
ppc_md.kbd_leds = 0;
ppc_md.kbd_rate_fn = 0;
#ifdef CONFIG_MAGIC_SYSRQ
#ifdef CONFIG_MAC_ADBKEYCODES
if (!keyboard_sends_linux_keycodes) {
......@@ -747,7 +746,6 @@ select_adb_keyboard(void)
ppc_md.kbd_translate = mackbd_translate;
ppc_md.kbd_unexpected_up = mackbd_unexpected_up;
ppc_md.kbd_leds = mackbd_leds;
ppc_md.kbd_rate_fn = NULL;
ppc_md.kbd_init_hw = mackbd_init_hw;
#ifdef CONFIG_MAGIC_SYSRQ
ppc_md.ppc_kbd_sysrq_xlate = mackbd_sysrq_xlate;
......
/*
* BK Id: SCCS/s.prep_setup.c 1.32 08/20/01 15:06:15 paulus
* BK Id: SCCS/s.prep_setup.c 1.34 08/29/01 10:07:29 paulus
*/
/*
* linux/arch/ppc/kernel/setup.c
......@@ -89,7 +89,6 @@ extern int pckbd_translate(unsigned char scancode, unsigned char *keycode,
char raw_mode);
extern char pckbd_unexpected_up(unsigned char keycode);
extern void pckbd_leds(unsigned char leds);
extern int pckbd_rate(struct kbd_repeat *rep);
extern void pckbd_init_hw(void);
extern unsigned char pckbd_sysrq_xlate[128];
......@@ -955,7 +954,6 @@ prep_init(unsigned long r3, unsigned long r4, unsigned long r5,
ppc_md.kbd_translate = pckbd_translate;
ppc_md.kbd_unexpected_up = pckbd_unexpected_up;
ppc_md.kbd_leds = pckbd_leds;
ppc_md.kbd_rate_fn = pckbd_rate;
ppc_md.kbd_init_hw = pckbd_init_hw;
#ifdef CONFIG_MAGIC_SYSRQ
ppc_md.ppc_kbd_sysrq_xlate = pckbd_sysrq_xlate;
......
......@@ -3691,6 +3691,8 @@ COMPATIBLE_IOCTL(BLKRASET)
COMPATIBLE_IOCTL(BLKFRASET)
COMPATIBLE_IOCTL(BLKSECTSET)
COMPATIBLE_IOCTL(BLKSSZGET)
COMPATIBLE_IOCTL(BLKBSZGET)
COMPATIBLE_IOCTL(BLKBSZSET)
/* RAID */
COMPATIBLE_IOCTL(RAID_VERSION)
......
......@@ -39,7 +39,6 @@
#define BREAKPOINT3
#define disable() __cli()
#define enable() __sti()
#define wbinvd()
/*! [Begin] no source code translation */
......@@ -101,7 +100,6 @@
#define disable() __cli()
#define enable() __sti()
#define halt() __asm__ __volatile__ ("sti; hlt":::"memory")
#define wbinvd()
/*! [Begin] no source code translation
*
......
......@@ -31,6 +31,7 @@
#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/hdreg.h>
#include <linux/blkpg.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/locks.h>
......@@ -5094,21 +5095,12 @@ static int DAC960_IOCTL(Inode_T *Inode, File_T *File,
.nr_sects,
(long *) Argument);
case BLKRAGET:
/* Get Read-Ahead. */
if ((long *) Argument == NULL) return -EINVAL;
return put_user(read_ahead[MAJOR(Inode->i_rdev)], (long *) Argument);
case BLKRASET:
/* Set Read-Ahead. */
if (!capable(CAP_SYS_ADMIN)) return -EACCES;
if (Argument > 256) return -EINVAL;
read_ahead[MAJOR(Inode->i_rdev)] = Argument;
return 0;
case BLKFLSBUF:
/* Flush Buffers. */
if (!capable(CAP_SYS_ADMIN)) return -EACCES;
fsync_dev(Inode->i_rdev);
invalidate_buffers(Inode->i_rdev);
return 0;
case BLKBSZGET:
case BLKBSZSET:
return blk_ioctl (Inode->i_rdev, Request, Argument);
case BLKRRPART:
/* Re-Read Partition Table. */
if (!capable(CAP_SYS_ADMIN)) return -EACCES;
......
......@@ -274,6 +274,29 @@ int blk_ioctl(kdev_t dev, unsigned int cmd, unsigned long arg)
return blkelvset_ioctl(&blk_get_queue(dev)->elevator,
(blkelv_ioctl_arg_t *) arg);
case BLKBSZGET:
/* get the logical block size (cf. BLKSSZGET) */
intval = BLOCK_SIZE;
if (blksize_size[MAJOR(dev)])
intval = blksize_size[MAJOR(dev)][MINOR(dev)];
return put_user (intval, (int *) arg);
case BLKBSZSET:
/* set the logical block size */
if (!capable (CAP_SYS_ADMIN))
return -EACCES;
if (!dev || !arg)
return -EINVAL;
if (get_user (intval, (int *) arg))
return -EFAULT;
if (intval > PAGE_SIZE || intval < 512 ||
(intval & (intval - 1)))
return -EINVAL;
if (is_mounted (dev) || is_swap_partition (dev))
return -EBUSY;
set_blocksize (dev, intval);
return 0;
default:
return -EINVAL;
}
......
......@@ -406,6 +406,8 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
case BLKRRPART:
return revalidate_logvol(inode->i_rdev, 1);
case BLKFLSBUF:
case BLKBSZSET:
case BLKBSZGET:
case BLKROSET:
case BLKROGET:
case BLKRASET:
......
......@@ -1266,6 +1266,8 @@ static int ida_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
}
case BLKFLSBUF:
case BLKBSZSET:
case BLKBSZGET:
case BLKROSET:
case BLKROGET:
case BLKRASET:
......
......@@ -62,6 +62,7 @@
#include <linux/major.h>
#include <linux/wait.h>
#include <linux/blk.h>
#include <linux/blkpg.h>
#include <linux/init.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/smp_lock.h>
......@@ -854,6 +855,10 @@ static int lo_ioctl(struct inode * inode, struct file * file,
}
err = put_user(loop_sizes[lo->lo_number] << 1, (long *) arg);
break;
case BLKBSZGET:
case BLKBSZSET:
err = blk_ioctl(inode->i_rdev, cmd, arg);
break;
default:
err = lo->ioctl ? lo->ioctl(lo, cmd, arg) : -EINVAL;
}
......
......@@ -1127,6 +1127,8 @@ static int ps2esdi_ioctl(struct inode *inode,
case BLKRASET:
case BLKRAGET:
case BLKFLSBUF:
case BLKBSZGET:
case BLKBSZSET:
case BLKPG:
return blk_ioctl(inode->i_rdev, cmd, arg);
}
......
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