Commit efa1546d authored by Anton Altaparmakov's avatar Anton Altaparmakov

Merge bk://linus.bkbits.net/linux-2.5 into cantab.net:/usr/src/tng

parents f17b9748 bdff23c1
......@@ -4,7 +4,7 @@
*/
OUTPUT_ARCH(arm)
ENTRY(stext)
jiffies = jiffies_64 + 4;
jiffies = jiffies_64;
SECTIONS
{
. = TEXTADDR;
......
......@@ -4,7 +4,7 @@
*/
OUTPUT_ARCH(arm)
ENTRY(stext)
jiffies = jiffies_64 + 4;
jiffies = jiffies_64;
SECTIONS
{
. = TEXTADDR;
......
......@@ -29,13 +29,15 @@
#include <asm/prom.h>
#include <asm/uaccess.h>
#include <asm/mediabay.h>
#include <asm/feature.h>
#include <asm/machdep.h>
#include <asm/pmac_feature.h>
#define MAJOR_NR FLOPPY_MAJOR
#include <linux/blk.h>
#include <linux/devfs_fs_kernel.h>
static int floppy_sizes[2] = {2880,2880};
static int floppy_blocksizes[2] = {512,512};
static int floppy_sizes[2] = {1440,1440};
#define MAX_FLOPPIES 2
......@@ -312,10 +314,10 @@ static void start_request(struct floppy_state *fs)
return;
}
while (!QUEUE_EMPTY && fs->state == idle) {
if (MAJOR(CURRENT->rq_dev) != MAJOR_NR)
if (major(CURRENT->rq_dev) != MAJOR_NR)
panic(DEVICE_NAME ": request list destroyed");
if (CURRENT->bh && !buffer_locked(CURRENT->bh))
panic(DEVICE_NAME ": block not locked");
// if (CURRENT->bh && !buffer_locked(CURRENT->bh))
// panic(DEVICE_NAME ": block not locked");
#if 0
printk("do_fd_req: dev=%x cmd=%d sec=%ld nr_sec=%ld buf=%p\n",
kdev_t_to_nr(CURRENT->rq_dev), CURRENT->cmd,
......@@ -337,7 +339,7 @@ static void start_request(struct floppy_state *fs)
continue;
}
if (CURRENT->cmd == WRITE) {
if (rq_data_dir(CURRENT) == WRITE) {
if (fs->write_prot < 0)
fs->write_prot = swim3_readbit(fs, WRITE_PROT);
if (fs->write_prot) {
......@@ -425,7 +427,7 @@ static inline void setup_transfer(struct floppy_state *fs)
printk(KERN_ERR "swim3: transfer 0 sectors?\n");
return;
}
if (CURRENT->cmd == WRITE)
if (rq_data_dir(CURRENT) == WRITE)
n = 1;
else {
n = fs->secpertrack - fs->req_sector + 1;
......@@ -438,21 +440,21 @@ static inline void setup_transfer(struct floppy_state *fs)
out_8(&sw->nsect, n);
out_8(&sw->gap3, 0);
st_le32(&dr->cmdptr, virt_to_bus(cp));
if (CURRENT->cmd == WRITE) {
if (rq_data_dir(CURRENT) == WRITE) {
/* Set up 3 dma commands: write preamble, data, postamble */
init_dma(cp, OUTPUT_MORE, write_preamble, sizeof(write_preamble));
++cp;
init_dma(cp, OUTPUT_MORE, CURRENT->buffer, 512);
++cp;
init_dma(cp, OUTPUT_MORE, write_postamble, sizeof(write_postamble));
init_dma(cp, OUTPUT_LAST, write_postamble, sizeof(write_postamble));
} else {
init_dma(cp, INPUT_MORE, CURRENT->buffer, n * 512);
init_dma(cp, INPUT_LAST, CURRENT->buffer, n * 512);
}
++cp;
out_le16(&cp->command, DBDMA_STOP);
out_le32(&dr->control, (RUN << 16) | RUN);
out_8(&sw->control_bis,
(CURRENT->cmd == WRITE? WRITE_SECTORS: 0) | DO_ACTION);
(rq_data_dir(CURRENT) == WRITE? WRITE_SECTORS: 0) | DO_ACTION);
/* enable intr when transfer complete */
out_8(&sw->intr_enable, ERROR_INTR | TRANSFER_DONE);
set_timeout(fs, 2*HZ, xfer_timeout); /* enable timeout */
......@@ -591,7 +593,7 @@ static void xfer_timeout(unsigned long data)
out_8(&sw->intr_enable, 0);
out_8(&sw->control_bic, WRITE_SECTORS | DO_ACTION);
out_8(&sw->select, RELAX);
if (CURRENT->cmd == WRITE)
if (rq_data_dir(CURRENT) == WRITE)
++cp;
if (ld_le16(&cp->xfer_status) != 0)
s = fs->scount - ((ld_le16(&cp->res_count) + 511) >> 9);
......@@ -600,7 +602,7 @@ static void xfer_timeout(unsigned long data)
CURRENT->sector += s;
CURRENT->current_nr_sectors -= s;
printk(KERN_ERR "swim3: timeout %sing sector %ld\n",
(CURRENT->cmd==WRITE? "writ": "read"), CURRENT->sector);
(rq_data_dir(CURRENT)==WRITE? "writ": "read"), CURRENT->sector);
end_request(0);
fs->state = idle;
start_request(fs);
......@@ -621,8 +623,8 @@ static void swim3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
printk("swim3 intr state=%d intr=%x err=%x\n", fs->state, intr, err);
#endif
if ((intr & ERROR_INTR) && fs->state != do_transfer)
printk(KERN_ERR "swim3_interrupt, state=%d, cmd=%x, intr=%x, err=%x\n",
fs->state, CURRENT->cmd, intr, err);
printk(KERN_ERR "swim3_interrupt, state=%d, dir=%lx, intr=%x, err=%x\n",
fs->state, rq_data_dir(CURRENT), intr, err);
switch (fs->state) {
case locating:
if (intr & SEEN_SECTOR) {
......@@ -678,13 +680,16 @@ static void swim3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
break;
dr = fs->dma;
cp = fs->dma_cmd;
st_le32(&dr->control, RUN << 16);
/* We must wait a bit for dbdma to complete */
for (n=0; (in_le32(&dr->status) & ACTIVE) && n < 1000; n++)
udelay(10);
DBDMA_DO_STOP(dr);
out_8(&sw->intr_enable, 0);
out_8(&sw->control_bic, WRITE_SECTORS | DO_ACTION);
out_8(&sw->select, RELAX);
del_timer(&fs->timeout);
fs->timeout_pending = 0;
if (CURRENT->cmd == WRITE)
if (rq_data_dir(CURRENT) == WRITE)
++cp;
stat = ld_le16(&cp->xfer_status);
resid = ld_le16(&cp->res_count);
......@@ -701,7 +706,7 @@ static void swim3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
act(fs);
} else {
printk("swim3: error %sing block %ld (err=%x)\n",
CURRENT->cmd == WRITE? "writ": "read",
rq_data_dir(CURRENT) == WRITE? "writ": "read",
CURRENT->sector, err);
end_request(0);
fs->state = idle;
......@@ -710,8 +715,8 @@ static void swim3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
if ((stat & ACTIVE) == 0 || resid != 0) {
/* musta been an error */
printk(KERN_ERR "swim3: fd dma: stat=%x resid=%d\n", stat, resid);
printk(KERN_ERR " state=%d, cmd=%x, intr=%x, err=%x\n",
fs->state, CURRENT->cmd, intr, err);
printk(KERN_ERR " state=%d, dir=%lx, intr=%x, err=%x\n",
fs->state, rq_data_dir(CURRENT), intr, err);
end_request(0);
fs->state = idle;
start_request(fs);
......@@ -815,7 +820,7 @@ static int floppy_ioctl(struct inode *inode, struct file *filp,
{
struct floppy_state *fs;
int err;
int devnum = MINOR(inode->i_rdev);
int devnum = minor(inode->i_rdev);
if (devnum >= floppy_count)
return -ENODEV;
......@@ -847,7 +852,7 @@ static int floppy_open(struct inode *inode, struct file *filp)
struct floppy_state *fs;
volatile struct swim3 *sw;
int n, err;
int devnum = MINOR(inode->i_rdev);
int devnum = minor(inode->i_rdev);
if (devnum >= floppy_count)
return -ENODEV;
......@@ -921,7 +926,7 @@ static int floppy_release(struct inode *inode, struct file *filp)
{
struct floppy_state *fs;
volatile struct swim3 *sw;
int devnum = MINOR(inode->i_rdev);
int devnum = minor(inode->i_rdev);
if (devnum >= floppy_count)
return -ENODEV;
......@@ -938,9 +943,9 @@ static int floppy_release(struct inode *inode, struct file *filp)
static int floppy_check_change(kdev_t dev)
{
struct floppy_state *fs;
int devnum = MINOR(dev);
int devnum = minor(dev);
if (MAJOR(dev) != MAJOR_NR || (devnum >= floppy_count))
if (major(dev) != MAJOR_NR || (devnum >= floppy_count))
return 0;
fs = &floppy_states[devnum];
......@@ -952,9 +957,9 @@ static int floppy_revalidate(kdev_t dev)
struct floppy_state *fs;
volatile struct swim3 *sw;
int ret, n;
int devnum = MINOR(dev);
int devnum = minor(dev);
if (MAJOR(dev) != MAJOR_NR || (devnum >= floppy_count))
if (major(dev) != MAJOR_NR || (devnum >= floppy_count))
return 0;
fs = &floppy_states[devnum];
......@@ -1031,8 +1036,8 @@ int swim3_init(void)
MAJOR_NR);
return -EBUSY;
}
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_fd_request,
&swim3_lock);
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,&swim3_lock);
blksize_size[MAJOR_NR] = floppy_blocksizes;
blk_size[MAJOR_NR] = floppy_sizes;
}
......@@ -1060,9 +1065,14 @@ static int swim3_add_device(struct device_node *swim)
return -EINVAL;
}
if (!request_OF_resource(swim, 0, NULL)) {
printk(KERN_INFO "swim3: can't request IO resource !\n");
return -EINVAL;
}
mediabay = (strcasecmp(swim->parent->type, "media-bay") == 0) ? swim->parent : NULL;
if (mediabay == NULL)
feature_set(swim, FEATURE_SWIM3_enable);
pmac_call_feature(PMAC_FTR_SWIM3_ENABLE, swim, 0, 1);
memset(fs, 0, sizeof(*fs));
fs->state = idle;
......@@ -1084,14 +1094,14 @@ static int swim3_add_device(struct device_node *swim)
if (request_irq(fs->swim3_intr, swim3_interrupt, 0, "SWIM3", fs)) {
printk(KERN_ERR "Couldn't get irq %d for SWIM3\n", fs->swim3_intr);
feature_clear(swim, FEATURE_SWIM3_enable);
pmac_call_feature(PMAC_FTR_SWIM3_ENABLE, swim, 0, 0);
return -EBUSY;
}
/*
if (request_irq(fs->dma_intr, fd_dma_interrupt, 0, "SWIM3-dma", fs)) {
printk(KERN_ERR "Couldn't get irq %d for SWIM3 DMA",
fs->dma_intr);
feature_clear(swim, FEATURE_SWIM3_enable);
pmac_call_feature(PMAC_FTR_SWIM3_ENABLE, swim, 0, 0);
return -EBUSY;
}
*/
......
......@@ -670,8 +670,8 @@ static void hpt366_tune_chipset(struct ata_device *drive, byte speed)
* Disable the "fast interrupt" prediction.
*/
pci_read_config_byte(dev, regfast, &drive_fast);
if (drive_fast & 0x02)
pci_write_config_byte(dev, regfast, drive_fast & ~0x20);
if (drive_fast & 0x80)
pci_write_config_byte(dev, regfast, drive_fast & ~0x80);
pci_read_config_dword(dev, regtime, &reg1);
reg2 = pci_bus_clock_list(speed,
......
......@@ -594,7 +594,7 @@ static int cdrom_decode_status(ide_startstop_t *startstop, struct ata_device *dr
pc = (struct packet_command *) rq->special;
pc->stat = 1;
cdrom_end_request(drive, rq, 1);
*startstop = ide_error (drive, "request sense failure", stat);
*startstop = ide_error (drive, rq, "request sense failure", stat);
return 1;
} else if (rq->flags & (REQ_PC | REQ_BLOCK_PC)) {
......@@ -614,7 +614,7 @@ static int cdrom_decode_status(ide_startstop_t *startstop, struct ata_device *dr
return 0;
} else if (!pc->quiet) {
/* Otherwise, print an error. */
ide_dump_status(drive, "packet command error", stat);
ide_dump_status(drive, rq, "packet command error", stat);
}
/* Set the error flag and complete the request.
......@@ -662,18 +662,18 @@ static int cdrom_decode_status(ide_startstop_t *startstop, struct ata_device *dr
sense_key == DATA_PROTECT) {
/* No point in retrying after an illegal
request or data protect error.*/
ide_dump_status (drive, "command error", stat);
ide_dump_status(drive, rq, "command error", stat);
cdrom_end_request(drive, rq, 0);
} else if (sense_key == MEDIUM_ERROR) {
/* No point in re-trying a zillion times on a bad
* sector. The error is not correctable at all.
*/
ide_dump_status (drive, "media error (bad sector)", stat);
ide_dump_status(drive, rq, "media error (bad sector)", stat);
cdrom_end_request(drive, rq, 0);
} else if ((err & ~ABRT_ERR) != 0) {
/* Go to the default handler
for other errors. */
*startstop = ide_error (drive, __FUNCTION__, stat);
*startstop = ide_error(drive, rq, __FUNCTION__, stat);
return 1;
} else if ((++rq->errors > ERROR_MAX)) {
/* We've racked up too many retries. Abort. */
......@@ -732,7 +732,7 @@ static ide_startstop_t cdrom_start_packet_command(struct ata_device *drive,
struct cdrom_info *info = drive->driver_data;
/* Wait for the controller to be idle. */
if (ide_wait_stat(&startstop, drive, 0, BUSY_STAT, WAIT_READY))
if (ide_wait_stat(&startstop, drive, rq, 0, BUSY_STAT, WAIT_READY))
return startstop;
if (info->dma) {
......@@ -789,7 +789,7 @@ static ide_startstop_t cdrom_transfer_packet_command(struct ata_device *drive,
return startstop;
} else {
/* Otherwise, we must wait for DRQ to get set. */
if (ide_wait_stat(&startstop, drive, DRQ_STAT, BUSY_STAT, WAIT_READY))
if (ide_wait_stat(&startstop, drive, rq, DRQ_STAT, BUSY_STAT, WAIT_READY))
return startstop;
}
......@@ -917,7 +917,7 @@ static ide_startstop_t cdrom_read_intr(struct ata_device *drive, struct request
__ide_end_request(drive, rq, 1, rq->nr_sectors);
return ide_stopped;
} else
return ide_error (drive, "dma error", stat);
return ide_error (drive, rq, "dma error", stat);
}
/* Read the interrupt reason and the transfer length. */
......@@ -1496,7 +1496,7 @@ static ide_startstop_t cdrom_write_intr(struct ata_device *drive, struct request
*/
if (dma) {
if (dma_error)
return ide_error(drive, "dma error", stat);
return ide_error(drive, rq, "dma error", stat);
__ide_end_request(drive, rq, 1, rq->nr_sectors);
return ide_stopped;
......@@ -2659,12 +2659,6 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
return nslots;
}
static void ide_cdrom_add_settings(ide_drive_t *drive)
{
ide_add_setting(drive, "dsc_overlap",
SETTING_RW, -1, -1, TYPE_BYTE, 0, 1, 1, 1, &drive->dsc_overlap, NULL);
}
static
int ide_cdrom_setup(ide_drive_t *drive)
{
......@@ -2798,7 +2792,7 @@ int ide_cdrom_setup(ide_drive_t *drive)
info->devinfo.handle = NULL;
return 1;
}
ide_cdrom_add_settings(drive);
return 0;
}
......
......@@ -472,12 +472,6 @@ static int set_nowerr(struct ata_device *drive, int arg)
drive->nowerr = arg;
drive->bad_wstat = arg ? BAD_R_STAT : BAD_W_STAT;
/* FIXME: I'm less then sure that we are under the global request lock here!
*/
#if 0
spin_unlock_irq(&ide_lock);
#endif
return 0;
}
......@@ -531,8 +525,10 @@ static int set_using_tcq(struct ata_device *drive, int arg)
{
if (!drive->driver)
return -EPERM;
if (!drive->channel->XXX_udma)
return -EPERM;
if (arg == drive->queue_depth && drive->using_tcq)
return 0;
......@@ -568,20 +564,6 @@ static int set_lba_addressing(struct ata_device *drive, int arg)
return (probe_lba_addressing(drive, arg));
}
static void idedisk_add_settings(struct ata_device *drive)
{
struct hd_driveid *id = drive->id;
ide_add_setting(drive, "address", SETTING_RW, HDIO_GET_ADDRESS, HDIO_SET_ADDRESS, TYPE_INTA, 0, 2, 1, 1, &drive->addressing, set_lba_addressing);
ide_add_setting(drive, "multcount", id ? SETTING_RW : SETTING_READ, HDIO_GET_MULTCOUNT, HDIO_SET_MULTCOUNT, TYPE_BYTE, 0, id ? id->max_multsect : 0, 1, 1, &drive->mult_count, set_multcount);
ide_add_setting(drive, "nowerr", SETTING_RW, HDIO_GET_NOWERR, HDIO_SET_NOWERR, TYPE_BYTE, 0, 1, 1, 1, &drive->nowerr, set_nowerr);
ide_add_setting(drive, "wcache", SETTING_RW, HDIO_GET_WCACHE, HDIO_SET_WCACHE, TYPE_BYTE, 0, 1, 1, 1, &drive->wcache, write_cache);
ide_add_setting(drive, "acoustic", SETTING_RW, HDIO_GET_ACOUSTIC, HDIO_SET_ACOUSTIC, TYPE_BYTE, 0, 254, 1, 1, &drive->acoustic, set_acoustic);
#ifdef CONFIG_BLK_DEV_IDE_TCQ
ide_add_setting(drive, "using_tcq", SETTING_RW, HDIO_GET_QDMA, HDIO_SET_QDMA, TYPE_BYTE, 0, IDE_MAX_TAG, 1, 1, &drive->using_tcq, set_using_tcq);
#endif
}
static int idedisk_suspend(struct device *dev, u32 state, u32 level)
{
struct ata_device *drive = dev->driver_data;
......@@ -624,9 +606,6 @@ static int idedisk_resume(struct device *dev, u32 level)
/* This is just a hook for the overall driver tree.
*
* FIXME: This is soon goig to replace the custom linked list games played up
* to great extend between the different components of the IDE drivers.
*/
static struct device_driver idedisk_devdrv = {
......@@ -783,8 +762,6 @@ static void idedisk_setup(struct ata_device *drive)
sector_t set_max;
int drvid = -1;
idedisk_add_settings(drive);
if (id == NULL)
return;
......@@ -1022,6 +999,159 @@ static int idedisk_cleanup(struct ata_device *drive)
return ide_unregister_subdriver(drive);
}
static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
struct hd_driveid *id = drive->id;
switch (cmd) {
case HDIO_GET_ADDRESS: {
unsigned long val = drive->addressing;
if (put_user(val, (unsigned long *) arg))
return -EFAULT;
return 0;
}
case HDIO_SET_ADDRESS: {
int val;
if (arg < 0 || arg > 2)
return -EINVAL;
if (ide_spin_wait_hwgroup(drive))
return -EBUSY;
val = set_lba_addressing(drive, arg);
spin_unlock_irq(&ide_lock);
return val;
}
case HDIO_GET_MULTCOUNT: {
unsigned long val = drive->mult_count & 0xFF;
if (put_user(val, (unsigned long *) arg))
return -EFAULT;
return 0;
}
case HDIO_SET_MULTCOUNT: {
int val;
if (!id)
return -EBUSY;
if (arg < 0 || arg > (id ? id->max_multsect : 0))
return -EINVAL;
if (ide_spin_wait_hwgroup(drive))
return -EBUSY;
val = set_multcount(drive, arg);
spin_unlock_irq(&ide_lock);
return val;
}
case HDIO_GET_NOWERR: {
unsigned long val = drive->nowerr;
if (put_user(val, (unsigned long *) arg))
return -EFAULT;
return 0;
}
case HDIO_SET_NOWERR: {
int val;
if (arg < 0 || arg > 1)
return -EINVAL;
if (ide_spin_wait_hwgroup(drive))
return -EBUSY;
val = set_nowerr(drive, arg);
spin_unlock_irq(&ide_lock);
return val;
}
case HDIO_GET_WCACHE: {
unsigned long val = drive->wcache;
if (put_user(val, (unsigned long *) arg))
return -EFAULT;
return 0;
}
case HDIO_SET_WCACHE: {
int val;
if (arg < 0 || arg > 1)
return -EINVAL;
if (ide_spin_wait_hwgroup(drive))
return -EBUSY;
val = write_cache(drive, arg);
spin_unlock_irq(&ide_lock);
return val;
}
case HDIO_GET_ACOUSTIC: {
u8 val = drive->acoustic;
if (put_user(val, (u8 *) arg))
return -EFAULT;
return 0;
}
case HDIO_SET_ACOUSTIC: {
int val;
if (arg < 0 || arg > 254)
return -EINVAL;
if (ide_spin_wait_hwgroup(drive))
return -EBUSY;
val = set_acoustic(drive, arg);
spin_unlock_irq(&ide_lock);
return val;
}
#ifdef CONFIG_BLK_DEV_IDE_TCQ
case HDIO_GET_QDMA: {
u8 val = drive->using_tcq;
if (put_user(val, (u8 *) arg))
return -EFAULT;
return 0;
}
case HDIO_SET_QDMA: {
int val;
if (arg < 0 || arg > IDE_MAX_TAG)
return -EINVAL;
if (ide_spin_wait_hwgroup(drive))
return -EBUSY;
val = set_using_tcq(drive, arg);
spin_unlock_irq(&ide_lock);
return val;
}
#endif
default:
return -EINVAL;
}
}
/*
* IDE subdriver functions, registered with ide.c
*/
......@@ -1031,7 +1161,7 @@ static struct ata_operations idedisk_driver = {
standby: idedisk_standby,
do_request: idedisk_do_request,
end_request: NULL,
ioctl: NULL,
ioctl: idedisk_ioctl,
open: idedisk_open,
release: idedisk_release,
check_media_change: idedisk_check_media_change,
......
......@@ -208,7 +208,7 @@ ide_startstop_t ide_dma_intr(struct ata_device *drive, struct request *rq)
printk(KERN_ERR "%s: dma_intr: bad DMA status (dma_stat=%x)\n",
drive->name, dma_stat);
}
return ide_error(drive, "dma_intr", stat);
return ide_error(drive, rq, "dma_intr", stat);
}
/*
......@@ -375,7 +375,7 @@ static int config_drive_for_dma(struct ata_device *drive)
/*
* 1 dma-ing, 2 error, 4 intr
*/
static int dma_timer_expiry(struct ata_device *drive, struct request *__rq)
static int dma_timer_expiry(struct ata_device *drive, struct request *rq)
{
/* FIXME: What's that? */
u8 dma_stat = inb(drive->channel->dma_base+2);
......@@ -390,7 +390,7 @@ static int dma_timer_expiry(struct ata_device *drive, struct request *__rq)
if (dma_stat & 2) { /* ERROR */
u8 stat = GET_STAT();
return ide_error(drive, "dma_timer_expiry", stat);
return ide_error(drive, rq, "dma_timer_expiry", stat);
}
if (dma_stat & 1) /* DMAing */
return WAIT_CMD;
......
......@@ -393,7 +393,7 @@ int ide_config_drive_speed (ide_drive_t *drive, byte speed)
enable_irq(hwif->irq);
if (error) {
ide_dump_status(drive, "set_drive_speed_status", stat);
ide_dump_status(drive, NULL, "set_drive_speed_status", stat);
return error;
}
......
......@@ -692,7 +692,7 @@ static int idefloppy_end_request(struct ata_device *drive, struct request *rq, i
return 0;
}
rq->errors = error;
ide_end_drive_cmd (drive, 0, 0);
ide_end_drive_cmd (drive, rq, 0, 0);
return 0;
}
......@@ -1006,7 +1006,7 @@ static ide_startstop_t idefloppy_transfer_pc(struct ata_device *drive, struct re
idefloppy_floppy_t *floppy = drive->driver_data;
idefloppy_ireason_reg_t ireason;
if (ide_wait_stat (&startstop,drive,DRQ_STAT,BUSY_STAT,WAIT_READY)) {
if (ide_wait_stat (&startstop, drive, rq, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
printk (KERN_ERR "ide-floppy: Strange, packet command initiated yet DRQ isn't asserted\n");
return startstop;
}
......@@ -1043,13 +1043,13 @@ static int idefloppy_transfer_pc2(struct ata_device *drive, struct request *__rq
return IDEFLOPPY_WAIT_CMD; /* Timeout for the packet command */
}
static ide_startstop_t idefloppy_transfer_pc1(struct ata_device *drive, struct request *__rq)
static ide_startstop_t idefloppy_transfer_pc1(struct ata_device *drive, struct request *rq)
{
idefloppy_floppy_t *floppy = drive->driver_data;
ide_startstop_t startstop;
idefloppy_ireason_reg_t ireason;
if (ide_wait_stat (&startstop,drive,DRQ_STAT,BUSY_STAT,WAIT_READY)) {
if (ide_wait_stat(&startstop, drive, rq, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
printk (KERN_ERR "ide-floppy: Strange, packet command initiated yet DRQ isn't asserted\n");
return startstop;
}
......@@ -1960,14 +1960,6 @@ static int idefloppy_identify_device (ide_drive_t *drive,struct hd_driveid *id)
return 0;
}
static void idefloppy_add_settings(ide_drive_t *drive)
{
ide_add_setting(drive, "bios_cyl", SETTING_RW, -1, -1, TYPE_INT, 0, 1023, 1, 1, &drive->bios_cyl, NULL);
ide_add_setting(drive, "bios_head", SETTING_RW, -1, -1, TYPE_BYTE, 0, 255, 1, 1, &drive->bios_head, NULL);
ide_add_setting(drive, "bios_sect", SETTING_RW, -1, -1, TYPE_BYTE, 0, 63, 1, 1, &drive->bios_sect, NULL);
}
/*
* Driver initialization.
*/
......@@ -2009,7 +2001,7 @@ static void idefloppy_setup (ide_drive_t *drive, idefloppy_floppy_t *floppy)
}
(void) idefloppy_get_capacity (drive);
idefloppy_add_settings(drive);
for (i = 0; i < MAX_DRIVES; ++i) {
struct ata_channel *hwif = drive->channel;
......
......@@ -628,9 +628,6 @@ static int init_irq(struct ata_channel *ch)
return 1;
}
memset(hwgroup, 0, sizeof(*hwgroup));
init_timer(&hwgroup->timer);
hwgroup->timer.function = &ide_timer_expiry;
hwgroup->timer.data = (unsigned long) hwgroup;
}
/*
......@@ -659,6 +656,11 @@ static int init_irq(struct ata_channel *ch)
* Everything is okay. Tag us as member of this hardware group.
*/
ch->hwgroup = hwgroup;
init_timer(&ch->timer);
ch->timer.function = &ide_timer_expiry;
ch->timer.data = (unsigned long) ch;
for (i = 0; i < MAX_DRIVES; ++i) {
struct ata_device *drive = &ch->drives[i];
request_queue_t *q;
......@@ -667,8 +669,8 @@ static int init_irq(struct ata_channel *ch)
if (!drive->present)
continue;
if (!hwgroup->XXX_drive)
hwgroup->XXX_drive = drive;
if (!ch->drive)
ch->drive = drive;
/*
* Init the per device request queue
......@@ -842,7 +844,6 @@ static void channel_init(struct ata_channel *ch)
for (unit = 0; unit < MAX_DRIVES; ++unit) {
char name[80];
ide_add_generic_settings(ch->drives + unit);
ch->drives[unit].dn = ((ch->unit ? 2 : 0) + unit);
sprintf(name, "host%d/bus%d/target%d/lun%d",
ch->index, ch->unit, unit, ch->drives[unit].lun);
......
......@@ -1925,7 +1925,7 @@ static int idetape_end_request(struct ata_device *drive, struct request *rq, int
idetape_increase_max_pipeline_stages (drive);
}
}
ide_end_drive_cmd (drive, 0, 0);
ide_end_drive_cmd(drive, rq, 0, 0);
if (remove_stage)
idetape_remove_stage_head (drive);
if (tape->active_data_request == NULL)
......@@ -2228,7 +2228,7 @@ static ide_startstop_t idetape_pc_intr(struct ata_device *drive, struct request
* we will handle the next request.
*
*/
static ide_startstop_t idetape_transfer_pc(struct ata_device *drive, struct request *__rq)
static ide_startstop_t idetape_transfer_pc(struct ata_device *drive, struct request *rq)
{
idetape_tape_t *tape = drive->driver_data;
idetape_pc_t *pc = tape->pc;
......@@ -2236,7 +2236,7 @@ static ide_startstop_t idetape_transfer_pc(struct ata_device *drive, struct requ
int retries = 100;
ide_startstop_t startstop;
if (ide_wait_stat (&startstop,drive,DRQ_STAT,BUSY_STAT,WAIT_READY)) {
if (ide_wait_stat(&startstop, drive, rq, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
printk (KERN_ERR "ide-tape: Strange, packet command initiated yet DRQ isn't asserted\n");
return startstop;
}
......@@ -5926,41 +5926,7 @@ static void idetape_get_blocksize_from_block_descriptor(ide_drive_t *drive)
tape->tape_block_size =( block_descrp->length[0]<<16) + (block_descrp->length[1]<<8) + block_descrp->length[2];
#if IDETAPE_DEBUG_INFO
printk (KERN_INFO "ide-tape: Adjusted block size - %d\n", tape->tape_block_size);
#endif /* IDETAPE_DEBUG_INFO */
}
static void idetape_add_settings (ide_drive_t *drive)
{
idetape_tape_t *tape = drive->driver_data;
/*
* drive setting name read/write ioctl ioctl data type min max mul_factor div_factor data pointer set function
*/
ide_add_setting(drive, "buffer", SETTING_READ, -1, -1, TYPE_SHORT, 0, 0xffff, 1, 2, &tape->capabilities.buffer_size, NULL);
ide_add_setting(drive, "pipeline_min", SETTING_RW, -1, -1, TYPE_INT, 2, 0xffff, tape->stage_size / 1024, 1, &tape->min_pipeline, NULL);
ide_add_setting(drive, "pipeline", SETTING_RW, -1, -1, TYPE_INT, 2, 0xffff, tape->stage_size / 1024, 1, &tape->max_stages, NULL);
ide_add_setting(drive, "pipeline_max", SETTING_RW, -1, -1, TYPE_INT, 2, 0xffff, tape->stage_size / 1024, 1, &tape->max_pipeline, NULL);
ide_add_setting(drive, "pipeline_used",SETTING_READ, -1, -1, TYPE_INT, 0, 0xffff, tape->stage_size / 1024, 1, &tape->nr_stages, NULL);
ide_add_setting(drive, "pipeline_pending",SETTING_READ,-1, -1, TYPE_INT, 0, 0xffff, tape->stage_size / 1024, 1, &tape->nr_pending_stages, NULL);
ide_add_setting(drive, "speed", SETTING_READ, -1, -1, TYPE_SHORT, 0, 0xffff, 1, 1, &tape->capabilities.speed, NULL);
ide_add_setting(drive, "stage", SETTING_READ, -1, -1, TYPE_INT, 0, 0xffff, 1, 1024, &tape->stage_size, NULL);
ide_add_setting(drive, "tdsc", SETTING_RW, -1, -1, TYPE_INT, IDETAPE_DSC_RW_MIN, IDETAPE_DSC_RW_MAX, 1000, HZ, &tape->best_dsc_rw_frequency, NULL);
ide_add_setting(drive, "dsc_overlap", SETTING_RW, -1, -1, TYPE_BYTE, 0, 1, 1, 1, &drive->dsc_overlap, NULL);
ide_add_setting(drive, "pipeline_head_speed_c",SETTING_READ, -1, -1, TYPE_INT, 0, 0xffff, 1, 1, &tape->controlled_pipeline_head_speed, NULL);
ide_add_setting(drive, "pipeline_head_speed_u",SETTING_READ, -1, -1, TYPE_INT, 0, 0xffff, 1, 1, &tape->uncontrolled_pipeline_head_speed, NULL);
ide_add_setting(drive, "avg_speed", SETTING_READ, -1, -1, TYPE_INT, 0, 0xffff, 1, 1, &tape->avg_speed, NULL);
ide_add_setting(drive, "debug_level",SETTING_RW, -1, -1, TYPE_INT, 0, 0xffff, 1, 1, &tape->debug_level, NULL);
if (tape->onstream) {
ide_add_setting(drive, "cur_frames", SETTING_READ, -1, -1, TYPE_SHORT, 0, 0xffff, 1, 1, &tape->cur_frames, NULL);
ide_add_setting(drive, "max_frames", SETTING_READ, -1, -1, TYPE_SHORT, 0, 0xffff, 1, 1, &tape->max_frames, NULL);
ide_add_setting(drive, "insert_speed", SETTING_READ, -1, -1, TYPE_INT, 0, 0xffff, 1, 1, &tape->insert_speed, NULL);
ide_add_setting(drive, "speed_control",SETTING_RW, -1, -1, TYPE_INT, 0, 0xffff, 1, 1, &tape->speed_control, NULL);
ide_add_setting(drive, "tape_still_time",SETTING_READ, -1, -1, TYPE_INT, 0, 0xffff, 1, 1, &tape->tape_still_time, NULL);
ide_add_setting(drive, "max_insert_speed",SETTING_RW, -1, -1, TYPE_INT, 0, 0xffff, 1, 1, &tape->max_insert_speed, NULL);
ide_add_setting(drive, "insert_size", SETTING_READ, -1, -1, TYPE_INT, 0, 0xffff, 1, 1, &tape->insert_size, NULL);
ide_add_setting(drive, "capacity", SETTING_READ, -1, -1, TYPE_INT, 0, 0xffff, 1, 1, &tape->capacity, NULL);
ide_add_setting(drive, "first_frame", SETTING_READ, -1, -1, TYPE_INT, 0, 0xffff, 1, 1, &tape->first_frame_position, NULL);
ide_add_setting(drive, "logical_blk", SETTING_READ, -1, -1, TYPE_INT, 0, 0xffff, 1, 1, &tape->logical_blk_num, NULL);
}
#endif
}
/*
......@@ -6074,8 +6040,6 @@ static void idetape_setup (ide_drive_t *drive, idetape_tape_t *tape, int minor)
drive->name, tape->name, tape->capabilities.speed, (tape->capabilities.buffer_size * 512) / tape->stage_size,
tape->stage_size / 1024, tape->max_stages * tape->stage_size / 1024,
tape->best_dsc_rw_frequency * 1000 / HZ, drive->using_dma ? ", DMA":"");
idetape_add_settings(drive);
}
static int idetape_cleanup (ide_drive_t *drive)
......
......@@ -308,7 +308,7 @@ static ide_startstop_t pre_task_mulout_intr(struct ata_device *drive, struct req
struct ata_taskfile *args = rq->special;
ide_startstop_t startstop;
if (ide_wait_stat(&startstop, drive, DATA_READY, drive->bad_wstat, WAIT_DRQ))
if (ide_wait_stat(&startstop, drive, rq, DATA_READY, drive->bad_wstat, WAIT_DRQ))
return startstop;
ata_poll_drive_ready(drive);
......@@ -329,7 +329,7 @@ static ide_startstop_t task_mulout_intr(struct ata_device *drive, struct request
*/
if (!rq->nr_sectors) {
if (stat & (ERR_STAT|DRQ_STAT)) {
startstop = ide_error(drive, "task_mulout_intr", stat);
startstop = ide_error(drive, rq, "task_mulout_intr", stat);
return startstop;
}
......@@ -342,7 +342,7 @@ static ide_startstop_t task_mulout_intr(struct ata_device *drive, struct request
if (!OK_STAT(stat, DATA_READY, BAD_R_STAT)) {
if (stat & (ERR_STAT | DRQ_STAT)) {
startstop = ide_error(drive, "task_mulout_intr", stat);
startstop = ide_error(drive, rq, "task_mulout_intr", stat);
return startstop;
}
......@@ -489,12 +489,12 @@ ide_startstop_t ata_taskfile(struct ata_device *drive,
/*
* This is invoked on completion of a WIN_RESTORE (recalibrate) cmd.
*/
ide_startstop_t recal_intr(struct ata_device *drive, struct request *__rq)
ide_startstop_t recal_intr(struct ata_device *drive, struct request *rq)
{
u8 stat;
if (!OK_STAT(stat = GET_STAT(),READY_STAT,BAD_STAT))
return ide_error(drive, "recal_intr", stat);
return ide_error(drive, rq, "recal_intr", stat);
return ide_stopped;
}
......@@ -511,11 +511,11 @@ ide_startstop_t task_no_data_intr(struct ata_device *drive, struct request *rq)
if (!OK_STAT(stat = GET_STAT(), READY_STAT, BAD_STAT)) {
/* Keep quiet for NOP because it is expected to fail. */
if (args && args->taskfile.command != WIN_NOP)
return ide_error(drive, "task_no_data_intr", stat);
return ide_error(drive, rq, "task_no_data_intr", stat);
}
if (args)
ide_end_drive_cmd (drive, stat, GET_ERR());
ide_end_drive_cmd(drive, rq, stat, GET_ERR());
return ide_stopped;
}
......@@ -523,7 +523,7 @@ ide_startstop_t task_no_data_intr(struct ata_device *drive, struct request *rq)
/*
* Handler for command with PIO data-in phase
*/
static ide_startstop_t task_in_intr (struct ata_device *drive, struct request *rq)
static ide_startstop_t task_in_intr(struct ata_device *drive, struct request *rq)
{
u8 stat = GET_STAT();
char *pBuf = NULL;
......@@ -531,7 +531,7 @@ static ide_startstop_t task_in_intr (struct ata_device *drive, struct request *r
if (!OK_STAT(stat,DATA_READY,BAD_R_STAT)) {
if (stat & (ERR_STAT|DRQ_STAT)) {
return ide_error(drive, "task_in_intr", stat);
return ide_error(drive, rq, "task_in_intr", stat);
}
if (!(stat & BUSY_STAT)) {
DTF("task_in_intr to Soon wait for next interrupt\n");
......@@ -569,7 +569,7 @@ static ide_startstop_t pre_task_out_intr(struct ata_device *drive, struct reques
struct ata_taskfile *args = rq->special;
ide_startstop_t startstop;
if (ide_wait_stat(&startstop, drive, DATA_READY, drive->bad_wstat, WAIT_DRQ)) {
if (ide_wait_stat(&startstop, drive, rq, DATA_READY, drive->bad_wstat, WAIT_DRQ)) {
printk(KERN_ERR "%s: no DRQ after issuing %s\n", drive->name, drive->mult_count ? "MULTWRITE" : "WRITE");
return startstop;
}
......@@ -600,7 +600,7 @@ static ide_startstop_t task_out_intr(struct ata_device *drive, struct request *r
unsigned long flags;
if (!OK_STAT(stat,DRIVE_READY,drive->bad_wstat))
return ide_error(drive, "task_out_intr", stat);
return ide_error(drive, rq, "task_out_intr", stat);
if (!rq->current_nr_sectors)
if (!ide_end_request(drive, rq, 1))
......@@ -632,7 +632,7 @@ static ide_startstop_t task_mulin_intr(struct ata_device *drive, struct request
if (!OK_STAT(stat = GET_STAT(),DATA_READY,BAD_R_STAT)) {
if (stat & (ERR_STAT|DRQ_STAT)) {
return ide_error(drive, "task_mulin_intr", stat);
return ide_error(drive, rq, "task_mulin_intr", stat);
}
/* no data yet, so wait for another interrupt */
ide_set_handler(drive, task_mulin_intr, WAIT_CMD, NULL);
......
This diff is collapsed.
......@@ -185,7 +185,7 @@ int __init setup_pdc4030(struct ata_channel *hwif)
if (pdc4030_cmd(drive,PROMISE_GET_CONFIG)) {
return 0;
}
if (ide_wait_stat(&startstop, drive,DATA_READY,BAD_W_STAT,WAIT_DRQ)) {
if (ide_wait_stat(&startstop, drive, NULL, DATA_READY,BAD_W_STAT,WAIT_DRQ)) {
printk(KERN_INFO
"%s: Failed Promise read config!\n",hwif->name);
return 0;
......@@ -309,14 +309,14 @@ void __init ide_probe_for_pdc4030(void)
*/
static ide_startstop_t promise_read_intr(struct ata_device *drive, struct request *rq)
{
byte stat;
u8 stat;
int total_remaining;
unsigned int sectors_left, sectors_avail, nsect;
unsigned long flags;
char *to;
if (!OK_STAT(stat=GET_STAT(),DATA_READY,BAD_R_STAT)) {
return ide_error(drive, "promise_read_intr", stat);
return ide_error(drive, rq, "promise_read_intr", stat);
}
read_again:
......@@ -348,17 +348,18 @@ static ide_startstop_t promise_read_intr(struct ata_device *drive, struct reques
if ((rq->current_nr_sectors -= nsect) <= 0) {
ide_end_request(drive, rq, 1);
}
/*
* Now the data has been read in, do the following:
*
* if there are still sectors left in the request,
* if we know there are still sectors available from the interface,
* go back and read the next bit of the request.
* else if DRQ is asserted, there are more sectors available, so
* go back and find out how many, then read them in.
* else if BUSY is asserted, we are going to get an interrupt, so
* set the handler for the interrupt and just return
*/
/*
* Now the data has been read in, do the following:
*
* if there are still sectors left in the request, if we know there are
* still sectors available from the interface, go back and read the
* next bit of the request. else if DRQ is asserted, there are more
* sectors available, so go back and find out how many, then read them
* in. else if BUSY is asserted, we are going to get an interrupt, so
* set the handler for the interrupt and just return
*/
if (total_remaining > 0) {
if (sectors_avail)
goto read_next;
......@@ -375,7 +376,7 @@ static ide_startstop_t promise_read_intr(struct ata_device *drive, struct reques
}
printk(KERN_ERR "%s: Eeek! promise_read_intr: sectors left "
"!DRQ !BUSY\n", drive->name);
return ide_error(drive, "promise read intr", stat);
return ide_error(drive, rq, "promise read intr", stat);
}
return ide_stopped;
}
......@@ -400,7 +401,7 @@ static ide_startstop_t promise_complete_pollfunc(struct ata_device *drive, struc
ch->poll_timeout = 0;
printk(KERN_ERR "%s: completion timeout - still busy!\n",
drive->name);
return ide_error(drive, "busy timeout", GET_STAT());
return ide_error(drive, rq, "busy timeout", GET_STAT());
}
ch->poll_timeout = 0;
......@@ -478,7 +479,7 @@ static ide_startstop_t promise_write_pollfunc(struct ata_device *drive, struct r
}
ch->poll_timeout = 0;
printk(KERN_ERR "%s: write timed out!\n",drive->name);
return ide_error(drive, "write timeout", GET_STAT());
return ide_error(drive, rq, "write timeout", GET_STAT());
}
/*
......@@ -613,7 +614,7 @@ ide_startstop_t do_pdc4030_io(struct ata_device *drive, struct ata_taskfile *arg
* call the promise_write function to deal with writing the data out
* NOTE: No interrupts are generated on writes. Write completion must be polled
*/
if (ide_wait_stat(&startstop, drive, DATA_READY, drive->bad_wstat, WAIT_DRQ)) {
if (ide_wait_stat(&startstop, drive, rq, DATA_READY, drive->bad_wstat, WAIT_DRQ)) {
printk(KERN_ERR "%s: no DRQ after issuing "
"PROMISE_WRITE\n", drive->name);
return startstop;
......
......@@ -52,7 +52,7 @@
#undef IDE_TCQ_FIDDLE_SI
static ide_startstop_t ide_dmaq_intr(struct ata_device *drive, struct request *rq);
static ide_startstop_t service(struct ata_device *drive);
static ide_startstop_t service(struct ata_device *drive, struct request *rq);
static inline void drive_ctl_nien(struct ata_device *drive, int set)
{
......@@ -70,7 +70,7 @@ static ide_startstop_t tcq_nop_handler(struct ata_device *drive, struct request
struct ata_taskfile *args = rq->special;
ide__sti();
ide_end_drive_cmd(drive, GET_STAT(), GET_ERR());
ide_end_drive_cmd(drive, rq, GET_STAT(), GET_ERR());
kfree(args);
return ide_stopped;
}
......@@ -82,7 +82,8 @@ static ide_startstop_t tcq_nop_handler(struct ata_device *drive, struct request
*/
static void tcq_invalidate_queue(struct ata_device *drive)
{
ide_hwgroup_t *hwgroup = HWGROUP(drive);
struct ata_channel *ch = drive->channel;
ide_hwgroup_t *hwgroup = ch->hwgroup;
request_queue_t *q = &drive->queue;
struct ata_taskfile *args;
struct request *rq;
......@@ -92,7 +93,7 @@ static void tcq_invalidate_queue(struct ata_device *drive)
spin_lock_irqsave(&ide_lock, flags);
del_timer(&hwgroup->timer);
del_timer(&ch->timer);
if (test_bit(IDE_DMA, &hwgroup->flags))
udma_stop(drive);
......@@ -169,7 +170,7 @@ static void ata_tcq_irq_timeout(unsigned long data)
* if pending commands, try service before giving up
*/
if (ata_pending_commands(drive) && (GET_STAT() & SERVICE_STAT))
if (service(drive) == ide_started)
if (service(drive, hwgroup->rq) == ide_started)
return;
if (drive)
......@@ -178,6 +179,7 @@ static void ata_tcq_irq_timeout(unsigned long data)
static void set_irq(struct ata_device *drive, ata_handler_t *handler)
{
struct ata_channel *ch = drive->channel;
ide_hwgroup_t *hwgroup = HWGROUP(drive);
unsigned long flags;
......@@ -186,10 +188,14 @@ static void set_irq(struct ata_device *drive, ata_handler_t *handler)
/*
* always just bump the timer for now, the timeout handling will
* have to be changed to be per-command
*
* FIXME: Jens - this is broken it will interfere with
* the normal timer function on serialized drives!
*/
hwgroup->timer.function = ata_tcq_irq_timeout;
hwgroup->timer.data = (unsigned long) hwgroup->XXX_drive;
mod_timer(&hwgroup->timer, jiffies + 5 * HZ);
ch->timer.function = ata_tcq_irq_timeout;
ch->timer.data = (unsigned long) ch->drive;
mod_timer(&ch->timer, jiffies + 5 * HZ);
hwgroup->handler = handler;
spin_unlock_irqrestore(&ide_lock, flags);
......@@ -223,9 +229,8 @@ static ide_startstop_t udma_tcq_start(struct ata_device *drive, struct request *
*
* Also, nIEN must be set as not to need protection against ide_dmaq_intr
*/
static ide_startstop_t service(struct ata_device *drive)
static ide_startstop_t service(struct ata_device *drive, struct request *rq)
{
struct request *rq;
u8 feat;
u8 stat;
int tag;
......@@ -242,7 +247,7 @@ static ide_startstop_t service(struct ata_device *drive)
/*
* need to select the right drive first...
*/
if (drive != HWGROUP(drive)->XXX_drive) {
if (drive != drive->channel->drive) {
SELECT_DRIVE(drive->channel, drive);
udelay(10);
}
......@@ -256,8 +261,9 @@ static ide_startstop_t service(struct ata_device *drive)
if (wait_altstat(drive, &stat, BUSY_STAT)) {
printk(KERN_ERR"%s: BUSY clear took too long\n", __FUNCTION__);
ide_dump_status(drive, __FUNCTION__, stat);
ide_dump_status(drive, rq, __FUNCTION__, stat);
tcq_invalidate_queue(drive);
return ide_stopped;
}
......@@ -267,8 +273,9 @@ static ide_startstop_t service(struct ata_device *drive)
* FIXME, invalidate queue
*/
if (stat & ERR_STAT) {
ide_dump_status(drive, __FUNCTION__, stat);
ide_dump_status(drive, rq, __FUNCTION__, stat);
tcq_invalidate_queue(drive);
return ide_stopped;
}
......@@ -301,7 +308,7 @@ static ide_startstop_t service(struct ata_device *drive)
return udma_tcq_start(drive, rq);
}
static ide_startstop_t check_service(struct ata_device *drive)
static ide_startstop_t check_service(struct ata_device *drive, struct request *rq)
{
u8 stat;
......@@ -311,7 +318,7 @@ static ide_startstop_t check_service(struct ata_device *drive)
return ide_stopped;
if ((stat = GET_STAT()) & SERVICE_STAT)
return service(drive);
return service(drive, rq);
/*
* we have pending commands, wait for interrupt
......@@ -335,8 +342,9 @@ ide_startstop_t ide_dmaq_complete(struct ata_device *drive, struct request *rq,
*/
if (unlikely(!OK_STAT(stat, READY_STAT, drive->bad_wstat | DRQ_STAT))) {
printk(KERN_ERR "%s: %s: error status %x\n", __FUNCTION__, drive->name,stat);
ide_dump_status(drive, __FUNCTION__, stat);
ide_dump_status(drive, rq, __FUNCTION__, stat);
tcq_invalidate_queue(drive);
return ide_stopped;
}
......@@ -349,7 +357,7 @@ ide_startstop_t ide_dmaq_complete(struct ata_device *drive, struct request *rq,
/*
* we completed this command, check if we can service a new command
*/
return check_service(drive);
return check_service(drive, rq);
}
/*
......@@ -380,11 +388,11 @@ static ide_startstop_t ide_dmaq_intr(struct ata_device *drive, struct request *r
*/
if (stat & SERVICE_STAT) {
TCQ_PRINTK("%s: SERV (stat=%x)\n", __FUNCTION__, stat);
return service(drive);
return service(drive, rq);
}
printk("%s: stat=%x, not expected\n", __FUNCTION__, stat);
return check_service(drive);
return check_service(drive, rq);
}
/*
......@@ -558,7 +566,7 @@ ide_startstop_t udma_tcq_taskfile(struct ata_device *drive, struct request *rq)
OUT_BYTE(args->taskfile.command, IDE_COMMAND_REG);
if (wait_altstat(drive, &stat, BUSY_STAT)) {
ide_dump_status(drive, "queued start", stat);
ide_dump_status(drive, rq, "queued start", stat);
tcq_invalidate_queue(drive);
return ide_stopped;
}
......@@ -566,7 +574,7 @@ ide_startstop_t udma_tcq_taskfile(struct ata_device *drive, struct request *rq)
drive_ctl_nien(drive, 0);
if (stat & ERR_STAT) {
ide_dump_status(drive, "tcq_start", stat);
ide_dump_status(drive, rq, "tcq_start", stat);
return ide_stopped;
}
......@@ -582,7 +590,7 @@ ide_startstop_t udma_tcq_taskfile(struct ata_device *drive, struct request *rq)
TCQ_PRINTK("REL in queued_start\n");
if ((stat = GET_STAT()) & SERVICE_STAT)
return service(drive);
return service(drive, rq);
return ide_released;
}
......
......@@ -32,9 +32,11 @@ obj-$(CONFIG_NVRAM) += nvram.o
obj-$(CONFIG_MAC_HID) += mac_hid.o
obj-$(CONFIG_INPUT_ADBHID) += adbhid.o
obj-$(CONFIG_PPC_RTC) += rtc.o
obj-$(CONFIG_ANSLCD) += ans-lcd.o
obj-$(CONFIG_ADB_PMU) += via-pmu.o
obj-$(CONFIG_ADB_CUDA) += via-cuda.o
obj-$(CONFIG_PMAC_APM_EMU) += apm_emu.o
obj-$(CONFIG_ADB) += adb.o
obj-$(CONFIG_ADB_KEYBOARD) += mac_keyb.o
......
......@@ -34,6 +34,7 @@
#include <linux/wait.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/completion.h>
#include <asm/uaccess.h>
#ifdef CONFIG_PPC
#include <asm/prom.h>
......@@ -77,8 +78,8 @@ struct notifier_block *adb_client_list = NULL;
static int adb_got_sleep = 0;
static int adb_inited = 0;
static pid_t adb_probe_task_pid;
static unsigned long adb_probe_task_flag;
static wait_queue_head_t adb_probe_task_wq;
static DECLARE_MUTEX(adb_probe_mutex);
static struct completion adb_probe_task_comp;
static int sleepy_trackpad;
int __adb_probe_sync;
......@@ -241,7 +242,8 @@ adb_probe_task(void *x)
printk(KERN_INFO "adb: finished probe task...\n");
adb_probe_task_pid = 0;
clear_bit(0, &adb_probe_task_flag);
up(&adb_probe_mutex);
return 0;
}
......@@ -263,14 +265,8 @@ adb_reset_bus(void)
do_adb_reset_bus();
return 0;
}
/* We need to get a lock on the probe thread */
while (test_and_set_bit(0, &adb_probe_task_flag))
schedule();
/* Just wait for PID to be 0 just in case (possible race) */
while (adb_probe_task_pid != 0)
schedule();
down(&adb_probe_mutex);
/* Create probe thread as a child of keventd */
if (current_is_keventd())
......@@ -318,7 +314,7 @@ int __init adb_init(void)
if (machine_is_compatible("AAPL,PowerBook1998") ||
machine_is_compatible("PowerBook1,1"))
sleepy_trackpad = 1;
init_waitqueue_head(&adb_probe_task_wq);
init_completion(&adb_probe_task_comp);
adbdev_init();
adb_reset_bus();
}
......@@ -340,21 +336,20 @@ adb_notify_sleep(struct pmu_sleep_notifier *self, int when)
case PBOOK_SLEEP_REQUEST:
adb_got_sleep = 1;
/* We need to get a lock on the probe thread */
while (test_and_set_bit(0, &adb_probe_task_flag))
schedule();
/* Just wait for PID to be 0 just in case (possible race) */
while (adb_probe_task_pid != 0)
schedule();
down(&adb_probe_mutex);
/* Stop autopoll */
if (adb_controller->autopoll)
adb_controller->autopoll(0);
ret = notifier_call_chain(&adb_client_list, ADB_MSG_POWERDOWN, NULL);
if (ret & NOTIFY_STOP_MASK)
if (ret & NOTIFY_STOP_MASK) {
up(&adb_probe_mutex);
return PBOOK_SLEEP_REFUSE;
}
break;
case PBOOK_SLEEP_REJECT:
if (adb_got_sleep) {
adb_got_sleep = 0;
clear_bit(0, &adb_probe_task_flag);
up(&adb_probe_mutex);
adb_reset_bus();
}
break;
......@@ -363,7 +358,7 @@ adb_notify_sleep(struct pmu_sleep_notifier *self, int when)
break;
case PBOOK_WAKE:
adb_got_sleep = 0;
clear_bit(0, &adb_probe_task_flag);
up(&adb_probe_mutex);
adb_reset_bus();
break;
}
......@@ -435,9 +430,10 @@ adb_poll(void)
static void
adb_probe_wakeup(struct adb_request *req)
{
wake_up(&adb_probe_task_wq);
complete(&adb_probe_task_comp);
}
/* Static request used during probe */
static struct adb_request adb_sreq;
static unsigned long adb_sreq_lock; // Use semaphore ! */
......@@ -484,20 +480,11 @@ adb_request(struct adb_request *req, void (*done)(struct adb_request *),
if ((flags & ADBREQ_SYNC) &&
(current->pid && adb_probe_task_pid &&
adb_probe_task_pid == current->pid)) {
DECLARE_WAITQUEUE(wait, current);
req->done = adb_probe_wakeup;
add_wait_queue(&adb_probe_task_wq, &wait);
rc = adb_controller->send_request(req, 0);
if (rc || req->complete)
goto bail;
for (;;) {
set_current_state(TASK_UNINTERRUPTIBLE);
if (req->complete)
break;
schedule();
}
current->state = TASK_RUNNING;
remove_wait_queue(&adb_probe_task_wq, &wait);
wait_for_completion(&adb_probe_task_comp);
rc = 0;
goto bail;
}
......@@ -652,7 +639,7 @@ static int adb_open(struct inode *inode, struct file *file)
{
struct adbdev_state *state;
if (MINOR(inode->i_rdev) > 0 || adb_controller == NULL)
if (minor(inode->i_rdev) > 0 || adb_controller == NULL)
return -ENXIO;
state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL);
if (state == 0)
......@@ -672,6 +659,7 @@ static int adb_release(struct inode *inode, struct file *file)
struct adbdev_state *state = file->private_data;
unsigned long flags;
lock_kernel();
if (state) {
file->private_data = NULL;
spin_lock_irqsave(&state->lock, flags);
......@@ -684,6 +672,7 @@ static int adb_release(struct inode *inode, struct file *file)
spin_unlock_irqrestore(&state->lock, flags);
}
}
unlock_kernel();
return 0;
}
......@@ -705,17 +694,16 @@ static ssize_t adb_read(struct file *file, char *buf,
return ret;
req = NULL;
spin_lock_irqsave(&state->lock, flags);
add_wait_queue(&state->wait_queue, &wait);
current->state = TASK_INTERRUPTIBLE;
for (;;) {
spin_lock_irqsave(&state->lock, flags);
req = state->completed;
if (req != NULL)
state->completed = req->next;
else if (atomic_read(&state->n_pending) == 0)
ret = -EIO;
spin_unlock_irqrestore(&state->lock, flags);
if (req != NULL || ret != 0)
break;
......@@ -727,12 +715,15 @@ static ssize_t adb_read(struct file *file, char *buf,
ret = -ERESTARTSYS;
break;
}
spin_unlock_irqrestore(&state->lock, flags);
schedule();
spin_lock_irqsave(&state->lock, flags);
}
current->state = TASK_RUNNING;
remove_wait_queue(&state->wait_queue, &wait);
spin_unlock_irqrestore(&state->lock, flags);
if (ret)
return ret;
......@@ -755,6 +746,8 @@ static ssize_t adb_write(struct file *file, const char *buf,
if (count < 2 || count > sizeof(req->data))
return -EINVAL;
if (adb_controller == NULL)
return -ENXIO;
ret = verify_area(VERIFY_READ, buf, count);
if (ret)
return ret;
......@@ -774,7 +767,10 @@ static ssize_t adb_write(struct file *file, const char *buf,
goto out;
atomic_inc(&state->n_pending);
if (adb_controller == NULL) return -ENXIO;
/* If a probe is in progress or we are sleeping, wait for it to complete */
down(&adb_probe_mutex);
up(&adb_probe_mutex);
/* Special case for ADB_BUSRESET request, all others are sent to
the controller */
......@@ -782,6 +778,8 @@ static ssize_t adb_write(struct file *file, const char *buf,
&&(req->data[1] == ADB_BUSRESET)) {
ret = do_adb_reset_bus();
atomic_dec(&state->n_pending);
if (ret == 0)
ret = count;
goto out;
} else {
req->reply_expected = ((req->data[1] & 0xc) == 0xc);
......
......@@ -96,6 +96,11 @@ static struct adb_ids keyboard_ids;
static struct adb_ids mouse_ids;
static struct adb_ids buttons_ids;
#ifdef CONFIG_PMAC_BACKLIGHT
/* Exported to via-pmu.c */
int disable_kernel_backlight = 0;
#endif /* CONFIG_PMAC_BACKLIGHT */
/* Kind of keyboard, see Apple technote 1152 */
#define ADB_KEYBOARD_UNKNOWN 0
#define ADB_KEYBOARD_ANSI 0x0100
......@@ -273,43 +278,60 @@ adbhid_buttons_input(unsigned char *data, int nb, struct pt_regs *regs, int auto
break;
case 0x1f: /* Powerbook button device */
{
int down = (data[1] == (data[1] & 0xf));
#ifdef CONFIG_PMAC_BACKLIGHT
int backlight = get_backlight_level();
#endif
/*
* XXX: Where is the contrast control for the passive?
* -- Cort
*/
switch (data[1]) {
switch (data[1] & 0x0f) {
case 0x8: /* mute */
input_report_key(&adbhid[id]->input, KEY_MUTE, down);
break;
case 0x7: /* contrast decrease */
case 0x7: /* volume decrease */
input_report_key(&adbhid[id]->input, KEY_VOLUMEDOWN, down);
break;
case 0x6: /* contrast increase */
break;
case 0x6: /* volume increase */
input_report_key(&adbhid[id]->input, KEY_VOLUMEUP, down);
break;
case 0xb: /* eject */
input_report_key(&adbhid[id]->input, KEY_EJECTCD, down);
break;
case 0xa: /* brightness decrease */
if (backlight < 0)
#ifdef CONFIG_PMAC_BACKLIGHT
if (!disable_kernel_backlight) {
if (!down || backlight < 0)
break;
if (backlight > BACKLIGHT_OFF)
set_backlight_level(backlight-1);
else
set_backlight_level(BACKLIGHT_OFF);
break;
if (backlight > BACKLIGHT_OFF)
set_backlight_level(backlight-1);
else
set_backlight_level(BACKLIGHT_OFF);
}
#endif /* CONFIG_PMAC_BACKLIGHT */
input_report_key(&adbhid[id]->input, KEY_BRIGHTNESSDOWN, down);
break;
case 0x9: /* brightness increase */
if (backlight < 0)
#ifdef CONFIG_PMAC_BACKLIGHT
if (!disable_kernel_backlight) {
if (!down || backlight < 0)
break;
if (backlight < BACKLIGHT_MAX)
set_backlight_level(backlight+1);
else
set_backlight_level(BACKLIGHT_MAX);
break;
if (backlight < BACKLIGHT_MAX)
set_backlight_level(backlight+1);
else
set_backlight_level(BACKLIGHT_MAX);
}
#endif /* CONFIG_PMAC_BACKLIGHT */
input_report_key(&adbhid[id]->input, KEY_BRIGHTNESSUP, down);
break;
}
#endif /* CONFIG_PMAC_BACKLIGHT */
}
break;
}
......@@ -504,6 +526,13 @@ adbhid_input_register(int id, int default_id, int original_handler_id,
case 0x1f: /* Powerbook button device */
sprintf(adbhid[id]->name, "ADB Powerbook buttons on ID %d:%d.%02x",
id, default_id, original_handler_id);
adbhid[id]->input.evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
set_bit(KEY_MUTE, adbhid[id]->input.keybit);
set_bit(KEY_VOLUMEUP, adbhid[id]->input.keybit);
set_bit(KEY_VOLUMEDOWN, adbhid[id]->input.keybit);
set_bit(KEY_BRIGHTNESSUP, adbhid[id]->input.keybit);
set_bit(KEY_BRIGHTNESSDOWN, adbhid[id]->input.keybit);
set_bit(KEY_EJECTCD, adbhid[id]->input.keybit);
break;
}
if (adbhid[id]->name[0])
......@@ -542,16 +571,38 @@ static void adbhid_input_unregister(int id)
}
static u16
adbhid_input_reregister(int id, int default_id, int org_handler_id,
int cur_handler_id, int mk)
{
if (adbhid[id]) {
if (adbhid[id]->input.idproduct !=
((id << 12)|(default_id << 8)|org_handler_id)) {
adbhid_input_unregister(id);
adbhid_input_register(id, default_id, org_handler_id,
cur_handler_id, mk);
}
} else
adbhid_input_register(id, default_id, org_handler_id,
cur_handler_id, mk);
return 1<<id;
}
static void
adbhid_input_devcleanup(u16 exist)
{
int i;
for(i=1; i<16; i++)
if (adbhid[i] && !(exist&(1<<i)))
adbhid_input_unregister(i);
}
static void
adbhid_probe(void)
{
struct adb_request req;
int i, default_id, org_handler_id, cur_handler_id;
for (i = 1; i < 16; i++) {
if (adbhid[i])
adbhid_input_unregister(i);
}
u16 reg = 0;
adb_register(ADB_MOUSE, 0, &mouse_ids, adbhid_mouse_input);
adb_register(ADB_KEYBOARD, 0, &keyboard_ids, adbhid_keyboard_input);
......@@ -580,14 +631,14 @@ adbhid_probe(void)
printk("ADB keyboard at %d, handler 1\n", id);
adb_get_infos(id, &default_id, &cur_handler_id);
adbhid_input_register(id, default_id, org_handler_id, cur_handler_id, 0);
reg |= adbhid_input_reregister(id, default_id, org_handler_id, cur_handler_id, 0);
}
for (i = 0; i < buttons_ids.nids; i++) {
int id = buttons_ids.id[i];
adb_get_infos(id, &default_id, &org_handler_id);
adbhid_input_register(id, default_id, org_handler_id, org_handler_id, 0);
reg |= adbhid_input_reregister(id, default_id, org_handler_id, org_handler_id, 0);
}
/* Try to switch all mice to handler 4, or 2 for three-button
......@@ -676,9 +727,10 @@ adbhid_probe(void)
printk("\n");
adb_get_infos(id, &default_id, &cur_handler_id);
adbhid_input_register(id, default_id, org_handler_id,
reg |= adbhid_input_reregister(id, default_id, org_handler_id,
cur_handler_id, mouse_kind);
}
adbhid_input_devcleanup(reg);
}
static void
......
/*
* /dev/lcd driver for Apple Network Servers.
*/
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/miscdevice.h>
#include <linux/fcntl.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <asm/uaccess.h>
#include <asm/sections.h>
#include <asm/prom.h>
#include <asm/ans-lcd.h>
#include <asm/io.h>
#define ANSLCD_ADDR 0xf301c000
#define ANSLCD_CTRL_IX 0x00
#define ANSLCD_DATA_IX 0x10
static unsigned long anslcd_short_delay = 80;
static unsigned long anslcd_long_delay = 3280;
static volatile unsigned char* anslcd_ptr;
#undef DEBUG
static void __pmac
anslcd_write_byte_ctrl ( unsigned char c )
{
#ifdef DEBUG
printk(KERN_DEBUG "LCD: CTRL byte: %02x\n",c);
#endif
out_8(anslcd_ptr + ANSLCD_CTRL_IX, c);
switch(c) {
case 1:
case 2:
case 3:
udelay(anslcd_long_delay); break;
default: udelay(anslcd_short_delay);
}
}
static void __pmac
anslcd_write_byte_data ( unsigned char c )
{
out_8(anslcd_ptr + ANSLCD_DATA_IX, c);
udelay(anslcd_short_delay);
}
static ssize_t __pmac
anslcd_write( struct file * file, const char * buf,
size_t count, loff_t *ppos )
{
const char * p = buf;
int i;
#ifdef DEBUG
printk(KERN_DEBUG "LCD: write\n");
#endif
if ( verify_area(VERIFY_READ, buf, count) )
return -EFAULT;
for ( i = *ppos; count > 0; ++i, ++p, --count )
{
char c;
__get_user(c, p);
anslcd_write_byte_data( c );
}
*ppos = i;
return p - buf;
}
static int __pmac
anslcd_ioctl( struct inode * inode, struct file * file,
unsigned int cmd, unsigned long arg )
{
char ch, *temp;
#ifdef DEBUG
printk(KERN_DEBUG "LCD: ioctl(%d,%d)\n",cmd,arg);
#endif
switch ( cmd )
{
case ANSLCD_CLEAR:
anslcd_write_byte_ctrl ( 0x38 );
anslcd_write_byte_ctrl ( 0x0f );
anslcd_write_byte_ctrl ( 0x06 );
anslcd_write_byte_ctrl ( 0x01 );
anslcd_write_byte_ctrl ( 0x02 );
return 0;
case ANSLCD_SENDCTRL:
temp = (char *) arg;
__get_user(ch, temp);
for (; ch; temp++) { /* FIXME: This is ugly, but should work, as a \0 byte is not a valid command code */
anslcd_write_byte_ctrl ( ch );
__get_user(ch, temp);
}
return 0;
case ANSLCD_SETSHORTDELAY:
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
anslcd_short_delay=arg;
return 0;
case ANSLCD_SETLONGDELAY:
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
anslcd_long_delay=arg;
return 0;
default:
return -EINVAL;
}
}
static int __pmac
anslcd_open( struct inode * inode, struct file * file )
{
return 0;
}
struct file_operations anslcd_fops = {
write: anslcd_write,
ioctl: anslcd_ioctl,
open: anslcd_open,
};
static struct miscdevice anslcd_dev = {
ANSLCD_MINOR,
"anslcd",
&anslcd_fops
};
const char anslcd_logo[] = "********************" /* Line #1 */
"* LINUX! *" /* Line #3 */
"* Welcome to *" /* Line #2 */
"********************"; /* Line #4 */
int __init
anslcd_init(void)
{
int a;
struct device_node* node;
node = find_devices("lcd");
if (!node || !node->parent)
return -ENODEV;
if (strcmp(node->parent->name, "gc"))
return -ENODEV;
anslcd_ptr = (volatile unsigned char*)ioremap(ANSLCD_ADDR, 0x20);
misc_register(&anslcd_dev);
#ifdef DEBUG
printk(KERN_DEBUG "LCD: init\n");
#endif
anslcd_write_byte_ctrl ( 0x38 );
anslcd_write_byte_ctrl ( 0x0c );
anslcd_write_byte_ctrl ( 0x06 );
anslcd_write_byte_ctrl ( 0x01 );
anslcd_write_byte_ctrl ( 0x02 );
for(a=0;a<80;a++) {
anslcd_write_byte_data(anslcd_logo[a]);
}
return 0;
}
__initcall(anslcd_init);
This diff is collapsed.
......@@ -200,15 +200,16 @@ static unsigned char e0_keys[128] = {
0, 0, 0, KEY_KPCOMMA, 0, KEY_INTL3, 0, 0, /* 0x00-0x07 */
0, 0, 0, 0, KEY_LANG1, KEY_LANG2, 0, 0, /* 0x08-0x0f */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x17 */
0, 0, 0, 0, KEY_KPENTER, KEY_RIGHTCTRL, 0, 0, /* 0x18-0x1f */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x20-0x27 */
0, 0, 0, 0, KEY_KPENTER, KEY_RIGHTCTRL, KEY_VOLUMEUP, 0,/* 0x18-0x1f */
0, 0, 0, 0, 0, KEY_VOLUMEDOWN, KEY_MUTE, 0, /* 0x20-0x27 */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x28-0x2f */
0, 0, 0, 0, 0, KEY_KPSLASH, 0, KEY_SYSRQ, /* 0x30-0x37 */
KEY_RIGHTALT, 0, 0, 0, 0, 0, 0, 0, /* 0x38-0x3f */
KEY_RIGHTALT, KEY_BRIGHTNESSUP, KEY_BRIGHTNESSDOWN,
KEY_EJECTCD, 0, 0, 0, 0, /* 0x38-0x3f */
0, 0, 0, 0, 0, 0, 0, KEY_HOME, /* 0x40-0x47 */
KEY_UP, KEY_PAGEUP, 0, KEY_LEFT, 0, KEY_RIGHT, 0, KEY_END, /* 0x48-0x4f */
KEY_DOWN, KEY_PAGEDOWN, KEY_INSERT, KEY_DELETE, 0, 0, 0, 0, /* 0x50-0x57 */
0, 0, 0, KEY_LEFTMETA, KEY_RIGHTMETA, KEY_COMPOSE, 0, 0, /* 0x58-0x5f */
0, 0, 0, KEY_LEFTMETA, KEY_RIGHTMETA, KEY_COMPOSE, KEY_POWER, 0, /* 0x58-0x5f */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x67 */
0, 0, 0, 0, 0, 0, 0, KEY_MACRO, /* 0x68-0x6f */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x70-0x77 */
......
This diff is collapsed.
......@@ -111,8 +111,8 @@ struct mac_serial {
char kgdb_channel; /* Kgdb is running on this channel */
char is_cons; /* Is this our console. */
char is_internal_modem; /* is connected to an internal modem */
char is_cobalt_modem; /* is a gatwick-based cobalt modem */
char is_irda; /* is connected to an IrDA codec */
int port_type; /* Port type for pmac_feature */
unsigned char tx_active; /* character is being xmitted */
unsigned char tx_stopped; /* output is suspended */
unsigned char power_wait; /* waiting for power-up delay to expire */
......
This diff is collapsed.
......@@ -34,14 +34,13 @@ static int rtc_busy = 0;
void get_rtc_time(struct rtc_time *t)
{
unsigned long nowtime;
nowtime = (ppc_md.get_rtc_time)();
to_tm(nowtime, t);
t->tm_year -= 1900;
t->tm_mon -= 1;
t->tm_wday -= 1;
t->tm_mon -= 1; /* Make sure userland has a 0-based month */
}
/* Set the current date and time in the real time clock. */
......@@ -49,7 +48,8 @@ void set_rtc_time(struct rtc_time *t)
{
unsigned long nowtime;
nowtime = mktime(t->tm_year+1900, t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
nowtime = mktime(t->tm_year+1900, t->tm_mon+1, t->tm_mday,
t->tm_hour, t->tm_min, t->tm_sec);
(ppc_md.set_rtc_time)(nowtime);
}
......
......@@ -125,7 +125,7 @@ struct adb_driver via_cuda_driver = {
#endif /* CONFIG_ADB */
#ifdef CONFIG_PPC
int
int __init
find_via_cuda(void)
{
int err;
......@@ -186,11 +186,13 @@ find_via_cuda(void)
}
#endif /* CONFIG_PPC */
int via_cuda_start(void)
static int __init via_cuda_start(void)
{
if (via == NULL)
return -ENODEV;
request_OF_resource(vias, 0, NULL);
if (request_irq(CUDA_IRQ, cuda_interrupt, 0, "ADB", cuda_interrupt)) {
printk(KERN_ERR "cuda_init: can't get irq %d\n", CUDA_IRQ);
return -EAGAIN;
......@@ -202,6 +204,8 @@ int via_cuda_start(void)
return 0;
}
device_initcall(via_cuda_start);
#ifdef CONFIG_ADB
static int
cuda_probe()
......@@ -217,7 +221,7 @@ cuda_probe()
return 0;
}
static int
static int __init
cuda_init(void)
{
if (via == NULL)
......
This diff is collapsed.
......@@ -2079,7 +2079,6 @@ static int init_planb(struct planb *pb)
#endif
pb->tab_size = PLANB_MAXLINES + 40;
pb->suspend = 0;
pb->lock = 0;
init_MUTEX(&pb->lock);
pb->ch1_cmd = 0;
pb->ch2_cmd = 0;
......
......@@ -271,7 +271,7 @@ static int idescsi_end_request(struct ata_device *drive, struct request *rq, int
ide_end_request(drive, rq, uptodate);
return 0;
}
ide_end_drive_cmd (drive, 0, 0);
ide_end_drive_cmd(drive, rq, 0, 0);
if (rq->errors >= ERROR_MAX) {
pc->scsi_cmd->result = DID_ERROR << 16;
if (log)
......@@ -401,7 +401,7 @@ static ide_startstop_t idescsi_transfer_pc(struct ata_device *drive, struct requ
byte ireason;
ide_startstop_t startstop;
if (ide_wait_stat (&startstop,drive,DRQ_STAT,BUSY_STAT,WAIT_READY)) {
if (ide_wait_stat(&startstop, drive, rq, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
printk (KERN_ERR "ide-scsi: Strange, packet command initiated yet DRQ isn't asserted\n");
return startstop;
}
......@@ -489,20 +489,6 @@ static void idescsi_ide_release(struct inode *inode, struct file *filp, struct a
static ide_drive_t *idescsi_drives[MAX_HWIFS * MAX_DRIVES];
static int idescsi_initialized = 0;
static void idescsi_add_settings(ide_drive_t *drive)
{
idescsi_scsi_t *scsi = drive->driver_data;
/*
* drive setting name read/write ioctl ioctl data type min max mul_factor div_factor data pointer set function
*/
ide_add_setting(drive, "bios_cyl", SETTING_RW, -1, -1, TYPE_INT, 0, 1023, 1, 1, &drive->bios_cyl, NULL);
ide_add_setting(drive, "bios_head", SETTING_RW, -1, -1, TYPE_BYTE, 0, 255, 1, 1, &drive->bios_head, NULL);
ide_add_setting(drive, "bios_sect", SETTING_RW, -1, -1, TYPE_BYTE, 0, 63, 1, 1, &drive->bios_sect, NULL);
ide_add_setting(drive, "transform", SETTING_RW, -1, -1, TYPE_INT, 0, 3, 1, 1, &scsi->transform, NULL);
ide_add_setting(drive, "log", SETTING_RW, -1, -1, TYPE_INT, 0, 1, 1, 1, &scsi->log, NULL);
}
/*
* Driver initialization.
*/
......@@ -521,8 +507,7 @@ static void idescsi_setup (ide_drive_t *drive, idescsi_scsi_t *scsi, int id)
clear_bit(IDESCSI_SG_TRANSFORM, &scsi->transform);
#if IDESCSI_DEBUG_LOG
set_bit(IDESCSI_LOG_CMD, &scsi->log);
#endif /* IDESCSI_DEBUG_LOG */
idescsi_add_settings(drive);
#endif
}
static int idescsi_cleanup (ide_drive_t *drive)
......
This diff is collapsed.
......@@ -9,25 +9,26 @@
int mesh_detect(Scsi_Host_Template *);
int mesh_release(struct Scsi_Host *);
int mesh_command(Scsi_Cmnd *);
int mesh_queue(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
int mesh_abort(Scsi_Cmnd *);
int mesh_reset(Scsi_Cmnd *, unsigned int);
int mesh_host_reset(Scsi_Cmnd *);
#define SCSI_MESH { \
proc_name: "mesh", \
name: "MESH", \
detect: mesh_detect, \
release: mesh_release, \
command: mesh_command, \
queuecommand: mesh_queue, \
abort: mesh_abort, \
reset: mesh_reset, \
can_queue: 20, \
this_id: 7, \
sg_tablesize: SG_ALL, \
cmd_per_lun: 2, \
use_clustering: DISABLE_CLUSTERING, \
#define SCSI_MESH { \
proc_name: "mesh", \
name: "MESH", \
detect: mesh_detect, \
release: mesh_release, \
command: NULL, \
queuecommand: mesh_queue, \
eh_abort_handler: mesh_abort, \
eh_device_reset_handler: NULL, \
eh_bus_reset_handler: NULL, \
eh_host_reset_handler: mesh_host_reset, \
can_queue: 20, \
this_id: 7, \
sg_tablesize: SG_ALL, \
cmd_per_lun: 2, \
use_clustering: DISABLE_CLUSTERING, \
}
/*
......
......@@ -29,7 +29,6 @@
#ifdef __KERNEL__
extern int find_via_cuda(void);
extern int via_cuda_start(void);
extern int cuda_request(struct adb_request *req,
void (*done)(struct adb_request *), int nbytes, ...);
extern void cuda_poll(void);
......
This diff is collapsed.
......@@ -325,6 +325,9 @@ struct input_event {
#define KEY_UNKNOWN 240
#define KEY_BRIGHTNESSDOWN 224
#define KEY_BRIGHTNESSUP 225
#define BTN_MISC 0x100
#define BTN_0 0x100
#define BTN_1 0x101
......
This diff is collapsed.
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