It is now possible to locate IDE drives by searching the device tree for "block" type devices containing a C drive instance variable. Rewrite ob_ide_quiesce() to locate and quiesce IDE drives using this method which finally enables us to remove the global IDE channels list and its remaining ide_add_channel() function.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- drivers/ide.c | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-)
diff --git a/drivers/ide.c b/drivers/ide.c index 62c20b9..4cc572c 100644 --- a/drivers/ide.c +++ b/drivers/ide.c @@ -65,14 +65,6 @@ DECLARE_UNNAMED_NODE( ob_ide_ctrl, 0, sizeof(int));
static int current_channel = FIRST_UNIT;
-static struct ide_channel *channels = NULL; - -static inline void ide_add_channel(struct ide_channel *chan) -{ - chan->next = channels; - channels = chan; -} - /* * don't be pedantic */ @@ -1405,8 +1397,6 @@ int ob_ide_init(const char *path, uint32_t io_port0, uint32_t ctl_port0, chan->drives[j].nr = i * 2 + j; }
- ide_add_channel(chan); - ob_ide_probe(chan);
if (!chan->present) @@ -1507,23 +1497,21 @@ int ob_ide_init(const char *path, uint32_t io_port0, uint32_t ctl_port0,
void ob_ide_quiesce(void) { - struct ide_channel *channel; - int i; + phandle_t ph = 0, xt; + struct ide_drive *drive;
- channel = channels; - while (channel) { - for (i = 0; i < 2; i++) { - struct ide_drive *drive = &channel->drives[i]; + while ((ph = dt_iterate_type(ph, "block"))) { + xt = find_package_method("drive", ph);
- if (!drive->present) - continue; + if (xt) { + PUSH(xt); + fword("execute"); + drive = cell2pointer(POP());
ob_ide_select_drive(drive); ob_ide_software_reset(drive); ob_ide_device_type_check(drive); } - - channel = channel->next; } }
@@ -1604,8 +1592,6 @@ int macio_ide_init(const char *path, uint32_t addr, int nb_channels) continue; }
- ide_add_channel(chan); - ob_ide_identify_drives(chan);
fword("new-device");