aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsmh22@boulderdash.cl.cam.ac.uk <smh22@boulderdash.cl.cam.ac.uk>2003-02-12 18:06:34 +0000
committersmh22@boulderdash.cl.cam.ac.uk <smh22@boulderdash.cl.cam.ac.uk>2003-02-12 18:06:34 +0000
commit831f0e088fc7b9213ff63c83cc8a45fd617691b4 (patch)
tree88fae9e5bf7c34cae08db433d37ceae2b1172821
parenta9495f0f6150478d139a1fa7b37cccaadefb9689 (diff)
downloadxen-831f0e088fc7b9213ff63c83cc8a45fd617691b4.tar.gz
xen-831f0e088fc7b9213ff63c83cc8a45fd617691b4.tar.bz2
xen-831f0e088fc7b9213ff63c83cc8a45fd617691b4.zip
bitkeeper revision 1.22.2.16 (3e4a8d2aTphYwwULlRL1UC7BPu-ezQ)
rest of previous checkin
-rw-r--r--xen-2.4.16/Rules.mk1
-rw-r--r--xen-2.4.16/arch/i386/entry.S1
-rw-r--r--xen-2.4.16/arch/i386/setup.c11
-rw-r--r--xen-2.4.16/common/event.c4
-rw-r--r--xen-2.4.16/drivers/Makefile4
-rw-r--r--xen-2.4.16/drivers/block/ll_rw_blk.c27
-rw-r--r--xen-2.4.16/drivers/ide/ide-disk.c15
-rw-r--r--xen-2.4.16/drivers/ide/ide-probe.c43
-rw-r--r--xen-2.4.16/drivers/ide/ide-taskfile.c2
-rw-r--r--xen-2.4.16/drivers/ide/ide.c12
-rw-r--r--xen-2.4.16/drivers/net/Makefile4
-rw-r--r--xen-2.4.16/include/hypervisor-ifs/block.h85
-rw-r--r--xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h9
-rw-r--r--xen-2.4.16/include/xeno/blkdev.h1
-rw-r--r--xen-2.4.16/include/xeno/config.h1
-rw-r--r--xen-2.4.16/include/xeno/sched.h2
-rw-r--r--xenolinux-2.4.16-sparse/arch/xeno/drivers/block/Makefile2
-rw-r--r--xenolinux-2.4.16-sparse/drivers/block/ll_rw_blk.c5
-rw-r--r--xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor.h10
19 files changed, 199 insertions, 40 deletions
diff --git a/xen-2.4.16/Rules.mk b/xen-2.4.16/Rules.mk
index 8bea789439..33fb3d314b 100644
--- a/xen-2.4.16/Rules.mk
+++ b/xen-2.4.16/Rules.mk
@@ -15,6 +15,7 @@ OBJS += $(patsubst %.c,%.o,$(C_SRCS))
# Note that link order matters!
ALL_OBJS := $(BASEDIR)/common/common.o
ALL_OBJS += $(BASEDIR)/net/network.o
+ALL_OBJS += $(BASEDIR)/drivers/char/driver.o
ALL_OBJS += $(BASEDIR)/drivers/pci/driver.o
ALL_OBJS += $(BASEDIR)/drivers/net/driver.o
ALL_OBJS += $(BASEDIR)/drivers/block/driver.o
diff --git a/xen-2.4.16/arch/i386/entry.S b/xen-2.4.16/arch/i386/entry.S
index a26c96ccc1..ec9e2d100d 100644
--- a/xen-2.4.16/arch/i386/entry.S
+++ b/xen-2.4.16/arch/i386/entry.S
@@ -524,6 +524,7 @@ ENTRY(hypervisor_call_table)
.long SYMBOL_NAME(kill_domain)
.long SYMBOL_NAME(do_dom0_op)
.long SYMBOL_NAME(do_network_op)
+ .long SYMBOL_NAME(do_block_io_op)
.long SYMBOL_NAME(do_set_debugreg)
.long SYMBOL_NAME(do_get_debugreg)
.long SYMBOL_NAME(do_update_descriptor)
diff --git a/xen-2.4.16/arch/i386/setup.c b/xen-2.4.16/arch/i386/setup.c
index a03c4bac4d..57d3f93a7b 100644
--- a/xen-2.4.16/arch/i386/setup.c
+++ b/xen-2.4.16/arch/i386/setup.c
@@ -282,6 +282,9 @@ void __init start_of_day(void)
extern void init_timervecs(void);
extern int setup_network_devices(void);
extern void net_init(void);
+ extern void initialize_block_io(void);
+ extern void initialize_serial(void);
+ extern void initialize_keyboard(void);
unsigned long low_mem_size;
@@ -333,9 +336,15 @@ void __init start_of_day(void)
pci_init();
#endif
do_initcalls();
+
+ initialize_serial(); /* setup serial 'driver' (for debugging) */
+ initialize_keyboard(); /* setup keyboard (also for debugging) */
+
if ( !setup_network_devices() )
panic("Must have a network device!\n");
- net_init(); /* initializes virtual network system. */
+ net_init(); /* initializes virtual network system. */
+ initialize_block_io(); /* setup block devices */
+
#ifdef CONFIG_SMP
wait_init_idle = cpu_online_map;
diff --git a/xen-2.4.16/common/event.c b/xen-2.4.16/common/event.c
index 6a81c63f8b..4514d02eb3 100644
--- a/xen-2.4.16/common/event.c
+++ b/xen-2.4.16/common/event.c
@@ -15,13 +15,15 @@ typedef void (*hyp_event_callback_fn_t)(void);
extern void schedule(void);
extern void flush_rx_queue(void);
+extern void flush_blk_queue(void);
/* Ordering must match definitions of _HYP_EVENT_* in xeno/sched.h */
static hyp_event_callback_fn_t event_call_fn[] =
{
schedule,
flush_rx_queue,
- kill_domain
+ kill_domain,
+ flush_blk_queue
};
/* Handle outstanding events for the currently-executing domain. */
diff --git a/xen-2.4.16/drivers/Makefile b/xen-2.4.16/drivers/Makefile
index 5aa320fcbe..bee17fa208 100644
--- a/xen-2.4.16/drivers/Makefile
+++ b/xen-2.4.16/drivers/Makefile
@@ -1,12 +1,16 @@
default:
+ $(MAKE) -C char
$(MAKE) -C pci
$(MAKE) -C net
$(MAKE) -C block
$(MAKE) -C ide
+# $(MAKE) -C scsi
clean:
+ $(MAKE) -C char clean
$(MAKE) -C pci clean
$(MAKE) -C net clean
$(MAKE) -C block clean
$(MAKE) -C ide clean
+# $(MAKE) -C scsi clean
diff --git a/xen-2.4.16/drivers/block/ll_rw_blk.c b/xen-2.4.16/drivers/block/ll_rw_blk.c
index 0ee8477c71..06d9fb72e9 100644
--- a/xen-2.4.16/drivers/block/ll_rw_blk.c
+++ b/xen-2.4.16/drivers/block/ll_rw_blk.c
@@ -31,8 +31,12 @@
#include <xeno/slab.h>
#include <xeno/module.h>
+static void end_buffer_dummy(struct buffer_head *bh, int uptodate)
+{
+ /* do nothing */
+}
+
/* This will die as all synchronous stuff is coming to an end */
-#define end_buffer_io_sync NULL
#define complete(_r) panic("completion.h stuff may be needed...")
/*
@@ -307,10 +311,14 @@ static void generic_plug_device(request_queue_t *q, kdev_t dev)
*/
static inline void __generic_unplug_device(request_queue_t *q)
{
+ /* printk(KERN_ALERT "__generic_unplug_device %p %d\n", q, q->plugged); */
if (q->plugged) {
q->plugged = 0;
if (!list_empty(&q->queue_head))
+ {
+ /* printk(KERN_ALERT " calling %p\n", q->request_fn); */
q->request_fn(q);
+ }
}
}
@@ -319,6 +327,8 @@ void generic_unplug_device(void *data)
request_queue_t *q = (request_queue_t *) data;
unsigned long flags;
+ /* printk(KERN_ALERT "generic_unplug_device\n"); */
+
spin_lock_irqsave(&io_request_lock, flags);
__generic_unplug_device(q);
spin_unlock_irqrestore(&io_request_lock, flags);
@@ -856,6 +866,8 @@ static int __make_request(request_queue_t * q, int rw,
int latency;
elevator_t *elevator = &q->elevator;
+ /* printk(KERN_ALERT "__make_request\n");*/
+
count = bh->b_size >> 9;
sector = bh->b_rsector;
@@ -1061,6 +1073,8 @@ void generic_make_request (int rw, struct buffer_head * bh)
int minorsize = 0;
request_queue_t *q;
+ /* printk(KERN_ALERT "generic_make_request\n"); */
+
if (!bh->b_end_io)
BUG();
@@ -1130,6 +1144,8 @@ void submit_bh(int rw, struct buffer_head * bh)
{
int count = bh->b_size >> 9;
+ /* printk(KERN_ALERT "submit_bh\n"); */
+
if (!test_bit(BH_Lock, &bh->b_state))
BUG();
@@ -1141,7 +1157,7 @@ void submit_bh(int rw, struct buffer_head * bh)
* further remap this.
*/
bh->b_rdev = bh->b_dev;
- bh->b_rsector = bh->b_blocknr * count;
+ /* bh->b_rsector = bh->b_blocknr * count; */
generic_make_request(rw, bh);
@@ -1194,6 +1210,8 @@ void ll_rw_block(int rw, int nr, struct buffer_head * bhs[])
int correct_size;
int i;
+ /* printk(KERN_ALERT "ll_rw_block %d %d\n", rw, nr); */
+
if (!nr)
return;
@@ -1229,14 +1247,14 @@ void ll_rw_block(int rw, int nr, struct buffer_head * bhs[])
/* We have the buffer lock */
atomic_inc(&bh->b_count);
- bh->b_end_io = end_buffer_io_sync;
+ bh->b_end_io = end_buffer_dummy;
switch(rw) {
case WRITE:
if (!atomic_set_buffer_clean(bh))
/* Hmmph! Nothing to write */
goto end_io;
- __mark_buffer_clean(bh);
+ /* __mark_buffer_clean(bh); */
break;
case READA:
@@ -1302,6 +1320,7 @@ int end_that_request_first (struct request *req, int uptodate, char *name)
req->bh = bh->b_reqnext;
bh->b_reqnext = NULL;
bh->b_end_io(bh, uptodate);
+ end_block_io_op(bh);
if ((bh = req->bh) != NULL) {
req->hard_sector += nsect;
req->hard_nr_sectors -= nsect;
diff --git a/xen-2.4.16/drivers/ide/ide-disk.c b/xen-2.4.16/drivers/ide/ide-disk.c
index 984e53cd67..0d1cd113cd 100644
--- a/xen-2.4.16/drivers/ide/ide-disk.c
+++ b/xen-2.4.16/drivers/ide/ide-disk.c
@@ -420,13 +420,13 @@ static ide_startstop_t chs_rw_disk (ide_drive_t *drive, struct request *rq, unsi
taskfile.device_head |= drive->select.all;
taskfile.command = command;
-#ifdef DEBUG
+ /* #ifdef DEBUG */
printk("%s: %sing: ", drive->name, (rq->cmd==READ) ? "read" : "writ");
if (lba) printk("LBAsect=%lld, ", block);
else printk("CHS=%d/%d/%d, ", cyl, head, sect);
printk("sectors=%ld, ", rq->nr_sectors);
printk("buffer=0x%08lx\n", (unsigned long) rq->buffer);
-#endif
+ /* #endif*/
memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
@@ -578,7 +578,8 @@ static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsig
tasklets[9] = (task_ioreg_t) 0;
// tasklets[8] = (task_ioreg_t) (block>>32);
// tasklets[9] = (task_ioreg_t) (block>>40);
-#ifdef DEBUG
+ /*#ifdef DEBUG */
+ printk("[A]\n");
printk("%s: %sing: LBAsect=%lu, sectors=%ld, buffer=0x%08lx, LBAsect=0x%012lx\n",
drive->name,
(rq->cmd==READ)?"read":"writ",
@@ -590,7 +591,7 @@ static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsig
drive->name, tasklets[3], tasklets[2],
tasklets[9], tasklets[8], tasklets[7],
tasklets[6], tasklets[5], tasklets[4]);
-#endif
+ /* #endif */
OUT_BYTE(tasklets[1], IDE_FEATURE_REG);
OUT_BYTE(tasklets[3], IDE_NSECTOR_REG);
OUT_BYTE(tasklets[7], IDE_SECTOR_REG);
@@ -1320,6 +1321,10 @@ static void idedisk_setup (ide_drive_t *drive)
struct hd_driveid *id = drive->id;
unsigned long capacity;
+
+ printk (KERN_ALERT
+ "ide-disk.c::idedisk_setup: chs %d %d %d\n",
+ drive->cyl, drive->head, drive->sect);
idedisk_add_settings(drive);
@@ -1383,7 +1388,7 @@ static void idedisk_setup (ide_drive_t *drive)
if ((capacity >= (drive->bios_cyl * drive->bios_sect * drive->bios_head)) &&
(!drive->forced_geom) && drive->bios_sect && drive->bios_head)
drive->bios_cyl = (capacity / drive->bios_sect) / drive->bios_head;
- printk (KERN_INFO "XEN %s: %ld sectors", drive->name, capacity);
+ printk (KERN_INFO "[XEN] %s: %ld sectors", drive->name, capacity);
/* Give size in megabytes (MB), not mebibytes (MiB). */
/* We compute the exact rounded value, avoiding overflow. */
diff --git a/xen-2.4.16/drivers/ide/ide-probe.c b/xen-2.4.16/drivers/ide/ide-probe.c
index e83157ec01..99f38dfcb8 100644
--- a/xen-2.4.16/drivers/ide/ide-probe.c
+++ b/xen-2.4.16/drivers/ide/ide-probe.c
@@ -51,11 +51,18 @@
#include <asm/uaccess.h>
#include <asm/io.h>
+#define IDE_PROBE_TRACE 0
+
static inline void do_identify (ide_drive_t *drive, byte cmd)
{
int bswap = 1;
struct hd_driveid *id;
+ if (IDE_PROBE_TRACE)
+ {
+ printk (KERN_ALERT "ide-probe::do_identify\n");
+ }
+
id = drive->id = kmalloc (SECTOR_WORDS*4, GFP_ATOMIC); /* called with interrupts disabled! */
if (!id) {
printk(KERN_WARNING "(ide-probe::do_identify) Out of memory.\n");
@@ -201,6 +208,11 @@ static int actual_try_to_identify (ide_drive_t *drive, byte cmd)
unsigned long timeout;
byte s, a;
+ if (IDE_PROBE_TRACE)
+ {
+ printk (KERN_ALERT "ide-probe::actual_try_to_identify\n");
+ }
+
if (IDE_CONTROL_REG) {
/* take a deep breath */
ide_delay_50ms();
@@ -260,6 +272,11 @@ static int try_to_identify (ide_drive_t *drive, byte cmd)
int autoprobe = 0;
unsigned long cookie = 0;
+ if (IDE_PROBE_TRACE)
+ {
+ printk (KERN_ALERT "ide-probe::try_to_identify\n");
+ }
+
if (IDE_CONTROL_REG && !HWIF(drive)->irq) {
autoprobe = 1;
cookie = probe_irq_on();
@@ -314,6 +331,12 @@ static int do_probe (ide_drive_t *drive, byte cmd)
{
int rc;
ide_hwif_t *hwif = HWIF(drive);
+
+ if (IDE_PROBE_TRACE)
+ {
+ printk (KERN_ALERT "ide-probe::do_probe\n");
+ }
+
if (drive->present) { /* avoid waiting for inappropriate probes */
if ((drive->media != ide_disk) && (cmd == WIN_IDENTIFY))
return 4;
@@ -372,6 +395,11 @@ static void enable_nest (ide_drive_t *drive)
{
unsigned long timeout;
+ if (IDE_PROBE_TRACE)
+ {
+ printk (KERN_ALERT "ide-probe::enable_nest\n");
+ }
+
printk("%s: enabling %s -- ", HWIF(drive)->name, drive->id->model);
SELECT_DRIVE(HWIF(drive), drive);
ide_delay_50ms();
@@ -402,6 +430,11 @@ static void enable_nest (ide_drive_t *drive)
*/
static inline byte probe_for_drive (ide_drive_t *drive)
{
+ if (IDE_PROBE_TRACE)
+ {
+ printk (KERN_ALERT "ide-probe::probe_for_drive\n");
+ }
+
if (drive->noprobe) /* skip probing? */
return drive->present;
if (do_probe(drive, WIN_IDENTIFY) >= 2) { /* if !(success||timed-out) */
@@ -500,6 +533,11 @@ static void probe_hwif (ide_hwif_t *hwif)
unsigned int unit;
unsigned long flags;
+ if (IDE_PROBE_TRACE)
+ {
+ printk (KERN_ALERT "ide-probe::probe_hwif\n");
+ }
+
if (hwif->noprobe)
return;
#ifdef CONFIG_BLK_DEV_IDE
@@ -978,6 +1016,11 @@ int ideprobe_init (void)
{
unsigned int index;
int probe[MAX_HWIFS];
+
+ if (IDE_PROBE_TRACE)
+ {
+ printk (KERN_ALERT "ide-probe::ideprobe_init\n");
+ }
MOD_INC_USE_COUNT;
memset(probe, 0, MAX_HWIFS * sizeof(int));
diff --git a/xen-2.4.16/drivers/ide/ide-taskfile.c b/xen-2.4.16/drivers/ide/ide-taskfile.c
index 34bfacebfe..578af55156 100644
--- a/xen-2.4.16/drivers/ide/ide-taskfile.c
+++ b/xen-2.4.16/drivers/ide/ide-taskfile.c
@@ -171,6 +171,8 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
struct hd_driveid *id = drive->id;
byte HIHI = (drive->addressing) ? 0xE0 : 0xEF;
+ printk(KERN_ALERT "do_rw_taskfile\n");
+
/* (ks/hs): Moved to start, do not use for multiple out commands */
if (task->handler != task_mulout_intr) {
if (IDE_CONTROL_REG)
diff --git a/xen-2.4.16/drivers/ide/ide.c b/xen-2.4.16/drivers/ide/ide.c
index af3694bf85..51cee21f77 100644
--- a/xen-2.4.16/drivers/ide/ide.c
+++ b/xen-2.4.16/drivers/ide/ide.c
@@ -1391,6 +1391,8 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
block = rq->sector;
blockend = block + rq->nr_sectors;
+
+#ifdef NEVER
if ((rq->cmd == READ || rq->cmd == WRITE) &&
(drive->media == ide_disk || drive->media == ide_floppy)) {
if ((blockend < block) || (blockend > drive->part[minor&PARTN_MASK].nr_sects)) {
@@ -1404,6 +1406,15 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
possibly killing some innocent following sector */
if (block == 0 && drive->remap_0_to_1 == 1)
block = 1; /* redirect MBR access to EZ-Drive partn table */
+#endif
+
+#ifdef NEVER_DEBUG
+ {
+ printk(" ide::start_request %lx %lx %lx %lx %lx\n",
+ rq->sector, rq->nr_sectors, block,
+ drive->part[minor&PARTN_MASK].start_sect, drive->sect0);
+ }
+#endif
#if (DISK_RECOVERY_TIME > 0)
while ((read_timer() - hwif->last_time) < DISK_RECOVERY_TIME);
@@ -1414,6 +1425,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
printk("%s: drive not ready for command\n", drive->name);
return startstop;
}
+ drive->special.all = 0;
if (!drive->special.all) {
switch(rq->cmd) {
case IDE_DRIVE_CMD:
diff --git a/xen-2.4.16/drivers/net/Makefile b/xen-2.4.16/drivers/net/Makefile
index 8b752b9712..5b20a6c8c9 100644
--- a/xen-2.4.16/drivers/net/Makefile
+++ b/xen-2.4.16/drivers/net/Makefile
@@ -4,13 +4,11 @@ include $(BASEDIR)/Rules.mk
default: $(OBJS)
$(MAKE) -C ne
$(MAKE) -C tulip
- $(MAKE) -C e1000
- $(LD) -r -o driver.o $(OBJS) tulip/tulip.o e1000/e1000.o ne/ne_drv.o
+ $(LD) -r -o driver.o $(OBJS) tulip/tulip.o ne/ne_drv.o
clean:
$(MAKE) -C ne clean
$(MAKE) -C tulip clean
- $(MAKE) -C e1000 clean
rm -f *.o *~ core
.PHONY: default clean
diff --git a/xen-2.4.16/include/hypervisor-ifs/block.h b/xen-2.4.16/include/hypervisor-ifs/block.h
index 55f7a33ce2..1722a6c288 100644
--- a/xen-2.4.16/include/hypervisor-ifs/block.h
+++ b/xen-2.4.16/include/hypervisor-ifs/block.h
@@ -6,35 +6,80 @@
* These are the ring data structures for buffering messages between
* the hypervisor and guestos's.
*
- * For now we'll start with our own rings for the block IO code instead
- * of using the network rings. Hopefully, this will give us additional
- * flexibility in the future should we choose to move away from a
- * ring producer consumer communication model.
*/
#ifndef __BLOCK_H__
#define __BLOCK_H__
-typedef struct blk_tx_entry_st {
- unsigned long addr; /* virtual address */
- unsigned long size; /* in bytes */
-} blk_tx_entry_t;
+#include <linux/kdev_t.h>
-typedef struct blk_rx_entry_st {
- unsigned long addr; /* virtual address */
- unsigned long size; /* in bytes */
-} blk_rx_entry_t;
+/* the first four definitions match fs.h */
+#define XEN_BLOCK_READ 0
+#define XEN_BLOCK_WRITE 1
+#define XEN_BLOCK_READA 2 /* currently unused */
+#define XEN_BLOCK_SPECIAL 4 /* currently unused */
+#define XEN_BLOCK_PROBE 8 /* determine io configuration from hypervisor */
+#define XEN_BLOCK_DEBUG 16 /* debug */
-typedef struct blk_ring_st {
- blk_tx_entry_t *tx_ring;
- unsigned int tx_prod, tx_cons, tx_event;
- unsigned int tx_ring_size;
+#define XEN_BLOCK_SYNC 2
+#define XEN_BLOCK_ASYNC 3
- blk_rx_entry_t *rx_ring;
- unsigned int rx_prod, rx_cons, rx_event;
- unsigned int rx_ring_size;
+#define XEN_BLOCK_MAX_DOMAINS 32 /* NOTE: FIX THIS. VALUE SHOULD COME FROM? */
+
+#define BLK_TX_RING_SIZE 256
+#define BLK_RX_RING_SIZE 256
+
+#define BLK_TX_RING_MAX_ENTRIES (BLK_TX_RING_SIZE - 2)
+#define BLK_RX_RING_MAX_ENTRIES (BLK_RX_RING_SIZE - 2)
+
+#define BLK_TX_RING_INC(_i) (((_i)+1) & (BLK_TX_RING_SIZE-1))
+#define BLK_RX_RING_INC(_i) (((_i)+1) & (BLK_RX_RING_SIZE-1))
+#define BLK_TX_RING_ADD(_i,_j) (((_i)+(_j)) & (BLK_TX_RING_SIZE-1))
+#define BLK_RX_RING_ADD(_i,_j) (((_i)+(_j)) & (BLK_RX_RING_SIZE-1))
+
+typedef struct blk_ring_entry
+{
+ void * id; /* for guest os use; used for the bh */
+ int priority; /* orig sched pri, SYNC or ASYNC for now */
+ int operation; /* XEN_BLOCK_READ or XEN_BLOCK_WRITE */
+ char * buffer;
+ unsigned long block_number; /* block number */
+ unsigned short block_size; /* block size */
+ kdev_t device;
+ unsigned long sector_number; /* real buffer location on disk */
+} blk_ring_entry_t;
+
+typedef struct blk_ring_st
+{
+ blk_ring_entry_t *tx_ring;
+ unsigned int tx_prod, tx_cons;
+ unsigned int tx_ring_size;
+
+ blk_ring_entry_t *rx_ring;
+ unsigned int rx_prod, rx_cons;
+ unsigned int rx_ring_size;
} blk_ring_t;
-int blk_create_ring(int domain, unsigned long ptr);
+#define MAX_XEN_DISK_COUNT 100
+
+#define XEN_DISK_IDE 1
+#define XEN_DISK_SCSI 2
+
+typedef struct xen_disk /* physical disk */
+{
+ int type; /* disk type */
+ unsigned long capacity;
+ unsigned char heads; /* hdreg.h::hd_geometry */
+ unsigned char sectors; /* hdreg.h::hd_geometry */
+ unsigned int cylinders; /* hdreg.h::hd_big_geometry */
+ unsigned long start; /* hdreg.h::hd_geometry */
+ void * gendisk; /* struct gendisk ptr */
+} xen_disk_t;
+
+typedef struct xen_disk_info
+{
+ int count; /* number of subsequent xen_disk_t structures to follow */
+ xen_disk_t disks[100];
+} xen_disk_info_t;
#endif
diff --git a/xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h b/xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h
index a0cfc7ae59..ad3c9a5dd8 100644
--- a/xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h
+++ b/xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h
@@ -85,10 +85,11 @@ typedef struct
#define __HYPERVISOR_exit 8
#define __HYPERVISOR_dom0_op 9
#define __HYPERVISOR_network_op 10
-#define __HYPERVISOR_set_debugreg 11
-#define __HYPERVISOR_get_debugreg 12
-#define __HYPERVISOR_update_descriptor 13
-#define __HYPERVISOR_set_fast_trap 14
+#define __HYPERVISOR_block_io_op 11
+#define __HYPERVISOR_set_debugreg 12
+#define __HYPERVISOR_get_debugreg 13
+#define __HYPERVISOR_update_descriptor 14
+#define __HYPERVISOR_set_fast_trap 15
#define TRAP_INSTR "int $0x82"
diff --git a/xen-2.4.16/include/xeno/blkdev.h b/xen-2.4.16/include/xeno/blkdev.h
index 2701eb84e3..f5c1d25d75 100644
--- a/xen-2.4.16/include/xeno/blkdev.h
+++ b/xen-2.4.16/include/xeno/blkdev.h
@@ -85,6 +85,7 @@ struct buffer_head {
struct inode * b_inode;
struct list_head b_inode_buffers; /* doubly linked list of inode dirty buffers */
+ void *b_xen_request; /* xen request structure */
};
typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate);
diff --git a/xen-2.4.16/include/xeno/config.h b/xen-2.4.16/include/xeno/config.h
index 637281f64b..d9ffb1d95d 100644
--- a/xen-2.4.16/include/xeno/config.h
+++ b/xen-2.4.16/include/xeno/config.h
@@ -29,6 +29,7 @@
#define CONFIG_IDEDMA_PCI_AUTO 1
#define CONFIG_IDEDMA_AUTO 1
#define CONFIG_BLK_DEV_IDE_MODES 1
+#define CONFIG_BLK_DEV_PIIX 1
#define CONFIG_SCSI 1
#define CONFIG_BLK_DEV_SD 1
diff --git a/xen-2.4.16/include/xeno/sched.h b/xen-2.4.16/include/xeno/sched.h
index 6f2863e8a5..370852af00 100644
--- a/xen-2.4.16/include/xeno/sched.h
+++ b/xen-2.4.16/include/xeno/sched.h
@@ -1,4 +1,3 @@
-
#ifndef _LINUX_SCHED_H
#define _LINUX_SCHED_H
@@ -49,6 +48,7 @@ extern struct mm_struct init_mm;
#define _HYP_EVENT_NEED_RESCHED 0
#define _HYP_EVENT_NET_RX 1
#define _HYP_EVENT_DIE 2
+#define _HYP_EVENT_BLK_RX 3
#define PF_DONEFPUINIT 0x1 /* Has the FPU been initialised for this task? */
#define PF_USEDFPU 0x2 /* Has this task used the FPU since last save? */
diff --git a/xenolinux-2.4.16-sparse/arch/xeno/drivers/block/Makefile b/xenolinux-2.4.16-sparse/arch/xeno/drivers/block/Makefile
index 9361a01ec7..74a0c6c565 100644
--- a/xenolinux-2.4.16-sparse/arch/xeno/drivers/block/Makefile
+++ b/xenolinux-2.4.16-sparse/arch/xeno/drivers/block/Makefile
@@ -1,3 +1,3 @@
O_TARGET := blk.o
-obj-y := block.o
+obj-y := xl_block.o xl_block_test.o
include $(TOPDIR)/Rules.make
diff --git a/xenolinux-2.4.16-sparse/drivers/block/ll_rw_blk.c b/xenolinux-2.4.16-sparse/drivers/block/ll_rw_blk.c
index a9e973d05f..c6d5c9625b 100644
--- a/xenolinux-2.4.16-sparse/drivers/block/ll_rw_blk.c
+++ b/xenolinux-2.4.16-sparse/drivers/block/ll_rw_blk.c
@@ -1227,6 +1227,11 @@ int __init blk_dev_init(void)
#ifdef CONFIG_SUN_JSFLASH
jsfd_init();
#endif
+
+#ifdef CONFIG_XENOLINUX_BLOCK
+ xlblk_init();
+#endif
+
return 0;
};
diff --git a/xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor.h b/xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor.h
index d25c6f8171..8e9ef3eed5 100644
--- a/xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor.h
+++ b/xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor.h
@@ -257,6 +257,16 @@ static inline int HYPERVISOR_network_op(void *network_op)
return ret;
}
+static inline int HYPERVISOR_block_io_op(void)
+{
+ int ret;
+ __asm__ __volatile__ (
+ TRAP_INSTR
+ : "=a" (ret) : "0" (__HYPERVISOR_block_io_op) );
+
+ return ret;
+}
+
static inline int HYPERVISOR_set_debugreg(int reg, unsigned long value)
{
int ret;