diff options
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/.cvsignore | 1 | ||||
-rw-r--r-- | drivers/block/floppy.c | 29 | ||||
-rw-r--r-- | drivers/block/genhd.c | 88 | ||||
-rw-r--r-- | drivers/block/ll_rw_blk.c | 4 | ||||
-rw-r--r-- | drivers/block/rd.c | 3 |
5 files changed, 102 insertions, 23 deletions
diff --git a/drivers/block/.cvsignore b/drivers/block/.cvsignore new file mode 100644 index 000000000..4671378ae --- /dev/null +++ b/drivers/block/.cvsignore @@ -0,0 +1 @@ +.depend diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 7179c6f33..bc77f31f8 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -151,6 +151,7 @@ static int use_virtual_dma=0; /* virtual DMA for Intel */ static unsigned short virtual_dma_port=0x3f0; void floppy_interrupt(int irq, void *dev_id, struct pt_regs * regs); static int set_dor(int fdc, char mask, char data); +static inline int __get_order(unsigned long size); #include <asm/floppy.h> @@ -170,6 +171,20 @@ static int set_dor(int fdc, char mask, char data); /* Dma Memory related stuff */ +/* Pure 2^n version of get_order */ +static inline int __get_order(unsigned long size) +{ + int order; + + size = (size-1) >> (PAGE_SHIFT-1); + order = -1; + do { + size >>= 1; + order++; + } while (size); + return order; +} + #ifndef fd_dma_mem_free #define fd_dma_mem_free(addr, size) free_pages(addr, __get_order(size)) #endif @@ -1207,6 +1222,7 @@ static void fdc_specify(void) /*DPRINT("FIFO enabled\n");*/ } +#ifndef __sparc__ switch (raw_cmd->rate & 0x03) { case 3: dtr = 1000; @@ -1261,6 +1277,7 @@ static void fdc_specify(void) output_byte(FDCS->spec1 = spec1); output_byte(FDCS->spec2 = spec2); } +#endif } /* fdc_specify */ /* Set the FDC's data transfer rate on behalf of the specified drive. @@ -1534,7 +1551,8 @@ static void seek_floppy(void) (raw_cmd->flags & FD_RAW_NEED_SEEK)) track = raw_cmd->track; else { - setup_rw_floppy(); return; + setup_rw_floppy(); + return; } } @@ -1661,9 +1679,9 @@ void floppy_interrupt(int irq, void *dev_id, struct pt_regs * regs) } if (handler) { if(intr_count >= 2) - schedule_bh( (void *)(void *) handler); + schedule_bh( (void *)(void *) handler); else - handler(); + handler(); } else FDCS->reset = 1; is_alive("normal interrupt end"); @@ -1709,7 +1727,7 @@ static void reset_fdc(void) /* Irrelevant for systems with true DMA (i386). */ fd_disable_dma(); - if (FDCS->version >= FDC_82077) + if (FDCS->version >= FDC_82072A) fd_outb(0x80 | (FDCS->dtr &3), FD_STATUS); else { fd_outb(FDCS->dor & ~0x04, FD_DOR); @@ -2748,8 +2766,7 @@ static void process_fd_request(void) static void do_fd_request(void) { if(usage_count == 0) { - printk("warning: usage count=0, CURRENT=%p exiting\n", CURRENT); - printk("sect=%ld cmd=%d\n", CURRENT->sector, CURRENT->cmd); + printk("warning: usage count=0, CURRENT=%p exiting\n", CURRENT);+ printk("sect=%ld cmd=%d\n", CURRENT->sector, CURRENT->cmd); return; } sti(); diff --git a/drivers/block/genhd.c b/drivers/block/genhd.c index 198e4a483..85a0ca3c7 100644 --- a/drivers/block/genhd.c +++ b/drivers/block/genhd.c @@ -15,8 +15,6 @@ * * More flexible handling of extended partitions - aeb, 950831 * - * Support for systems without PC-style consoles - <dfrick@dial.eunet.ch>, 960+ * - * * Check partition table on IDE disks for common CHS translations */ @@ -39,9 +37,9 @@ */ #include <asm/unaligned.h> -#define SYS_IND(p) get_unaligned(&p->sys_ind) -#define NR_SECTS(p) get_unaligned(&p->nr_sects) -#define START_SECT(p) get_unaligned(&p->start_sect) +#define SYS_IND(p) get_unaligned(&p->sys_ind) +#define NR_SECTS(p) get_unaligned(&p->nr_sects) +#define START_SECT(p) get_unaligned(&p->start_sect) struct gendisk *gendisk_head = NULL; @@ -245,7 +243,6 @@ static int msdos_partition(struct gendisk *hd, kdev_t dev, unsigned long first_s { int i, minor = current_minor; struct buffer_head *bh; - struct partition ptable[4]; struct partition *p; unsigned char *data; int mask = (1 << hd->minor_shift) - 1; @@ -270,8 +267,7 @@ check_table: brelse(bh); return 0; } - memcpy(ptable, (struct partition *)(data + 0x1be), sizeof(struct partition) * 4); - p = ptable; + p = (struct partition *) (0x1be + data); #ifdef CONFIG_BLK_DEV_IDE if (!tested_for_xlate++) { /* Do this only once per disk */ @@ -378,7 +374,7 @@ check_table: * Check for old-style Disk Manager partition table */ if (*(unsigned short *) (data+0xfc) == 0x55AA) { - p = ptable; + p = (struct partition *) (0x1be + data); for (i = 4 ; i < 16 ; i++, current_minor++) { p--; if ((current_minor & mask) == 0) @@ -556,6 +552,74 @@ static int sun_partition(struct gendisk *hd, kdev_t dev, unsigned long first_sec #endif /* CONFIG_SUN_PARTITION */ +#ifdef CONFIG_SGI_PARTITION + +static int sgi_partition(struct gendisk *hd, kdev_t dev, unsigned long first_sector) +{ + int i, csum; + unsigned int *ui; + struct buffer_head *bh; + struct sgi_disklabel { + int magic_mushroom; /* Big fat spliff... */ + short root_part_num; /* Root partition number */ + short swap_part_num; /* Swap partition number */ + char boot_file[16]; /* Name of boot file for ARCS */ + unsigned char _unused0[48]; /* Device parameter useless crapola.. */ + struct sgi_volume { + char name[8]; /* Name of volume */ + int block_num; /* Logical block number */ + int num_bytes; /* How big, in bytes */ + } volume[15]; + struct sgi_partition { + int num_blocks; /* Size in logical blocks */ + int first_block; /* First logical block */ + int type; /* Type of this partition */ + } partitions[16]; + int csum; /* Disk label checksum */ + int _unused1; /* Padding */ + } *label; + struct sgi_partition *p; +#define SGI_LABEL_MAGIC 0x0be5a941 + + if(!(bh = bread(dev, 0, 1024))) { + printk("Dev %s: unable to read partition table\n", kdevname(dev)); + return -1; + } + label = (struct sgi_disklabel *) bh->b_data; + p = &label->partitions[0]; + if(label->magic_mushroom != SGI_LABEL_MAGIC) { + printk("Dev %s SGI disklabel: bad magic %08x\n", + kdevname(dev), label->magic_mushroom); + brelse(bh); + return 0; + } + ui = ((unsigned int *) (label + 1)) - 1; + for(csum = 0; ui >= ((unsigned int *) label);) + csum += *ui--; + if(csum) { + printk("Dev %s SGI disklabel: csum bad, label corrupted\n", + kdevname(dev)); + brelse(bh); + return 0; + } + /* All SGI disk labels have 16 partitions, disks under Linux only + * have 15 minor's. Luckily there are always a few zero length + * partitions which we don't care about so we never overflow the + * current_minor. + */ + for(i = 0; i < 16; i++, p++) { + if(!(p->num_blocks)) + continue; + add_partition(hd, current_minor, p->first_block, p->num_blocks); + current_minor++; + } + printk("\n"); + brelse(bh); + return 1; +} + +#endif + #ifdef CONFIG_AMIGA_PARTITION #include <asm/byteorder.h> #include <linux/affs_hardblocks.h> @@ -675,6 +739,10 @@ static void check_partition(struct gendisk *hd, kdev_t dev) if(amiga_partition(hd, dev, first_sector)) return; #endif +#ifdef CONFIG_SGI_PARTITION + if(sgi_partition(hd, dev, first_sector)) + return; +#endif printk(" unknown partition table\n"); } @@ -746,9 +814,7 @@ void device_setup(void) #ifdef CONFIG_INET net_dev_init(); #endif -#ifndef CONFIG_SERIAL_ONLY_CONSOLE console_map_init(); -#endif for (p = gendisk_head ; p ; p=p->next) { setup_dev(p); diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index e7ad12604..bc2206737 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c @@ -3,7 +3,6 @@ * * Copyright (C) 1991, 1992 Linus Torvalds * Copyright (C) 1994, Karl Keyte: Added support for disk statistics - * Copyright (C) 1996, ACN S.A: Added support for flash devices */ /* @@ -650,10 +649,9 @@ int blk_dev_init(void) #ifdef CONFIG_BLK_DEV_FD floppy_init(); #else +#ifndef CONFIG_SGI outb_p(0xc, 0x3f2); #endif -#ifdef CONFIG_ACN_MIPS_BOARD - flash_devs_init(); #endif #ifdef CONFIG_CDU31A cdu31a_init(); diff --git a/drivers/block/rd.c b/drivers/block/rd.c index 0150bf404..f1bfa7403 100644 --- a/drivers/block/rd.c +++ b/drivers/block/rd.c @@ -35,7 +35,6 @@ * * 4/25/96 : Made ramdisk size a parameter (default is now 4MB) * - Chad Page - * 7/23/96 : Support for systems without PC-style consoles - <dfrick@dial.eunet.ch> */ #include <linux/config.h> @@ -521,11 +520,9 @@ void rd_load() #ifdef CONFIG_BLK_DEV_FD floppy_eject(); #endif -#ifndef CONFIG_SERIAL_ONLY_CONSOLE printk(KERN_NOTICE "VFS: Insert root floppy disk to be loaded into ramdisk and press ENTER\n"); wait_for_keypress(); -#endif } rd_load_image(ROOT_DEV,rd_image_start); |