debuggers.hg

view xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_block.h @ 648:cda951fc1bef

bitkeeper revision 1.341 (3f1120a2WW6KGE81TArq_p654xy38Q)

Merge labyrinth.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into labyrinth.cl.cam.ac.uk:/auto/anfs/scratch/labyrinth/iap10/xeno-clone/xeno.bk
author iap10@labyrinth.cl.cam.ac.uk
date Sun Jul 13 09:04:34 2003 +0000 (2003-07-13)
parents b6f13a6cdded 9339f3942f4e
children
line source
1 /******************************************************************************
2 * xl_block.h
3 *
4 * Shared definitions between all levels of XenoLinux Virtual block devices.
5 */
7 #ifndef __XL_BLOCK_H__
8 #define __XL_BLOCK_H__
10 #include <linux/config.h>
11 #include <linux/module.h>
13 #include <linux/kernel.h>
14 #include <linux/sched.h>
15 #include <linux/slab.h>
16 #include <linux/string.h>
17 #include <linux/errno.h>
19 #include <linux/fs.h>
20 #include <linux/hdreg.h>
21 #include <linux/blkdev.h>
22 #include <linux/major.h>
24 #include <asm/hypervisor-ifs/block.h>
25 #include <asm/hypervisor-ifs/hypervisor-if.h>
26 #include <asm/io.h>
27 #include <asm/atomic.h>
28 #include <asm/uaccess.h>
30 #if 0
31 #define DPRINTK(_f, _a...) printk ( KERN_ALERT _f , ## _a )
32 #else
33 #define DPRINTK(_f, _a...) ((void)0)
34 #endif
36 #if 0
37 #define DPRINTK_IOCTL(_f, _a...) printk ( KERN_ALERT _f , ## _a )
38 #else
39 #define DPRINTK_IOCTL(_f, _a...) ((void)0)
40 #endif
42 /* XL IDE and SCSI use same major/minor numbers as normal Linux devices. */
43 #define XLIDE_MAJOR_0 IDE0_MAJOR
44 #define XLIDE_MAJOR_1 IDE1_MAJOR
45 #define XLSCSI_MAJOR SCSI_DISK0_MAJOR
47 #define XLIDE_PARTN_SHIFT 6
48 #define XLSCSI_PARTN_SHIFT 4
49 #define XLVIRT_PARTN_SHIFT 4
51 static inline int PARTN_SHIFT(kdev_t dev)
52 {
53 switch ( MAJOR(dev) )
54 {
55 case XLIDE_MAJOR_0:
56 case XLIDE_MAJOR_1:
57 return XLIDE_PARTN_SHIFT;
58 case XLSCSI_MAJOR:
59 return XLSCSI_PARTN_SHIFT;
60 case XLVIRT_MAJOR:
61 return XLVIRT_PARTN_SHIFT;
62 default:
63 BUG();
64 }
65 }
67 #define XLIDE_DEVS_PER_MAJOR 2
68 #define XLSCSI_DEVS_PER_MAJOR 16
69 #define XLVIRT_DEVS_PER_MAJOR 16
71 /*
72 * We have one of these per XL-IDE, XL-SCSI, and XL-VIRT device.
73 * They hang in an array off the gendisk structure. We may end up putting
74 * all kinds of interesting stuff here :-)
75 */
76 typedef struct xl_disk {
77 int usage;
78 unsigned long capacity;
79 } xl_disk_t;
81 /* Generic layer. */
82 extern int xenolinux_control_msg(int operration, char *buffer, int size);
83 extern int xenolinux_block_open(struct inode *inode, struct file *filep);
84 extern int xenolinux_block_release(struct inode *inode, struct file *filep);
85 extern int xenolinux_block_ioctl(struct inode *inode, struct file *filep,
86 unsigned command, unsigned long argument);
87 extern int xenolinux_block_check(kdev_t dev);
88 extern int xenolinux_block_revalidate(kdev_t dev);
89 extern void do_xlblk_request (request_queue_t *rq);
91 /* Fake IDE subsystem. */
92 extern int xlide_init(xen_disk_info_t *xdi);
93 extern int xlide_hwsect(int minor);
94 extern void xlide_cleanup(void);
95 extern struct gendisk *xlide_gendisk[];
97 /* Fake SCSI subsystem. */
98 extern int xlscsi_init(xen_disk_info_t *xdi);
99 extern int xlscsi_hwsect(int minor);
100 extern void xlscsi_cleanup(void);
101 extern struct gendisk *xlscsi_gendisk;
103 /* Virtual block-device subsystem. */
104 extern int xlsegment_hwsect(int minor);
105 extern struct gendisk *xlsegment_gendisk;
107 extern unsigned short xldev_to_physdev(kdev_t xldev);
108 extern kdev_t physdev_to_xldev(unsigned short physdev);
110 #endif /* __XL_BLOCK_H__ */