[OpenBIOS] [PATCH 5/5] ppc: add ob_ide_quiesce() and call it from the PPC CIF quiesce word

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Fri Oct 9 18:20:33 CEST 2015


Add a new ob_ide_quiesce() function and hook it into QEMU PPC's ciface_quiesce()
routine to properly prepare the drives for transferring control to the operating
system.

Without this OS 9 becomes confused about the initial drive state on boot and
refuses to correctly detect and initialise it.

Based upon an original patch by Cormac O'Brien <cormac at c-obrien.org>.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 openbios-devel/arch/ppc/qemu/methods.c   |    2 ++
 openbios-devel/drivers/ide.c             |   22 ++++++++++++++++++++++
 openbios-devel/include/drivers/drivers.h |    1 +
 3 files changed, 25 insertions(+)

diff --git a/openbios-devel/arch/ppc/qemu/methods.c b/openbios-devel/arch/ppc/qemu/methods.c
index cb72bc1..930b47c 100644
--- a/openbios-devel/arch/ppc/qemu/methods.c
+++ b/openbios-devel/arch/ppc/qemu/methods.c
@@ -114,6 +114,8 @@ static void
 ciface_quiesce( unsigned long args[], unsigned long ret[] )
 {
 	usb_exit();
+
+	ob_ide_quiesce();
 #if 0
 	unsigned long msr;
 	/* This seems to be the correct thing to do - but I'm not sure */
diff --git a/openbios-devel/drivers/ide.c b/openbios-devel/drivers/ide.c
index ce9305a..5125b78 100644
--- a/openbios-devel/drivers/ide.c
+++ b/openbios-devel/drivers/ide.c
@@ -1488,6 +1488,28 @@ int ob_ide_init(const char *path, uint32_t io_port0, uint32_t ctl_port0,
 	return 0;
 }
 
+void ob_ide_quiesce(void)
+{
+	struct ide_channel *channel;
+	int i;
+
+	channel = channels;
+	while (channel) {
+		for (i = 0; i < 2; i++) {
+			struct ide_drive *drive = &channel->drives[i];
+
+			if (!drive->present)
+				continue;
+
+			ob_ide_select_drive(drive);
+			ob_ide_software_reset(drive);
+			ob_ide_device_type_check(drive);
+		}
+
+		channel = channel->next;
+	}
+}
+
 #if defined(CONFIG_DRIVER_MACIO)
 static unsigned char
 macio_ide_inb(struct ide_channel *chan, unsigned int port)
diff --git a/openbios-devel/include/drivers/drivers.h b/openbios-devel/include/drivers/drivers.h
index 3b83b12..48f81a8 100644
--- a/openbios-devel/include/drivers/drivers.h
+++ b/openbios-devel/include/drivers/drivers.h
@@ -52,6 +52,7 @@ void kbd_init(uint64_t base);
 /* drivers/ide.c */
 int ob_ide_init(const char *path, uint32_t io_port0, uint32_t ctl_port0,
                 uint32_t io_port1, uint32_t ctl_port1);
+void ob_ide_quiesce(void);
 int macio_ide_init(const char *path, uint32_t addr, int nb_channels);
 #endif
 #ifdef CONFIG_DRIVER_ESP
-- 
1.7.10.4




More information about the OpenBIOS mailing list