|
|
|
|
@@ -23,17 +23,6 @@
|
|
|
|
|
#include <asm/io.h>
|
|
|
|
|
#include <asm/semaphore.h>
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This is the multiple IDE interface driver, as evolved from hd.c.
|
|
|
|
|
* It supports up to four IDE interfaces, on one or more IRQs (usually 14 & 15).
|
|
|
|
|
* There can be up to two drives per interface, as per the ATA-2 spec.
|
|
|
|
|
*
|
|
|
|
|
* Primary i/f: ide0: major=3; (hda) minor=0; (hdb) minor=64
|
|
|
|
|
* Secondary i/f: ide1: major=22; (hdc or hd1a) minor=0; (hdd or hd1b) minor=64
|
|
|
|
|
* Tertiary i/f: ide2: major=33; (hde) minor=0; (hdf) minor=64
|
|
|
|
|
* Quaternary i/f: ide3: major=34; (hdg) minor=0; (hdh) minor=64
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
|
* IDE driver configuration options (play with these as desired):
|
|
|
|
|
*
|
|
|
|
|
@@ -193,11 +182,6 @@ typedef unsigned char byte; /* used everywhere */
|
|
|
|
|
#define WAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */
|
|
|
|
|
#define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */
|
|
|
|
|
|
|
|
|
|
#define HOST(hwif,chipset) \
|
|
|
|
|
{ \
|
|
|
|
|
return ((hwif)->chipset == chipset) ? 1 : 0; \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Check for an interrupt and acknowledge the interrupt status
|
|
|
|
|
*/
|
|
|
|
|
@@ -390,45 +374,6 @@ typedef union {
|
|
|
|
|
} b;
|
|
|
|
|
} ata_nsector_t, ata_data_t, atapi_bcount_t, ata_index_t;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* ATA-IDE Error Register
|
|
|
|
|
*
|
|
|
|
|
* mark : Bad address mark
|
|
|
|
|
* tzero : Couldn't find track 0
|
|
|
|
|
* abrt : Aborted Command
|
|
|
|
|
* mcr : Media Change Request
|
|
|
|
|
* id : ID field not found
|
|
|
|
|
* mce : Media Change Event
|
|
|
|
|
* ecc : Uncorrectable ECC error
|
|
|
|
|
* bdd : dual meaing
|
|
|
|
|
*/
|
|
|
|
|
typedef union {
|
|
|
|
|
unsigned all :8;
|
|
|
|
|
struct {
|
|
|
|
|
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
|
|
|
|
unsigned mark :1;
|
|
|
|
|
unsigned tzero :1;
|
|
|
|
|
unsigned abrt :1;
|
|
|
|
|
unsigned mcr :1;
|
|
|
|
|
unsigned id :1;
|
|
|
|
|
unsigned mce :1;
|
|
|
|
|
unsigned ecc :1;
|
|
|
|
|
unsigned bdd :1;
|
|
|
|
|
#elif defined(__BIG_ENDIAN_BITFIELD)
|
|
|
|
|
unsigned bdd :1;
|
|
|
|
|
unsigned ecc :1;
|
|
|
|
|
unsigned mce :1;
|
|
|
|
|
unsigned id :1;
|
|
|
|
|
unsigned mcr :1;
|
|
|
|
|
unsigned abrt :1;
|
|
|
|
|
unsigned tzero :1;
|
|
|
|
|
unsigned mark :1;
|
|
|
|
|
#else
|
|
|
|
|
#error "Please fix <asm/byteorder.h>"
|
|
|
|
|
#endif
|
|
|
|
|
} b;
|
|
|
|
|
} ata_error_t;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* ATA-IDE Select Register, aka Device-Head
|
|
|
|
|
*
|
|
|
|
|
@@ -503,39 +448,6 @@ typedef union {
|
|
|
|
|
} b;
|
|
|
|
|
} ata_status_t, atapi_status_t;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* ATA-IDE Control Register
|
|
|
|
|
*
|
|
|
|
|
* bit0 : Should be set to zero
|
|
|
|
|
* nIEN : device INTRQ to host
|
|
|
|
|
* SRST : host soft reset bit
|
|
|
|
|
* bit3 : ATA-2 thingy, Should be set to 1
|
|
|
|
|
* reserved456 : Reserved
|
|
|
|
|
* HOB : 48-bit address ordering, High Ordered Bit
|
|
|
|
|
*/
|
|
|
|
|
typedef union {
|
|
|
|
|
unsigned all : 8;
|
|
|
|
|
struct {
|
|
|
|
|
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
|
|
|
|
unsigned bit0 : 1;
|
|
|
|
|
unsigned nIEN : 1;
|
|
|
|
|
unsigned SRST : 1;
|
|
|
|
|
unsigned bit3 : 1;
|
|
|
|
|
unsigned reserved456 : 3;
|
|
|
|
|
unsigned HOB : 1;
|
|
|
|
|
#elif defined(__BIG_ENDIAN_BITFIELD)
|
|
|
|
|
unsigned HOB : 1;
|
|
|
|
|
unsigned reserved456 : 3;
|
|
|
|
|
unsigned bit3 : 1;
|
|
|
|
|
unsigned SRST : 1;
|
|
|
|
|
unsigned nIEN : 1;
|
|
|
|
|
unsigned bit0 : 1;
|
|
|
|
|
#else
|
|
|
|
|
#error "Please fix <asm/byteorder.h>"
|
|
|
|
|
#endif
|
|
|
|
|
} b;
|
|
|
|
|
} ata_control_t;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* ATAPI Feature Register
|
|
|
|
|
*
|
|
|
|
|
@@ -617,39 +529,6 @@ typedef union {
|
|
|
|
|
} b;
|
|
|
|
|
} atapi_error_t;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* ATAPI floppy Drive Select Register
|
|
|
|
|
*
|
|
|
|
|
* sam_lun : Logical unit number
|
|
|
|
|
* reserved3 : Reserved
|
|
|
|
|
* drv : The responding drive will be drive 0 (0) or drive 1 (1)
|
|
|
|
|
* one5 : Should be set to 1
|
|
|
|
|
* reserved6 : Reserved
|
|
|
|
|
* one7 : Should be set to 1
|
|
|
|
|
*/
|
|
|
|
|
typedef union {
|
|
|
|
|
unsigned all :8;
|
|
|
|
|
struct {
|
|
|
|
|
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
|
|
|
|
unsigned sam_lun :3;
|
|
|
|
|
unsigned reserved3 :1;
|
|
|
|
|
unsigned drv :1;
|
|
|
|
|
unsigned one5 :1;
|
|
|
|
|
unsigned reserved6 :1;
|
|
|
|
|
unsigned one7 :1;
|
|
|
|
|
#elif defined(__BIG_ENDIAN_BITFIELD)
|
|
|
|
|
unsigned one7 :1;
|
|
|
|
|
unsigned reserved6 :1;
|
|
|
|
|
unsigned one5 :1;
|
|
|
|
|
unsigned drv :1;
|
|
|
|
|
unsigned reserved3 :1;
|
|
|
|
|
unsigned sam_lun :3;
|
|
|
|
|
#else
|
|
|
|
|
#error "Please fix <asm/byteorder.h>"
|
|
|
|
|
#endif
|
|
|
|
|
} b;
|
|
|
|
|
} atapi_select_t;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Status returned from various ide_ functions
|
|
|
|
|
*/
|
|
|
|
|
@@ -1101,10 +980,7 @@ typedef struct ide_driver_s {
|
|
|
|
|
int (*end_request)(ide_drive_t *, int, int);
|
|
|
|
|
ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8);
|
|
|
|
|
ide_startstop_t (*abort)(ide_drive_t *, struct request *rq);
|
|
|
|
|
int (*ioctl)(ide_drive_t *, struct inode *, struct file *, unsigned int, unsigned long);
|
|
|
|
|
ide_proc_entry_t *proc;
|
|
|
|
|
void (*ata_prebuilder)(ide_drive_t *);
|
|
|
|
|
void (*atapi_prebuilder)(ide_drive_t *);
|
|
|
|
|
struct device_driver gen_driver;
|
|
|
|
|
} ide_driver_t;
|
|
|
|
|
|
|
|
|
|
@@ -1298,7 +1174,6 @@ extern int ide_spin_wait_hwgroup(ide_drive_t *);
|
|
|
|
|
extern void ide_timer_expiry(unsigned long);
|
|
|
|
|
extern irqreturn_t ide_intr(int irq, void *dev_id, struct pt_regs *regs);
|
|
|
|
|
extern void do_ide_request(request_queue_t *);
|
|
|
|
|
extern void ide_init_subdrivers(void);
|
|
|
|
|
|
|
|
|
|
void ide_init_disk(struct gendisk *, ide_drive_t *);
|
|
|
|
|
|
|
|
|
|
@@ -1371,6 +1246,12 @@ void ide_init_sg_cmd(ide_drive_t *, struct request *);
|
|
|
|
|
#define GOOD_DMA_DRIVE 1
|
|
|
|
|
|
|
|
|
|
#ifdef CONFIG_BLK_DEV_IDEDMA
|
|
|
|
|
struct drive_list_entry {
|
|
|
|
|
const char *id_model;
|
|
|
|
|
const char *id_firmware;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *);
|
|
|
|
|
int __ide_dma_bad_drive(ide_drive_t *);
|
|
|
|
|
int __ide_dma_good_drive(ide_drive_t *);
|
|
|
|
|
int ide_use_dma(ide_drive_t *);
|
|
|
|
|
|