Commit e8618032 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] ppc boot device selection cleanup

	PPC logics for choice of default boot device number switched to
dev_t.  Rationale: it belongs to userland; we notice partitions with
certain properties and choose one of them as the best candidate for
being a root fs; then we put the resulting device number into ROOT_DEV,
which has only one use - it's passed to mknod(2) to create a device node
on rootfs and allow mount(2) get us the final root.

	IOW, all that code has nothing whatsoever with kernel internals
of any description - the value we are generating will be passed to
mknod(2) anyway.  Switched to dev_t.

	Note: that code should eventually be moved to early userland.
parent 91b58109
...@@ -67,7 +67,7 @@ void btext_progress(char *, unsigned short); ...@@ -67,7 +67,7 @@ void btext_progress(char *, unsigned short);
extern unsigned long pmac_find_end_of_memory(void); extern unsigned long pmac_find_end_of_memory(void);
extern int of_show_percpuinfo(struct seq_file *, int); extern int of_show_percpuinfo(struct seq_file *, int);
extern kdev_t boot_dev; extern dev_t boot_dev;
extern PTE *Hash, *Hash_end; extern PTE *Hash, *Hash_end;
extern unsigned long Hash_size, Hash_mask; extern unsigned long Hash_size, Hash_mask;
......
...@@ -364,7 +364,7 @@ extern char *bootdevice; ...@@ -364,7 +364,7 @@ extern char *bootdevice;
void *boot_host; void *boot_host;
int boot_target; int boot_target;
int boot_part; int boot_part;
extern kdev_t boot_dev; extern dev_t boot_dev;
#ifdef CONFIG_SCSI #ifdef CONFIG_SCSI
void __init void __init
...@@ -398,18 +398,18 @@ note_scsi_host(struct device_node *node, void *host) ...@@ -398,18 +398,18 @@ note_scsi_host(struct device_node *node, void *host)
#endif #endif
#if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC) #if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
kdev_t __init dev_t __init
find_ide_boot(void) find_ide_boot(void)
{ {
char *p; char *p;
int n; int n;
kdev_t __init pmac_find_ide_boot(char *bootdevice, int n); dev_t __init pmac_find_ide_boot(char *bootdevice, int n);
if (bootdevice == NULL) if (bootdevice == NULL)
return NODEV; return 0;
p = strrchr(bootdevice, '/'); p = strrchr(bootdevice, '/');
if (p == NULL) if (p == NULL)
return NODEV; return 0;
n = p - bootdevice; n = p - bootdevice;
return pmac_find_ide_boot(bootdevice, n); return pmac_find_ide_boot(bootdevice, n);
...@@ -436,7 +436,7 @@ late_initcall(pmac_late_init); ...@@ -436,7 +436,7 @@ late_initcall(pmac_late_init);
/* can't be __init - can be called whenever a disk is first accessed */ /* can't be __init - can be called whenever a disk is first accessed */
void __pmac void __pmac
note_bootable_part(kdev_t dev, int part, int goodness) note_bootable_part(dev_t dev, int part, int goodness)
{ {
static int found_boot = 0; static int found_boot = 0;
char *p; char *p;
...@@ -454,9 +454,9 @@ note_bootable_part(kdev_t dev, int part, int goodness) ...@@ -454,9 +454,9 @@ note_bootable_part(kdev_t dev, int part, int goodness)
find_boot_device(); find_boot_device();
found_boot = 1; found_boot = 1;
} }
if (kdev_same(boot_dev, NODEV) || kdev_same(dev, boot_dev)) { if (!boot_dev || dev == boot_dev) {
ROOT_DEV = MKDEV(major(dev), minor(dev) + part); ROOT_DEV = dev + part;
boot_dev = NODEV; boot_dev = 0;
current_root_goodness = goodness; current_root_goodness = goodness;
} }
} }
......
...@@ -91,7 +91,7 @@ extern void prep_tiger1_setup_pci(char *irq_edge_mask_lo, char *irq_edge_mask_hi ...@@ -91,7 +91,7 @@ extern void prep_tiger1_setup_pci(char *irq_edge_mask_lo, char *irq_edge_mask_hi
#define cached_A1 (((char *)(ppc_cached_irq_mask))[2]) #define cached_A1 (((char *)(ppc_cached_irq_mask))[2])
/* for the mac fs */ /* for the mac fs */
kdev_t boot_dev; dev_t boot_dev;
#ifdef CONFIG_SOUND_CS4232 #ifdef CONFIG_SOUND_CS4232
long ppc_cs4232_dma, ppc_cs4232_dma2; long ppc_cs4232_dma, ppc_cs4232_dma2;
......
...@@ -79,7 +79,7 @@ void fwnmi_init(void); ...@@ -79,7 +79,7 @@ void fwnmi_init(void);
extern void SystemReset_FWNMI(void), MachineCheck_FWNMI(void); /* from head.S */ extern void SystemReset_FWNMI(void), MachineCheck_FWNMI(void); /* from head.S */
int fwnmi_active; /* TRUE if an FWNMI handler is present */ int fwnmi_active; /* TRUE if an FWNMI handler is present */
kdev_t boot_dev; dev_t boot_dev;
unsigned long virtPython0Facilities = 0; // python0 facility area (memory mapped io) (64-bit format) VIRTUAL address. unsigned long virtPython0Facilities = 0; // python0 facility area (memory mapped io) (64-bit format) VIRTUAL address.
extern unsigned long loops_per_jiffy; extern unsigned long loops_per_jiffy;
......
...@@ -702,7 +702,7 @@ pmac_ide_get_irq(unsigned long base) ...@@ -702,7 +702,7 @@ pmac_ide_get_irq(unsigned long base)
static int ide_majors[] __pmacdata = { 3, 22, 33, 34, 56, 57 }; static int ide_majors[] __pmacdata = { 3, 22, 33, 34, 56, 57 };
kdev_t __init dev_t __init
pmac_find_ide_boot(char *bootdevice, int n) pmac_find_ide_boot(char *bootdevice, int n)
{ {
int i; int i;
...@@ -717,7 +717,7 @@ pmac_find_ide_boot(char *bootdevice, int n) ...@@ -717,7 +717,7 @@ pmac_find_ide_boot(char *bootdevice, int n)
name = pmac_ide[i].node->full_name; name = pmac_ide[i].node->full_name;
if (memcmp(name, bootdevice, n) == 0 && name[n] == 0) { if (memcmp(name, bootdevice, n) == 0 && name[n] == 0) {
/* XXX should cope with the 2nd drive as well... */ /* XXX should cope with the 2nd drive as well... */
return mk_kdev(ide_majors[i], 0); return MKDEV(ide_majors[i], 0);
} }
} }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "mac.h" #include "mac.h"
#ifdef CONFIG_ALL_PPC #ifdef CONFIG_ALL_PPC
extern void note_bootable_part(kdev_t dev, int part, int goodness); extern void note_bootable_part(dev_t dev, int part, int goodness);
#endif #endif
/* /*
...@@ -121,8 +121,7 @@ int mac_partition(struct parsed_partitions *state, struct block_device *bdev) ...@@ -121,8 +121,7 @@ int mac_partition(struct parsed_partitions *state, struct block_device *bdev)
} }
#ifdef CONFIG_ALL_PPC #ifdef CONFIG_ALL_PPC
if (found_root_goodness) if (found_root_goodness)
note_bootable_part(to_kdev_t(bdev->bd_dev), note_bootable_part(bdev->bd_dev, found_root, found_root_goodness);
found_root, found_root_goodness);
#endif #endif
put_dev_sector(sect); put_dev_sector(sect);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment