diff options
author | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2019-10-22 19:00:24 +0100 |
---|---|---|
committer | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2019-10-22 19:00:24 +0100 |
commit | 7e5b89e4295063d8eba55b9c8ce8bc681c2d129a (patch) | |
tree | 703858537a70b6dcf0fa6efd6eac8ed84be9230a | |
parent | 1c63d13a1f4a9bf0369cda63d2eae4278c52a1d6 (diff) | |
download | openbios-7e5b89e4295063d8eba55b9c8ce8bc681c2d129a.zip openbios-7e5b89e4295063d8eba55b9c8ce8bc681c2d129a.tar.gz openbios-7e5b89e4295063d8eba55b9c8ce8bc681c2d129a.tar.bz2 |
ide: locate drives by iterating over the device tree during ob_ide_quiesce()
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>
-rw-r--r-- | drivers/ide.c | 30 |
1 files 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"); |