summaryrefslogtreecommitdiffstats
path: root/drivers/block/blk.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/blk.h')
-rw-r--r--drivers/block/blk.h127
1 files changed, 84 insertions, 43 deletions
diff --git a/drivers/block/blk.h b/drivers/block/blk.h
index 53d55b17d..797c6a95e 100644
--- a/drivers/block/blk.h
+++ b/drivers/block/blk.h
@@ -3,16 +3,12 @@
#include <linux/blkdev.h>
#include <linux/locks.h>
+#include <linux/config.h>
/*
* NR_REQUEST is the number of entries in the request-queue.
* NOTE that writes may use only the low 2/3 of these: reads
* take precedence.
- *
- * 32 seems to be a reasonable number: enough to get some benefit
- * from the elevator-mechanism, but not so much as to lock a lot of
- * buffers when they are in the queue. 64 seems to be too many (easily
- * long pauses in reading when heavy writing/syncing is going on)
*/
#define NR_REQUEST 64
@@ -30,16 +26,31 @@
* These will have to be changed to be aware of different buffer
* sizes etc.. It actually needs a major cleanup.
*/
+#ifdef IDE_DRIVER
+#define SECTOR_MASK ((BLOCK_SIZE >> 9) - 1)
+#else
#define SECTOR_MASK (blksize_size[MAJOR_NR] && \
blksize_size[MAJOR_NR][MINOR(CURRENT->dev)] ? \
((blksize_size[MAJOR_NR][MINOR(CURRENT->dev)] >> 9) - 1) : \
((BLOCK_SIZE >> 9) - 1))
+#endif /* IDE_DRIVER */
#define SUBSECTOR(block) (CURRENT->current_nr_sectors > 0)
-extern unsigned long hd_init(unsigned long mem_start, unsigned long mem_end);
extern unsigned long cdu31a_init(unsigned long mem_start, unsigned long mem_end);
extern unsigned long mcd_init(unsigned long mem_start, unsigned long mem_end);
+#ifdef CONFIG_AZTCD
+extern unsigned long aztcd_init(unsigned long mem_start, unsigned long mem_end);
+#endif
+#ifdef CONFIG_CDU535
+extern unsigned long sony535_init(unsigned long mem_start, unsigned long mem_end);
+#endif
+#ifdef CONFIG_BLK_DEV_HD
+extern unsigned long hd_init(unsigned long mem_start, unsigned long mem_end);
+#endif
+#ifdef CONFIG_BLK_DEV_IDE
+extern unsigned long ide_init(unsigned long mem_start, unsigned long mem_end);
+#endif
#ifdef CONFIG_SBPCD
extern unsigned long sbpcd_init(unsigned long, unsigned long);
#endif CONFIG_SBPCD
@@ -64,14 +75,19 @@ extern unsigned long xd_init(unsigned long mem_start, unsigned long mem_end);
case BLKROGET: { int __err = verify_area(VERIFY_WRITE, (void *) (where), sizeof(long)); \
if (!__err) put_fs_long(0!=is_read_only(dev),(long *) (where)); return __err; }
-#ifdef MAJOR_NR
+#if defined(MAJOR_NR) || defined(IDE_DRIVER)
/*
- * Add entries as needed. Currently the only block devices
- * supported are hard-disks and floppies.
+ * Add entries as needed.
*/
-#if (MAJOR_NR == MEM_MAJOR)
+#ifdef IDE_DRIVER
+
+#define DEVICE_NR(device) (MINOR(device) >> PARTN_BITS)
+#define DEVICE_ON(device) /* nothing */
+#define DEVICE_OFF(device) /* nothing */
+
+#elif (MAJOR_NR == MEM_MAJOR)
/* ram disk */
#define DEVICE_NAME "ramdisk"
@@ -117,7 +133,7 @@ static void floppy_off(unsigned int nr);
#define DEVICE_NAME "scsitape"
#define DEVICE_INTR do_st
-#define DEVICE_NR(device) (MINOR(device))
+#define DEVICE_NR(device) (MINOR(device) & 0x7f)
#define DEVICE_ON(device)
#define DEVICE_OFF(device)
@@ -155,6 +171,23 @@ static void floppy_off(unsigned int nr);
#define DEVICE_ON(device)
#define DEVICE_OFF(device)
+#elif (MAJOR_NR == AZTECH_CDROM_MAJOR)
+
+#define DEVICE_NAME "Aztech CD-ROM"
+#define DEVICE_REQUEST do_aztcd_request
+#define DEVICE_NR(device) (MINOR(device))
+#define DEVICE_ON(device)
+#define DEVICE_OFF(device)
+
+#elif (MAJOR_NR == CDU535_CDROM_MAJOR)
+
+#define DEVICE_NAME "SONY-CDU535"
+#define DEVICE_INTR do_cdu535
+#define DEVICE_REQUEST do_cdu535_request
+#define DEVICE_NR(device) (MINOR(device))
+#define DEVICE_ON(device)
+#define DEVICE_OFF(device)
+
#elif (MAJOR_NR == MATSUSHITA_CDROM_MAJOR)
#define DEVICE_NAME "Matsushita CD-ROM controller #1"
@@ -187,9 +220,9 @@ static void floppy_off(unsigned int nr);
#define DEVICE_ON(device)
#define DEVICE_OFF(device)
-#endif
+#endif /* MAJOR_NR == whatever */
-#if (MAJOR_NR != SCSI_TAPE_MAJOR)
+#if (MAJOR_NR != SCSI_TAPE_MAJOR) && !defined(IDE_DRIVER)
#ifndef CURRENT
#define CURRENT (blk_dev[MAJOR_NR].current_request)
@@ -215,27 +248,50 @@ if ((DEVICE_INTR = (x)) != NULL) \
else \
CLEAR_TIMER;
-#else
+#else /* !DEVICE_TIMEOUT */
#define SET_INTR(x) (DEVICE_INTR = (x))
-#endif
+#endif /* DEVICE_TIMEOUT */
+
static void (DEVICE_REQUEST)(void);
+#ifdef DEVICE_INTR
+#define CLEAR_INTR SET_INTR(NULL)
+#else
+#define CLEAR_INTR
+#endif
+
+#define INIT_REQUEST \
+ if (!CURRENT) {\
+ CLEAR_INTR; \
+ return; \
+ } \
+ if (MAJOR(CURRENT->dev) != MAJOR_NR) \
+ panic(DEVICE_NAME ": request list destroyed"); \
+ if (CURRENT->bh) { \
+ if (!CURRENT->bh->b_lock) \
+ panic(DEVICE_NAME ": block not locked"); \
+ }
+
+#endif /* (MAJOR_NR != SCSI_TAPE_MAJOR) && !defined(IDE_DRIVER) */
+
/* end_request() - SCSI devices have their own version */
#if ! SCSI_MAJOR(MAJOR_NR)
-static void end_request(int uptodate)
-{
- struct request * req;
+#ifdef IDE_DRIVER
+static void end_request(byte uptodate, byte hwif) {
+ struct request *req = ide_cur_rq[HWIF];
+#else
+static void end_request(int uptodate) {
+ struct request *req = CURRENT;
+#endif /* IDE_DRIVER */
struct buffer_head * bh;
- req = CURRENT;
req->errors = 0;
if (!uptodate) {
- printk(DEVICE_NAME " I/O error\n");
- printk("dev %04lX, sector %lu\n",
+ printk("end_request: I/O error, dev %04lX, sector %lu\n",
(unsigned long)req->dev, req->sector);
req->nr_sectors--;
req->nr_sectors &= ~SECTOR_MASK;
@@ -259,34 +315,19 @@ static void end_request(int uptodate)
return;
}
}
+#ifdef IDE_DRIVER
+ ide_cur_rq[HWIF] = NULL;
+#else
DEVICE_OFF(req->dev);
CURRENT = req->next;
+#endif /* IDE_DRIVER */
if (req->sem != NULL)
up(req->sem);
req->dev = -1;
wake_up(&wait_for_request);
}
-#endif
+#endif /* ! SCSI_MAJOR(MAJOR_NR) */
-#ifdef DEVICE_INTR
-#define CLEAR_INTR SET_INTR(NULL)
-#else
-#define CLEAR_INTR
-#endif
+#endif /* defined(MAJOR_NR) || defined(IDE_DRIVER) */
-#define INIT_REQUEST \
- if (!CURRENT) {\
- CLEAR_INTR; \
- return; \
- } \
- if (MAJOR(CURRENT->dev) != MAJOR_NR) \
- panic(DEVICE_NAME ": request list destroyed"); \
- if (CURRENT->bh) { \
- if (!CURRENT->bh->b_lock) \
- panic(DEVICE_NAME ": block not locked"); \
- }
-
-#endif
-
-#endif
-#endif
+#endif /* _BLK_H */