ia64/xen-unstable

changeset 147:2868f9ebcc69

bitkeeper revision 1.22.2.16 (3e4a8d2aTphYwwULlRL1UC7BPu-ezQ)

rest of previous checkin
author smh22@boulderdash.cl.cam.ac.uk
date Wed Feb 12 18:06:34 2003 +0000 (2003-02-12)
parents b15e9e05e112
children 8b22726a81da
files xen-2.4.16/Rules.mk xen-2.4.16/arch/i386/entry.S xen-2.4.16/arch/i386/setup.c xen-2.4.16/common/event.c xen-2.4.16/drivers/Makefile xen-2.4.16/drivers/block/ll_rw_blk.c xen-2.4.16/drivers/ide/ide-disk.c xen-2.4.16/drivers/ide/ide-probe.c xen-2.4.16/drivers/ide/ide-taskfile.c xen-2.4.16/drivers/ide/ide.c xen-2.4.16/drivers/net/Makefile xen-2.4.16/include/hypervisor-ifs/block.h xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h xen-2.4.16/include/xeno/blkdev.h xen-2.4.16/include/xeno/config.h xen-2.4.16/include/xeno/sched.h xenolinux-2.4.16-sparse/arch/xeno/drivers/block/Makefile xenolinux-2.4.16-sparse/drivers/block/ll_rw_blk.c xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor.h
line diff
     1.1 --- a/xen-2.4.16/Rules.mk	Wed Feb 12 18:04:53 2003 +0000
     1.2 +++ b/xen-2.4.16/Rules.mk	Wed Feb 12 18:06:34 2003 +0000
     1.3 @@ -15,6 +15,7 @@ OBJS    += $(patsubst %.c,%.o,$(C_SRCS))
     1.4  # Note that link order matters!
     1.5  ALL_OBJS := $(BASEDIR)/common/common.o
     1.6  ALL_OBJS += $(BASEDIR)/net/network.o
     1.7 +ALL_OBJS += $(BASEDIR)/drivers/char/driver.o
     1.8  ALL_OBJS += $(BASEDIR)/drivers/pci/driver.o
     1.9  ALL_OBJS += $(BASEDIR)/drivers/net/driver.o
    1.10  ALL_OBJS += $(BASEDIR)/drivers/block/driver.o
     2.1 --- a/xen-2.4.16/arch/i386/entry.S	Wed Feb 12 18:04:53 2003 +0000
     2.2 +++ b/xen-2.4.16/arch/i386/entry.S	Wed Feb 12 18:06:34 2003 +0000
     2.3 @@ -524,6 +524,7 @@ ENTRY(hypervisor_call_table)
     2.4          .long SYMBOL_NAME(kill_domain)
     2.5          .long SYMBOL_NAME(do_dom0_op)
     2.6          .long SYMBOL_NAME(do_network_op)
     2.7 +        .long SYMBOL_NAME(do_block_io_op)
     2.8          .long SYMBOL_NAME(do_set_debugreg)
     2.9          .long SYMBOL_NAME(do_get_debugreg)
    2.10          .long SYMBOL_NAME(do_update_descriptor)
     3.1 --- a/xen-2.4.16/arch/i386/setup.c	Wed Feb 12 18:04:53 2003 +0000
     3.2 +++ b/xen-2.4.16/arch/i386/setup.c	Wed Feb 12 18:06:34 2003 +0000
     3.3 @@ -282,6 +282,9 @@ void __init start_of_day(void)
     3.4      extern void init_timervecs(void);
     3.5      extern int  setup_network_devices(void);
     3.6      extern void net_init(void);
     3.7 +    extern void initialize_block_io(void);
     3.8 +    extern void initialize_serial(void);
     3.9 +    extern void initialize_keyboard(void);
    3.10  
    3.11      unsigned long low_mem_size;
    3.12      
    3.13 @@ -333,9 +336,15 @@ void __init start_of_day(void)
    3.14      pci_init();
    3.15  #endif
    3.16      do_initcalls();
    3.17 +
    3.18 +    initialize_serial();   /* setup serial 'driver' (for debugging) */
    3.19 +    initialize_keyboard(); /* setup keyboard (also for debugging) */
    3.20 +
    3.21      if ( !setup_network_devices() )
    3.22          panic("Must have a network device!\n");
    3.23 -    net_init(); /* initializes virtual network system. */
    3.24 +    net_init();            /* initializes virtual network system. */
    3.25 +    initialize_block_io(); /* setup block devices */
    3.26 +
    3.27  
    3.28  #ifdef CONFIG_SMP
    3.29      wait_init_idle = cpu_online_map;
     4.1 --- a/xen-2.4.16/common/event.c	Wed Feb 12 18:04:53 2003 +0000
     4.2 +++ b/xen-2.4.16/common/event.c	Wed Feb 12 18:06:34 2003 +0000
     4.3 @@ -15,13 +15,15 @@ typedef void (*hyp_event_callback_fn_t)(
     4.4  
     4.5  extern void schedule(void);
     4.6  extern void flush_rx_queue(void);
     4.7 +extern void flush_blk_queue(void);
     4.8  
     4.9  /* Ordering must match definitions of _HYP_EVENT_* in xeno/sched.h */
    4.10  static hyp_event_callback_fn_t event_call_fn[] = 
    4.11  {
    4.12      schedule,
    4.13      flush_rx_queue,
    4.14 -    kill_domain
    4.15 +    kill_domain, 
    4.16 +    flush_blk_queue
    4.17  };
    4.18  
    4.19  /* Handle outstanding events for the currently-executing domain. */
     5.1 --- a/xen-2.4.16/drivers/Makefile	Wed Feb 12 18:04:53 2003 +0000
     5.2 +++ b/xen-2.4.16/drivers/Makefile	Wed Feb 12 18:06:34 2003 +0000
     5.3 @@ -1,12 +1,16 @@
     5.4  
     5.5  default:
     5.6 +	$(MAKE) -C char
     5.7  	$(MAKE) -C pci
     5.8  	$(MAKE) -C net
     5.9  	$(MAKE) -C block
    5.10  	$(MAKE) -C ide
    5.11 +#	$(MAKE) -C scsi
    5.12  
    5.13  clean:
    5.14 +	$(MAKE) -C char clean
    5.15  	$(MAKE) -C pci clean
    5.16  	$(MAKE) -C net clean
    5.17  	$(MAKE) -C block clean
    5.18  	$(MAKE) -C ide clean
    5.19 +#	$(MAKE) -C scsi clean
     6.1 --- a/xen-2.4.16/drivers/block/ll_rw_blk.c	Wed Feb 12 18:04:53 2003 +0000
     6.2 +++ b/xen-2.4.16/drivers/block/ll_rw_blk.c	Wed Feb 12 18:06:34 2003 +0000
     6.3 @@ -31,8 +31,12 @@
     6.4  #include <xeno/slab.h>
     6.5  #include <xeno/module.h>
     6.6  
     6.7 +static void end_buffer_dummy(struct buffer_head *bh, int uptodate)
     6.8 +{
     6.9 +  /* do nothing */
    6.10 +}
    6.11 +
    6.12  /* This will die as all synchronous stuff is coming to an end */
    6.13 -#define end_buffer_io_sync NULL
    6.14  #define complete(_r) panic("completion.h stuff may be needed...")
    6.15  
    6.16  /*
    6.17 @@ -307,10 +311,14 @@ static void generic_plug_device(request_
    6.18   */
    6.19  static inline void __generic_unplug_device(request_queue_t *q)
    6.20  {
    6.21 +  /*	printk(KERN_ALERT "__generic_unplug_device %p %d\n", q, q->plugged); */
    6.22  	if (q->plugged) {
    6.23  		q->plugged = 0;
    6.24  		if (!list_empty(&q->queue_head))
    6.25 +		  {
    6.26 +		    /*		    printk(KERN_ALERT " calling %p\n", q->request_fn); */
    6.27  			q->request_fn(q);
    6.28 +		  }
    6.29  	}
    6.30  }
    6.31  
    6.32 @@ -319,6 +327,8 @@ void generic_unplug_device(void *data)
    6.33  	request_queue_t *q = (request_queue_t *) data;
    6.34  	unsigned long flags;
    6.35  
    6.36 +	/*	printk(KERN_ALERT "generic_unplug_device\n"); */
    6.37 +
    6.38  	spin_lock_irqsave(&io_request_lock, flags);
    6.39  	__generic_unplug_device(q);
    6.40  	spin_unlock_irqrestore(&io_request_lock, flags);
    6.41 @@ -856,6 +866,8 @@ static int __make_request(request_queue_
    6.42  	int latency;
    6.43  	elevator_t *elevator = &q->elevator;
    6.44  
    6.45 +	/* 	printk(KERN_ALERT "__make_request\n");*/
    6.46 +
    6.47  	count = bh->b_size >> 9;
    6.48  	sector = bh->b_rsector;
    6.49  
    6.50 @@ -1061,6 +1073,8 @@ void generic_make_request (int rw, struc
    6.51  	int minorsize = 0;
    6.52  	request_queue_t *q;
    6.53  
    6.54 +	/* 	printk(KERN_ALERT "generic_make_request\n"); */
    6.55 +
    6.56  	if (!bh->b_end_io)
    6.57  		BUG();
    6.58  
    6.59 @@ -1130,6 +1144,8 @@ void submit_bh(int rw, struct buffer_hea
    6.60  {
    6.61  	int count = bh->b_size >> 9;
    6.62  
    6.63 +	/* 	printk(KERN_ALERT "submit_bh\n"); */
    6.64 +
    6.65  	if (!test_bit(BH_Lock, &bh->b_state))
    6.66  		BUG();
    6.67  
    6.68 @@ -1141,7 +1157,7 @@ void submit_bh(int rw, struct buffer_hea
    6.69  	 * further remap this.
    6.70  	 */
    6.71  	bh->b_rdev = bh->b_dev;
    6.72 -	bh->b_rsector = bh->b_blocknr * count;
    6.73 +	/*	bh->b_rsector = bh->b_blocknr * count; */
    6.74  
    6.75  	generic_make_request(rw, bh);
    6.76  
    6.77 @@ -1194,6 +1210,8 @@ void ll_rw_block(int rw, int nr, struct 
    6.78  	int correct_size;
    6.79  	int i;
    6.80  
    6.81 +	/* 	printk(KERN_ALERT "ll_rw_block %d %d\n", rw, nr); */
    6.82 +
    6.83  	if (!nr)
    6.84  		return;
    6.85  
    6.86 @@ -1229,14 +1247,14 @@ void ll_rw_block(int rw, int nr, struct 
    6.87  
    6.88  		/* We have the buffer lock */
    6.89  		atomic_inc(&bh->b_count);
    6.90 -		bh->b_end_io = end_buffer_io_sync;
    6.91 +		bh->b_end_io = end_buffer_dummy;
    6.92  
    6.93  		switch(rw) {
    6.94  		case WRITE:
    6.95  			if (!atomic_set_buffer_clean(bh))
    6.96  				/* Hmmph! Nothing to write */
    6.97  				goto end_io;
    6.98 -			__mark_buffer_clean(bh);
    6.99 +			/* __mark_buffer_clean(bh); */
   6.100  			break;
   6.101  
   6.102  		case READA:
   6.103 @@ -1302,6 +1320,7 @@ int end_that_request_first (struct reque
   6.104  		req->bh = bh->b_reqnext;
   6.105  		bh->b_reqnext = NULL;
   6.106  		bh->b_end_io(bh, uptodate);
   6.107 +		end_block_io_op(bh);
   6.108  		if ((bh = req->bh) != NULL) {
   6.109  			req->hard_sector += nsect;
   6.110  			req->hard_nr_sectors -= nsect;
     7.1 --- a/xen-2.4.16/drivers/ide/ide-disk.c	Wed Feb 12 18:04:53 2003 +0000
     7.2 +++ b/xen-2.4.16/drivers/ide/ide-disk.c	Wed Feb 12 18:06:34 2003 +0000
     7.3 @@ -420,13 +420,13 @@ static ide_startstop_t chs_rw_disk (ide_
     7.4  	taskfile.device_head	|= drive->select.all;
     7.5  	taskfile.command	= command;
     7.6  
     7.7 -#ifdef DEBUG
     7.8 +	/* #ifdef DEBUG */
     7.9  	printk("%s: %sing: ", drive->name, (rq->cmd==READ) ? "read" : "writ");
    7.10  	if (lba)	printk("LBAsect=%lld, ", block);
    7.11  	else		printk("CHS=%d/%d/%d, ", cyl, head, sect);
    7.12  	printk("sectors=%ld, ", rq->nr_sectors);
    7.13  	printk("buffer=0x%08lx\n", (unsigned long) rq->buffer);
    7.14 -#endif
    7.15 +	/* #endif*/
    7.16  
    7.17  	memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
    7.18  	memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
    7.19 @@ -578,7 +578,8 @@ static ide_startstop_t do_rw_disk (ide_d
    7.20  			tasklets[9] = (task_ioreg_t) 0;
    7.21  //			tasklets[8] = (task_ioreg_t) (block>>32);
    7.22  //			tasklets[9] = (task_ioreg_t) (block>>40);
    7.23 -#ifdef DEBUG
    7.24 +			/*#ifdef DEBUG */
    7.25 +			printk("[A]\n");
    7.26  			printk("%s: %sing: LBAsect=%lu, sectors=%ld, buffer=0x%08lx, LBAsect=0x%012lx\n",
    7.27  				drive->name,
    7.28  				(rq->cmd==READ)?"read":"writ",
    7.29 @@ -590,7 +591,7 @@ static ide_startstop_t do_rw_disk (ide_d
    7.30  				drive->name, tasklets[3], tasklets[2],
    7.31  				tasklets[9], tasklets[8], tasklets[7],
    7.32  				tasklets[6], tasklets[5], tasklets[4]);
    7.33 -#endif
    7.34 +			/* #endif */
    7.35  			OUT_BYTE(tasklets[1], IDE_FEATURE_REG);
    7.36  			OUT_BYTE(tasklets[3], IDE_NSECTOR_REG);
    7.37  			OUT_BYTE(tasklets[7], IDE_SECTOR_REG);
    7.38 @@ -1320,6 +1321,10 @@ static void idedisk_setup (ide_drive_t *
    7.39  	
    7.40  	struct hd_driveid *id = drive->id;
    7.41  	unsigned long capacity;
    7.42 +
    7.43 +	printk (KERN_ALERT
    7.44 +		"ide-disk.c::idedisk_setup: chs %d %d %d\n",
    7.45 +		drive->cyl, drive->head, drive->sect);
    7.46  	
    7.47  	idedisk_add_settings(drive);
    7.48  
    7.49 @@ -1383,7 +1388,7 @@ static void idedisk_setup (ide_drive_t *
    7.50  	if ((capacity >= (drive->bios_cyl * drive->bios_sect * drive->bios_head)) &&
    7.51  	    (!drive->forced_geom) && drive->bios_sect && drive->bios_head)
    7.52  		drive->bios_cyl = (capacity / drive->bios_sect) / drive->bios_head;
    7.53 -	printk (KERN_INFO "XEN %s: %ld sectors", drive->name, capacity);
    7.54 +	printk (KERN_INFO "[XEN] %s: %ld sectors", drive->name, capacity);
    7.55  
    7.56  	/* Give size in megabytes (MB), not mebibytes (MiB). */
    7.57  	/* We compute the exact rounded value, avoiding overflow. */
     8.1 --- a/xen-2.4.16/drivers/ide/ide-probe.c	Wed Feb 12 18:04:53 2003 +0000
     8.2 +++ b/xen-2.4.16/drivers/ide/ide-probe.c	Wed Feb 12 18:06:34 2003 +0000
     8.3 @@ -51,11 +51,18 @@
     8.4  #include <asm/uaccess.h>
     8.5  #include <asm/io.h>
     8.6  
     8.7 +#define IDE_PROBE_TRACE 0
     8.8 +
     8.9  static inline void do_identify (ide_drive_t *drive, byte cmd)
    8.10  {
    8.11  	int bswap = 1;
    8.12  	struct hd_driveid *id;
    8.13  
    8.14 +	if (IDE_PROBE_TRACE)
    8.15 +	{
    8.16 +	  printk (KERN_ALERT "ide-probe::do_identify\n");
    8.17 +	}
    8.18 +
    8.19  	id = drive->id = kmalloc (SECTOR_WORDS*4, GFP_ATOMIC);	/* called with interrupts disabled! */
    8.20  	if (!id) {
    8.21  		printk(KERN_WARNING "(ide-probe::do_identify) Out of memory.\n");
    8.22 @@ -201,6 +208,11 @@ static int actual_try_to_identify (ide_d
    8.23  	unsigned long timeout;
    8.24  	byte s, a;
    8.25  
    8.26 +	if (IDE_PROBE_TRACE)
    8.27 +	{
    8.28 +	  printk (KERN_ALERT "ide-probe::actual_try_to_identify\n");
    8.29 +	}
    8.30 +
    8.31  	if (IDE_CONTROL_REG) {
    8.32  		/* take a deep breath */
    8.33  		ide_delay_50ms();
    8.34 @@ -260,6 +272,11 @@ static int try_to_identify (ide_drive_t 
    8.35  	int autoprobe = 0;
    8.36  	unsigned long cookie = 0;
    8.37  
    8.38 +	if (IDE_PROBE_TRACE)
    8.39 +	{
    8.40 +	  printk (KERN_ALERT "ide-probe::try_to_identify\n");
    8.41 +	}
    8.42 +
    8.43  	if (IDE_CONTROL_REG && !HWIF(drive)->irq) {
    8.44  		autoprobe = 1;
    8.45  		cookie = probe_irq_on();
    8.46 @@ -314,6 +331,12 @@ static int do_probe (ide_drive_t *drive,
    8.47  {
    8.48  	int rc;
    8.49  	ide_hwif_t *hwif = HWIF(drive);
    8.50 +
    8.51 +	if (IDE_PROBE_TRACE)
    8.52 +	{
    8.53 +	  printk (KERN_ALERT "ide-probe::do_probe\n");
    8.54 +	}
    8.55 +
    8.56  	if (drive->present) {	/* avoid waiting for inappropriate probes */
    8.57  		if ((drive->media != ide_disk) && (cmd == WIN_IDENTIFY))
    8.58  			return 4;
    8.59 @@ -372,6 +395,11 @@ static void enable_nest (ide_drive_t *dr
    8.60  {
    8.61  	unsigned long timeout;
    8.62  
    8.63 +	if (IDE_PROBE_TRACE)
    8.64 +	{
    8.65 +	  printk (KERN_ALERT "ide-probe::enable_nest\n");
    8.66 +	}
    8.67 +
    8.68  	printk("%s: enabling %s -- ", HWIF(drive)->name, drive->id->model);
    8.69  	SELECT_DRIVE(HWIF(drive), drive);
    8.70  	ide_delay_50ms();
    8.71 @@ -402,6 +430,11 @@ static void enable_nest (ide_drive_t *dr
    8.72   */
    8.73  static inline byte probe_for_drive (ide_drive_t *drive)
    8.74  {
    8.75 +  if (IDE_PROBE_TRACE)
    8.76 +  {
    8.77 +    printk (KERN_ALERT "ide-probe::probe_for_drive\n");
    8.78 +  }
    8.79 +
    8.80  	if (drive->noprobe)			/* skip probing? */
    8.81  		return drive->present;
    8.82  	if (do_probe(drive, WIN_IDENTIFY) >= 2) { /* if !(success||timed-out) */
    8.83 @@ -500,6 +533,11 @@ static void probe_hwif (ide_hwif_t *hwif
    8.84  	unsigned int unit;
    8.85  	unsigned long flags;
    8.86  
    8.87 +  if (IDE_PROBE_TRACE)
    8.88 +  {
    8.89 +    printk (KERN_ALERT "ide-probe::probe_hwif\n");
    8.90 +  }
    8.91 +
    8.92  	if (hwif->noprobe)
    8.93  		return;
    8.94  #ifdef CONFIG_BLK_DEV_IDE
    8.95 @@ -978,6 +1016,11 @@ int ideprobe_init (void)
    8.96  {
    8.97  	unsigned int index;
    8.98  	int probe[MAX_HWIFS];
    8.99 +
   8.100 +  if (IDE_PROBE_TRACE)
   8.101 +  {
   8.102 +    printk (KERN_ALERT "ide-probe::ideprobe_init\n");
   8.103 +  }
   8.104  	
   8.105  	MOD_INC_USE_COUNT;
   8.106  	memset(probe, 0, MAX_HWIFS * sizeof(int));
     9.1 --- a/xen-2.4.16/drivers/ide/ide-taskfile.c	Wed Feb 12 18:04:53 2003 +0000
     9.2 +++ b/xen-2.4.16/drivers/ide/ide-taskfile.c	Wed Feb 12 18:06:34 2003 +0000
     9.3 @@ -171,6 +171,8 @@ ide_startstop_t do_rw_taskfile (ide_driv
     9.4  	struct hd_driveid *id = drive->id;
     9.5  	byte HIHI = (drive->addressing) ? 0xE0 : 0xEF;
     9.6  
     9.7 +	printk(KERN_ALERT "do_rw_taskfile\n");
     9.8 +
     9.9  	/* (ks/hs): Moved to start, do not use for multiple out commands */
    9.10  	if (task->handler != task_mulout_intr) {
    9.11  		if (IDE_CONTROL_REG)
    10.1 --- a/xen-2.4.16/drivers/ide/ide.c	Wed Feb 12 18:04:53 2003 +0000
    10.2 +++ b/xen-2.4.16/drivers/ide/ide.c	Wed Feb 12 18:06:34 2003 +0000
    10.3 @@ -1391,6 +1391,8 @@ static ide_startstop_t start_request (id
    10.4  	block    = rq->sector;
    10.5  	blockend = block + rq->nr_sectors;
    10.6  
    10.7 +
    10.8 +#ifdef NEVER
    10.9  	if ((rq->cmd == READ || rq->cmd == WRITE) &&
   10.10  	    (drive->media == ide_disk || drive->media == ide_floppy)) {
   10.11  		if ((blockend < block) || (blockend > drive->part[minor&PARTN_MASK].nr_sects)) {
   10.12 @@ -1404,6 +1406,15 @@ static ide_startstop_t start_request (id
   10.13  	   possibly killing some innocent following sector */
   10.14  	if (block == 0 && drive->remap_0_to_1 == 1)
   10.15  		block = 1;  /* redirect MBR access to EZ-Drive partn table */
   10.16 +#endif
   10.17 +
   10.18 +#ifdef NEVER_DEBUG
   10.19 +	{
   10.20 +	  printk("    ide::start_request  %lx %lx  %lx  %lx %lx\n", 
   10.21 +		 rq->sector, rq->nr_sectors, block,
   10.22 +		 drive->part[minor&PARTN_MASK].start_sect, drive->sect0);
   10.23 +	}
   10.24 +#endif
   10.25  
   10.26  #if (DISK_RECOVERY_TIME > 0)
   10.27  	while ((read_timer() - hwif->last_time) < DISK_RECOVERY_TIME);
   10.28 @@ -1414,6 +1425,7 @@ static ide_startstop_t start_request (id
   10.29  		printk("%s: drive not ready for command\n", drive->name);
   10.30  		return startstop;
   10.31  	}
   10.32 +	drive->special.all = 0;
   10.33  	if (!drive->special.all) {
   10.34  		switch(rq->cmd) {
   10.35  			case IDE_DRIVE_CMD:
    11.1 --- a/xen-2.4.16/drivers/net/Makefile	Wed Feb 12 18:04:53 2003 +0000
    11.2 +++ b/xen-2.4.16/drivers/net/Makefile	Wed Feb 12 18:06:34 2003 +0000
    11.3 @@ -4,13 +4,11 @@ include $(BASEDIR)/Rules.mk
    11.4  default: $(OBJS)
    11.5  	$(MAKE) -C ne
    11.6  	$(MAKE) -C tulip
    11.7 -	$(MAKE) -C e1000
    11.8 -	$(LD) -r -o driver.o $(OBJS) tulip/tulip.o e1000/e1000.o ne/ne_drv.o
    11.9 +	$(LD) -r -o driver.o $(OBJS) tulip/tulip.o ne/ne_drv.o
   11.10  
   11.11  clean:
   11.12  	$(MAKE) -C ne clean
   11.13  	$(MAKE) -C tulip clean
   11.14 -	$(MAKE) -C e1000 clean
   11.15  	rm -f *.o *~ core
   11.16  
   11.17  .PHONY: default clean
    12.1 --- a/xen-2.4.16/include/hypervisor-ifs/block.h	Wed Feb 12 18:04:53 2003 +0000
    12.2 +++ b/xen-2.4.16/include/hypervisor-ifs/block.h	Wed Feb 12 18:06:34 2003 +0000
    12.3 @@ -6,35 +6,80 @@
    12.4   * These are the ring data structures for buffering messages between 
    12.5   * the hypervisor and guestos's.  
    12.6   *
    12.7 - * For now we'll start with our own rings for the block IO code instead
    12.8 - * of using the network rings.  Hopefully, this will give us additional
    12.9 - * flexibility in the future should we choose to move away from a 
   12.10 - * ring producer consumer communication model.
   12.11   */
   12.12  
   12.13  #ifndef __BLOCK_H__
   12.14  #define __BLOCK_H__
   12.15  
   12.16 -typedef struct blk_tx_entry_st {
   12.17 -	unsigned long addr; /* virtual address */
   12.18 -	unsigned long size; /* in bytes */
   12.19 -} blk_tx_entry_t;
   12.20 +#include <linux/kdev_t.h>
   12.21 +
   12.22 +/* the first four definitions match fs.h */
   12.23 +#define XEN_BLOCK_READ  0
   12.24 +#define XEN_BLOCK_WRITE 1
   12.25 +#define XEN_BLOCK_READA 2                                /* currently unused */
   12.26 +#define XEN_BLOCK_SPECIAL 4                              /* currently unused */
   12.27 +#define XEN_BLOCK_PROBE 8      /* determine io configuration from hypervisor */
   12.28 +#define XEN_BLOCK_DEBUG 16                                          /* debug */
   12.29 +
   12.30 +#define XEN_BLOCK_SYNC  2
   12.31 +#define XEN_BLOCK_ASYNC 3
   12.32 +
   12.33 +#define XEN_BLOCK_MAX_DOMAINS 32  /* NOTE: FIX THIS. VALUE SHOULD COME FROM? */
   12.34 +
   12.35 +#define BLK_TX_RING_SIZE 256
   12.36 +#define BLK_RX_RING_SIZE 256
   12.37 +
   12.38 +#define BLK_TX_RING_MAX_ENTRIES (BLK_TX_RING_SIZE - 2)
   12.39 +#define BLK_RX_RING_MAX_ENTRIES (BLK_RX_RING_SIZE - 2)
   12.40  
   12.41 -typedef struct blk_rx_entry_st {
   12.42 -	unsigned long addr; /* virtual address */
   12.43 -	unsigned long size; /* in bytes */
   12.44 -} blk_rx_entry_t;
   12.45 +#define BLK_TX_RING_INC(_i)    (((_i)+1) & (BLK_TX_RING_SIZE-1))
   12.46 +#define BLK_RX_RING_INC(_i)    (((_i)+1) & (BLK_RX_RING_SIZE-1))
   12.47 +#define BLK_TX_RING_ADD(_i,_j) (((_i)+(_j)) & (BLK_TX_RING_SIZE-1))
   12.48 +#define BLK_RX_RING_ADD(_i,_j) (((_i)+(_j)) & (BLK_RX_RING_SIZE-1))
   12.49  
   12.50 -typedef struct blk_ring_st {
   12.51 -	blk_tx_entry_t	*tx_ring;
   12.52 -	unsigned int	tx_prod, tx_cons, tx_event;
   12.53 -	unsigned int 	tx_ring_size;
   12.54 +typedef struct blk_ring_entry 
   12.55 +{
   12.56 +  void *          id;                   /* for guest os use; used for the bh */
   12.57 +  int             priority;         /* orig sched pri, SYNC or ASYNC for now */
   12.58 +  int             operation;            /* XEN_BLOCK_READ or XEN_BLOCK_WRITE */
   12.59 +  char *          buffer;
   12.60 +  unsigned long   block_number;                              /* block number */
   12.61 +  unsigned short  block_size;                                  /* block size */
   12.62 +  kdev_t          device;
   12.63 +  unsigned long   sector_number;             /* real buffer location on disk */
   12.64 +} blk_ring_entry_t;
   12.65  
   12.66 -	blk_rx_entry_t	*rx_ring;
   12.67 -	unsigned int	rx_prod, rx_cons, rx_event;
   12.68 -	unsigned int	rx_ring_size;
   12.69 +typedef struct blk_ring_st 
   12.70 +{
   12.71 +  blk_ring_entry_t *tx_ring;
   12.72 +  unsigned int      tx_prod, tx_cons;
   12.73 +  unsigned int 	    tx_ring_size;
   12.74 +
   12.75 +  blk_ring_entry_t *rx_ring;
   12.76 +  unsigned int      rx_prod, rx_cons;
   12.77 +  unsigned int	    rx_ring_size;
   12.78  } blk_ring_t;
   12.79  
   12.80 -int blk_create_ring(int domain, unsigned long ptr);
   12.81 +#define MAX_XEN_DISK_COUNT 100
   12.82 +
   12.83 +#define XEN_DISK_IDE  1
   12.84 +#define XEN_DISK_SCSI 2
   12.85 +
   12.86 +typedef struct xen_disk                                     /* physical disk */
   12.87 +{
   12.88 +  int           type;                                           /* disk type */
   12.89 +  unsigned long capacity;
   12.90 +  unsigned char heads;                               /* hdreg.h::hd_geometry */
   12.91 +  unsigned char sectors;                             /* hdreg.h::hd_geometry */
   12.92 +  unsigned int  cylinders;                       /* hdreg.h::hd_big_geometry */
   12.93 +  unsigned long start;                               /* hdreg.h::hd_geometry */
   12.94 +  void *        gendisk;                               /* struct gendisk ptr */
   12.95 +} xen_disk_t;
   12.96 +
   12.97 +typedef struct xen_disk_info
   12.98 +{
   12.99 +  int         count; /* number of subsequent xen_disk_t structures to follow */
  12.100 +  xen_disk_t  disks[100];
  12.101 +} xen_disk_info_t;
  12.102  
  12.103  #endif
    13.1 --- a/xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h	Wed Feb 12 18:04:53 2003 +0000
    13.2 +++ b/xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h	Wed Feb 12 18:06:34 2003 +0000
    13.3 @@ -85,10 +85,11 @@ typedef struct
    13.4  #define __HYPERVISOR_exit                  8
    13.5  #define __HYPERVISOR_dom0_op               9
    13.6  #define __HYPERVISOR_network_op           10
    13.7 -#define __HYPERVISOR_set_debugreg         11
    13.8 -#define __HYPERVISOR_get_debugreg         12
    13.9 -#define __HYPERVISOR_update_descriptor    13
   13.10 -#define __HYPERVISOR_set_fast_trap        14
   13.11 +#define __HYPERVISOR_block_io_op          11
   13.12 +#define __HYPERVISOR_set_debugreg         12
   13.13 +#define __HYPERVISOR_get_debugreg         13
   13.14 +#define __HYPERVISOR_update_descriptor    14
   13.15 +#define __HYPERVISOR_set_fast_trap        15
   13.16  
   13.17  #define TRAP_INSTR "int $0x82"
   13.18  
    14.1 --- a/xen-2.4.16/include/xeno/blkdev.h	Wed Feb 12 18:04:53 2003 +0000
    14.2 +++ b/xen-2.4.16/include/xeno/blkdev.h	Wed Feb 12 18:06:34 2003 +0000
    14.3 @@ -85,6 +85,7 @@ struct buffer_head {
    14.4  
    14.5          struct inode *       b_inode;
    14.6          struct list_head     b_inode_buffers;   /* doubly linked list of inode dirty buffers */
    14.7 +        void *b_xen_request;                        /* xen request structure */
    14.8  };
    14.9  
   14.10  typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate);
    15.1 --- a/xen-2.4.16/include/xeno/config.h	Wed Feb 12 18:04:53 2003 +0000
    15.2 +++ b/xen-2.4.16/include/xeno/config.h	Wed Feb 12 18:06:34 2003 +0000
    15.3 @@ -29,6 +29,7 @@
    15.4  #define CONFIG_IDEDMA_PCI_AUTO 1
    15.5  #define CONFIG_IDEDMA_AUTO 1
    15.6  #define CONFIG_BLK_DEV_IDE_MODES 1
    15.7 +#define CONFIG_BLK_DEV_PIIX 1
    15.8  
    15.9  #define CONFIG_SCSI 1
   15.10  #define CONFIG_BLK_DEV_SD 1
    16.1 --- a/xen-2.4.16/include/xeno/sched.h	Wed Feb 12 18:04:53 2003 +0000
    16.2 +++ b/xen-2.4.16/include/xeno/sched.h	Wed Feb 12 18:06:34 2003 +0000
    16.3 @@ -1,4 +1,3 @@
    16.4 -
    16.5  #ifndef _LINUX_SCHED_H
    16.6  #define _LINUX_SCHED_H
    16.7  
    16.8 @@ -49,6 +48,7 @@ extern struct mm_struct init_mm;
    16.9  #define _HYP_EVENT_NEED_RESCHED 0
   16.10  #define _HYP_EVENT_NET_RX       1
   16.11  #define _HYP_EVENT_DIE          2
   16.12 +#define _HYP_EVENT_BLK_RX       3
   16.13  
   16.14  #define PF_DONEFPUINIT  0x1  /* Has the FPU been initialised for this task? */
   16.15  #define PF_USEDFPU      0x2  /* Has this task used the FPU since last save? */
    17.1 --- a/xenolinux-2.4.16-sparse/arch/xeno/drivers/block/Makefile	Wed Feb 12 18:04:53 2003 +0000
    17.2 +++ b/xenolinux-2.4.16-sparse/arch/xeno/drivers/block/Makefile	Wed Feb 12 18:06:34 2003 +0000
    17.3 @@ -1,3 +1,3 @@
    17.4  O_TARGET := blk.o
    17.5 -obj-y := block.o
    17.6 +obj-y := xl_block.o xl_block_test.o
    17.7  include $(TOPDIR)/Rules.make
    18.1 --- a/xenolinux-2.4.16-sparse/drivers/block/ll_rw_blk.c	Wed Feb 12 18:04:53 2003 +0000
    18.2 +++ b/xenolinux-2.4.16-sparse/drivers/block/ll_rw_blk.c	Wed Feb 12 18:06:34 2003 +0000
    18.3 @@ -1227,6 +1227,11 @@ int __init blk_dev_init(void)
    18.4  #ifdef CONFIG_SUN_JSFLASH
    18.5  	jsfd_init();
    18.6  #endif
    18.7 +
    18.8 +#ifdef CONFIG_XENOLINUX_BLOCK
    18.9 +    xlblk_init();
   18.10 +#endif
   18.11 +
   18.12  	return 0;
   18.13  };
   18.14  
    19.1 --- a/xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor.h	Wed Feb 12 18:04:53 2003 +0000
    19.2 +++ b/xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor.h	Wed Feb 12 18:06:34 2003 +0000
    19.3 @@ -257,6 +257,16 @@ static inline int HYPERVISOR_network_op(
    19.4      return ret;
    19.5  }
    19.6  
    19.7 +static inline int HYPERVISOR_block_io_op(void)
    19.8 +{
    19.9 +    int ret;
   19.10 +    __asm__ __volatile__ (
   19.11 +        TRAP_INSTR
   19.12 +        : "=a" (ret) : "0" (__HYPERVISOR_block_io_op) ); 
   19.13 +
   19.14 +    return ret;
   19.15 +}
   19.16 +
   19.17  static inline int HYPERVISOR_set_debugreg(int reg, unsigned long value)
   19.18  {
   19.19      int ret;