Commit 84f4a1c4 authored by Martin Dalecki's avatar Martin Dalecki Committed by Trond Myklebust

[PATCH] IDE 100

  Trivia time:

  - C99 conforming initializations by Rusty.

  - ide__sti() -> local_irq_enable() and its friends.
parent e9356da8
......@@ -61,15 +61,18 @@
#define AEC_CABLEPINS_INPUT 0x10
static unsigned char aec_cyc2udma[9] = { 5, 5, 5, 4, 3, 2, 2, 1, 1 };
static unsigned char aec_cyc2act[16] = { 1, 1, 2, 3, 4, 5, 6, 0, 0, 7, 7, 7, 7, 7, 7, 7 };
static unsigned char aec_cyc2rec[16] = { 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 12, 13, 14 };
static unsigned char aec_cyc2act[16] =
{ 1, 1, 2, 3, 4, 5, 6, 0, 0, 7, 7, 7, 7, 7, 7, 7 };
static unsigned char aec_cyc2rec[16] =
{ 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 12, 13, 14 };
/*
* aec_set_speed_old() writes timing values to
* the chipset registers for ATP850UF
*/
static void aec_set_speed_old(struct pci_dev *dev, unsigned char dn, struct ata_timing *timing)
static void aec_set_speed_old(struct pci_dev *dev, unsigned char dn,
struct ata_timing *timing)
{
unsigned char t;
......@@ -90,19 +93,22 @@ static void aec_set_speed_old(struct pci_dev *dev, unsigned char dn, struct ata_
* other Artop chips
*/
static void aec_set_speed_new(struct pci_dev *dev, unsigned char dn, struct ata_timing *timing)
static void aec_set_speed_new(struct pci_dev *dev, unsigned char dn,
struct ata_timing *timing)
{
unsigned char t;
pci_write_config_byte(dev, AEC_DRIVE_TIMING + dn,
(aec_cyc2act[FIT(timing->active, 0, 15)] << 4)
(aec_cyc2act[FIT(timing->active, 0, 15)] <<
4)
| aec_cyc2rec[FIT(timing->recover, 0, 15)]);
pci_read_config_byte(dev, AEC_UDMA_NEW + (dn >> 1), &t);
t &= ~(0xf << ((dn & 1) << 2));
if (timing->udma) {
if (timing->udma >= 2)
t |= aec_cyc2udma[FIT(timing->udma, 2, 8)] << ((dn & 1) << 2);
t |= aec_cyc2udma[FIT(timing->udma, 2, 8)] <<
((dn & 1) << 2);
if (timing->mode == XFER_UDMA_5)
t |= 6;
if (timing->mode == XFER_UDMA_6)
......@@ -123,11 +129,14 @@ static int aec_set_drive(struct ata_device *drive, unsigned char speed)
int T, UT;
int aec_old;
aec_old = (drive->channel->pci_dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF);
aec_old =
(drive->channel->pci_dev->device ==
PCI_DEVICE_ID_ARTOP_ATP850UF);
if (speed != XFER_PIO_SLOW && speed != drive->current_speed)
if (ide_config_drive_speed(drive, speed))
printk(KERN_WARNING "ide%d: Drive %d didn't accept speed setting. Oh, well.\n",
printk(KERN_WARNING
"ide%d: Drive %d didn't accept speed setting. Oh, well.\n",
drive->dn >> 1, drive->dn & 1);
T = 1000000000 / system_bus_speed;
......@@ -152,7 +161,9 @@ static int aec_set_drive(struct ata_device *drive, unsigned char speed)
static void aec62xx_tune_drive(struct ata_device *drive, unsigned char pio)
{
if (pio == 255) {
aec_set_drive(drive, ata_timing_mode(drive, XFER_PIO | XFER_EPIO));
aec_set_drive(drive,
ata_timing_mode(drive,
XFER_PIO | XFER_EPIO));
return;
}
......@@ -173,7 +184,10 @@ static int __init aec62xx_modes_map(struct ata_channel *ch)
case PCI_DEVICE_ID_ARTOP_ATP865:
/* Can't use these modes simultaneously,
based on which PLL clock was chosen. */
map |= inb (bmide + AEC_BM_STAT_PCH) & AEC_PLLCLK_ATA133 ? XFER_UDMA_133 : XFER_UDMA_100;
map |=
inb(bmide +
AEC_BM_STAT_PCH) & AEC_PLLCLK_ATA133 ?
XFER_UDMA_133 : XFER_UDMA_100;
case PCI_DEVICE_ID_ARTOP_ATP860R:
case PCI_DEVICE_ID_ARTOP_ATP860:
map |= XFER_UDMA_66;
......@@ -220,7 +234,8 @@ static unsigned int __init aec62xx_init_chipset(struct pci_dev *dev)
pci_write_config_byte(dev, AEC_IDE_ENABLE, t | 0x80);
#endif
/* switch cable detection pins to input-only. */
outb (inb (bmide + AEC_BM_STAT_SCH) | AEC_CABLEPINS_INPUT, bmide + AEC_BM_STAT_SCH);
outb(inb(bmide + AEC_BM_STAT_SCH) | AEC_CABLEPINS_INPUT,
bmide + AEC_BM_STAT_SCH);
}
/*
......@@ -274,7 +289,8 @@ static void __init aec62xx_init_channel(struct ata_channel *ch)
/*
* We allow the BM-DMA driver only work on enabled interfaces.
*/
static void __init aec62xx_init_dma(struct ata_channel *ch, unsigned long dmabase)
static void __init aec62xx_init_dma(struct ata_channel *ch,
unsigned long dmabase)
{
unsigned char t;
......@@ -286,50 +302,49 @@ static void __init aec62xx_init_dma(struct ata_channel *ch, unsigned long dmabas
/* module data table */
static struct ata_pci_device chipsets[] __initdata = {
{
vendor: PCI_VENDOR_ID_ARTOP,
device: PCI_DEVICE_ID_ARTOP_ATP850UF,
init_chipset: aec62xx_init_chipset,
init_channel: aec62xx_init_channel,
init_dma: aec62xx_init_dma,
enablebits: { {0x4a,0x02,0x02}, {0x4a,0x04,0x04} },
bootable: OFF_BOARD,
flags: ATA_F_SER | ATA_F_IRQ | ATA_F_DMA
.vendor = PCI_VENDOR_ID_ARTOP,
.device = PCI_DEVICE_ID_ARTOP_ATP850UF,
.init_chipset = aec62xx_init_chipset,
.init_channel = aec62xx_init_channel,
.init_dma = aec62xx_init_dma,
.enablebits = {{0x4a, 0x02, 0x02}, {0x4a, 0x04, 0x04}},
.bootable = OFF_BOARD,
.flags = ATA_F_SER | ATA_F_IRQ | ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_ARTOP,
device: PCI_DEVICE_ID_ARTOP_ATP860,
init_chipset: aec62xx_init_chipset,
init_channel: aec62xx_init_channel,
enablebits: { {0x4a,0x02,0x02}, {0x4a,0x04,0x04} },
bootable: NEVER_BOARD,
flags: ATA_F_IRQ | ATA_F_DMA
.vendor = PCI_VENDOR_ID_ARTOP,
.device = PCI_DEVICE_ID_ARTOP_ATP860,
.init_chipset = aec62xx_init_chipset,
.init_channel = aec62xx_init_channel,
.enablebits = {{0x4a, 0x02, 0x02}, {0x4a, 0x04, 0x04}},
.bootable = NEVER_BOARD,
.flags = ATA_F_IRQ | ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_ARTOP,
device: PCI_DEVICE_ID_ARTOP_ATP860R,
init_chipset: aec62xx_init_chipset,
init_channel: aec62xx_init_channel,
enablebits: { {0x4a,0x02,0x02}, {0x4a,0x04,0x04} },
bootable: OFF_BOARD,
flags: ATA_F_IRQ | ATA_F_DMA
},
.vendor = PCI_VENDOR_ID_ARTOP,
.device = PCI_DEVICE_ID_ARTOP_ATP860R,
.init_chipset = aec62xx_init_chipset,
.init_channel = aec62xx_init_channel,
.enablebits = {{0x4a, 0x02, 0x02}, {0x4a, 0x04, 0x04}},
.bootable = OFF_BOARD,
.flags = ATA_F_IRQ | ATA_F_DMA},
{
vendor: PCI_VENDOR_ID_ARTOP,
device: PCI_DEVICE_ID_ARTOP_ATP865,
init_chipset: aec62xx_init_chipset,
init_channel: aec62xx_init_channel,
enablebits: { {0x4a,0x02,0x02}, {0x4a,0x04,0x04} },
bootable: NEVER_BOARD,
flags: ATA_F_IRQ | ATA_F_DMA
.vendor = PCI_VENDOR_ID_ARTOP,
.device = PCI_DEVICE_ID_ARTOP_ATP865,
.init_chipset = aec62xx_init_chipset,
.init_channel = aec62xx_init_channel,
.enablebits = {{0x4a, 0x02, 0x02}, {0x4a, 0x04, 0x04}},
.bootable = NEVER_BOARD,
.flags = ATA_F_IRQ | ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_ARTOP,
device: PCI_DEVICE_ID_ARTOP_ATP865R,
init_chipset: aec62xx_init_chipset,
init_channel: aec62xx_init_channel,
enablebits: { {0x4a,0x02,0x02}, {0x4a,0x04,0x04} },
bootable: OFF_BOARD,
flags: ATA_F_IRQ | ATA_F_DMA
.vendor = PCI_VENDOR_ID_ARTOP,
.device = PCI_DEVICE_ID_ARTOP_ATP865R,
.init_chipset = aec62xx_init_chipset,
.init_channel = aec62xx_init_channel,
.enablebits = {{0x4a, 0x02, 0x02}, {0x4a, 0x04, 0x04}},
.bootable = OFF_BOARD,
.flags = ATA_F_IRQ | ATA_F_DMA
}
};
......
......@@ -46,7 +46,8 @@
/* port addresses for auto-detection */
#define ALI_NUM_PORTS 4
static int ports[ALI_NUM_PORTS] __initdata = { 0x074, 0x0f4, 0x034, 0x0e4 };
static int ports[ALI_NUM_PORTS] __initdata =
{ 0x074, 0x0f4, 0x034, 0x0e4 };
/* register initialization data */
struct reg_initializer {
......@@ -67,10 +68,14 @@ static struct reg_initializer init_data[] __initdata = {
static struct {
u8 reg1, reg2, reg3, reg4;
} reg_tab[4] = {
{ 0x03, 0x26, 0x04, 0x27 }, /* drive 0 */
{ 0x05, 0x28, 0x06, 0x29 }, /* drive 1 */
{ 0x2b, 0x30, 0x2c, 0x31 }, /* drive 2 */
{ 0x2d, 0x32, 0x2e, 0x33 }, /* drive 3 */
{
0x03, 0x26, 0x04, 0x27}, /* drive 0 */
{
0x05, 0x28, 0x06, 0x29}, /* drive 1 */
{
0x2b, 0x30, 0x2c, 0x31}, /* drive 2 */
{
0x2d, 0x32, 0x2e, 0x33}, /* drive 3 */
};
static int base_port; /* base port address */
......@@ -121,13 +126,16 @@ static void ali14xx_tune_drive(struct ata_device *drive, u8 pio)
time1 = t->cycle;
time2 = t->active;
param3 = param1 = (time2 * system_bus_speed + 999999) / 1000000;
param4 = param2 = (time1 * system_bus_speed + 999999) / 1000000 - param1;
param4 = param2 =
(time1 * system_bus_speed + 999999) / 1000000 - param1;
if (pio < XFER_PIO_3) {
param3 += 8;
param4 += 8;
}
printk(KERN_DEBUG "%s: PIO mode%d, t1=%dns, t2=%dns, cycles = %d+%d, %d+%d\n",
drive->name, pio - XFER_PIO_0, time1, time2, param1, param2, param3, param4);
printk(KERN_DEBUG
"%s: PIO mode%d, t1=%dns, t2=%dns, cycles = %d+%d, %d+%d\n",
drive->name, pio - XFER_PIO_0, time1, time2, param1, param2,
param3, param4);
/* stuff timing parameters into controller registers */
drive_num = (drive->channel->index << 1) + drive->select.b.unit;
......@@ -150,8 +158,7 @@ static int __init find_port(void)
int i;
unsigned long flags;
__save_flags(flags); /* local CPU only */
__cli(); /* local CPU only */
local_irq_save(flags);
for (i = 0; i < ALI_NUM_PORTS; i++) {
base_port = ports[i];
reg_off = inb(base_port);
......@@ -163,7 +170,7 @@ static int __init find_port(void)
data_port = base_port + 8;
t = in_reg(0) & 0xf0;
outb_p(reg_off, base_port);
__restore_flags(flags); /* local CPU only */
local_irq_restore(flags);
if (t != 0x50)
return 0;
return 1; /* success */
......@@ -171,7 +178,8 @@ static int __init find_port(void)
}
outb_p(reg_off, base_port);
}
__restore_flags(flags); /* local CPU only */
local_irq_restore(flags);
return 0;
}
......@@ -184,15 +192,15 @@ static int __init init_registers(void)
unsigned long flags;
u8 t;
__save_flags(flags); /* local CPU only */
__cli(); /* local CPU only */
local_irq_save(flags);
outb_p(reg_on, base_port);
for (p = init_data; p->reg != 0; ++p)
out_reg(p->data, p->reg);
outb_p(0x01, reg_port);
t = inb(reg_port) & 0x01;
outb_p(reg_off, base_port);
__restore_flags(flags); /* local CPU only */
local_irq_restore(flags);
return t;
}
......
......@@ -73,8 +73,8 @@ static void ali15x3_tune_drive(struct ata_device *drive, byte pio)
if (r_clc >= 16)
r_clc = 0;
}
__save_flags(flags);
__cli();
local_irq_save(flags);
/*
* PIO mode => ATA FIFO on, ATAPI FIFO off
......@@ -96,7 +96,8 @@ static void ali15x3_tune_drive(struct ata_device *drive, byte pio)
pci_write_config_byte(dev, port, s_clc);
pci_write_config_byte(dev, port+drive->select.b.unit+2, (a_clc << 4) | r_clc);
__restore_flags(flags);
local_irq_restore(flags);
}
static int ali15x3_tune_chipset(struct ata_device *drive, byte speed)
......@@ -216,8 +217,7 @@ static unsigned int __init ali15x3_ata66_check(struct ata_channel *hwif)
unsigned long flags;
byte tmpbyte;
__save_flags(flags);
__cli();
local_irq_save(flags);
if (m5229_revision >= 0xC2) {
/*
......@@ -297,9 +297,9 @@ static unsigned int __init ali15x3_ata66_check(struct ata_channel *hwif)
pci_write_config_byte(dev, 0x53, tmpbyte);
__restore_flags(flags);
local_irq_restore(flags);
return(ata66);
return (ata66);
}
static void __init ali15x3_init_channel(struct ata_channel *hwif)
......@@ -374,22 +374,22 @@ static void __init ali15x3_init_dma(struct ata_channel *ch, unsigned long dmabas
/* module data table */
static struct ata_pci_device chipsets[] __initdata = {
{
vendor: PCI_VENDOR_ID_AL,
device: PCI_DEVICE_ID_AL_M5219,
.vendor = PCI_VENDOR_ID_AL,
.device = PCI_DEVICE_ID_AL_M5219,
/* FIXME: Perhaps we should use the same init routines
* as below here. */
enablebits: { {0x00,0x00,0x00}, {0x00,0x00,0x00} },
bootable: ON_BOARD,
flags: ATA_F_SIMPLEX
.enablebits = { {0x00,0x00,0x00}, {0x00,0x00,0x00} },
.bootable = ON_BOARD,
.flags = ATA_F_SIMPLEX
},
{
vendor: PCI_VENDOR_ID_AL,
device: PCI_DEVICE_ID_AL_M5229,
init_chipset: ali15x3_init_chipset,
init_channel: ali15x3_init_channel,
init_dma: ali15x3_init_dma,
enablebits: { {0x00,0x00,0x00}, {0x00,0x00,0x00} },
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_AL,
.device = PCI_DEVICE_ID_AL_M5229,
.init_chipset = ali15x3_init_chipset,
.init_channel = ali15x3_init_channel,
.init_dma = ali15x3_init_dma,
.enablebits = { {0x00,0x00,0x00}, {0x00,0x00,0x00} },
.bootable = ON_BOARD
}
};
......@@ -397,9 +397,8 @@ int __init init_ali15x3(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(chipsets); ++i) {
for (i = 0; i < ARRAY_SIZE(chipsets); ++i)
ata_register_chipset(&chipsets[i]);
}
return 0;
}
......@@ -303,59 +303,59 @@ static void __init amd74xx_init_dma(struct ata_channel *ch, unsigned long dmabas
/* module data table */
static struct ata_pci_device chipsets[] __initdata = {
{
vendor: PCI_VENDOR_ID_AMD,
device: PCI_DEVICE_ID_AMD_COBRA_7401,
init_chipset: amd74xx_init_chipset,
init_channel: amd74xx_init_channel,
init_dma: amd74xx_init_dma,
enablebits: {{0x40,0x01,0x01}, {0x40,0x02,0x02}},
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_AMD,
.device = PCI_DEVICE_ID_AMD_COBRA_7401,
.init_chipset = amd74xx_init_chipset,
.init_channel = amd74xx_init_channel,
.init_dma = amd74xx_init_dma,
.enablebits = {{0x40,0x01,0x01}, {0x40,0x02,0x02}},
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_AMD,
device: PCI_DEVICE_ID_AMD_VIPER_7409,
init_chipset: amd74xx_init_chipset,
init_channel: amd74xx_init_channel,
init_dma: amd74xx_init_dma,
enablebits: {{0x40,0x01,0x01}, {0x40,0x02,0x02}},
bootable: ON_BOARD,
flags: ATA_F_SIMPLEX
.vendor = PCI_VENDOR_ID_AMD,
.device = PCI_DEVICE_ID_AMD_VIPER_7409,
.init_chipset = amd74xx_init_chipset,
.init_channel = amd74xx_init_channel,
.init_dma = amd74xx_init_dma,
.enablebits = {{0x40,0x01,0x01}, {0x40,0x02,0x02}},
.bootable = ON_BOARD,
.flags = ATA_F_SIMPLEX
},
{
vendor: PCI_VENDOR_ID_AMD,
device: PCI_DEVICE_ID_AMD_VIPER_7411,
init_chipset: amd74xx_init_chipset,
init_channel: amd74xx_init_channel,
init_dma: amd74xx_init_dma,
enablebits: {{0x40,0x01,0x01}, {0x40,0x02,0x02}},
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_AMD,
.device = PCI_DEVICE_ID_AMD_VIPER_7411,
.init_chipset = amd74xx_init_chipset,
.init_channel = amd74xx_init_channel,
.init_dma = amd74xx_init_dma,
.enablebits = {{0x40,0x01,0x01}, {0x40,0x02,0x02}},
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_AMD,
device: PCI_DEVICE_ID_AMD_OPUS_7441,
init_chipset: amd74xx_init_chipset,
init_channel: amd74xx_init_channel,
init_dma: amd74xx_init_dma,
enablebits: {{0x40,0x01,0x01}, {0x40,0x02,0x02}},
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_AMD,
.device = PCI_DEVICE_ID_AMD_OPUS_7441,
.init_chipset = amd74xx_init_chipset,
.init_channel = amd74xx_init_channel,
.init_dma = amd74xx_init_dma,
.enablebits = {{0x40,0x01,0x01}, {0x40,0x02,0x02}},
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_AMD,
device: PCI_DEVICE_ID_AMD_8111_IDE,
init_chipset: amd74xx_init_chipset,
init_channel: amd74xx_init_channel,
init_dma: amd74xx_init_dma,
enablebits: {{0x40,0x01,0x01}, {0x40,0x02,0x02}},
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_AMD,
.device = PCI_DEVICE_ID_AMD_8111_IDE,
.init_chipset = amd74xx_init_chipset,
.init_channel = amd74xx_init_channel,
.init_dma = amd74xx_init_dma,
.enablebits = {{0x40,0x01,0x01}, {0x40,0x02,0x02}},
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_NVIDIA,
device: PCI_DEVICE_ID_NVIDIA_NFORCE_IDE,
init_chipset: amd74xx_init_chipset,
init_channel: amd74xx_init_channel,
init_dma: amd74xx_init_dma,
enablebits: {{0x50,0x01,0x01}, {0x50,0x02,0x02}},
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_NVIDIA,
.device = PCI_DEVICE_ID_NVIDIA_NFORCE_IDE,
.init_chipset = amd74xx_init_chipset,
.init_channel = amd74xx_init_channel,
.init_dma = amd74xx_init_dma,
.enablebits = {{0x50,0x01,0x01}, {0x50,0x02,0x02}},
.bootable = ON_BOARD
},
};
......@@ -363,9 +363,8 @@ int __init init_amd74xx(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(chipsets); ++i) {
for (i = 0; i < ARRAY_SIZE(chipsets); ++i)
ata_register_chipset(&chipsets[i]);
}
return 0;
}
......@@ -34,12 +34,14 @@
#include "ataraid.h"
static struct raid_device_operations* ataraid_ops[16];
static struct raid_device_operations *ataraid_ops[16];
static int ataraid_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
static int ataraid_open(struct inode * inode, struct file * filp);
static int ataraid_release(struct inode * inode, struct file * filp);
static void ataraid_split_request(request_queue_t *q, int rw, struct buffer_head * bh);
static int ataraid_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg);
static int ataraid_open(struct inode *inode, struct file *filp);
static int ataraid_release(struct inode *inode, struct file *filp);
static void ataraid_split_request(request_queue_t * q, int rw,
struct buffer_head *bh);
struct gendisk ataraid_gendisk;
......@@ -47,10 +49,10 @@ static int ataraid_gendisk_sizes[256];
static int ataraid_readahead[256];
static struct block_device_operations ataraid_fops = {
owner: THIS_MODULE,
open: ataraid_open,
release: ataraid_release,
ioctl: ataraid_ioctl,
.owner = THIS_MODULE,
.open = ataraid_open,
.release = ataraid_release,
.ioctl = ataraid_ioctl,
};
......@@ -63,48 +65,50 @@ static unsigned int ataraiduse;
/* stub fops functions */
static int ataraid_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
static int ataraid_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
int minor;
minor = minor(inode->i_rdev)>>SHIFT;
minor = minor(inode->i_rdev) >> SHIFT;
if ((ataraid_ops[minor])&&(ataraid_ops[minor]->ioctl))
return (ataraid_ops[minor]->ioctl)(inode,file,cmd,arg);
if ((ataraid_ops[minor]) && (ataraid_ops[minor]->ioctl))
return (ataraid_ops[minor]->ioctl) (inode, file, cmd, arg);
return -EINVAL;
}
static int ataraid_open(struct inode * inode, struct file * filp)
static int ataraid_open(struct inode *inode, struct file *filp)
{
int minor;
minor = minor(inode->i_rdev)>>SHIFT;
minor = minor(inode->i_rdev) >> SHIFT;
if ((ataraid_ops[minor])&&(ataraid_ops[minor]->open))
return (ataraid_ops[minor]->open)(inode,filp);
if ((ataraid_ops[minor]) && (ataraid_ops[minor]->open))
return (ataraid_ops[minor]->open) (inode, filp);
return -EINVAL;
}
static int ataraid_release(struct inode * inode, struct file * filp)
static int ataraid_release(struct inode *inode, struct file *filp)
{
int minor;
minor = minor(inode->i_rdev)>>SHIFT;
minor = minor(inode->i_rdev) >> SHIFT;
if ((ataraid_ops[minor])&&(ataraid_ops[minor]->release))
return (ataraid_ops[minor]->release)(inode,filp);
if ((ataraid_ops[minor]) && (ataraid_ops[minor]->release))
return (ataraid_ops[minor]->release) (inode, filp);
return -EINVAL;
}
static int ataraid_make_request (request_queue_t *q, int rw, struct buffer_head * bh)
static int ataraid_make_request(request_queue_t * q, int rw,
struct buffer_head *bh)
{
int minor;
int retval;
minor = minor(bh->b_rdev)>>SHIFT;
minor = minor(bh->b_rdev) >> SHIFT;
if ((ataraid_ops[minor])&&(ataraid_ops[minor]->make_request)) {
if ((ataraid_ops[minor]) && (ataraid_ops[minor]->make_request)) {
retval= (ataraid_ops[minor]->make_request)(q,rw,bh);
retval = (ataraid_ops[minor]->make_request) (q, rw, bh);
if (retval == -1) {
ataraid_split_request(q,rw,bh);
ataraid_split_request(q, rw, bh);
return 0;
} else
return retval;
......@@ -116,7 +120,7 @@ struct buffer_head *ataraid_get_bhead(void)
{
void *ptr = NULL;
while (!ptr) {
ptr=kmalloc(sizeof(struct buffer_head),GFP_NOIO);
ptr = kmalloc(sizeof(struct buffer_head), GFP_NOIO);
if (!ptr)
yield();
}
......@@ -129,7 +133,7 @@ struct ataraid_bh_private *ataraid_get_private(void)
{
void *ptr = NULL;
while (!ptr) {
ptr=kmalloc(sizeof(struct ataraid_bh_private),GFP_NOIO);
ptr = kmalloc(sizeof(struct ataraid_bh_private), GFP_NOIO);
if (!ptr)
yield();
}
......@@ -142,11 +146,11 @@ void ataraid_end_request(struct buffer_head *bh, int uptodate)
{
struct ataraid_bh_private *private = bh->b_private;
if (private==NULL)
if (private == NULL)
BUG();
if (atomic_dec_and_test(&private->count)) {
private->parent->b_end_io(private->parent,uptodate);
private->parent->b_end_io(private->parent, uptodate);
private->parent = NULL;
kfree(private);
}
......@@ -155,18 +159,19 @@ void ataraid_end_request(struct buffer_head *bh, int uptodate)
EXPORT_SYMBOL(ataraid_end_request);
static void ataraid_split_request(request_queue_t *q, int rw, struct buffer_head * bh)
static void ataraid_split_request(request_queue_t * q, int rw,
struct buffer_head *bh)
{
struct buffer_head *bh1,*bh2;
struct buffer_head *bh1, *bh2;
struct ataraid_bh_private *private;
bh1=ataraid_get_bhead();
bh2=ataraid_get_bhead();
bh1 = ataraid_get_bhead();
bh2 = ataraid_get_bhead();
/* If either of those ever fails we're doomed */
if ((!bh1)||(!bh2))
if ((!bh1) || (!bh2))
BUG();
private = ataraid_get_private();
if (private==NULL)
if (private == NULL)
BUG();
memcpy(bh1, bh, sizeof(*bh));
......@@ -182,12 +187,12 @@ static void ataraid_split_request(request_queue_t *q, int rw, struct buffer_head
bh1->b_private = private;
bh2->b_private = private;
atomic_set(&private->count,2);
atomic_set(&private->count, 2);
bh2->b_data += bh->b_size/2;
bh2->b_data += bh->b_size / 2;
generic_make_request(rw,bh1);
generic_make_request(rw,bh2);
generic_make_request(rw, bh1);
generic_make_request(rw, bh2);
}
......@@ -200,12 +205,12 @@ int ataraid_get_device(struct raid_device_operations *fops)
{
int bit;
down(&ataraid_sem);
if (ataraiduse==~0U) {
if (ataraiduse == ~0U) {
up(&ataraid_sem);
return -ENODEV;
}
bit=ffz(ataraiduse);
ataraiduse |= 1<<bit;
bit = ffz(ataraiduse);
ataraiduse |= 1 << bit;
ataraid_ops[bit] = fops;
up(&ataraid_sem);
return bit;
......@@ -215,35 +220,38 @@ void ataraid_release_device(int device)
{
down(&ataraid_sem);
if ((ataraiduse & (1<<device))==0)
if ((ataraiduse & (1 << device)) == 0)
BUG(); /* device wasn't registered at all */
ataraiduse &= ~(1<<device);
ataraiduse &= ~(1 << device);
ataraid_ops[device] = NULL;
up(&ataraid_sem);
}
void ataraid_register_disk(int device,long size)
void ataraid_register_disk(int device, long size)
{
register_disk(&ataraid_gendisk, mk_kdev(ATAMAJOR,16*device),16,
&ataraid_fops,size);
register_disk(&ataraid_gendisk, mk_kdev(ATAMAJOR, 16 * device), 16,
&ataraid_fops, size);
}
static __init int ataraid_init(void)
{
int i;
for(i=0;i<256;i++)
for (i = 0; i < 256; i++)
ataraid_readahead[i] = 1023;
/* setup the gendisk structure */
ataraid_gendisk.part = kmalloc(256 * sizeof(struct hd_struct),GFP_KERNEL);
if (ataraid_gendisk.part==NULL) {
printk(KERN_ERR "ataraid: Couldn't allocate memory, aborting \n");
ataraid_gendisk.part =
kmalloc(256 * sizeof(struct hd_struct), GFP_KERNEL);
if (ataraid_gendisk.part == NULL) {
printk(KERN_ERR
"ataraid: Couldn't allocate memory, aborting \n");
return -1;
}
memset(&ataraid_gendisk.part[0],0,256*sizeof(struct hd_struct));
memset(&ataraid_gendisk.part[0], 0,
256 * sizeof(struct hd_struct));
ataraid_gendisk.major = ATAMAJOR;
......@@ -257,13 +265,15 @@ static __init int ataraid_init(void)
add_gendisk(&ataraid_gendisk);
if (register_blkdev(ATAMAJOR, "ataraid", &ataraid_fops)) {
printk(KERN_ERR "ataraid: Could not get major %d \n",ATAMAJOR);
printk(KERN_ERR "ataraid: Could not get major %d \n",
ATAMAJOR);
return -1;
}
blk_queue_make_request(BLK_DEFAULT_QUEUE(ATAMAJOR),ataraid_make_request);
blk_queue_make_request(BLK_DEFAULT_QUEUE(ATAMAJOR),
ataraid_make_request);
return 0;
}
......@@ -292,4 +302,3 @@ EXPORT_SYMBOL(ataraid_release_device);
EXPORT_SYMBOL(ataraid_gendisk);
EXPORT_SYMBOL(ataraid_register_disk);
MODULE_LICENSE("GPL");
......@@ -135,8 +135,7 @@ static void program_drive_counts(struct ata_device *drive, int setup_count, int
/*
* Now that everything is ready, program the new timings
*/
__save_flags (flags);
__cli();
local_irq_save(flags);
/*
* Program the address_setup clocks into ARTTIM reg,
* and then the active/recovery counts into the DRWTIM reg
......@@ -148,7 +147,7 @@ static void program_drive_counts(struct ata_device *drive, int setup_count, int
(byte) ((active_count << 4) | recovery_count));
cmdprintk ("Write %x to %x\n", ((byte) setup_count) | (temp_b & 0x3f), arttim_regs[channel][slave]);
cmdprintk ("Write %x to %x\n", (byte) ((active_count << 4) | recovery_count), drwtim_regs[channel][slave]);
__restore_flags(flags);
local_irq_restore(flags);
}
/*
......@@ -808,45 +807,45 @@ static void __init cmd64x_init_channel(struct ata_channel *hwif)
/* module data table */
static struct ata_pci_device chipsets[] __initdata = {
{
vendor: PCI_VENDOR_ID_CMD,
device: PCI_DEVICE_ID_CMD_643,
init_chipset: cmd64x_init_chipset,
init_channel: cmd64x_init_channel,
bootable: ON_BOARD,
flags: ATA_F_SIMPLEX,
.vendor = PCI_VENDOR_ID_CMD,
.device = PCI_DEVICE_ID_CMD_643,
.init_chipset = cmd64x_init_chipset,
.init_channel = cmd64x_init_channel,
.bootable = ON_BOARD,
.flags = ATA_F_SIMPLEX,
},
{
vendor: PCI_VENDOR_ID_CMD,
device: PCI_DEVICE_ID_CMD_646,
init_chipset: cmd64x_init_chipset,
init_channel: cmd64x_init_channel,
enablebits: {{0x00,0x00,0x00}, {0x51,0x80,0x80}},
bootable: ON_BOARD,
flags: ATA_F_DMA
.vendor = PCI_VENDOR_ID_CMD,
.device = PCI_DEVICE_ID_CMD_646,
.init_chipset = cmd64x_init_chipset,
.init_channel = cmd64x_init_channel,
.enablebits = {{0x00,0x00,0x00}, {0x51,0x80,0x80}},
.bootable = ON_BOARD,
.flags = ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_CMD,
device: PCI_DEVICE_ID_CMD_648,
init_chipset: cmd64x_init_chipset,
init_channel: cmd64x_init_channel,
bootable: ON_BOARD,
flags: ATA_F_DMA
.vendor = PCI_VENDOR_ID_CMD,
.device = PCI_DEVICE_ID_CMD_648,
.init_chipset = cmd64x_init_chipset,
.init_channel = cmd64x_init_channel,
.bootable = ON_BOARD,
.flags = ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_CMD,
device: PCI_DEVICE_ID_CMD_649,
init_chipset: cmd64x_init_chipset,
init_channel: cmd64x_init_channel,
bootable: ON_BOARD,
flags: ATA_F_DMA
.vendor = PCI_VENDOR_ID_CMD,
.device = PCI_DEVICE_ID_CMD_649,
.init_chipset = cmd64x_init_chipset,
.init_channel = cmd64x_init_channel,
.bootable = ON_BOARD,
.flags = ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_CMD,
device: PCI_DEVICE_ID_CMD_680,
init_chipset: cmd64x_init_chipset,
init_channel: cmd64x_init_channel,
bootable: ON_BOARD,
flags: ATA_F_DMA
.vendor = PCI_VENDOR_ID_CMD,
.device = PCI_DEVICE_ID_CMD_680,
.init_chipset = cmd64x_init_chipset,
.init_channel = cmd64x_init_channel,
.bootable = ON_BOARD,
.flags = ATA_F_DMA
},
};
......
......@@ -314,12 +314,12 @@ static void __init ide_init_cs5530(struct ata_channel *hwif)
/* module data table */
static struct ata_pci_device chipset __initdata = {
vendor: PCI_VENDOR_ID_CYRIX,
device: PCI_DEVICE_ID_CYRIX_5530_IDE,
init_chipset: pci_init_cs5530,
init_channel: ide_init_cs5530,
bootable: ON_BOARD,
flags: ATA_F_DMA
.vendor = PCI_VENDOR_ID_CYRIX,
.device = PCI_DEVICE_ID_CYRIX_5530_IDE,
.init_chipset = pci_init_cs5530,
.init_channel = ide_init_cs5530,
.bootable = ON_BOARD,
.flags = ATA_F_DMA
};
int __init init_cs5530(void)
......
......@@ -426,12 +426,12 @@ static void __init ide_init_cy82c693(struct ata_channel *hwif)
/* module data table */
static struct ata_pci_device chipset __initdata = {
vendor: PCI_VENDOR_ID_CONTAQ,
device: PCI_DEVICE_ID_CONTAQ_82C693,
init_chipset: pci_init_cy82c693,
init_channel: ide_init_cy82c693,
bootable: ON_BOARD,
flags: ATA_F_DMA
.vendor = PCI_VENDOR_ID_CONTAQ,
.device = PCI_DEVICE_ID_CONTAQ_82C693,
.init_chipset = pci_init_cy82c693,
.init_channel = ide_init_cy82c693,
.bootable = ON_BOARD,
.flags = ATA_F_DMA
};
int __init init_cy82c693(void)
......
......@@ -151,7 +151,7 @@ int ata_status_poll(struct ata_device *drive, u8 good, u8 bad,
unsigned long flags;
__save_flags(flags);
ide__sti();
local_irq_enable();
timeout += jiffies;
while (!ata_status(drive, 0, BUSY_STAT)) {
if (time_after(jiffies, timeout)) {
......
......@@ -95,8 +95,7 @@ void __init init_dtc2278 (void)
{
unsigned long flags;
__save_flags(flags); /* local CPU only */
__cli(); /* local CPU only */
local_irq_save(flags);
/*
* This enables the second interface
*/
......@@ -112,7 +111,7 @@ void __init init_dtc2278 (void)
sub22(1,0xc3);
sub22(0,0xa0);
#endif
__restore_flags(flags); /* local CPU only */
local_irq_restore(flags);
ide_hwifs[0].serialized = 1;
ide_hwifs[1].serialized = 1;
......
......@@ -693,12 +693,12 @@ static int hd_release(struct inode * inode, struct file * file)
extern struct block_device_operations hd_fops;
static struct gendisk hd_gendisk = {
major: MAJOR_NR,
major_name: "hd",
minor_shift: 6,
part: hd,
sizes: hd_sizes,
fops: &hd_fops,
.major = MAJOR_NR,
.major_name = "hd",
.minor_shift = 6,
.part = hd,
.sizes = hd_sizes,
.fops = &hd_fops,
};
static void hd_interrupt(int irq, void *dev_id, struct pt_regs *regs)
......@@ -714,9 +714,9 @@ static void hd_interrupt(int irq, void *dev_id, struct pt_regs *regs)
}
static struct block_device_operations hd_fops = {
open: hd_open,
release: hd_release,
ioctl: hd_ioctl,
.open = hd_open,
.release = hd_release,
.ioctl = hd_ioctl,
};
/*
......
......@@ -135,8 +135,7 @@ static unsigned int __init pci_init_hpt34x(struct pci_dev *dev)
unsigned short cmd;
unsigned long flags;
__save_flags(flags); /* local CPU only */
__cli(); /* local CPU only */
local_irq_save(flags);
pci_write_config_byte(dev, HPT34X_PCI_INIT_REG, 0x00);
pci_read_config_word(dev, PCI_COMMAND, &cmd);
......@@ -167,7 +166,7 @@ static unsigned int __init pci_init_hpt34x(struct pci_dev *dev)
pci_write_config_dword(dev, PCI_BASE_ADDRESS_3, dev->resource[3].start);
pci_write_config_word(dev, PCI_COMMAND, cmd);
__restore_flags(flags); /* local CPU only */
local_irq_restore(flags);
return dev->irq;
}
......@@ -202,13 +201,13 @@ static void __init ide_init_hpt34x(struct ata_channel *hwif)
/* module data table */
static struct ata_pci_device chipset __initdata = {
vendor: PCI_VENDOR_ID_TTI,
device: PCI_DEVICE_ID_TTI_HPT343,
init_chipset: pci_init_hpt34x,
init_channel: ide_init_hpt34x,
bootable: NEVER_BOARD,
extra: 16,
flags: ATA_F_DMA
.vendor = PCI_VENDOR_ID_TTI,
.device = PCI_DEVICE_ID_TTI_HPT343,
.init_chipset = pci_init_hpt34x,
.init_channel = ide_init_hpt34x,
.bootable = NEVER_BOARD,
.extra = 16,
.flags = ATA_F_DMA
};
int __init init_hpt34x(void)
......
......@@ -1222,34 +1222,34 @@ static void __init hpt366_init_dma(struct ata_channel *ch, unsigned long dmabase
/* module data table */
static struct ata_pci_device chipsets[] __initdata = {
{
vendor: PCI_VENDOR_ID_TTI,
device: PCI_DEVICE_ID_TTI_HPT366,
init_chipset: hpt366_init_chipset,
init_channel: hpt366_init_channel,
init_dma: hpt366_init_dma,
bootable: OFF_BOARD,
extra: 240,
flags: ATA_F_IRQ | ATA_F_HPTHACK | ATA_F_DMA
.vendor = PCI_VENDOR_ID_TTI,
.device = PCI_DEVICE_ID_TTI_HPT366,
.init_chipset = hpt366_init_chipset,
.init_channel = hpt366_init_channel,
.init_dma = hpt366_init_dma,
.bootable = OFF_BOARD,
.extra = 240,
.flags = ATA_F_IRQ | ATA_F_HPTHACK | ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_TTI,
device: PCI_DEVICE_ID_TTI_HPT372,
init_chipset: hpt366_init_chipset,
init_channel: hpt366_init_channel,
init_dma: hpt366_init_dma,
bootable: OFF_BOARD,
extra: 0,
flags: ATA_F_IRQ | ATA_F_HPTHACK | ATA_F_DMA
.vendor = PCI_VENDOR_ID_TTI,
.device = PCI_DEVICE_ID_TTI_HPT372,
.init_chipset = hpt366_init_chipset,
.init_channel = hpt366_init_channel,
.init_dma = hpt366_init_dma,
.bootable = OFF_BOARD,
.extra = 0,
.flags = ATA_F_IRQ | ATA_F_HPTHACK | ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_TTI,
device: PCI_DEVICE_ID_TTI_HPT374,
init_chipset: hpt366_init_chipset,
init_channel: hpt366_init_channel,
init_dma: hpt366_init_dma,
bootable: OFF_BOARD,
extra: 0,
flags: ATA_F_IRQ | ATA_F_HPTHACK | ATA_F_DMA
.vendor = PCI_VENDOR_ID_TTI,
.device = PCI_DEVICE_ID_TTI_HPT374,
.init_chipset = hpt366_init_chipset,
.init_channel = hpt366_init_channel,
.init_dma = hpt366_init_dma,
.bootable = OFF_BOARD,
.extra = 0,
.flags = ATA_F_IRQ | ATA_F_HPTHACK | ATA_F_DMA
},
};
......
......@@ -35,10 +35,12 @@
#include "ataraid.h"
static int hptraid_open(struct inode * inode, struct file * filp);
static int hptraid_release(struct inode * inode, struct file * filp);
static int hptraid_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
static int hptraid_make_request (request_queue_t *q, int rw, struct buffer_head * bh);
static int hptraid_open(struct inode *inode, struct file *filp);
static int hptraid_release(struct inode *inode, struct file *filp);
static int hptraid_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg);
static int hptraid_make_request(request_queue_t * q, int rw,
struct buffer_head *bh);
......@@ -61,15 +63,16 @@ struct hptraid {
};
static struct raid_device_operations hptraid_ops = {
open: hptraid_open,
release: hptraid_release,
ioctl: hptraid_ioctl,
make_request: hptraid_make_request
.open = hptraid_open,
.release = hptraid_release,
.ioctl = hptraid_ioctl,
.make_request = hptraid_make_request
};
static struct hptraid raid[16];
static int hptraid_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
static int hptraid_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
unsigned int minor;
unsigned char val;
......@@ -78,32 +81,44 @@ static int hptraid_ioctl(struct inode *inode, struct file *file, unsigned int cm
if (!inode || kdev_none(inode->i_rdev))
return -EINVAL;
minor = minor(inode->i_rdev)>>SHIFT;
minor = minor(inode->i_rdev) >> SHIFT;
switch (cmd) {
case BLKGETSIZE: /* Return device size */
if (!arg) return -EINVAL;
sectors = ataraid_gendisk.part[minor(inode->i_rdev)].nr_sects;
if (minor(inode->i_rdev)&15)
if (!arg)
return -EINVAL;
sectors =
ataraid_gendisk.part[minor(inode->i_rdev)].nr_sects;
if (minor(inode->i_rdev) & 15)
return put_user(sectors, (unsigned long *) arg);
return put_user(raid[minor].sectors , (unsigned long *) arg);
return put_user(raid[minor].sectors,
(unsigned long *) arg);
break;
case HDIO_GETGEO:
{
struct hd_geometry *loc = (struct hd_geometry *) arg;
struct hd_geometry *loc =
(struct hd_geometry *) arg;
unsigned short bios_cyl;
if (!loc) return -EINVAL;
if (!loc)
return -EINVAL;
val = 255;
if (put_user(val, (byte *) &loc->heads)) return -EFAULT;
val=63;
if (put_user(val, (byte *) &loc->sectors)) return -EFAULT;
bios_cyl = raid[minor].sectors/63/255;
if (put_user(bios_cyl, (unsigned short *) &loc->cylinders)) return -EFAULT;
if (put_user((unsigned)ataraid_gendisk.part[minor(inode->i_rdev)].start_sect,
(unsigned long *) &loc->start)) return -EFAULT;
if (put_user(val, (byte *) & loc->heads))
return -EFAULT;
val = 63;
if (put_user(val, (byte *) & loc->sectors))
return -EFAULT;
bios_cyl = raid[minor].sectors / 63 / 255;
if (put_user
(bios_cyl, (unsigned short *) &loc->cylinders))
return -EFAULT;
if (put_user
((unsigned) ataraid_gendisk.
part[minor(inode->i_rdev)].start_sect,
(unsigned long *) &loc->start))
return -EFAULT;
return 0;
}
......@@ -120,12 +135,13 @@ static int hptraid_ioctl(struct inode *inode, struct file *file, unsigned int cm
}
static int hptraid_make_request (request_queue_t *q, int rw, struct buffer_head * bh)
static int hptraid_make_request(request_queue_t * q, int rw,
struct buffer_head *bh)
{
unsigned long rsect;
unsigned long rsect_left,rsect_accum = 0;
unsigned long rsect_left, rsect_accum = 0;
unsigned long block;
unsigned int disk=0,real_disk=0;
unsigned int disk = 0, real_disk = 0;
int i;
int device;
struct hptraid *thisraid;
......@@ -144,44 +160,53 @@ static int hptraid_make_request (request_queue_t *q, int rw, struct buffer_head
* point, we have to divide by one less.
*/
device = (bh->b_rdev >> SHIFT)&MAJOR_MASK;
device = (bh->b_rdev >> SHIFT) & MAJOR_MASK;
thisraid = &raid[device];
if (thisraid->stride==0)
thisraid->stride=1;
if (thisraid->stride == 0)
thisraid->stride = 1;
/* Partitions need adding of the start sector of the partition to the requested sector */
rsect += ataraid_gendisk.part[minor(bh->b_rdev)].start_sect;
/* Woops we need to split the request to avoid crossing a stride barrier */
if ((rsect/thisraid->stride) != ((rsect+(bh->b_size/512)-1)/thisraid->stride)) {
if ((rsect / thisraid->stride) !=
((rsect + (bh->b_size / 512) - 1) / thisraid->stride)) {
return -1;
}
rsect_left = rsect;
for (i=0;i<8;i++) {
if (thisraid->cutoff_disks[i]==0)
for (i = 0; i < 8; i++) {
if (thisraid->cutoff_disks[i] == 0)
break;
if (rsect > thisraid->cutoff[i]) {
/* we're in the wrong area so far */
rsect_left -= thisraid->cutoff[i];
rsect_accum += thisraid->cutoff[i]/thisraid->cutoff_disks[i];
rsect_accum +=
thisraid->cutoff[i] /
thisraid->cutoff_disks[i];
} else {
block = rsect_left / thisraid->stride;
disk = block % thisraid->cutoff_disks[i];
block = (block / thisraid->cutoff_disks[i]) * thisraid->stride;
rsect = rsect_accum + (rsect_left % thisraid->stride) + block;
block =
(block / thisraid->cutoff_disks[i]) *
thisraid->stride;
rsect =
rsect_accum + (rsect_left % thisraid->stride) +
block;
break;
}
}
for (i=0;i<8;i++) {
if ((disk==0) && (thisraid->disk[i].sectors > rsect_accum)) {
for (i = 0; i < 8; i++) {
if ((disk == 0)
&& (thisraid->disk[i].sectors > rsect_accum)) {
real_disk = i;
break;
}
if ((disk>0) && (thisraid->disk[i].sectors >= rsect_accum)) {
if ((disk > 0)
&& (thisraid->disk[i].sectors >= rsect_accum)) {
disk--;
}
......@@ -189,8 +214,8 @@ static int hptraid_make_request (request_queue_t *q, int rw, struct buffer_head
disk = real_disk;
/* All but the first disk have a 10 sector offset */
if (i>0)
rsect+=10;
if (i > 0)
rsect += 10;
/*
......@@ -226,22 +251,22 @@ static int __init read_disk_sb(struct block_device *bdev,
return -1;
}
static unsigned long maxsectors (int major,int minor)
static unsigned long maxsectors(int major, int minor)
{
unsigned long lba = 0;
kdev_t dev;
struct ata_device *ideinfo;
dev = mk_kdev(major,minor);
ideinfo = get_info_ptr (dev);
if (ideinfo==NULL)
dev = mk_kdev(major, minor);
ideinfo = get_info_ptr(dev);
if (ideinfo == NULL)
return 0;
/* first sector of the last cluster */
if (ideinfo->head==0)
if (ideinfo->head == 0)
return 0;
if (ideinfo->sect==0)
if (ideinfo->sect == 0)
return 0;
lba = (ideinfo->capacity);
......@@ -249,35 +274,36 @@ static unsigned long maxsectors (int major,int minor)
}
static struct highpoint_raid_conf __initdata prom;
static void __init probedisk(int major, int minor,int device)
static void __init probedisk(int major, int minor, int device)
{
int i;
struct block_device *bdev = bdget(mk_kdev(major,minor));
struct block_device *bdev = bdget(mk_kdev(major, minor));
struct gendisk *gd;
if (!bdev)
return;
if (blkdev_get(bdev,FMODE_READ|FMODE_WRITE,0,BDEV_RAW) < 0)
if (blkdev_get(bdev, FMODE_READ | FMODE_WRITE, 0, BDEV_RAW) < 0)
return;
if (maxsectors(major,minor)==0)
if (maxsectors(major, minor) == 0)
goto out;
if (read_disk_sb(bdev, &prom))
goto out;
if (prom.magic!= 0x5a7816f0)
if (prom.magic != 0x5a7816f0)
goto out;
if (prom.type) {
printk(KERN_INFO "hptraid: only RAID0 is supported currently\n");
printk(KERN_INFO
"hptraid: only RAID0 is supported currently\n");
goto out;
}
i = prom.disk_number;
if (i<0)
if (i < 0)
goto out;
if (i>8)
if (i > 8)
goto out;
raid[device].disk[i].bdev = bdev;
......@@ -285,38 +311,40 @@ static void __init probedisk(int major, int minor,int device)
/* now blank the /proc/partitions table for the wrong partition table,
so that scripts don't accidentally mount it and crash the kernel */
/* XXX: the 0 is an utter hack --hch */
gd=get_gendisk(mk_kdev(major, 0));
if (gd!=NULL) {
gd = get_gendisk(mk_kdev(major, 0));
if (gd != NULL) {
int j;
for (j=1+(minor<<gd->minor_shift);j<((minor+1)<<gd->minor_shift);j++)
gd->part[j].nr_sects=0;
for (j = 1 + (minor << gd->minor_shift);
j < ((minor + 1) << gd->minor_shift); j++)
gd->part[j].nr_sects = 0;
}
raid[device].disk[i].device = mk_kdev(major,minor);
raid[device].disk[i].sectors = maxsectors(major,minor);
raid[device].stride = (1<<prom.raid0_shift);
raid[device].disk[i].device = mk_kdev(major, minor);
raid[device].disk[i].sectors = maxsectors(major, minor);
raid[device].stride = (1 << prom.raid0_shift);
raid[device].disks = prom.raid_disks;
raid[device].sectors = prom.total_secs;
return;
out:
out:
blkdev_put(bdev);
}
static void __init fill_cutoff(int device)
{
int i,j;
int i, j;
unsigned long smallest;
unsigned long bar;
int count;
bar = 0;
for (i=0;i<8;i++) {
for (i = 0; i < 8; i++) {
smallest = ~0;
for (j=0;j<8;j++)
if ((raid[device].disk[j].sectors < smallest) && (raid[device].disk[j].sectors>bar))
for (j = 0; j < 8; j++)
if ((raid[device].disk[j].sectors < smallest)
&& (raid[device].disk[j].sectors > bar))
smallest = raid[device].disk[j].sectors;
count = 0;
for (j=0;j<8;j++)
for (j = 0; j < 8; j++)
if (raid[device].disk[j].sectors >= smallest)
count++;
......@@ -331,7 +359,7 @@ static void __init fill_cutoff(int device)
static __init int hptraid_init_one(int device)
{
int i,count;
int i, count;
probedisk(IDE0_MAJOR, 0, device);
probedisk(IDE0_MAJOR, 64, device);
......@@ -346,20 +374,22 @@ static __init int hptraid_init_one(int device)
/* Initialize the gendisk structure */
ataraid_register_disk(device,raid[device].sectors);
ataraid_register_disk(device, raid[device].sectors);
count=0;
printk(KERN_INFO "Highpoint HPT370 Softwareraid driver for linux version 0.01\n");
count = 0;
printk(KERN_INFO
"Highpoint HPT370 Softwareraid driver for linux version 0.01\n");
for (i=0;i<8;i++) {
if (raid[device].disk[i].device!=0) {
for (i = 0; i < 8; i++) {
if (raid[device].disk[i].device != 0) {
printk(KERN_INFO "Drive %i is %li Mb \n",
i,raid[device].disk[i].sectors/2048);
i, raid[device].disk[i].sectors / 2048);
count++;
}
}
if (count) {
printk(KERN_INFO "Raid array consists of %i drives. \n",count);
printk(KERN_INFO "Raid array consists of %i drives. \n",
count);
return 0;
} else {
printk(KERN_INFO "No raid array found\n");
......@@ -370,10 +400,10 @@ static __init int hptraid_init_one(int device)
static __init int hptraid_init(void)
{
int retval,device;
int retval, device;
device=ataraid_get_device(&hptraid_ops);
if (device<0)
device = ataraid_get_device(&hptraid_ops);
if (device < 0)
return -ENODEV;
retval = hptraid_init_one(device);
if (retval)
......@@ -381,12 +411,13 @@ static __init int hptraid_init(void)
return retval;
}
static void __exit hptraid_exit (void)
static void __exit hptraid_exit(void)
{
int i,device;
for (device = 0; device<16; device++) {
for (i=0;i<8;i++) {
struct block_device *bdev = raid[device].disk[i].bdev;
int i, device;
for (device = 0; device < 16; device++) {
for (i = 0; i < 8; i++) {
struct block_device *bdev =
raid[device].disk[i].bdev;
raid[device].disk[i].bdev = NULL;
if (bdev)
blkdev_put(bdev, BDEV_RAW);
......@@ -396,12 +427,12 @@ static void __exit hptraid_exit (void)
}
}
static int hptraid_open(struct inode * inode, struct file * filp)
static int hptraid_open(struct inode *inode, struct file *filp)
{
MOD_INC_USE_COUNT;
return 0;
}
static int hptraid_release(struct inode * inode, struct file * filp)
static int hptraid_release(struct inode *inode, struct file *filp)
{
MOD_DEC_USE_COUNT;
return 0;
......
......@@ -127,8 +127,7 @@ static void ht6560b_selectproc(struct ata_device *drive)
static u8 current_timing = 0;
u8 select, timing;
__save_flags (flags); /* local CPU only */
__cli(); /* local CPU only */
local_irq_save(flags);
select = HT_CONFIG(drive);
timing = HT_TIMING(drive);
......@@ -152,7 +151,7 @@ static void ht6560b_selectproc(struct ata_device *drive)
printk("ht6560b: %s: select=%#x timing=%#x\n", drive->name, select, timing);
#endif
}
__restore_flags (flags); /* local CPU only */
local_irq_restore(flags);
}
/*
......
......@@ -2453,26 +2453,26 @@ void ide_cdrom_release_real (struct cdrom_device_info *cdi)
* Device initialization.
*/
static struct cdrom_device_ops ide_cdrom_dops = {
open: ide_cdrom_open_real,
release: ide_cdrom_release_real,
drive_status: ide_cdrom_drive_status,
media_changed: ide_cdrom_check_media_change_real,
tray_move: ide_cdrom_tray_move,
lock_door: ide_cdrom_lock_door,
select_speed: ide_cdrom_select_speed,
get_last_session: ide_cdrom_get_last_session,
get_mcn: ide_cdrom_get_mcn,
reset: ide_cdrom_reset,
audio_ioctl: ide_cdrom_audio_ioctl,
dev_ioctl: ide_cdrom_dev_ioctl,
capability: CDC_CLOSE_TRAY | CDC_OPEN_TRAY | CDC_LOCK |
.open = ide_cdrom_open_real,
.release = ide_cdrom_release_real,
.drive_status = ide_cdrom_drive_status,
.media_changed = ide_cdrom_check_media_change_real,
.tray_move = ide_cdrom_tray_move,
.lock_door = ide_cdrom_lock_door,
.select_speed = ide_cdrom_select_speed,
.get_last_session = ide_cdrom_get_last_session,
.get_mcn = ide_cdrom_get_mcn,
.reset = ide_cdrom_reset,
.audio_ioctl = ide_cdrom_audio_ioctl,
.dev_ioctl = ide_cdrom_dev_ioctl,
.capability = CDC_CLOSE_TRAY | CDC_OPEN_TRAY | CDC_LOCK |
CDC_SELECT_SPEED | CDC_SELECT_DISC |
CDC_MULTI_SESSION | CDC_MCN |
CDC_MEDIA_CHANGED | CDC_PLAY_AUDIO | CDC_RESET |
CDC_IOCTLS | CDC_DRIVE_STATUS | CDC_CD_R |
CDC_CD_RW | CDC_DVD | CDC_DVD_R| CDC_DVD_RAM |
CDC_GENERIC_PACKET,
generic_packet: ide_cdrom_packet,
.generic_packet = ide_cdrom_packet,
};
static int ide_cdrom_register(struct ata_device *drive, int nslots)
......@@ -2932,18 +2932,18 @@ int ide_cdrom_cleanup(struct ata_device *drive)
static void ide_cdrom_attach(struct ata_device *drive);
static struct ata_operations ide_cdrom_driver = {
owner: THIS_MODULE,
attach: ide_cdrom_attach,
cleanup: ide_cdrom_cleanup,
standby: NULL,
do_request: ide_cdrom_do_request,
end_request: NULL,
ioctl: ide_cdrom_ioctl,
open: ide_cdrom_open,
release: ide_cdrom_release,
check_media_change: ide_cdrom_check_media_change,
revalidate: ide_cdrom_revalidate,
capacity: ide_cdrom_capacity,
.owner = THIS_MODULE,
.attach = ide_cdrom_attach,
.cleanup = ide_cdrom_cleanup,
.standby = NULL,
.do_request = ide_cdrom_do_request,
.end_request = NULL,
.ioctl = ide_cdrom_ioctl,
.open = ide_cdrom_open,
.release = ide_cdrom_release,
.check_media_change = ide_cdrom_check_media_change,
.revalidate = ide_cdrom_revalidate,
.capacity = ide_cdrom_capacity,
};
/* options */
......
......@@ -1443,18 +1443,18 @@ static void idedisk_attach(struct ata_device *drive);
* Subdriver functions.
*/
static struct ata_operations idedisk_driver = {
owner: THIS_MODULE,
attach: idedisk_attach,
cleanup: idedisk_cleanup,
standby: idedisk_standby,
do_request: idedisk_do_request,
end_request: NULL,
ioctl: idedisk_ioctl,
open: idedisk_open,
release: idedisk_release,
check_media_change: idedisk_check_media_change,
revalidate: NULL, /* use default method */
capacity: idedisk_capacity,
.owner = THIS_MODULE,
.attach = idedisk_attach,
.cleanup = idedisk_cleanup,
.standby = idedisk_standby,
.do_request = idedisk_do_request,
.end_request = NULL,
.ioctl = idedisk_ioctl,
.open = idedisk_open,
.release = idedisk_release,
.check_media_change = idedisk_check_media_change,
.revalidate = NULL, /* use default method */
.capacity = idedisk_capacity,
};
static void idedisk_attach(struct ata_device *drive)
......
......@@ -593,9 +593,9 @@ static ide_startstop_t idefloppy_pc_intr(struct ata_device *drive, struct reques
#if IDEFLOPPY_DEBUG_LOG
printk (KERN_INFO "Packet command completed, %d bytes transferred\n", pc->actually_transferred);
#endif /* IDEFLOPPY_DEBUG_LOG */
clear_bit (PC_DMA_IN_PROGRESS, &pc->flags);
clear_bit(PC_DMA_IN_PROGRESS, &pc->flags);
ide__sti(); /* local CPU only */
local_irq_enable();
if (status.b.check || test_bit(PC_DMA_ERROR, &pc->flags)) { /* Error detected */
#if IDEFLOPPY_DEBUG_LOG
......@@ -1345,18 +1345,18 @@ static int idefloppy_get_format_progress(struct ata_device *drive,
progress_indication=floppy->progress_indication;
}
/* Else assume format_unit has finished, and we're
** at 0x10000 */
* at 0x10000
*/
}
else
{
atapi_status_reg_t status;
unsigned long flags;
__save_flags(flags);
__cli();
local_irq_save(flags);
ata_status(drive, 0, 0);
status.all = drive->status;
__restore_flags(flags);
local_irq_restore(flags);
progress_indication= !status.b.dsc ? 0:0x10000;
}
......@@ -1735,18 +1735,18 @@ static void idefloppy_attach(struct ata_device *drive);
* IDE subdriver functions, registered with ide.c
*/
static struct ata_operations idefloppy_driver = {
owner: THIS_MODULE,
attach: idefloppy_attach,
cleanup: idefloppy_cleanup,
standby: NULL,
do_request: idefloppy_do_request,
end_request: idefloppy_end_request,
ioctl: idefloppy_ioctl,
open: idefloppy_open,
release: idefloppy_release,
check_media_change: idefloppy_check_media_change,
revalidate: NULL, /* use default method */
capacity: idefloppy_capacity,
.owner = THIS_MODULE,
.attach = idefloppy_attach,
.cleanup = idefloppy_cleanup,
.standby = NULL,
.do_request = idefloppy_do_request,
.end_request = idefloppy_end_request,
.ioctl = idefloppy_ioctl,
.open = idefloppy_open,
.release = idefloppy_release,
.check_media_change = idefloppy_check_media_change,
.revalidate = NULL, /* use default method */
.capacity = idefloppy_capacity,
};
static void idefloppy_attach(struct ata_device *drive)
......
......@@ -697,75 +697,75 @@ void __init ide_scan_pcibus(int scan_direction)
*/
static struct ata_pci_device chipsets[] __initdata = {
{
vendor: PCI_VENDOR_ID_PCTECH,
device: PCI_DEVICE_ID_PCTECH_SAMURAI_IDE,
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_PCTECH,
.device = PCI_DEVICE_ID_PCTECH_SAMURAI_IDE,
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_CMD,
device: PCI_DEVICE_ID_CMD_640,
init_channel: ATA_PCI_IGNORE,
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_CMD,
.device = PCI_DEVICE_ID_CMD_640,
.init_channel = ATA_PCI_IGNORE,
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_NS,
device: PCI_DEVICE_ID_NS_87410,
enablebits: {{0x43,0x08,0x08}, {0x47,0x08,0x08}},
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_NS,
.device = PCI_DEVICE_ID_NS_87410,
.enablebits = {{0x43,0x08,0x08}, {0x47,0x08,0x08}},
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_HINT,
device: PCI_DEVICE_ID_HINT_VXPROII_IDE,
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_HINT,
.device = PCI_DEVICE_ID_HINT_VXPROII_IDE,
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_HOLTEK,
device: PCI_DEVICE_ID_HOLTEK_6565,
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_HOLTEK,
.device = PCI_DEVICE_ID_HOLTEK_6565,
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82371MX,
enablebits: {{0x6D,0x80,0x80}, {0x00,0x00,0x00}},
bootable: ON_BOARD,
flags: ATA_F_NODMA
.vendor = PCI_VENDOR_ID_INTEL,
.device = PCI_DEVICE_ID_INTEL_82371MX,
.enablebits = {{0x6D,0x80,0x80}, {0x00,0x00,0x00}},
.bootable = ON_BOARD,
.flags = ATA_F_NODMA
},
{
vendor: PCI_VENDOR_ID_UMC,
device: PCI_DEVICE_ID_UMC_UM8673F,
bootable: ON_BOARD,
flags: ATA_F_FIXIRQ
.vendor = PCI_VENDOR_ID_UMC,
.device = PCI_DEVICE_ID_UMC_UM8673F,
.bootable = ON_BOARD,
.flags = ATA_F_FIXIRQ
},
{
vendor: PCI_VENDOR_ID_UMC,
device: PCI_DEVICE_ID_UMC_UM8886A,
bootable: ON_BOARD,
flags: ATA_F_FIXIRQ
.vendor = PCI_VENDOR_ID_UMC,
.device = PCI_DEVICE_ID_UMC_UM8886A,
.bootable = ON_BOARD,
.flags = ATA_F_FIXIRQ
},
{
vendor: PCI_VENDOR_ID_UMC,
device: PCI_DEVICE_ID_UMC_UM8886BF,
bootable: ON_BOARD,
flags: ATA_F_FIXIRQ
.vendor = PCI_VENDOR_ID_UMC,
.device = PCI_DEVICE_ID_UMC_UM8886BF,
.bootable = ON_BOARD,
.flags = ATA_F_FIXIRQ
},
{
vendor: PCI_VENDOR_ID_VIA,
device: PCI_DEVICE_ID_VIA_82C561,
bootable: ON_BOARD,
flags: ATA_F_NOADMA
.vendor = PCI_VENDOR_ID_VIA,
.device = PCI_DEVICE_ID_VIA_82C561,
.bootable = ON_BOARD,
.flags = ATA_F_NOADMA
},
{
vendor: PCI_VENDOR_ID_VIA,
device: PCI_DEVICE_ID_VIA_82C586_1,
bootable: ON_BOARD,
flags: ATA_F_NOADMA
.vendor = PCI_VENDOR_ID_VIA,
.device = PCI_DEVICE_ID_VIA_82C586_1,
.bootable = ON_BOARD,
.flags = ATA_F_NOADMA
},
{
vendor: PCI_VENDOR_ID_TTI,
device: PCI_DEVICE_ID_TTI_HPT366,
bootable: OFF_BOARD,
extra: 240,
flags: ATA_F_IRQ | ATA_F_HPTHACK
.vendor = PCI_VENDOR_ID_TTI,
.device = PCI_DEVICE_ID_TTI_HPT366,
.bootable = OFF_BOARD,
.extra = 240,
.flags = ATA_F_IRQ | ATA_F_HPTHACK
}
};
......
......@@ -419,10 +419,10 @@ pmac_ide_do_setfeature(struct ata_device *drive, u8 command)
OUT_BYTE(SETFEATURES_XFER, IDE_FEATURE_REG);
OUT_BYTE(WIN_SETFEATURES, IDE_COMMAND_REG);
udelay(1);
__save_flags(flags); /* local CPU only */
ide__sti(); /* local CPU only -- for jiffies */
__save_flags(flags);
local_irq_enable();
result = wait_for_ready(drive);
__restore_flags(flags); /* local CPU only */
__restore_flags(flags);
ata_irq_enable(drive, 1);
if (result)
printk(KERN_ERR "pmac_ide_do_setfeature disk not ready after SET_FEATURE !\n");
......
......@@ -1881,9 +1881,9 @@ static ide_startstop_t idetape_pc_intr(struct ata_device *drive, struct request
if (tape->debug_level >= 2)
printk (KERN_INFO "ide-tape: Packet command completed, %d bytes transferred\n", pc->actually_transferred);
#endif
clear_bit (PC_DMA_IN_PROGRESS, &pc->flags);
clear_bit(PC_DMA_IN_PROGRESS, &pc->flags);
ide__sti(); /* local CPU only */
local_irq_enable();
#if SIMULATE_ERRORS
if ((pc->c[0] == IDETAPE_WRITE_CMD || pc->c[0] == IDETAPE_READ_CMD) && (++error_sim_count % 100) == 0) {
......@@ -5926,17 +5926,17 @@ static void idetape_revalidate(struct ata_device *_dummy)
static void idetape_attach(struct ata_device *);
static struct ata_operations idetape_driver = {
owner: THIS_MODULE,
attach: idetape_attach,
cleanup: idetape_cleanup,
standby: NULL,
do_request: idetape_do_request,
end_request: idetape_end_request,
ioctl: idetape_blkdev_ioctl,
open: idetape_blkdev_open,
release: idetape_blkdev_release,
check_media_change: NULL,
revalidate: idetape_revalidate,
.owner = THIS_MODULE,
.attach = idetape_attach,
.cleanup = idetape_cleanup,
.standby = NULL,
.do_request = idetape_do_request,
.end_request = idetape_end_request,
.ioctl = idetape_blkdev_ioctl,
.open = idetape_blkdev_open,
.release = idetape_blkdev_release,
.check_media_change = NULL,
.revalidate = idetape_revalidate,
};
......@@ -5945,12 +5945,12 @@ static struct ata_operations idetape_driver = {
* Our character device supporting functions, passed to register_chrdev.
*/
static struct file_operations idetape_fops = {
owner: THIS_MODULE,
read: idetape_chrdev_read,
write: idetape_chrdev_write,
ioctl: idetape_chrdev_ioctl,
open: idetape_chrdev_open,
release: idetape_chrdev_release,
.owner = THIS_MODULE,
.read = idetape_chrdev_read,
.write = idetape_chrdev_write,
.ioctl = idetape_chrdev_ioctl,
.open = idetape_chrdev_open,
.release = idetape_chrdev_release,
};
static void idetape_attach(struct ata_device *drive)
......
......@@ -143,7 +143,7 @@ static ide_startstop_t special_intr(struct ata_device *drive, struct request *rq
struct ata_taskfile *ar = rq->special;
ide_startstop_t ret = ATA_OP_FINISHED;
ide__sti();
local_irq_enable();
if (rq->buffer && ar->taskfile.sector_number) {
if (!ata_status(drive, 0, DRQ_STAT) && ar->taskfile.sector_number) {
......
......@@ -288,8 +288,8 @@ u8 ata_dump(struct ata_device *drive, struct request * rq, const char *msg)
u8 err = 0;
/* FIXME: --bzolnier */
__save_flags (flags); /* local CPU only */
ide__sti(); /* local CPU only */
__save_flags(flags);
local_irq_enable();
printk("%s: %s: status=0x%02x", drive->name, msg, drive->status);
dump_bits(ata_status_msgs, ARRAY_SIZE(ata_status_msgs), drive->status);
......@@ -337,7 +337,8 @@ u8 ata_dump(struct ata_device *drive, struct request * rq, const char *msg)
#endif
printk("\n");
}
__restore_flags (flags); /* local CPU only */
__restore_flags (flags);
return err;
}
......@@ -522,7 +523,7 @@ static void do_request(struct ata_channel *channel)
unsigned int unit;
ide_startstop_t ret;
__cli(); /* necessary paranoia: ensure IRQs are masked on local CPU */
local_irq_disable(); /* necessary paranoia */
/*
* Select the next device which will be serviced. This selects
......@@ -683,7 +684,8 @@ static void do_request(struct ata_channel *channel)
drive->rq = rq;
spin_unlock(ch->lock);
ide__sti(); /* allow other IRQs while we start this request */
/* allow other IRQs while we start this request */
local_irq_enable();
/*
* This initiates handling of a new I/O request.
......@@ -837,8 +839,8 @@ void ide_timer_expiry(unsigned long data)
#else
disable_irq(ch->irq); /* disable_irq_nosync ?? */
#endif
/* FIXME: IRQs are already disabled by spin_lock_irqsave() --bzolnier */
__cli(); /* local CPU only, as if we were handling an interrupt */
local_irq_disable();
if (ch->poll_timeout) {
ret = handler(drive, drive->rq);
} else if (ata_status_irq(drive)) {
......@@ -906,7 +908,7 @@ void ide_timer_expiry(unsigned long data)
* drive enters "idle", "standby", or "sleep" mode, so if the status looks
* "good", we just ignore the interrupt completely.
*
* This routine assumes __cli() is in effect when called.
* This routine assumes IRQ are disabled on entry.
*
* If an unexpected interrupt happens on irq15 while we are handling irq14
* and if the two interfaces are "serialized" (CMD640), then it looks like
......@@ -955,7 +957,7 @@ static void unexpected_irq(int irq)
}
/*
* Entry point for all interrupts, caller does __cli() for us.
* Entry point for all interrupts. Aussumes disabled IRQs.
*/
void ata_irq_request(int irq, void *data, struct pt_regs *regs)
{
......@@ -1024,7 +1026,7 @@ void ata_irq_request(int irq, void *data, struct pt_regs *regs)
spin_unlock(ch->lock);
if (ch->unmask)
ide__sti();
local_irq_enable();
/*
* Service this interrupt, this may setup handler for next interrupt.
......@@ -1185,12 +1187,12 @@ static int ide_check_media_change(kdev_t i_rdev)
}
struct block_device_operations ide_fops[] = {{
owner: THIS_MODULE,
open: ide_open,
release: ide_release,
ioctl: ata_ioctl,
check_media_change: ide_check_media_change,
revalidate: ata_revalidate
.owner = THIS_MODULE,
.open = ide_open,
.release = ide_release,
.ioctl = ata_ioctl,
.check_media_change = ide_check_media_change,
.revalidate = ata_revalidate
}};
EXPORT_SYMBOL(ide_fops);
......
......@@ -225,12 +225,12 @@ static void __init ide_init_it8172(struct ata_channel *hwif)
/* module data table */
static struct ata_pci_device chipset __initdata = {
vendor: PCI_VENDOR_ID_ITE,
device: PCI_DEVICE_ID_ITE_IT8172G,
init_chipset: pci_init_it8172,
init_channel: ide_init_it8172,
exnablebits: {{0x00,0x00,0x00}, {0x40,0x00,0x01} },
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_ITE,
.device = PCI_DEVICE_ID_ITE_IT8172G,
.init_chipset = pci_init_it8172,
.init_channel = ide_init_it8172,
.exnablebits = {{0x00,0x00,0x00}, {0x40,0x00,0x01} },
.bootable = ON_BOARD
};
int __init init_it8172(void)
......
......@@ -40,8 +40,7 @@ static void ns87415_prepare_drive(struct ata_device *drive, unsigned int use_dma
struct pci_dev *dev = hwif->pci_dev;
unsigned long flags;
__save_flags(flags); /* local CPU only */
__cli(); /* local CPU only */
local_irq_save(flags);
new = *old;
/* Adjust IRQ enable bit */
......@@ -75,7 +74,7 @@ static void ns87415_prepare_drive(struct ata_device *drive, unsigned int use_dma
udelay(10);
}
__restore_flags(flags); /* local CPU only */
local_irq_restore(flags);
}
static void ns87415_selectproc(struct ata_device *drive)
......@@ -215,10 +214,10 @@ static void __init ide_init_ns87415(struct ata_channel *hwif)
/* module data table */
static struct ata_pci_device chipset __initdata = {
vendor: PCI_VENDOR_ID_NS,
device: PCI_DEVICE_ID_NS_87415,
init_channel: ide_init_ns87415,
bootable: ON_BOARD,
.vendor = PCI_VENDOR_ID_NS,
.device = PCI_DEVICE_ID_NS_87415,
.init_channel = ide_init_ns87415,
.bootable = ON_BOARD,
};
int __init init_ns87415(void)
......
......@@ -323,18 +323,18 @@ static void __init ide_init_opti621(struct ata_channel *hwif)
/* module data table */
static struct ata_pci_device chipsets[] __initdata = {
{
vendor: PCI_VENDOR_ID_OPTI,
device: PCI_DEVICE_ID_OPTI_82C621,
init_channel: ide_init_opti621,
enablebits: {{0x45,0x80,0x00}, {0x40,0x08,0x00}},
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_OPTI,
.device = PCI_DEVICE_ID_OPTI_82C621,
.init_channel = ide_init_opti621,
.enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}},
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_OPTI,
device: PCI_DEVICE_ID_OPTI_82C825,
init_channel: ide_init_opti621,
enablebits: {{0x45,0x80,0x00}, {0x40,0x08,0x00}},
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_OPTI,
.device = PCI_DEVICE_ID_OPTI_82C825,
.init_channel = ide_init_opti621,
.enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}},
.bootable = ON_BOARD
},
};
......
......@@ -84,24 +84,24 @@ struct pdc_bit_messages {
};
static struct pdc_bit_messages pdc_reg_A[] = {
{ 0x80, "SYNC_IN" },
{ 0x40, "ERRDY_EN" },
{ 0x20, "IORDY_EN" },
{ 0x10, "PREFETCH_EN" },
{0x80, "SYNC_IN"},
{0x40, "ERRDY_EN"},
{0x20, "IORDY_EN"},
{0x10, "PREFETCH_EN"},
/* PA3-PA0 - PIO "A" timing */
};
static struct pdc_bit_messages pdc_reg_B[] = {
/* MB2-MB0 - DMA "B" timing */
{ 0x10, "PIO_FORCED/PB4" }, /* PIO_FORCE 1:0 */
{0x10, "PIO_FORCED/PB4"}, /* PIO_FORCE 1:0 */
/* PB3-PB0 - PIO "B" timing */
};
static struct pdc_bit_messages pdc_reg_C[] = {
{ 0x80, "DMARQp" },
{ 0x40, "IORDYp" },
{ 0x20, "DMAR_EN" },
{ 0x10, "DMAW_EN" },
{0x80, "DMARQp"},
{0x40, "IORDYp"},
{0x20, "DMAR_EN"},
{0x10, "DMAW_EN"},
/* MC3-MC0 - DMA "C" timing */
};
......@@ -119,7 +119,7 @@ static void pdc_dump_bits(struct pdc_bit_messages *msgs, byte bits)
}
#endif /* PDC202XX_DECODE_REGISTER_INFO */
static struct ata_device* drives[4];
static struct ata_device *drives[4];
int check_in_drive_lists(struct ata_device *drive)
{
......@@ -135,7 +135,7 @@ int check_in_drive_lists(struct ata_device *drive)
NULL
};
const char**list = pdc_quirk_drives;
const char **list = pdc_quirk_drives;
struct hd_driveid *id = drive->id;
while (*list)
......@@ -148,7 +148,7 @@ static int __init pdc202xx_modes_map(struct ata_channel *ch)
{
int map = XFER_EPIO | XFER_SWDMA | XFER_MWDMA | XFER_UDMA;
switch(ch->pci_dev->device) {
switch (ch->pci_dev->device) {
case PCI_DEVICE_ID_PROMISE_20276:
case PCI_DEVICE_ID_PROMISE_20275:
case PCI_DEVICE_ID_PROMISE_20271:
......@@ -164,7 +164,9 @@ static int __init pdc202xx_modes_map(struct ata_channel *ch)
map |= XFER_UDMA_66;
if (!ch->udma_four) {
printk(KERN_WARNING "%s: 40-pin cable, speed reduced to UDMA(33) mode.\n", ch->name);
printk(KERN_WARNING
"%s: 40-pin cable, speed reduced to UDMA(33) mode.\n",
ch->name);
map &= ~XFER_UDMA_80W;
}
}
......@@ -191,38 +193,89 @@ static int pdc202xx_tune_chipset(struct ata_device *drive, byte speed)
pci_read_config_byte(dev, drive_pci + 1, &BP);
pci_read_config_byte(dev, drive_pci + 2, &CP);
switch(speed) {
switch (speed) {
#ifdef CONFIG_BLK_DEV_IDEDMA
case XFER_UDMA_5:
case XFER_UDMA_4: TB = 0x20; TC = 0x01; break;
case XFER_UDMA_3: TB = 0x40; TC = 0x02; break;
case XFER_UDMA_2: TB = 0x20; TC = 0x01; break;
case XFER_UDMA_1: TB = 0x40; TC = 0x02; break;
case XFER_UDMA_0: TB = 0x60; TC = 0x03; break;
case XFER_MW_DMA_2: TB = 0x60; TC = 0x03; break;
case XFER_MW_DMA_1: TB = 0x60; TC = 0x04; break;
case XFER_MW_DMA_0: TB = 0x60; TC = 0x05; break;
case XFER_SW_DMA_2: TB = 0x60; TC = 0x05; break;
case XFER_SW_DMA_1: TB = 0x80; TC = 0x06; break;
case XFER_SW_DMA_0: TB = 0xC0; TC = 0x0B; break;
case XFER_UDMA_4:
TB = 0x20;
TC = 0x01;
break;
case XFER_UDMA_3:
TB = 0x40;
TC = 0x02;
break;
case XFER_UDMA_2:
TB = 0x20;
TC = 0x01;
break;
case XFER_UDMA_1:
TB = 0x40;
TC = 0x02;
break;
case XFER_UDMA_0:
TB = 0x60;
TC = 0x03;
break;
case XFER_MW_DMA_2:
TB = 0x60;
TC = 0x03;
break;
case XFER_MW_DMA_1:
TB = 0x60;
TC = 0x04;
break;
case XFER_MW_DMA_0:
TB = 0x60;
TC = 0x05;
break;
case XFER_SW_DMA_2:
TB = 0x60;
TC = 0x05;
break;
case XFER_SW_DMA_1:
TB = 0x80;
TC = 0x06;
break;
case XFER_SW_DMA_0:
TB = 0xC0;
TC = 0x0B;
break;
#endif
case XFER_PIO_4: TA = 0x01; TB = 0x04; break;
case XFER_PIO_3: TA = 0x02; TB = 0x06; break;
case XFER_PIO_2: TA = 0x03; TB = 0x08; break;
case XFER_PIO_1: TA = 0x05; TB = 0x0C; break;
case XFER_PIO_4:
TA = 0x01;
TB = 0x04;
break;
case XFER_PIO_3:
TA = 0x02;
TB = 0x06;
break;
case XFER_PIO_2:
TA = 0x03;
TB = 0x08;
break;
case XFER_PIO_1:
TA = 0x05;
TB = 0x0C;
break;
case XFER_PIO_0:
default: TA = 0x09; TB = 0x13; break;
default:
TA = 0x09;
TB = 0x13;
break;
}
#ifdef CONFIG_BLK_DEV_IDEDMA
if (speed >= XFER_SW_DMA_0) {
pci_write_config_byte(dev, drive_pci + 1, (BP & ~0xf0) | TB);
pci_write_config_byte(dev, drive_pci + 2, (CP & ~0x0f) | TC);
pci_write_config_byte(dev, drive_pci + 1,
(BP & ~0xf0) | TB);
pci_write_config_byte(dev, drive_pci + 2,
(CP & ~0x0f) | TC);
} else
#endif
{
pci_write_config_byte(dev, drive_pci, (AP & ~0x0f) | TA);
pci_write_config_byte(dev, drive_pci + 1, (BP & ~0x07) | TB);
pci_write_config_byte(dev, drive_pci + 1,
(BP & ~0x07) | TB);
}
#if PDC202XX_DECODE_REGISTER_INFO
......@@ -246,8 +299,7 @@ static int pdc202xx_tune_chipset(struct ata_device *drive, byte speed)
#if PDC202XX_DEBUG_DRIVE_INFO
printk("%s: %02x drive%d 0x%08x ",
drive->name, speed,
drive->dn, drive_conf);
drive->name, speed, drive->dn, drive_conf);
pci_read_config_dword(dev, drive_pci, &drive_conf);
printk("0x%08x\n", drive_conf);
#endif
......@@ -282,9 +334,9 @@ static int pdc202xx_new_tune_chipset(struct ata_device *drive, byte speed)
}
#endif
for (i = 0 ; i < 2 ; i++)
for (i = 0; i < 2; i++)
if (hwif->drives[i].present)
drives[i+j] = &hwif->drives[i];
drives[i + j] = &hwif->drives[i];
err = ide_config_drive_speed(drive, speed);
......@@ -293,7 +345,7 @@ static int pdc202xx_new_tune_chipset(struct ata_device *drive, byte speed)
return err;
/* We need to adjust timings to ATA133 clock if ATA133 drives exist */
for (i = 0 ; i < 4 ; i++) {
for (i = 0; i < 4; i++) {
if (!drives[i])
continue;
......@@ -400,7 +452,8 @@ static void pdc202xx_tune_drive(struct ata_device *drive, u8 pio)
if (pio == 255)
speed = ata_best_pio_mode(drive);
else speed = XFER_PIO_0 + min_t(byte, pio, 4);
else
speed = XFER_PIO_0 + min_t(byte, pio, 4);
pdc202xx_tune_chipset(drive, speed);
}
......@@ -419,7 +472,7 @@ static int pdc202xx_tx_udma_setup(struct ata_device *drive, int map)
/* IORDY_EN & PREFETCH_EN */
if (id->capability & 4)
set_2regs(0x13, (IN_BYTE(datareg)|0x03));
set_2regs(0x13, (IN_BYTE(datareg) | 0x03));
return udma_generic_setup(drive, map);
}
......@@ -428,7 +481,7 @@ static int pdc202xx_udma_setup(struct ata_device *drive, int map)
{
struct hd_driveid *id = drive->id;
struct ata_channel *hwif = drive->channel;
struct hd_driveid *mate_id = hwif->drives[!(drive->dn%2)].id;
struct hd_driveid *mate_id = hwif->drives[!(drive->dn % 2)].id;
struct pci_dev *dev = hwif->pci_dev;
u32 high_16 = pci_resource_start(dev, 4);
u32 drive_conf;
......@@ -472,25 +525,27 @@ static int pdc202xx_udma_setup(struct ata_device *drive, int map)
/* enable SYNC_ERRDY for master and slave (if enabled for master) */
if (!(AP & SYNC_ERRDY_EN)) {
if (!(drive->dn % 2)) {
pci_write_config_byte(dev, drive_pci, AP|SYNC_ERRDY_EN);
pci_write_config_byte(dev, drive_pci,
AP | SYNC_ERRDY_EN);
} else {
pci_read_config_byte(dev, drive_pci - 4, &tmp);
if (tmp & SYNC_ERRDY_EN)
pci_write_config_byte(dev, drive_pci, AP|SYNC_ERRDY_EN);
pci_write_config_byte(dev, drive_pci,
AP | SYNC_ERRDY_EN);
}
}
chipset_is_set:
chipset_is_set:
if (drive->type != ATA_DISK)
return 0;
pci_read_config_byte(dev, drive_pci, &AP);
if (id->capability & 4) /* IORDY_EN */
pci_write_config_byte(dev, drive_pci, AP|IORDY_EN);
pci_write_config_byte(dev, drive_pci, AP | IORDY_EN);
pci_read_config_byte(dev, drive_pci, &AP);
if (drive->type == ATA_DISK) /* PREFETCH_EN */
pci_write_config_byte(dev, drive_pci, AP|PREFETCH_EN);
pci_write_config_byte(dev, drive_pci, AP | PREFETCH_EN);
map = hwif->modes_map;
......@@ -507,7 +562,8 @@ static int pdc202xx_udma_setup(struct ata_device *drive, int map)
return udma_generic_setup(drive, map);
}
static void pdc202xx_udma_start(struct ata_device *drive, struct request *rq)
static void pdc202xx_udma_start(struct ata_device *drive,
struct request *rq)
{
struct ata_channel *ch = drive->channel;
u32 high_16 = pci_resource_start(ch->pci_dev, 4);
......@@ -521,7 +577,8 @@ static void pdc202xx_udma_start(struct ata_device *drive, struct request *rq)
OUT_BYTE(clock | (ch->unit ? 0x08 : 0x02), clockreg);
word_count = (rq->nr_sectors << 8);
hankval = (rq_data_dir(rq) == READ) ? 0x05 << 24 : 0x06 << 24;
hankval =
(rq_data_dir(rq) == READ) ? 0x05 << 24 : 0x06 << 24;
hankval |= word_count;
outl(hankval, atapi_port);
}
......@@ -552,9 +609,9 @@ static int pdc202xx_udma_stop(struct ata_device *drive)
OUT_BYTE(clock & ~(ch->unit ? 0x08 : 0x02), clockreg);
}
outb(inb(dma_base)&~1, dma_base); /* stop DMA */
dma_stat = inb(dma_base+2); /* get DMA status */
outb(dma_stat|6, dma_base+2); /* clear the INTR & ERROR bits */
outb(inb(dma_base) & ~1, dma_base); /* stop DMA */
dma_stat = inb(dma_base + 2); /* get DMA status */
outb(dma_stat | 6, dma_base + 2); /* clear the INTR & ERROR bits */
udma_destroy_table(ch); /* purge DMA mappings */
return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0; /* verify good DMA status */
......@@ -623,10 +680,12 @@ static unsigned int __init pdc202xx_init_chipset(struct pci_dev *dev)
set_reg_and_wait(burst & ~0x10, burstreg, 2000);
if (dev->resource[PCI_ROM_RESOURCE].start) {
pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", dev->name, dev->resource[PCI_ROM_RESOURCE].start);
pci_write_config_dword(dev, PCI_ROM_ADDRESS,
dev->resource[PCI_ROM_RESOURCE].
start | PCI_ROM_ADDRESS_ENABLE);
printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", dev->name,
dev->resource[PCI_ROM_RESOURCE].start);
}
#if 0
switch (dev->device) {
case PCI_DEVICE_ID_PROMISE_20267:
......@@ -637,11 +696,14 @@ static unsigned int __init pdc202xx_init_chipset(struct pci_dev *dev)
default:
if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) {
byte irq = 0, irq2 = 0;
pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq);
pci_read_config_byte(dev, (PCI_INTERRUPT_LINE)|0x80, &irq2); /* 0xbc */
pci_read_config_byte(dev, PCI_INTERRUPT_LINE,
&irq);
pci_read_config_byte(dev, (PCI_INTERRUPT_LINE) | 0x80, &irq2); /* 0xbc */
if (irq != irq2) {
pci_write_config_byte(dev, (PCI_INTERRUPT_LINE)|0x80, irq); /* 0xbc */
printk("%s: pci-config space interrupt mirror fixed.\n", dev->name);
pci_write_config_byte(dev, (PCI_INTERRUPT_LINE) | 0x80, irq); /* 0xbc */
printk
("%s: pci-config space interrupt mirror fixed.\n",
dev->name);
}
}
break;
......@@ -659,7 +721,7 @@ static unsigned int __init pdc202xx_init_chipset(struct pci_dev *dev)
"primary %s mode, secondary %s mode.\n",
dev->name, (burst & 1) ? "en" : "dis",
(IN_BYTE(high_16 + PDC_PRIMARY) & 1) ? "MASTER" : "PCI",
(IN_BYTE(high_16 + PDC_SECONDARY) & 1) ? "MASTER" : "PCI" );
(IN_BYTE(high_16 + PDC_SECONDARY) & 1) ? "MASTER" : "PCI");
return dev->irq;
}
......@@ -669,8 +731,11 @@ static unsigned int __init pdc202xx_init_chipset(struct pci_dev *dev)
static unsigned int __init pdc202xx_tx_init_chipset(struct pci_dev *dev)
{
if (dev->resource[PCI_ROM_RESOURCE].start) {
pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
printk(KERN_INFO "%s: ROM enabled at 0x%08lx.\n", dev->name, dev->resource[PCI_ROM_RESOURCE].start);
pci_write_config_dword(dev, PCI_ROM_ADDRESS,
dev->resource[PCI_ROM_RESOURCE].
start | PCI_ROM_ADDRESS_ENABLE);
printk(KERN_INFO "%s: ROM enabled at 0x%08lx.\n",
dev->name, dev->resource[PCI_ROM_RESOURCE].start);
}
return dev->irq;
}
......@@ -697,7 +762,7 @@ static void __init ide_init_pdc202xx(struct ata_channel *hwif)
hwif->quirkproc = &check_in_drive_lists;
hwif->resetproc = &pdc202xx_reset;
switch(hwif->pci_dev->device) {
switch (hwif->pci_dev->device) {
case PCI_DEVICE_ID_PROMISE_20276:
case PCI_DEVICE_ID_PROMISE_20275:
case PCI_DEVICE_ID_PROMISE_20271:
......@@ -753,107 +818,97 @@ static void __init ide_init_pdc202xx(struct ata_channel *hwif)
/* module data table */
static struct ata_pci_device chipsets[] __initdata = {
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20246,
init_chipset: pdc202xx_init_chipset,
init_channel: ide_init_pdc202xx,
.vendor = PCI_VENDOR_ID_PROMISE,
.device = PCI_DEVICE_ID_PROMISE_20246,
.init_chipset = pdc202xx_init_chipset,
.init_channel = ide_init_pdc202xx,
#ifndef CONFIG_PDC202XX_FORCE
enablebits: {{0x50,0x02,0x02}, {0x50,0x04,0x04}},
.enablebits = {{0x50, 0x02, 0x02}, {0x50, 0x04, 0x04}},
#endif
bootable: OFF_BOARD,
extra: 16,
flags: ATA_F_IRQ | ATA_F_DMA
},
.bootable = OFF_BOARD,
.extra = 16,
.flags = ATA_F_IRQ | ATA_F_DMA},
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20262,
init_chipset: pdc202xx_init_chipset,
init_channel: ide_init_pdc202xx,
.vendor = PCI_VENDOR_ID_PROMISE,
.device = PCI_DEVICE_ID_PROMISE_20262,
.init_chipset = pdc202xx_init_chipset,
.init_channel = ide_init_pdc202xx,
#ifndef CONFIG_PDC202XX_FORCE
enablebits: {{0x50,0x02,0x02}, {0x50,0x04,0x04}},
.enablebits = {{0x50, 0x02, 0x02}, {0x50, 0x04, 0x04}},
#endif
bootable: OFF_BOARD,
extra: 48,
flags: ATA_F_IRQ | ATA_F_PHACK | ATA_F_DMA
},
.bootable = OFF_BOARD,
.extra = 48,
.flags = ATA_F_IRQ | ATA_F_PHACK | ATA_F_DMA},
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20265,
init_chipset: pdc202xx_init_chipset,
init_channel: ide_init_pdc202xx,
.vendor = PCI_VENDOR_ID_PROMISE,
.device = PCI_DEVICE_ID_PROMISE_20265,
.init_chipset = pdc202xx_init_chipset,
.init_channel = ide_init_pdc202xx,
#ifndef CONFIG_PDC202XX_FORCE
enablebits: {{0x50,0x02,0x02}, {0x50,0x04,0x04}},
bootable: OFF_BOARD,
.enablebits = {{0x50, 0x02, 0x02}, {0x50, 0x04, 0x04}},
.bootable = OFF_BOARD,
#else
bootable: ON_BOARD,
.bootable = ON_BOARD,
#endif
extra: 48,
flags: ATA_F_IRQ | ATA_F_PHACK | ATA_F_DMA
},
.extra = 48,
.flags = ATA_F_IRQ | ATA_F_PHACK | ATA_F_DMA},
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20267,
init_chipset: pdc202xx_init_chipset,
init_channel: ide_init_pdc202xx,
.vendor = PCI_VENDOR_ID_PROMISE,
.device = PCI_DEVICE_ID_PROMISE_20267,
.init_chipset = pdc202xx_init_chipset,
.init_channel = ide_init_pdc202xx,
#ifndef CONFIG_PDC202XX_FORCE
enablebits: {{0x50,0x02,0x02}, {0x50,0x04,0x04}},
.enablebits = {{0x50, 0x02, 0x02}, {0x50, 0x04, 0x04}},
#endif
bootable: OFF_BOARD,
extra: 48,
flags: ATA_F_IRQ | ATA_F_DMA
},
.bootable = OFF_BOARD,
.extra = 48,
.flags = ATA_F_IRQ | ATA_F_DMA},
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20268,
init_chipset: pdc202xx_init_chipset,
init_channel: ide_init_pdc202xx,
bootable: OFF_BOARD,
flags: ATA_F_IRQ | ATA_F_DMA
},
.vendor = PCI_VENDOR_ID_PROMISE,
.device = PCI_DEVICE_ID_PROMISE_20268,
.init_chipset = pdc202xx_init_chipset,
.init_channel = ide_init_pdc202xx,
.bootable = OFF_BOARD,
.flags = ATA_F_IRQ | ATA_F_DMA},
/* Promise used a different PCI identification for the raid card
* apparently to try and prevent Linux detecting it and using our own
* raid code. We want to detect it for the ataraid drivers, so we have
* to list both here.. */
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20268R,
init_chipset: pdc202xx_init_chipset,
init_channel: ide_init_pdc202xx,
bootable: OFF_BOARD,
flags: ATA_F_IRQ | ATA_F_DMA
},
.vendor = PCI_VENDOR_ID_PROMISE,
.device = PCI_DEVICE_ID_PROMISE_20268R,
.init_chipset = pdc202xx_init_chipset,
.init_channel = ide_init_pdc202xx,
.bootable = OFF_BOARD,
.flags = ATA_F_IRQ | ATA_F_DMA},
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20269,
init_chipset: pdc202xx_init_chipset,
init_channel: ide_init_pdc202xx,
bootable: OFF_BOARD,
flags: ATA_F_IRQ | ATA_F_DMA
},
.vendor = PCI_VENDOR_ID_PROMISE,
.device = PCI_DEVICE_ID_PROMISE_20269,
.init_chipset = pdc202xx_init_chipset,
.init_channel = ide_init_pdc202xx,
.bootable = OFF_BOARD,
.flags = ATA_F_IRQ | ATA_F_DMA},
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20271,
init_chipset: pdc202xx_init_chipset,
init_channel: ide_init_pdc202xx,
bootable: OFF_BOARD,
flags: ATA_F_IRQ | ATA_F_DMA
},
.vendor = PCI_VENDOR_ID_PROMISE,
.device = PCI_DEVICE_ID_PROMISE_20271,
.init_chipset = pdc202xx_init_chipset,
.init_channel = ide_init_pdc202xx,
.bootable = OFF_BOARD,
.flags = ATA_F_IRQ | ATA_F_DMA},
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20275,
init_chipset: pdc202xx_init_chipset,
init_channel: ide_init_pdc202xx,
bootable: OFF_BOARD,
flags: ATA_F_IRQ | ATA_F_DMA
},
.vendor = PCI_VENDOR_ID_PROMISE,
.device = PCI_DEVICE_ID_PROMISE_20275,
.init_chipset = pdc202xx_init_chipset,
.init_channel = ide_init_pdc202xx,
.bootable = OFF_BOARD,
.flags = ATA_F_IRQ | ATA_F_DMA},
{
vendor: PCI_VENDOR_ID_PROMISE,
device: PCI_DEVICE_ID_PROMISE_20276,
init_chipset: pdc202xx_init_chipset,
init_channel: ide_init_pdc202xx,
bootable: OFF_BOARD,
flags: ATA_F_IRQ | ATA_F_DMA
},
.vendor = PCI_VENDOR_ID_PROMISE,
.device = PCI_DEVICE_ID_PROMISE_20276,
.init_chipset = pdc202xx_init_chipset,
.init_channel = ide_init_pdc202xx,
.bootable = OFF_BOARD,
.flags = ATA_F_IRQ | ATA_F_DMA},
};
int __init init_pdc202xx(void)
......
......@@ -106,26 +106,24 @@ static void read_vlb(struct ata_device *drive, void *buffer, unsigned int wcount
{
unsigned long flags;
__save_flags(flags); /* local CPU only */
__cli(); /* local CPU only */
local_irq_save(flags);
inb(IDE_NSECTOR_REG);
inb(IDE_NSECTOR_REG);
inb(IDE_NSECTOR_REG);
insl(IDE_DATA_REG, buffer, wcount);
__restore_flags(flags); /* local CPU only */
local_irq_restore(flags);
}
static void write_vlb(struct ata_device *drive, void *buffer, unsigned int wcount)
{
unsigned long flags;
__save_flags(flags); /* local CPU only */
__cli(); /* local CPU only */
local_irq_save(flags);
inb(IDE_NSECTOR_REG);
inb(IDE_NSECTOR_REG);
inb(IDE_NSECTOR_REG);
outsl(IDE_DATA_REG, buffer, wcount);
__restore_flags(flags); /* local CPU only */
local_irq_restore(flags);
}
static void read_16(struct ata_device *drive, void *buffer, unsigned int wcount)
......@@ -701,7 +699,7 @@ ide_startstop_t do_pdc4030_io(struct ata_device *drive, struct ata_taskfile *arg
return ret;
}
if (!drive->channel->unmask)
__cli(); /* local CPU only */
local_irq_disable();
return promise_do_write(drive, rq);
}
......
......@@ -31,11 +31,14 @@
#include "ataraid.h"
static int pdcraid_open(struct inode * inode, struct file * filp);
static int pdcraid_release(struct inode * inode, struct file * filp);
static int pdcraid_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
static int pdcraid0_make_request (request_queue_t *q, int rw, struct buffer_head * bh);
static int pdcraid1_make_request (request_queue_t *q, int rw, struct buffer_head * bh);
static int pdcraid_open(struct inode *inode, struct file *filp);
static int pdcraid_release(struct inode *inode, struct file *filp);
static int pdcraid_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg);
static int pdcraid0_make_request(request_queue_t * q, int rw,
struct buffer_head *bh);
static int pdcraid1_make_request(request_queue_t * q, int rw,
struct buffer_head *bh);
struct disk_dev {
int major;
......@@ -43,21 +46,21 @@ struct disk_dev {
int device;
};
static struct disk_dev devlist[]= {
{IDE0_MAJOR, 0, -1 },
{IDE0_MAJOR, 64, -1 },
{IDE1_MAJOR, 0, -1 },
{IDE1_MAJOR, 64, -1 },
{IDE2_MAJOR, 0, -1 },
{IDE2_MAJOR, 64, -1 },
{IDE3_MAJOR, 0, -1 },
{IDE3_MAJOR, 64, -1 },
{IDE4_MAJOR, 0, -1 },
{IDE4_MAJOR, 64, -1 },
{IDE5_MAJOR, 0, -1 },
{IDE5_MAJOR, 64, -1 },
{IDE6_MAJOR, 0, -1 },
{IDE6_MAJOR, 64, -1 },
static struct disk_dev devlist[] = {
{IDE0_MAJOR, 0, -1},
{IDE0_MAJOR, 64, -1},
{IDE1_MAJOR, 0, -1},
{IDE1_MAJOR, 64, -1},
{IDE2_MAJOR, 0, -1},
{IDE2_MAJOR, 64, -1},
{IDE3_MAJOR, 0, -1},
{IDE3_MAJOR, 64, -1},
{IDE4_MAJOR, 0, -1},
{IDE4_MAJOR, 64, -1},
{IDE5_MAJOR, 0, -1},
{IDE5_MAJOR, 64, -1},
{IDE6_MAJOR, 0, -1},
{IDE6_MAJOR, 64, -1},
};
......@@ -81,23 +84,24 @@ struct pdcraid {
};
static struct raid_device_operations pdcraid0_ops = {
open: pdcraid_open,
release: pdcraid_release,
ioctl: pdcraid_ioctl,
make_request: pdcraid0_make_request
.open = pdcraid_open,
.release = pdcraid_release,
.ioctl = pdcraid_ioctl,
.make_request = pdcraid0_make_request
};
static struct raid_device_operations pdcraid1_ops = {
open: pdcraid_open,
release: pdcraid_release,
ioctl: pdcraid_ioctl,
make_request: pdcraid1_make_request
.open = pdcraid_open,
.release = pdcraid_release,
.ioctl = pdcraid_ioctl,
.make_request = pdcraid1_make_request
};
static struct pdcraid raid[16];
static int pdcraid_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
static int pdcraid_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
unsigned int minor;
unsigned long sectors;
......@@ -105,30 +109,46 @@ static int pdcraid_ioctl(struct inode *inode, struct file *file, unsigned int cm
if (!inode || kdev_none(inode->i_rdev))
return -EINVAL;
minor = minor(inode->i_rdev)>>SHIFT;
minor = minor(inode->i_rdev) >> SHIFT;
switch (cmd) {
case BLKGETSIZE: /* Return device size */
if (!arg) return -EINVAL;
sectors = ataraid_gendisk.part[minor(inode->i_rdev)].nr_sects;
if (minor(inode->i_rdev)&15)
if (!arg)
return -EINVAL;
sectors =
ataraid_gendisk.part[minor(inode->i_rdev)].nr_sects;
if (minor(inode->i_rdev) & 15)
return put_user(sectors, (unsigned long *) arg);
return put_user(raid[minor].sectors , (unsigned long *) arg);
return put_user(raid[minor].sectors,
(unsigned long *) arg);
break;
case HDIO_GETGEO:
{
struct hd_geometry *loc = (struct hd_geometry *) arg;
struct hd_geometry *loc =
(struct hd_geometry *) arg;
unsigned short bios_cyl = raid[minor].geom.cylinders; /* truncate */
if (!loc) return -EINVAL;
if (put_user(raid[minor].geom.heads, (byte *) &loc->heads)) return -EFAULT;
if (put_user(raid[minor].geom.sectors, (byte *) &loc->sectors)) return -EFAULT;
if (put_user(bios_cyl, (unsigned short *) &loc->cylinders)) return -EFAULT;
if (put_user((unsigned)ataraid_gendisk.part[minor(inode->i_rdev)].start_sect,
(unsigned long *) &loc->start)) return -EFAULT;
if (!loc)
return -EINVAL;
if (put_user
(raid[minor].geom.heads,
(byte *) & loc->heads))
return -EFAULT;
if (put_user
(raid[minor].geom.sectors,
(byte *) & loc->sectors))
return -EFAULT;
if (put_user
(bios_cyl, (unsigned short *) &loc->cylinders))
return -EFAULT;
if (put_user
((unsigned) ataraid_gendisk.
part[minor(inode->i_rdev)].start_sect,
(unsigned long *) &loc->start))
return -EFAULT;
return 0;
}
......@@ -146,16 +166,23 @@ static int pdcraid_ioctl(struct inode *inode, struct file *file, unsigned int cm
}
unsigned long partition_map_normal(unsigned long block, unsigned long partition_off, unsigned long partition_size, int stride)
unsigned long partition_map_normal(unsigned long block,
unsigned long partition_off,
unsigned long partition_size,
int stride)
{
return block + partition_off;
}
unsigned long partition_map_linux(unsigned long block, unsigned long partition_off, unsigned long partition_size, int stride)
unsigned long partition_map_linux(unsigned long block,
unsigned long partition_off,
unsigned long partition_size, int stride)
{
unsigned long newblock;
newblock = stride - (partition_off%stride); if (newblock == stride) newblock = 0;
newblock = stride - (partition_off % stride);
if (newblock == stride)
newblock = 0;
newblock += block;
newblock = newblock % partition_size;
newblock += partition_off;
......@@ -165,17 +192,22 @@ unsigned long partition_map_linux(unsigned long block, unsigned long partition_o
static int funky_remap[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
unsigned long partition_map_linux_raid0_4disk(unsigned long block, unsigned long partition_off, unsigned long partition_size, int stride)
unsigned long partition_map_linux_raid0_4disk(unsigned long block,
unsigned long partition_off,
unsigned long partition_size,
int stride)
{
unsigned long newblock,temp,temp2;
unsigned long newblock, temp, temp2;
newblock = stride - (partition_off%stride); if (newblock == stride) newblock = 0;
newblock = stride - (partition_off % stride);
if (newblock == stride)
newblock = 0;
if (block < (partition_size / (8*stride))*8*stride ) {
if (block < (partition_size / (8 * stride)) * 8 * stride) {
temp = block % stride;
temp2 = block / stride;
temp2 = ((temp2>>3)<<3)|(funky_remap[temp2&7]);
block = temp2*stride+temp;
temp2 = ((temp2 >> 3) << 3) | (funky_remap[temp2 & 7]);
block = temp2 * stride + temp;
}
......@@ -188,12 +220,13 @@ unsigned long partition_map_linux_raid0_4disk(unsigned long block, unsigned long
static int pdcraid0_make_request (request_queue_t *q, int rw, struct buffer_head * bh)
static int pdcraid0_make_request(request_queue_t * q, int rw,
struct buffer_head *bh)
{
unsigned long rsect;
unsigned long rsect_left,rsect_accum = 0;
unsigned long rsect_left, rsect_accum = 0;
unsigned long block;
unsigned int disk=0,real_disk=0;
unsigned int disk = 0, real_disk = 0;
int i;
int device;
struct pdcraid *thisraid;
......@@ -212,44 +245,58 @@ static int pdcraid0_make_request (request_queue_t *q, int rw, struct buffer_head
* point, we have to divide by one less.
*/
device = (bh->b_rdev >> SHIFT)&MAJOR_MASK;
device = (bh->b_rdev >> SHIFT) & MAJOR_MASK;
thisraid = &raid[device];
if (thisraid->stride==0)
thisraid->stride=1;
if (thisraid->stride == 0)
thisraid->stride = 1;
/* Partitions need adding of the start sector of the partition to the requested sector */
rsect = partition_map_normal(rsect, ataraid_gendisk.part[MINOR(bh->b_rdev)].start_sect, ataraid_gendisk.part[MINOR(bh->b_rdev)].nr_sects, thisraid->stride);
rsect =
partition_map_normal(rsect,
ataraid_gendisk.part[MINOR(bh->b_rdev)].
start_sect,
ataraid_gendisk.part[MINOR(bh->b_rdev)].
nr_sects, thisraid->stride);
/* Woops we need to split the request to avoid crossing a stride barrier */
if ((rsect/thisraid->stride) != ((rsect+(bh->b_size/512)-1)/thisraid->stride)) {
if ((rsect / thisraid->stride) !=
((rsect + (bh->b_size / 512) - 1) / thisraid->stride)) {
return -1;
}
rsect_left = rsect;
for (i=0;i<8;i++) {
if (thisraid->cutoff_disks[i]==0)
for (i = 0; i < 8; i++) {
if (thisraid->cutoff_disks[i] == 0)
break;
if (rsect > thisraid->cutoff[i]) {
/* we're in the wrong area so far */
rsect_left -= thisraid->cutoff[i];
rsect_accum += thisraid->cutoff[i]/thisraid->cutoff_disks[i];
rsect_accum +=
thisraid->cutoff[i] /
thisraid->cutoff_disks[i];
} else {
block = rsect_left / thisraid->stride;
disk = block % thisraid->cutoff_disks[i];
block = (block / thisraid->cutoff_disks[i]) * thisraid->stride;
rsect = rsect_accum + (rsect_left % thisraid->stride) + block;
block =
(block / thisraid->cutoff_disks[i]) *
thisraid->stride;
rsect =
rsect_accum + (rsect_left % thisraid->stride) +
block;
break;
}
}
for (i=0;i<8;i++) {
if ((disk==0) && (thisraid->disk[i].sectors > rsect_accum)) {
for (i = 0; i < 8; i++) {
if ((disk == 0)
&& (thisraid->disk[i].sectors > rsect_accum)) {
real_disk = i;
break;
}
if ((disk>0) && (thisraid->disk[i].sectors >= rsect_accum)) {
if ((disk > 0)
&& (thisraid->disk[i].sectors >= rsect_accum)) {
disk--;
}
......@@ -270,25 +317,26 @@ static int pdcraid0_make_request (request_queue_t *q, int rw, struct buffer_head
return 1;
}
static int pdcraid1_write_request(request_queue_t *q, int rw, struct buffer_head * bh)
static int pdcraid1_write_request(request_queue_t * q, int rw,
struct buffer_head *bh)
{
struct buffer_head *bh1;
struct ataraid_bh_private *private;
int device;
int i;
device = (bh->b_rdev >> SHIFT)&MAJOR_MASK;
device = (bh->b_rdev >> SHIFT) & MAJOR_MASK;
private = ataraid_get_private();
if (private==NULL)
if (private == NULL)
BUG();
private->parent = bh;
atomic_set(&private->count,raid[device].disks);
atomic_set(&private->count, raid[device].disks);
for (i = 0; i< raid[device].disks; i++) {
bh1=ataraid_get_bhead();
for (i = 0; i < raid[device].disks; i++) {
bh1 = ataraid_get_bhead();
/* If this ever fails we're doomed */
if (!bh1)
BUG();
......@@ -302,18 +350,20 @@ static int pdcraid1_write_request(request_queue_t *q, int rw, struct buffer_head
bh1->b_rdev = raid[device].disk[i].device;
/* update the last known head position for the drive */
raid[device].disk[i].last_pos = bh1->b_rsector+(bh1->b_size>>9);
raid[device].disk[i].last_pos =
bh1->b_rsector + (bh1->b_size >> 9);
generic_make_request(rw,bh1);
generic_make_request(rw, bh1);
}
return 0;
}
static int pdcraid1_read_request (request_queue_t *q, int rw, struct buffer_head * bh)
static int pdcraid1_read_request(request_queue_t * q, int rw,
struct buffer_head *bh)
{
int device;
int dist;
int bestsofar,bestdist,i;
int bestsofar, bestdist, i;
static int previous;
/* Reads are simple in principle. Pick a disk and go.
......@@ -321,28 +371,29 @@ static int pdcraid1_read_request (request_queue_t *q, int rw, struct buffer_head
head position is closest by.
Later on, online/offline checking and performance needs adding */
device = (bh->b_rdev >> SHIFT)&MAJOR_MASK;
bh->b_rsector += ataraid_gendisk.part[MINOR(bh->b_rdev)].start_sect;
device = (bh->b_rdev >> SHIFT) & MAJOR_MASK;
bh->b_rsector +=
ataraid_gendisk.part[MINOR(bh->b_rdev)].start_sect;
bestsofar = 0;
bestdist = raid[device].disk[0].last_pos - bh->b_rsector;
if (bestdist<0)
bestdist=-bestdist;
if (bestdist>4095)
bestdist=4095;
if (bestdist < 0)
bestdist = -bestdist;
if (bestdist > 4095)
bestdist = 4095;
for (i=1 ; i<raid[device].disks; i++) {
for (i = 1; i < raid[device].disks; i++) {
dist = raid[device].disk[i].last_pos - bh->b_rsector;
if (dist<0)
if (dist < 0)
dist = -dist;
if (dist>4095)
dist=4095;
if (dist > 4095)
dist = 4095;
if (bestdist==dist) { /* it's a tie; try to do some read balancing */
if ((previous>bestsofar)&&(previous<=i))
if (bestdist == dist) { /* it's a tie; try to do some read balancing */
if ((previous > bestsofar) && (previous <= i))
bestsofar = i;
previous = (previous + 1) % raid[device].disks;
} else if (bestdist>dist) {
} else if (bestdist > dist) {
bestdist = dist;
bestsofar = i;
}
......@@ -350,7 +401,8 @@ static int pdcraid1_read_request (request_queue_t *q, int rw, struct buffer_head
}
bh->b_rdev = raid[device].disk[bestsofar].device;
raid[device].disk[bestsofar].last_pos = bh->b_rsector+(bh->b_size>>9);
raid[device].disk[bestsofar].last_pos =
bh->b_rsector + (bh->b_size >> 9);
/*
* Let the main block layer submit the IO and resolve recursion:
......@@ -360,16 +412,17 @@ static int pdcraid1_read_request (request_queue_t *q, int rw, struct buffer_head
}
static int pdcraid1_make_request (request_queue_t *q, int rw, struct buffer_head * bh)
static int pdcraid1_make_request(request_queue_t * q, int rw,
struct buffer_head *bh)
{
/* Read and Write are totally different cases; split them totally here */
if (rw==READA)
if (rw == READA)
rw = READ;
if (rw==READ)
return pdcraid1_read_request(q,rw,bh);
if (rw == READ)
return pdcraid1_read_request(q, rw, bh);
else
return pdcraid1_write_request(q,rw,bh);
return pdcraid1_write_request(q, rw, bh);
}
#include "pdcraid.h"
......@@ -379,23 +432,24 @@ static unsigned long calc_pdcblock_offset(struct block_device *bdev)
unsigned long lba = 0;
struct ata_device *ideinfo = get_info_ptr(to_kdev_t(bdev->bd_dev));
if (ideinfo==NULL)
if (ideinfo == NULL)
return 0;
/* first sector of the last cluster */
if (ideinfo->head==0)
if (ideinfo->head == 0)
return 0;
if (ideinfo->sect==0)
if (ideinfo->sect == 0)
return 0;
lba = (ideinfo->capacity / (ideinfo->head*ideinfo->sect));
lba = lba * (ideinfo->head*ideinfo->sect);
lba = (ideinfo->capacity / (ideinfo->head * ideinfo->sect));
lba = lba * (ideinfo->head * ideinfo->sect);
lba = lba - ideinfo->sect;
return lba;
}
static int read_disk_sb(struct block_device *bdev, struct promise_raid_conf *p)
static int read_disk_sb(struct block_device *bdev,
struct promise_raid_conf *p)
{
unsigned long sb_offset;
char *buffer;
......@@ -407,14 +461,15 @@ static int read_disk_sb(struct block_device *bdev, struct promise_raid_conf *p)
*/
sb_offset = calc_pdcblock_offset(bdev);
if (sb_offset==0)
if (sb_offset == 0)
return -1;
for (i = 0, buffer = (char*)p; i < 4; i++, buffer += 512) {
for (i = 0, buffer = (char *) p; i < 4; i++, buffer += 512) {
Sector sect;
char *q = read_dev_sector(bdev, sb_offset + i, &sect);
if (!p) {
printk(KERN_ERR "pdcraid: Error reading superblock.\n");
printk(KERN_ERR
"pdcraid: Error reading superblock.\n");
return -1;
}
memcpy(buffer, q, 512);
......@@ -423,13 +478,13 @@ static int read_disk_sb(struct block_device *bdev, struct promise_raid_conf *p)
return 0;
}
static unsigned int calc_sb_csum (unsigned int* ptr)
static unsigned int calc_sb_csum(unsigned int *ptr)
{
unsigned int sum;
int count;
sum = 0;
for (count=0;count<511;count++)
for (count = 0; count < 511; count++)
sum += *ptr++;
return sum;
......@@ -438,77 +493,80 @@ static unsigned int calc_sb_csum (unsigned int* ptr)
static int cookie = 0;
static struct promise_raid_conf __initdata prom;
static void __init probedisk(int devindex,int device, int raidlevel)
static void __init probedisk(int devindex, int device, int raidlevel)
{
int i;
int major, minor;
struct block_device *bdev;
if (devlist[devindex].device!=-1) /* already assigned to another array */
if (devlist[devindex].device != -1) /* already assigned to another array */
return;
major = devlist[devindex].major;
minor = devlist[devindex].minor;
bdev = bdget(mk_kdev(major,minor));
bdev = bdget(mk_kdev(major, minor));
if (!bdev)
return;
if (blkdev_get(bdev, FMODE_READ|FMODE_WRITE, 0, BDEV_RAW) != 0)
if (blkdev_get(bdev, FMODE_READ | FMODE_WRITE, 0, BDEV_RAW) != 0)
return;
if (read_disk_sb(bdev, &prom))
goto out;
/* the checksums must match */
if (prom.checksum != calc_sb_csum((unsigned int*)&prom))
if (prom.checksum != calc_sb_csum((unsigned int *) &prom))
goto out;
if (prom.raid.type!=raidlevel) /* different raidlevel */
if (prom.raid.type != raidlevel) /* different raidlevel */
goto out;
if ((cookie!=0) && (cookie != prom.raid.magic_1)) /* different array */
if ((cookie != 0) && (cookie != prom.raid.magic_1)) /* different array */
goto out;
cookie = prom.raid.magic_1;
/* This looks evil. But basically, we have to search for our adapternumber
in the arraydefinition, both of which are in the superblock */
for (i=0;(i<prom.raid.total_disks)&&(i<8);i++) {
if ( (prom.raid.disk[i].channel== prom.raid.channel) &&
(prom.raid.disk[i].device == prom.raid.device) ) {
for (i = 0; (i < prom.raid.total_disks) && (i < 8); i++) {
if ((prom.raid.disk[i].channel == prom.raid.channel) &&
(prom.raid.disk[i].device == prom.raid.device)) {
raid[device].disk[i].bdev = bdev;
raid[device].disk[i].device = mk_kdev(major,minor);
raid[device].disk[i].device =
mk_kdev(major, minor);
raid[device].disk[i].sectors = prom.raid.disk_secs;
raid[device].stride = (1<<prom.raid.raid0_shift);
raid[device].stride = (1 << prom.raid.raid0_shift);
raid[device].disks = prom.raid.total_disks;
raid[device].sectors = prom.raid.total_secs;
raid[device].geom.heads = prom.raid.heads+1;
raid[device].geom.heads = prom.raid.heads + 1;
raid[device].geom.sectors = prom.raid.sectors;
raid[device].geom.cylinders = prom.raid.cylinders+1;
devlist[devindex].device=device;
raid[device].geom.cylinders =
prom.raid.cylinders + 1;
devlist[devindex].device = device;
return;
}
}
out:
out:
blkdev_put(bdev, BDEV_RAW);
}
static void __init fill_cutoff(int device)
{
int i,j;
int i, j;
unsigned long smallest;
unsigned long bar;
int count;
bar = 0;
for (i=0;i<8;i++) {
for (i = 0; i < 8; i++) {
smallest = ~0;
for (j=0;j<8;j++)
if ((raid[device].disk[j].sectors < smallest) && (raid[device].disk[j].sectors>bar))
for (j = 0; j < 8; j++)
if ((raid[device].disk[j].sectors < smallest)
&& (raid[device].disk[j].sectors > bar))
smallest = raid[device].disk[j].sectors;
count = 0;
for (j=0;j<8;j++)
for (j = 0; j < 8; j++)
if (raid[device].disk[j].sectors >= smallest)
count++;
......@@ -519,31 +577,34 @@ static void __init fill_cutoff(int device)
}
}
static __init int pdcraid_init_one(int device,int raidlevel)
static __init int pdcraid_init_one(int device, int raidlevel)
{
int i, count;
for (i=0; i<14; i++)
for (i = 0; i < 14; i++)
probedisk(i, device, raidlevel);
if (raidlevel==0)
if (raidlevel == 0)
fill_cutoff(device);
/* Initialize the gendisk structure */
ataraid_register_disk(device,raid[device].sectors);
ataraid_register_disk(device, raid[device].sectors);
count=0;
count = 0;
for (i=0;i<8;i++) {
if (raid[device].disk[i].device!=0) {
for (i = 0; i < 8; i++) {
if (raid[device].disk[i].device != 0) {
printk(KERN_INFO "Drive %i is %li Mb (%i / %i) \n",
i,raid[device].disk[i].sectors/2048,major(raid[device].disk[i].device),minor(raid[device].disk[i].device));
i, raid[device].disk[i].sectors / 2048,
major(raid[device].disk[i].device),
minor(raid[device].disk[i].device));
count++;
}
}
if (count) {
printk(KERN_INFO "Raid%i array consists of %i drives. \n",raidlevel,count);
printk(KERN_INFO "Raid%i array consists of %i drives. \n",
raidlevel, count);
return 0;
} else {
return -ENODEV;
......@@ -556,10 +617,10 @@ static __init int pdcraid_init(void)
do {
cookie = 0;
device=ataraid_get_device(&pdcraid0_ops);
if (device<0)
device = ataraid_get_device(&pdcraid0_ops);
if (device < 0)
break;
retval = pdcraid_init_one(device,0);
retval = pdcraid_init_one(device, 0);
if (retval) {
ataraid_release_device(device);
break;
......@@ -571,10 +632,10 @@ static __init int pdcraid_init(void)
do {
cookie = 0;
device=ataraid_get_device(&pdcraid1_ops);
if (device<0)
device = ataraid_get_device(&pdcraid1_ops);
if (device < 0)
break;
retval = pdcraid_init_one(device,1);
retval = pdcraid_init_one(device, 1);
if (retval) {
ataraid_release_device(device);
break;
......@@ -584,19 +645,22 @@ static __init int pdcraid_init(void)
} while (1);
if (count) {
printk(KERN_INFO "Promise Fasttrak(tm) Softwareraid driver for linux version 0.03beta\n");
printk(KERN_INFO
"Promise Fasttrak(tm) Softwareraid driver for linux version 0.03beta\n");
return 0;
}
printk(KERN_DEBUG "Promise Fasttrak(tm) Softwareraid driver 0.03beta: No raid array found\n");
printk(KERN_DEBUG
"Promise Fasttrak(tm) Softwareraid driver 0.03beta: No raid array found\n");
return -ENODEV;
}
static void __exit pdcraid_exit (void)
static void __exit pdcraid_exit(void)
{
int i,device;
for (device = 0; device<16; device++) {
for (i=0;i<8;i++) {
struct block_device *bdev = raid[device].disk[i].bdev;
int i, device;
for (device = 0; device < 16; device++) {
for (i = 0; i < 8; i++) {
struct block_device *bdev =
raid[device].disk[i].bdev;
raid[device].disk[i].bdev = NULL;
if (bdev)
blkdev_put(bdev, BDEV_RAW);
......@@ -606,12 +670,12 @@ static void __exit pdcraid_exit (void)
}
}
static int pdcraid_open(struct inode * inode, struct file * filp)
static int pdcraid_open(struct inode *inode, struct file *filp)
{
MOD_INC_USE_COUNT;
return 0;
}
static int pdcraid_release(struct inode * inode, struct file * filp)
static int pdcraid_release(struct inode *inode, struct file *filp)
{
MOD_DEC_USE_COUNT;
return 0;
......
......@@ -388,130 +388,130 @@ static void __init piix_init_dma(struct ata_channel *ch, unsigned long dmabase)
/* module data table */
static struct ata_pci_device chipsets[] __initdata = {
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82371FB_1,
init_chipset: piix_init_chipset,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_INTEL,
.device = PCI_DEVICE_ID_INTEL_82371FB_1,
.init_chipset = piix_init_chipset,
.init_channel = piix_init_channel,
.init_dma = piix_init_dma,
.enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82371SB_1,
init_chipset: piix_init_chipset,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_INTEL,
.device = PCI_DEVICE_ID_INTEL_82371SB_1,
.init_chipset = piix_init_chipset,
.init_channel = piix_init_channel,
.init_dma = piix_init_dma,
.enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82371AB,
init_chipset: piix_init_chipset,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_INTEL,
.device = PCI_DEVICE_ID_INTEL_82371AB,
.init_chipset = piix_init_chipset,
.init_channel = piix_init_channel,
.init_dma = piix_init_dma,
.enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82443MX_1,
init_chipset: piix_init_chipset,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_INTEL,
.device = PCI_DEVICE_ID_INTEL_82443MX_1,
.init_chipset = piix_init_chipset,
.init_channel = piix_init_channel,
.init_dma = piix_init_dma,
.enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82372FB_1,
init_chipset: piix_init_chipset,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_INTEL,
.device = PCI_DEVICE_ID_INTEL_82372FB_1,
.init_chipset = piix_init_chipset,
.init_channel = piix_init_channel,
.init_dma = piix_init_dma,
.enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82801AA_1,
init_chipset: piix_init_chipset,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_INTEL,
.device = PCI_DEVICE_ID_INTEL_82801AA_1,
.init_chipset = piix_init_chipset,
.init_channel = piix_init_channel,
.init_dma = piix_init_dma,
.enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82801AB_1,
init_chipset: piix_init_chipset,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_INTEL,
.device = PCI_DEVICE_ID_INTEL_82801AB_1,
.init_chipset = piix_init_chipset,
.init_channel = piix_init_channel,
.init_dma = piix_init_dma,
.enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82801BA_9,
init_chipset: piix_init_chipset,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_INTEL,
.device = PCI_DEVICE_ID_INTEL_82801BA_9,
.init_chipset = piix_init_chipset,
.init_channel = piix_init_channel,
.init_dma = piix_init_dma,
.enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82801BA_8,
init_chipset: piix_init_chipset,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_INTEL,
.device = PCI_DEVICE_ID_INTEL_82801BA_8,
.init_chipset = piix_init_chipset,
.init_channel = piix_init_channel,
.init_dma = piix_init_dma,
.enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82801E_9,
init_chipset: piix_init_chipset,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_INTEL,
.device = PCI_DEVICE_ID_INTEL_82801E_9,
.init_chipset = piix_init_chipset,
.init_channel = piix_init_channel,
.init_dma = piix_init_dma,
.enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82801CA_10,
init_chipset: piix_init_chipset,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_INTEL,
.device = PCI_DEVICE_ID_INTEL_82801CA_10,
.init_chipset = piix_init_chipset,
.init_channel = piix_init_channel,
.init_dma = piix_init_dma,
.enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82801CA_11,
init_chipset: piix_init_chipset,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_INTEL,
.device = PCI_DEVICE_ID_INTEL_82801CA_11,
.init_chipset = piix_init_chipset,
.init_channel = piix_init_channel,
.init_dma = piix_init_dma,
.enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_INTEL,
device: PCI_DEVICE_ID_INTEL_82801DB_9,
init_chipset: piix_init_chipset,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_INTEL,
.device = PCI_DEVICE_ID_INTEL_82801DB_9,
.init_chipset = piix_init_chipset,
.init_channel = piix_init_channel,
.init_dma = piix_init_dma,
.enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_EFAR,
device: PCI_DEVICE_ID_EFAR_SLC90E66_1,
init_chipset: piix_init_chipset,
init_channel: piix_init_channel,
init_dma: piix_init_dma,
enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_EFAR,
.device = PCI_DEVICE_ID_EFAR_SLC90E66_1,
.init_chipset = piix_init_chipset,
.init_channel = piix_init_channel,
.init_dma = piix_init_dma,
.enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
.bootable = ON_BOARD
},
};
......@@ -519,9 +519,8 @@ int __init init_piix(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(chipsets); ++i) {
for (i = 0; i < ARRAY_SIZE(chipsets); ++i)
ata_register_chipset(&chipsets[i]);
}
return 0;
}
......@@ -403,7 +403,7 @@ static inline void do_identify(struct ata_device *drive, u8 cmd)
*/
ata_read(drive, id, SECTOR_WORDS);
ide__sti(); /* local CPU only */
local_irq_enable();
ata_fix_driveid(id);
if (id->word156 == 0x4d42) {
......@@ -616,12 +616,12 @@ static int identify(struct ata_device *drive, u8 cmd)
if (ata_status(drive, DRQ_STAT, BAD_R_STAT)) {
unsigned long flags;
__save_flags(flags); /* local CPU only */
__cli(); /* local CPU only; some systems need this */
local_irq_save(flags); /* some systems need this */
do_identify(drive, cmd); /* drive returned ID */
rc = 0; /* drive responded with ID */
ata_status(drive, 0, 0); /* clear drive IRQ */
__restore_flags(flags); /* local CPU only */
local_irq_restore(flags); /* local CPU only */
} else
rc = 2; /* drive refused ID */
......@@ -733,8 +733,8 @@ static void channel_probe(struct ata_channel *ch)
ch->straight8 = 0;
__save_flags(flags); /* local CPU only */
__sti(); /* local CPU only; needed for jiffies and irq probing */
__save_flags(flags);
local_irq_enable(); /* needed for jiffies and irq probing */
/*
* Check for the presence of a channel by probing for drives on it.
......@@ -852,7 +852,7 @@ static void channel_probe(struct ata_channel *ch)
if (ch->reset)
ata_reset(ch);
__restore_flags(flags); /* local CPU only */
__restore_flags(flags);
/*
* Now setup the PIO transfer modes of the drives on this channel.
......
......@@ -66,12 +66,9 @@ static int q40ide_default_irq(q40ide_ioreg_t base)
}
}
/*
/*
* Probe for Q40 IDE interfaces
*/
void q40ide_init(void)
{
int i;
......
......@@ -51,16 +51,16 @@ static void __init rz1000_init_channel(struct ata_channel *hwif)
/* module data table */
static struct ata_pci_device chipsets[] __initdata = {
{
vendor: PCI_VENDOR_ID_PCTECH,
device: PCI_DEVICE_ID_PCTECH_RZ1000,
init_channel: rz1000_init_channel,
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_PCTECH,
.device = PCI_DEVICE_ID_PCTECH_RZ1000,
.init_channel = rz1000_init_channel,
.bootable = ON_BOARD
},
{
vendor: PCI_VENDOR_ID_PCTECH,
device: PCI_DEVICE_ID_PCTECH_RZ1001,
init_channel: rz1000_init_channel,
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_PCTECH,
.device = PCI_DEVICE_ID_PCTECH_RZ1001,
.init_channel = rz1000_init_channel,
.bootable = ON_BOARD
},
};
......@@ -68,9 +68,8 @@ int __init init_rz1000(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(chipsets); ++i) {
for (i = 0; i < ARRAY_SIZE(chipsets); ++i)
ata_register_chipset(&chipsets[i]);
}
return 0;
}
......
......@@ -394,20 +394,20 @@ static void __init ide_init_svwks(struct ata_channel *hwif)
/* module data table */
static struct ata_pci_device chipsets[] __initdata = {
{
vendor: PCI_VENDOR_ID_SERVERWORKS,
device: PCI_DEVICE_ID_SERVERWORKS_OSB4IDE,
init_chipset: svwks_init_chipset,
init_channel: ide_init_svwks,
bootable: ON_BOARD,
flags: ATA_F_DMA
.vendor = PCI_VENDOR_ID_SERVERWORKS,
.device = PCI_DEVICE_ID_SERVERWORKS_OSB4IDE,
.init_chipset = svwks_init_chipset,
.init_channel = ide_init_svwks,
.bootable = ON_BOARD,
.flags = ATA_F_DMA
},
{
vendor: PCI_VENDOR_ID_SERVERWORKS,
device: PCI_DEVICE_ID_SERVERWORKS_CSB5IDE,
init_chipset: svwks_init_chipset,
init_channel: ide_init_svwks,
bootable: ON_BOARD,
flags: ATA_F_SIMPLEX
.vendor = PCI_VENDOR_ID_SERVERWORKS,
.device = PCI_DEVICE_ID_SERVERWORKS_CSB5IDE,
.init_chipset = svwks_init_chipset,
.init_channel = ide_init_svwks,
.bootable = ON_BOARD,
.flags = ATA_F_SIMPLEX
},
};
......
......@@ -505,12 +505,12 @@ static void __init ide_init_sis5513(struct ata_channel *hwif)
/* module data table */
static struct ata_pci_device chipset __initdata = {
vendor: PCI_VENDOR_ID_SI,
device: PCI_DEVICE_ID_SI_5513,
init_chipset: pci_init_sis5513,
init_channel: ide_init_sis5513,
enablebits: {{0x4a,0x02,0x02}, {0x4a,0x04,0x04} },
bootable: ON_BOARD,
.vendor = PCI_VENDOR_ID_SI,
.device = PCI_DEVICE_ID_SI_5513,
.init_chipset = pci_init_sis5513,
.init_channel = ide_init_sis5513,
.enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04} },
.bootable = ON_BOARD,
};
int __init init_sis5513(void)
......
......@@ -360,13 +360,13 @@ static void __init sl82c105_init_channel(struct ata_channel *ch)
/* module data table */
static struct ata_pci_device chipset __initdata = {
vendor: PCI_VENDOR_ID_WINBOND,
device: PCI_DEVICE_ID_WINBOND_82C105,
init_chipset: sl82c105_init_chipset,
init_channel: sl82c105_init_channel,
init_dma: sl82c105_init_dma,
enablebits: { {0x40,0x01,0x01}, {0x40,0x10,0x10} },
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_WINBOND,
.device = PCI_DEVICE_ID_WINBOND_82C105,
.init_chipset = sl82c105_init_chipset,
.init_channel = sl82c105_init_channel,
.init_dma = sl82c105_init_dma,
.enablebits = { {0x40,0x01,0x01}, {0x40,0x10,0x10} },
.bootable = ON_BOARD
};
int __init init_sl82c105(void)
......
......@@ -61,7 +61,7 @@ static ide_startstop_t tcq_nop_handler(struct ata_device *drive, struct request
struct ata_taskfile *args = rq->special;
struct ata_channel *ch = drive->channel;
ide__sti();
local_irq_enable();
spin_lock_irqsave(ch->lock, flags);
......
......@@ -151,8 +151,7 @@ static void trm290_prepare_drive(struct ata_device *drive, unsigned int use_dma)
/* select PIO or DMA */
reg = use_dma ? (0x21 | 0x82) : (0x21 & ~0x82);
__save_flags(flags); /* local CPU only */
__cli(); /* local CPU only */
local_irq_save(flags);
if (reg != hwif->select_data) {
hwif->select_data = reg;
......@@ -167,7 +166,7 @@ static void trm290_prepare_drive(struct ata_device *drive, unsigned int use_dma)
outw(reg, hwif->config_data+3);
}
__restore_flags(flags); /* local CPU only */
local_irq_restore(flags);
}
static void trm290_selectproc(struct ata_device *drive)
......@@ -266,8 +265,7 @@ static void __init trm290_init_channel(struct ata_channel *hwif)
printk("TRM290: using default config base at 0x%04lx\n", hwif->config_data);
}
__save_flags(flags); /* local CPU only */
__cli(); /* local CPU only */
local_irq_save(flags);
/* put config reg into first byte of hwif->select_data */
outb(0x51|(hwif->unit<<3), hwif->config_data+1);
hwif->select_data = 0x21; /* select PIO as default */
......@@ -275,7 +273,7 @@ static void __init trm290_init_channel(struct ata_channel *hwif)
reg = inb(hwif->config_data+3); /* get IRQ info */
reg = (reg & 0x10) | 0x03; /* mask IRQs for both ports */
outb(reg, hwif->config_data+3);
__restore_flags(flags); /* local CPU only */
local_irq_restore(flags);
if ((reg & 0x10))
hwif->irq = hwif->unit ? 15 : 14; /* legacy mode */
......@@ -327,10 +325,10 @@ static void __init trm290_init_channel(struct ata_channel *hwif)
/* module data table */
static struct ata_pci_device chipset __initdata = {
vendor: PCI_VENDOR_ID_TEKRAM,
device: PCI_DEVICE_ID_TEKRAM_DC290,
init_channel: trm290_init_channel,
bootable: ON_BOARD
.vendor = PCI_VENDOR_ID_TEKRAM,
.device = PCI_DEVICE_ID_TEKRAM_DC290,
.init_channel = trm290_init_channel,
.bootable = ON_BOARD
};
int __init init_trm290(void)
......
......@@ -127,30 +127,29 @@ void __init init_umc8672(void) /* called from ide.c */
{
unsigned long flags;
__save_flags(flags); /* local CPU only */
__cli(); /* local CPU only */
local_irq_save(flags);
if (!request_region(0x108, 2, "umc8672")) {
__restore_flags(flags);
local_irq_restore(flags);
printk("\numc8672: PORTS 0x108-0x109 ALREADY IN USE\n");
return;
}
outb_p (0x5A,0x108); /* enable umc */
if (in_umc (0xd5) != 0xa0)
{
__restore_flags(flags); /* local CPU only */
local_irq_restore(flags);
release_region(0x108, 2);
printk ("umc8672: not found\n");
return;
}
outb_p (0xa5,0x108); /* disable umc */
umc_set_speeds (current_speeds);
__restore_flags(flags); /* local CPU only */
umc_set_speeds(current_speeds);
local_irq_restore(flags);
ide_hwifs[0].chipset = ide_umc8672;
ide_hwifs[1].chipset = ide_umc8672;
ide_hwifs[0].tuneproc = &tune_umc;
ide_hwifs[1].tuneproc = &tune_umc;
ide_hwifs[0].tuneproc = tune_umc;
ide_hwifs[1].tuneproc = tune_umc;
ide_hwifs[0].unit = ATA_PRIMARY;
ide_hwifs[1].unit = ATA_SECONDARY;
}
......@@ -380,22 +380,22 @@ static void __init via82cxxx_init_dma(struct ata_channel *hwif, unsigned long dm
/* module data table */
static struct ata_pci_device chipsets[] __initdata = {
{
vendor: PCI_VENDOR_ID_VIA,
device: PCI_DEVICE_ID_VIA_82C576_1,
init_chipset: via82cxxx_init_chipset,
init_channel: via82cxxx_init_channel,
init_dma: via82cxxx_init_dma,
enablebits: {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
bootable: ON_BOARD,
.vendor = PCI_VENDOR_ID_VIA,
.device = PCI_DEVICE_ID_VIA_82C576_1,
.init_chipset = via82cxxx_init_chipset,
.init_channel = via82cxxx_init_channel,
.init_dma = via82cxxx_init_dma,
.enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
.bootable = ON_BOARD,
},
{
vendor: PCI_VENDOR_ID_VIA,
device: PCI_DEVICE_ID_VIA_82C586_1,
init_chipset: via82cxxx_init_chipset,
init_channel: via82cxxx_init_channel,
init_dma: via82cxxx_init_dma,
enablebits: {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
bootable: ON_BOARD,
.vendor = PCI_VENDOR_ID_VIA,
.device = PCI_DEVICE_ID_VIA_82C586_1,
.init_chipset = via82cxxx_init_chipset,
.init_channel = via82cxxx_init_channel,
.init_dma = via82cxxx_init_dma,
.enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
.bootable = ON_BOARD,
},
};
......@@ -403,9 +403,8 @@ int __init init_via82cxxx(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(chipsets); ++i) {
for (i = 0; i < ARRAY_SIZE(chipsets); ++i)
ata_register_chipset(&chipsets[i]);
}
return 0;
}
......@@ -318,10 +318,11 @@ static ide_startstop_t idescsi_pc_intr(struct ata_device *drive, struct request
if (ata_status(drive, 0, DRQ_STAT)) { /* No more interrupts */
if (test_bit(IDESCSI_LOG_CMD, &scsi->log))
printk (KERN_INFO "Packet command completed, %d bytes transferred\n", pc->actually_transferred);
ide__sti();
local_irq_enable();
if (drive->status & ERR_STAT)
rq->errors++;
idescsi_end_request(drive, rq, 1);
return ATA_OP_FINISHED;
}
bcount = IN_BYTE (IDE_BCOUNTH_REG) << 8 | IN_BYTE (IDE_BCOUNTL_REG);
......
......@@ -19,8 +19,6 @@
#define MAX_HWIFS 4
#endif
#define ide__sti() __sti()
static __inline__ int ide_default_irq(ide_ioreg_t base)
{
switch (base) {
......
......@@ -17,8 +17,6 @@
#define MAX_HWIFS 4
#endif
#define ide__sti() __sti()
#include <asm/arch/ide.h>
/*
......
......@@ -22,8 +22,6 @@
#define MAX_HWIFS 4
#define ide__sti() __sti()
static __inline__ int ide_default_irq(ide_ioreg_t base)
{
/* all IDE busses share the same IRQ, number 4.
......
......@@ -23,8 +23,6 @@
# endif
#endif
#define ide__sti() __sti()
static __inline__ int ide_default_irq(ide_ioreg_t base)
{
switch (base) {
......
......@@ -25,8 +25,6 @@
# endif
#endif
#define ide__sti() __sti()
static __inline__ int
ide_default_irq (ide_ioreg_t base)
{
......
......@@ -171,36 +171,5 @@ static __inline__ void ide_get_lock (int *ide_lock, void (*handler)(int, void *,
}
}
#endif /* CONFIG_ATARI */
/*
* On the Atari, we sometimes can't enable interrupts:
*/
/* MSch: changed sti() to STI() wherever possible in ide.c; moved STI() def.
* to asm/ide.h
*/
/* The Atari interrupt structure strictly requires that the IPL isn't lowered
* uncontrolled in an interrupt handler. In the concrete case, the IDE
* interrupt is already a slow int, so the irq is already disabled at the time
* the handler is called, and the IPL has been lowered to the minimum value
* possible. To avoid going below that, STI() checks for being called inside
* an interrupt, and in that case it does nothing. Hope that is reasonable and
* works. (Roman)
*/
#ifdef MACH_ATARI_ONLY
#define ide__sti() \
do { \
if (!in_interrupt()) __sti(); \
} while(0)
#elif defined(CONFIG_ATARI)
#define ide__sti() \
do { \
if (!MACH_IS_ATARI || !in_interrupt()) sti(); \
} while(0)
#else /* !defined(CONFIG_ATARI) */
#define ide__sti() __sti()
#endif
#endif /* __KERNEL__ */
#endif /* _M68K_IDE_H */
......@@ -24,8 +24,6 @@
# endif
#endif
#define ide__sti() __sti()
struct ide_ops {
int (*ide_default_irq)(ide_ioreg_t base);
ide_ioreg_t (*ide_default_io_base)(int index);
......
......@@ -27,8 +27,6 @@
# endif
#endif
#define ide__sti() __sti()
struct ide_ops {
int (*ide_default_irq)(ide_ioreg_t base);
ide_ioreg_t (*ide_default_io_base)(int index);
......
......@@ -19,8 +19,6 @@
#define MAX_HWIFS 10
#endif
#define ide__sti() __sti()
static __inline__ int ide_default_irq(ide_ioreg_t base)
{
switch (base) {
......
......@@ -44,8 +44,6 @@ extern struct ide_machdep_calls ppc_ide_md;
#undef SUPPORT_SLOW_DATA_PORTS
#define SUPPORT_SLOW_DATA_PORTS 0
#define ide__sti() __sti()
static __inline__ int ide_default_irq(ide_ioreg_t base)
{
if (ppc_ide_md.default_irq)
......
......@@ -19,11 +19,9 @@
#ifdef __KERNEL__
#ifndef MAX_HWIFS
#define MAX_HWIFS 4
# define MAX_HWIFS 4
#endif
#define ide__sti() __sti()
static __inline__ int ide_default_irq(ide_ioreg_t base) { return 0; }
static __inline__ ide_ioreg_t ide_default_io_base(int index) { return 0; }
......
......@@ -15,8 +15,6 @@
#define MAX_HWIFS 0
#endif
#define ide__sti() do {} while (0)
/*
* We always use the new IDE port registering,
* so these are fixed here.
......
/*
* linux/include/asm-s390/ide.h
*
* Copyright (C) 1994-1996 Linus Torvalds & authors
*/
/* s390 does not have IDE */
#ifndef __ASMS390_IDE_H
#define __ASMS390_IDE_H
#ifdef __KERNEL__
#ifndef MAX_HWIFS
#define MAX_HWIFS 0
#endif
#define ide__sti() do {} while (0)
/*
* We always use the new IDE port registering,
* so these are fixed here.
*/
#define ide_default_io_base(i) ((ide_ioreg_t)0)
#define ide_default_irq(b) (0)
#endif /* __KERNEL__ */
#endif /* __ASMS390_IDE_H */
......@@ -22,8 +22,6 @@
#define MAX_HWIFS 2
#endif
#define ide__sti() __sti()
static __inline__ int ide_default_irq_hp600(ide_ioreg_t base)
{
switch (base) {
......
......@@ -20,8 +20,6 @@
#undef MAX_HWIFS
#define MAX_HWIFS 2
#define ide__sti() __sti()
static __inline__ int ide_default_irq(ide_ioreg_t base)
{
return 0;
......
......@@ -20,8 +20,6 @@
#undef MAX_HWIFS
#define MAX_HWIFS 2
#define ide__sti() __sti()
static __inline__ int ide_default_irq(ide_ioreg_t base)
{
return 0;
......
......@@ -23,8 +23,6 @@
# endif
#endif
#define ide__sti() __sti()
static __inline__ int ide_default_irq(ide_ioreg_t base)
{
switch (base) {
......
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