diff options
Diffstat (limited to 'xenolinux-2.4.21-pre4-sparse')
5 files changed, 183 insertions, 124 deletions
diff --git a/xenolinux-2.4.21-pre4-sparse/arch/xeno/defconfig b/xenolinux-2.4.21-pre4-sparse/arch/xeno/defconfig index c59c3282e4..c8120dfa4c 100644 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/defconfig +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/defconfig @@ -159,7 +159,7 @@ CONFIG_JBD=y # CONFIG_JFFS_FS is not set # CONFIG_JFFS2_FS is not set # CONFIG_CRAMFS is not set -# CONFIG_TMPFS is not set +CONFIG_TMPFS=y CONFIG_RAMFS=y CONFIG_ISO9660_FS=y CONFIG_JOLIET=y @@ -248,7 +248,7 @@ CONFIG_NLS_DEFAULT="iso8559-1" # CONFIG_NLS_ISO8859_8 is not set # CONFIG_NLS_CODEPAGE_1250 is not set # CONFIG_NLS_CODEPAGE_1251 is not set -# CONFIG_NLS_ISO8859_1 is not set +CONFIG_NLS_ISO8859_1=y # CONFIG_NLS_ISO8859_2 is not set # CONFIG_NLS_ISO8859_3 is not set # CONFIG_NLS_ISO8859_4 is not set diff --git a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.c b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.c index 8a48285fb1..d3e09eb52c 100644 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.c +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.c @@ -7,6 +7,7 @@ #include "xl_block.h" #include <linux/blk.h> +#include <linux/cdrom.h> typedef unsigned char byte; /* from linux/ide.h */ @@ -49,10 +50,16 @@ inline unsigned short xldev_to_physdev(kdev_t xldev) switch ( MAJOR(xldev) ) { - case XLIDE_MAJOR: - physdev = XENDEV_IDE + (MINOR(xldev) >> XLIDE_PARTN_SHIFT); + case XLIDE_MAJOR_0: + physdev = XENDEV_IDE + (0*XLIDE_DEVS_PER_MAJOR) + + (MINOR(xldev) >> XLIDE_PARTN_SHIFT); break; - + + case XLIDE_MAJOR_1: + physdev = XENDEV_IDE + (1*XLIDE_DEVS_PER_MAJOR) + + (MINOR(xldev) >> XLIDE_PARTN_SHIFT); + break; + case XLSCSI_MAJOR: physdev = XENDEV_SCSI + (MINOR(xldev) >> XLSCSI_PARTN_SHIFT); break; @@ -74,8 +81,12 @@ static inline struct gendisk *xldev_to_gendisk(kdev_t xldev) switch ( MAJOR(xldev) ) { - case XLIDE_MAJOR: - gd = xlide_gendisk; + case XLIDE_MAJOR_0: + gd = xlide_gendisk[0]; + break; + + case XLIDE_MAJOR_1: + gd = xlide_gendisk[1]; break; case XLSCSI_MAJOR: @@ -157,7 +168,7 @@ int xenolinux_block_ioctl(struct inode *inode, struct file *filep, case BLKSSZGET: switch ( MAJOR(dev) ) { - case XLIDE_MAJOR: + case XLIDE_MAJOR_0: DPRINTK_IOCTL(" BLKSSZGET: %x 0x%x\n", BLKSSZGET, xlide_hwsect(MINOR(dev))); return xlide_hwsect(MINOR(dev)); @@ -213,9 +224,15 @@ int xenolinux_block_ioctl(struct inode *inode, struct file *filep, if (put_user(0x106, (unsigned int *) &geo->cylinders)) return -EFAULT; return 0; + case CDROMMULTISESSION: + printk("FIXME: support multisession CDs later\n"); + memset((struct cdrom_multisession *)argument, 0, + sizeof(struct cdrom_multisession)); + return 0; + default: - DPRINTK_IOCTL(" eh? unknown ioctl\n"); - break; + printk("ioctl %08x not supported by xl_block\n", command); + return -ENOSYS; } return 0; diff --git a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.h b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.h index b3f6fb98e9..ac7e7ae97a 100644 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.h +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.h @@ -40,18 +40,33 @@ #endif /* XL IDE and SCSI use same major/minor numbers as normal Linux devices. */ -#define XLIDE_MAJOR IDE0_MAJOR +#define XLIDE_MAJOR_0 IDE0_MAJOR +#define XLIDE_MAJOR_1 IDE1_MAJOR #define XLSCSI_MAJOR SCSI_DISK0_MAJOR -/* IDE has < 64 partitions per device. VIRT and SCSI have < 16. */ -#define PARTN_SHIFT(_dev) ((MAJOR(_dev)==IDE0_MAJOR) ? 6 : 4) #define XLIDE_PARTN_SHIFT 6 #define XLSCSI_PARTN_SHIFT 4 #define XLVIRT_PARTN_SHIFT 4 -#define XLIDE_DEVS_PER_MAJOR (256 >> XLIDE_PARTN_SHIFT) -#define XLSCSI_DEVS_PER_MAJOR (256 >> XLSCSI_PARTN_SHIFT) -#define XLVIRT_DEVS_PER_MAJOR (256 >> XLVIRT_PARTN_SHIFT) +static inline int PARTN_SHIFT(kdev_t dev) +{ + switch ( MAJOR(dev) ) + { + case XLIDE_MAJOR_0: + case XLIDE_MAJOR_1: + return XLIDE_PARTN_SHIFT; + case XLSCSI_MAJOR: + return XLSCSI_PARTN_SHIFT; + case XLVIRT_MAJOR: + return XLVIRT_PARTN_SHIFT; + default: + BUG(); + } +} + +#define XLIDE_DEVS_PER_MAJOR 2 +#define XLSCSI_DEVS_PER_MAJOR 16 +#define XLVIRT_DEVS_PER_MAJOR 16 /* * We have one of these per XL-IDE, XL-SCSI, and XL-VIRT device. @@ -77,7 +92,7 @@ extern void do_xlblk_request (request_queue_t *rq); extern int xlide_init(xen_disk_info_t *xdi); extern int xlide_hwsect(int minor); extern void xlide_cleanup(void); -extern struct gendisk *xlide_gendisk; +extern struct gendisk *xlide_gendisk[]; /* Fake SCSI subsystem. */ extern int xlscsi_init(xen_disk_info_t *xdi); diff --git a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_ide.c b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_ide.c index 510a73805e..4d7c42ecdb 100644 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_ide.c +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_ide.c @@ -5,8 +5,6 @@ */ #include "xl_block.h" - -#define MAJOR_NR XLIDE_MAJOR #include <linux/blk.h> #define XLIDE_MAX 256 @@ -15,7 +13,9 @@ static int xlide_blksize_size[XLIDE_MAX]; static int xlide_hardsect_size[XLIDE_MAX]; static int xlide_max_sectors[XLIDE_MAX]; -struct gendisk *xlide_gendisk = NULL; +#define XLIDE_NR_MAJORS 2 + +struct gendisk *xlide_gendisk[XLIDE_NR_MAJORS] = { NULL }; static struct block_device_operations xlide_block_fops = { @@ -31,63 +31,42 @@ int xlide_hwsect(int minor) return xlide_hardsect_size[minor]; } +static int get_major(int major) +{ + int r = register_blkdev(major, XLIDE_MAJOR_NAME, &xlide_block_fops); + if ( r < 0 ) + printk (KERN_ALERT "XL IDE: can't get major %d\n", XLIDE_MAJOR_0); + return r; +} -int xlide_init(xen_disk_info_t *xdi) +static void setup_major(struct gendisk **pgd, + xen_disk_info_t *xdi, int base, int major) { - int i, result, units, minors, disk; + int i, minors, disk, units = XLIDE_DEVS_PER_MAJOR; unsigned short minor; + unsigned char buf[64]; struct gendisk *gd; - char buf[64]; - - /* If we don't have any usable IDE devices we may as well bail now. */ - units = 0; - for ( i = 0; i < xdi->count; i++ ) - if ( IS_IDE_XENDEV(xdi->disks[i].device) && - ((xdi->disks[i].device & XENDEV_IDX_MASK) < - XLIDE_DEVS_PER_MAJOR) ) - units++; - if ( units == 0 ) return 0; - SET_MODULE_OWNER(&xlide_block_fops); + blk_size[major] = NULL; + blksize_size[major] = xlide_blksize_size + base*(1<<XLIDE_PARTN_SHIFT); + hardsect_size[major] = xlide_hardsect_size + base*(1<<XLIDE_PARTN_SHIFT); + max_sectors[major] = xlide_max_sectors + base*(1<<XLIDE_PARTN_SHIFT); + read_ahead[major] = 8; - result = register_blkdev(XLIDE_MAJOR, XLIDE_MAJOR_NAME, - &xlide_block_fops); - if ( result < 0 ) - { - printk (KERN_ALERT "XL IDE: can't get major %d\n", XLIDE_MAJOR); - return result; - } - - /* Initialize global arrays. */ - for ( i = 0; i < XLIDE_MAX; i++ ) - { - xlide_blksize_size[i] = 512; - xlide_hardsect_size[i] = 512; - xlide_max_sectors[i] = 128; - } - - blk_size[XLIDE_MAJOR] = NULL; - blksize_size[XLIDE_MAJOR] = xlide_blksize_size; - hardsect_size[XLIDE_MAJOR] = xlide_hardsect_size; - max_sectors[XLIDE_MAJOR] = xlide_max_sectors; - read_ahead[XLIDE_MAJOR] = 8; - - blk_init_queue(BLK_DEFAULT_QUEUE(XLIDE_MAJOR), do_xlblk_request); + blk_init_queue(BLK_DEFAULT_QUEUE(major), do_xlblk_request); /* - * Turn off barking 'headactive' mode. We dequeue buffer heads as - * soon as we pass them down to Xen. + * Turn off barking 'headactive' mode. We dequeue buffer heads as soon as + * we pass them down to Xen. */ - blk_queue_headactive(BLK_DEFAULT_QUEUE(XLIDE_MAJOR), 0); - - units = XLIDE_MAX >> XLIDE_PARTN_SHIFT; + blk_queue_headactive(BLK_DEFAULT_QUEUE(major), 0); /* Construct an appropriate gendisk structure. */ minors = units * (1<<XLIDE_PARTN_SHIFT); gd = kmalloc(sizeof(struct gendisk), GFP_KERNEL); gd->sizes = kmalloc(minors * sizeof(int), GFP_KERNEL); gd->part = kmalloc(minors * sizeof(struct hd_struct), GFP_KERNEL); - gd->major = XLIDE_MAJOR; + gd->major = major; gd->major_name = XLIDE_MAJOR_NAME; gd->minor_shift = XLIDE_PARTN_SHIFT; gd->max_p = 1<<XLIDE_PARTN_SHIFT; @@ -102,92 +81,124 @@ int xlide_init(xen_disk_info_t *xdi) memset(gd->de_arr, 0, sizeof(*gd->de_arr) * units); memset(gd->flags, 0, sizeof(*gd->flags) * units); memset(gd->real_devices, 0, sizeof(xl_disk_t) * units); - xlide_gendisk = gd; + *pgd = gd; add_gendisk(gd); /* Now register each disk in turn. */ for ( i = 0; i < xdi->count; i++ ) { disk = xdi->disks[i].device & XENDEV_IDX_MASK; - minor = disk << XLIDE_PARTN_SHIFT; - + minor = (disk-base) << XLIDE_PARTN_SHIFT; - if ( !IS_IDE_XENDEV(xdi->disks[i].device) || - (disk >= XLIDE_DEVS_PER_MAJOR) ) + if ( !IS_IDE_XENDEV(xdi->disks[i].device) || + (disk < base) || (disk >= (base + XLIDE_DEVS_PER_MAJOR)) ) continue; ((xl_disk_t *)gd->real_devices)[disk].capacity = xdi->disks[i].capacity; + switch (xdi->disks[i].type) + { + case XD_TYPE_CDROM: + set_device_ro(MKDEV(major, minor), 1); + + case XD_TYPE_FLOPPY: + case XD_TYPE_TAPE: + gd->flags[disk] = GENHD_FL_REMOVABLE; + printk(KERN_ALERT "Skipping partition check on %s /dev/%s\n", + xdi->disks[i].type==XD_TYPE_CDROM ? "cdrom" : + (xdi->disks[i].type==XD_TYPE_TAPE ? "tape" : "floppy"), + disk_name(gd, minor, buf)); + break; + + case XD_TYPE_DISK: + register_disk(gd, + MKDEV(major, minor), + 1<<XLIDE_PARTN_SHIFT, + &xlide_block_fops, xdi->disks[i].capacity); + break; + + default: + printk(KERN_ALERT "XenoLinux: unknown ide device type %d\n", + xdi->disks[i].type); + break; + } + } - switch (xdi->disks[i].type) { - case XD_TYPE_CDROM: - set_device_ro(MKDEV(XLIDE_MAJOR, minor), 1); - // fall through + return gd; +} - case XD_TYPE_FLOPPY: - case XD_TYPE_TAPE: - gd->flags[disk] = GENHD_FL_REMOVABLE; - printk(KERN_ALERT "Skipping partition check on %s /dev/%s\n", - xdi->disks[i].type == XD_TYPE_CDROM ? "cdrom" : - (xdi->disks[i].type == XD_TYPE_TAPE ? "tape" : "floppy"), - disk_name(gd, minor, buf)); - break; - case XD_TYPE_DISK: - register_disk(gd, MKDEV(XLIDE_MAJOR, minor), 1<<XLIDE_PARTN_SHIFT, - &xlide_block_fops, xdi->disks[i].capacity); - break; +int xlide_init(xen_disk_info_t *xdi) +{ + int i, units; - default: - printk(KERN_ALERT "XenoLinux: unknown ide device type %d\n", - xdi->disks[i].type); - break; - } + /* If we don't have any usable IDE devices we may as well bail now. */ + units = 0; + for ( i = 0; i < xdi->count; i++ ) + if ( IS_IDE_XENDEV(xdi->disks[i].device) && + ((xdi->disks[i].device & XENDEV_IDX_MASK) < + (XLIDE_NR_MAJORS*XLIDE_DEVS_PER_MAJOR)) ) + units++; + if ( units == 0 ) return 0; + SET_MODULE_OWNER(&xlide_block_fops); + + if ( get_major(XLIDE_MAJOR_0) < 0 ) + return 0; + if ( get_major(XLIDE_MAJOR_1) < 0 ) + { + (void)unregister_blkdev(XLIDE_MAJOR_0, XLIDE_MAJOR_NAME); + return 0; + } + /* Initialize global arrays. */ + for ( i = 0; i < XLIDE_MAX; i++ ) + { + xlide_blksize_size[i] = 512; + xlide_hardsect_size[i] = 512; + xlide_max_sectors[i] = 128; } - printk(KERN_ALERT - "XenoLinux Virtual IDE Device Driver installed [device: %d]\n", - XLIDE_MAJOR); + setup_major(&xlide_gendisk[0], xdi, 0*XLIDE_DEVS_PER_MAJOR, XLIDE_MAJOR_0); + setup_major(&xlide_gendisk[1], xdi, 1*XLIDE_DEVS_PER_MAJOR, XLIDE_MAJOR_1); return 0; } -void xlide_cleanup(void) +static void cleanup_major(int major) { - if ( xlide_gendisk == NULL ) return; - - blk_cleanup_queue(BLK_DEFAULT_QUEUE(XLIDE_MAJOR)); - - xlide_gendisk = NULL; + blk_cleanup_queue(BLK_DEFAULT_QUEUE(major)); - read_ahead[XLIDE_MAJOR] = 0; + read_ahead[major] = 0; - if ( blksize_size[XLIDE_MAJOR] != NULL ) + if ( blksize_size[major] != NULL ) { - kfree(blksize_size[XLIDE_MAJOR]); - blksize_size[XLIDE_MAJOR] = NULL; + kfree(blksize_size[major]); + blksize_size[major] = NULL; } - if ( hardsect_size[XLIDE_MAJOR] != NULL ) + if ( hardsect_size[major] != NULL ) { - kfree(hardsect_size[XLIDE_MAJOR]); - hardsect_size[XLIDE_MAJOR] = NULL; + kfree(hardsect_size[major]); + hardsect_size[major] = NULL; } - if ( max_sectors[XLIDE_MAJOR] != NULL ) + if ( max_sectors[major] != NULL ) { - kfree(max_sectors[XLIDE_MAJOR]); - max_sectors[XLIDE_MAJOR] = NULL; + kfree(max_sectors[major]); + max_sectors[major] = NULL; } - if ( unregister_blkdev(XLIDE_MAJOR, XLIDE_MAJOR_NAME) != 0 ) - { - printk(KERN_ALERT - "XenoLinux Virtual IDE Device Driver uninstalled w/ errs\n"); - } + (void)unregister_blkdev(major, XLIDE_MAJOR_NAME); +} + +void xlide_cleanup(void) +{ + if ( xlide_gendisk[0] == NULL ) return; + xlide_gendisk[0] = NULL; + cleanup_major(XLIDE_MAJOR_0); + cleanup_major(XLIDE_MAJOR_1); } diff --git a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/network/network.c b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/network/network.c index 7cf0fecbec..a125695e54 100644 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/network/network.c +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/network/network.c @@ -470,9 +470,9 @@ static int inetdev_notify(struct notifier_block *this, (void)HYPERVISOR_network_op(&op); /* - * Xen creates a pair of bootstrap rules which allows domain 0 to - * send and receive any packet. These rules can be removed once we - * have configured an IP address. + * When the first real interface is brought up we delete the start-of-day + * bootstrap rules -- they were only installed to allow an initial DHCP + * request and response. */ if ( (idx == 0) && (event == NETDEV_UP) && !removed_bootstrap_rules ) { @@ -480,11 +480,9 @@ static int inetdev_notify(struct notifier_block *this, op.cmd = NETWORK_OP_DELETERULE; op.u.net_rule.proto = NETWORK_PROTO_ANY; op.u.net_rule.action = NETWORK_ACTION_ACCEPT; - op.u.net_rule.src_vif = 0; op.u.net_rule.dst_vif = VIF_PHYSICAL_INTERFACE; (void)HYPERVISOR_network_op(&op); - op.u.net_rule.src_vif = VIF_ANY_INTERFACE; op.u.net_rule.dst_vif = 0; (void)HYPERVISOR_network_op(&op); @@ -511,13 +509,32 @@ int __init init_module(void) INIT_LIST_HEAD(&dev_list); - /* - * Domain 0 must poke its own network rules as it discovers its IP - * addresses. All other domains have a privileged "parent" to do this - * for them at start of day. - */ if ( start_info.dom_id == 0 ) + { + /* + * Domain 0 creates wildcard rules to allow DHCP to find its first IP + * address. These wildcard rules are deleted when the first inet + * interface is brought up. + */ + network_op_t op; + memset(&op, 0, sizeof(op)); + op.cmd = NETWORK_OP_ADDRULE; + op.u.net_rule.proto = NETWORK_PROTO_ANY; + op.u.net_rule.action = NETWORK_ACTION_ACCEPT; + op.u.net_rule.src_vif = 0; + op.u.net_rule.dst_vif = VIF_PHYSICAL_INTERFACE; + (void)HYPERVISOR_network_op(&op); + op.u.net_rule.src_vif = VIF_ANY_INTERFACE; + op.u.net_rule.dst_vif = 0; + (void)HYPERVISOR_network_op(&op); + + /* + * Domain 0 must poke its own network rules as it discovers its IP + * addresses. All other domains have a privileged "parent" to do this + * for them at start of day. + */ (void)register_inetaddr_notifier(¬ifier_inetdev); + } for ( i = 0; i < MAX_DOMAIN_VIFS; i++ ) { @@ -548,8 +565,7 @@ int __init init_module(void) dev->stop = network_close; dev->get_stats = network_get_stats; - memset(dev->dev_addr, 0, ETH_ALEN); - *(unsigned int *)(dev->dev_addr + 1) = i; + memcpy(dev->dev_addr, start_info.net_vmac[i], ETH_ALEN); if ( (err = register_netdev(dev)) != 0 ) { |