--- Gnu-Mach/linux/dev/drivers/block/genhd.c 2020/09/02 04:41:39 1.1 +++ Gnu-Mach/linux/dev/drivers/block/genhd.c 2020/09/02 04:48:33 1.1.1.4 @@ -27,6 +27,8 @@ #ifdef CONFIG_BLK_DEV_INITRD #include #endif +#include +#include #include @@ -39,6 +41,7 @@ #ifdef MACH #include +#include #endif #define SYS_IND(p) get_unaligned(&p->sys_ind) @@ -111,7 +114,7 @@ static void add_partition (struct gendis printk(" %s", disk_name(hd, minor, buf)); } -#ifdef MACH +#if defined (MACH) && defined (CONFIG_BSD_DISKLABEL) static int mach_minor; static void add_bsd_partition (struct gendisk *hd, int minor, int slice, @@ -123,7 +126,7 @@ add_bsd_partition (struct gendisk *hd, i printk (" %s%c", disk_name (hd, mach_minor, buf), slice); } #endif - + static inline int is_extended_partition(struct partition *p) { return (SYS_IND(p) == DOS_EXTENDED_PARTITION || @@ -182,7 +185,7 @@ static void extended_partition(struct ge * and OS/2 seems to use all four entries. */ - /* + /* * First process the data partition(s) */ for (i=0; i<4; i++, p++) { @@ -231,7 +234,7 @@ done: } #ifdef CONFIG_BSD_DISKLABEL -/* +/* * Create devices for BSD partitions listed in a disklabel, under a * dos-like partition. See extended_partition() for more information. */ @@ -289,7 +292,7 @@ read_mbr: printk(" unable to read partition table\n"); return -1; } - data = bh->b_data; + data = (unsigned char *)bh->b_data; /* In some cases we modify the geometry */ /* of the drive (below), so ensure that */ /* nobody else tries to re-use this data. */ @@ -313,7 +316,7 @@ check_table: if (SYS_IND(p) == EZD_PARTITION) { /* * The remainder of the disk must be accessed using - * a translated geometry that reduces the number of + * a translated geometry that reduces the number of * apparent cylinders to less than 1024 if possible. * * ide_xlate_1024() will take care of the necessary @@ -329,7 +332,7 @@ check_table: * Everything on the disk is offset by 63 sectors, * including a "new" MBR with its own partition table, * and the remainder of the disk must be accessed using - * a translated geometry that reduces the number of + * a translated geometry that reduces the number of * apparent cylinders to less than 1024 if possible. * * ide_xlate_1024() will take care of the necessary @@ -340,7 +343,7 @@ check_table: goto read_mbr; /* start over with new MBR */ } } else if (sig <= 0x1ae && *(unsigned short *)(data + sig) == 0x55AA - && (1 & *(unsigned char *)(data + sig + 2)) ) + && (1 & *(unsigned char *)(data + sig + 2)) ) { /* * DM6 signature in MBR, courtesy of OnTrack @@ -387,7 +390,7 @@ check_table: * be able to bread the block containing the extended * partition info. */ - hd->sizes[minor] = hd->part[minor].nr_sects + hd->sizes[minor] = hd->part[minor].nr_sects >> (BLOCK_SIZE_BITS - 9); extended_partition(hd, MKDEV(hd->major, minor)); printk(" >"); @@ -527,7 +530,7 @@ static int sun_partition(struct gendisk } partitions[8]; unsigned short magic; /* Magic number */ unsigned short csum; /* Label xor'd checksum */ - } * label; + } * label; struct sun_partition *p; int other_endian; unsigned long spc; @@ -642,7 +645,7 @@ amiga_partition(struct gendisk *hd, unsi blk = htonl(pb->pb_Next); if (pb->pb_ID == htonl(IDNAME_PARTITION) && checksum_block( (__u32 *)pb,htonl(pb->pb_SummedLongs) & 0x7F) == 0 ) { - + /* Tell Kernel about it */ if (!(nr_sects = (htonl(pb->pb_Environment[10]) + 1 - @@ -678,7 +681,7 @@ static void check_partition(struct gendi char buf[8]; if (first_time) - printk("Partition check:\n"); + printk("Partition check (DOS partitions):\n"); first_time = 0; first_sector = hd->part[MINOR(dev)].start_sect; @@ -751,7 +754,7 @@ static void setup_dev(struct gendisk *de dev->part[i].start_sect = 0; dev->part[i].nr_sects = 0; } - dev->init(dev); + dev->init(dev); for (drive = 0 ; drive < dev->nr_real ; drive++) { int first_minor = drive << dev->minor_shift; current_minor = 1 + first_minor; @@ -767,14 +770,36 @@ static void setup_dev(struct gendisk *de void device_setup(void) { extern void console_map_init(void); + extern char *kernel_cmdline; + char *c, *param, *white; struct gendisk *p; int nr=0; #ifdef MACH - extern int linux_intr_pri; - - linux_intr_pri = SPL5; + linux_intr_pri = SPL6; #endif + for (c = kernel_cmdline; c; ) + { + param = strstr(c, " ide"); + if (!param) + param = strstr(c, " hd"); + if (!param) + break; + if (param) { + param++; + white = strchr(param, ' '); + if (!white) { + ide_setup(param); + c = NULL; + } else { + char *word = alloca(white - param + 1); + strncpy(word, param, white - param); + word[white-param] = '\0'; + ide_setup(word); + c = white + 1; + } + } + } #ifndef MACH chr_dev_init(); #endif