From mark.cave-ayland at ilande.co.uk Mon May 1 15:13:38 2017 From: mark.cave-ayland at ilande.co.uk (Mark Cave-Ayland) Date: Mon, 1 May 2017 14:13:38 +0100 Subject: [OpenBIOS] [PATCH] vga.fs: install MacOS VGA PPC driver from QEMU fw_cfg interface if available Message-ID: <1493644418-28079-1-git-send-email-mark.cave-ayland@ilande.co.uk> If the fw_cfg interface provides a MacOS VGA PPC NDRV binary driver then install it into the "driver,AAPL,MacOS,PowerPC" property of the QEMU VGA package. The installation of the binary is configured via the NVRAM configuration variable "vga-ndrv?" (which is set to true by default for PPC) and also the presence of the NDRV binary driver file within the QEMU fw_cfg interface itself. Signed-off-by: Mark Cave-Ayland --- drivers/vga.fs | 14 ++++++++++++++ forth/admin/nvram.fs | 1 + 2 files changed, 15 insertions(+) diff --git a/drivers/vga.fs b/drivers/vga.fs index 29a043a..cbfa46c 100644 --- a/drivers/vga.fs +++ b/drivers/vga.fs @@ -34,6 +34,9 @@ fcode-version3 " fb8-fillrect" (find-xt) value fb8-fillrect-xt : fb8-fillrect fb8-fillrect-xt execute ; +" fw-cfg-read-file" (find-xt) value fw-cfg-read-file-xt +: fw-cfg-read-file fw-cfg-read-file-xt execute ; + \ \ IO port words \ @@ -197,6 +200,17 @@ headerless depth-bits encode-int " depth" property line-bytes encode-int " linebytes" property + \ Is the VGA NDRV driver enabled? (PPC only) + " /options" find-package drop s" vga-ndrv?" rot get-package-property not if + decode-string 2swap 2drop \ ( addr len ) + s" true" drop -rot comp 0= if + \ Embed NDRV driver via fw-cfg if it exists + " ndrv/qemu_vga.ndrv" fw-cfg-read-file if + encode-string " driver,AAPL,MacOS,PowerPC" property + then + then + then + ['] qemu-vga-driver-install is-install ; diff --git a/forth/admin/nvram.fs b/forth/admin/nvram.fs index 20f6462..3fbd935 100644 --- a/forth/admin/nvram.fs +++ b/forth/admin/nvram.fs @@ -336,6 +336,7 @@ s" -1" s" real-size" int-config s" 4000000" s" load-base" int-config s" -1" s" virt-base" int-config s" -1" s" virt-size" int-config +s" true" s" vga-ndrv?" bool-config [THEN] [IFDEF] CONFIG_X86 -- 1.7.10.4 From balaton at eik.bme.hu Sat May 27 22:59:17 2017 From: balaton at eik.bme.hu (BALATON Zoltan) Date: Sat, 27 May 2017 22:59:17 +0200 (CEST) Subject: [OpenBIOS] Adding new device in the middle of device-tree Message-ID: Hello, Is there a way to add a new device in the middle of the device tree (before or after an existing node) from Forth? If I try: dev / new-device " newdev" device-name finish-device show-devs /newdev appears at the end of the device-tree but that's not what I want. I need this device to go at a specific place in the middle but I could not find out how to achieve that. Any ideas? Thank you, BALATON Zoltan From tarl-b2 at tarl.net Sun May 28 01:07:11 2017 From: tarl-b2 at tarl.net (Tarl Neustaedter) Date: Sat, 27 May 2017 19:07:11 -0400 Subject: [OpenBIOS] Adding new device in the middle of device-tree In-Reply-To: References: Message-ID: <33aa4350-c85d-9b2f-87ad-bbfce3a400e0@tarl.net> On 2017-May-27 16:59 , BALATON Zoltan wrote: > > > Is there a way to add a new device in the middle of the device tree > (before or after an existing node) from Forth? If I try: > > dev / new-device " newdev" device-name finish-device show-devs > > /newdev appears at the end of the device-tree but that's not what I > want. I need this device to go at a specific place in the middle but I > could not find out how to achieve that. Any ideas? Nope. That's the way it generally works, the node is added at the beginning or end of a linked list for that level. You'd have to fiddle with private structures to change the order. But why do you care where it appears in the tree? You should always be finding the node by name and/or unit address, so it shouldn't matter what order things are in. From tarl-b2 at tarl.net Sun May 28 01:29:56 2017 From: tarl-b2 at tarl.net (Tarl Neustaedter) Date: Sat, 27 May 2017 19:29:56 -0400 Subject: [OpenBIOS] [ specific to Balaton, can't send you email ] In-Reply-To: <33aa4350-c85d-9b2f-87ad-bbfce3a400e0@tarl.net> References: <33aa4350-c85d-9b2f-87ad-bbfce3a400e0@tarl.net> Message-ID: By the way, there is something wrong with your email server. When trying to send you email, your email server at zero.eik.bme.hu complained: * : host zero.eik.bme.hu[2001:738:2001:2001::2001] said: 550 * 5.7.25 Client host rejected: cannot find your hostname, * [2607:f440::d144:5c9] (in reply to RCPT TO command) I'm pretty sure there is nothing fishy about my email server (hiwela.pair.com [209.68.5.201]), which suggests that your email server is taking an over-aggressive approach to rejecting email. Not sure why it ended up doing IPv6 addresses either, your MX record says the connection should go to 152.66.115.2 . From balaton at eik.bme.hu Sun May 28 12:38:47 2017 From: balaton at eik.bme.hu (BALATON Zoltan) Date: Sun, 28 May 2017 12:38:47 +0200 (CEST) Subject: [OpenBIOS] Adding new device in the middle of device-tree In-Reply-To: <33aa4350-c85d-9b2f-87ad-bbfce3a400e0@tarl.net> References: <33aa4350-c85d-9b2f-87ad-bbfce3a400e0@tarl.net> Message-ID: On Sat, 27 May 2017, Tarl Neustaedter wrote: > On 2017-May-27 16:59 , BALATON Zoltan wrote: >> Is there a way to add a new device in the middle of the device tree >> (before or after an existing node) from Forth? If I try: >> >> dev / new-device " newdev" device-name finish-device show-devs >> >> /newdev appears at the end of the device-tree but that's not what I >> want. I need this device to go at a specific place in the middle but I >> could not find out how to achieve that. Any ideas? > > Nope. That's the way it generally works, the node is added at the > beginning or end of a linked list for that level. You'd have to fiddle > with private structures to change the order. If there's a way to add it to the beginning instead of the end that may work as well. How to do that? Or I was thinking about copying the exising device tree one by one and insert the new device to the copy at the right place, then replacing the device tree with the new one but I'm not sure how to do that. Could you give some hints? > But why do you care where it appears in the tree? You should always be > finding the node by name and/or unit address, so it shouldn't matter > what order things are in. I'm trying to do this so I don't need the patch to OpenBIOS: https://mail.coreboot.org/pipermail/openbios/2017-January/009867.html Unfortunately the code relying on this (which I can't change) seems to have some assumptions about order of pci busses in the device tree and only works if added before the exising entry (i.e. /pci at f0000000 has to come before /pci at f2000000). Regards, BALATON Zoltan From segher at kernel.crashing.org Sun May 28 15:14:06 2017 From: segher at kernel.crashing.org (Segher Boessenkool) Date: Sun, 28 May 2017 08:14:06 -0500 Subject: [OpenBIOS] Adding new device in the middle of device-tree In-Reply-To: References: <33aa4350-c85d-9b2f-87ad-bbfce3a400e0@tarl.net> Message-ID: <20170528131405.GF19687@gate.crashing.org> On Sun, May 28, 2017 at 12:38:47PM +0200, BALATON Zoltan wrote: > On Sat, 27 May 2017, Tarl Neustaedter wrote: > >On 2017-May-27 16:59 , BALATON Zoltan wrote: > >>Is there a way to add a new device in the middle of the device tree > >>(before or after an existing node) from Forth? If I try: > >> > >>dev / new-device " newdev" device-name finish-device show-devs > >> > >>/newdev appears at the end of the device-tree but that's not what I > >>want. I need this device to go at a specific place in the middle but I > >>could not find out how to achieve that. Any ideas? > > > >Nope. That's the way it generally works, the node is added at the > >beginning or end of a linked list for that level. You'd have to fiddle > >with private structures to change the order. > > If there's a way to add it to the beginning instead of the end that may > work as well. How to do that? Or I was thinking about copying the exising > device tree one by one and insert the new device to the copy at the right > place, then replacing the device tree with the new one but I'm not sure > how to do that. Could you give some hints? There is no portable way to do it, and this doesn't matter at all; anything that relies on the order of devices in the device tree is broken. If you want this merely for aesthetic purposes, just arrange for all device nodes to be created in the order you want them to appear in? > >But why do you care where it appears in the tree? You should always be > >finding the node by name and/or unit address, so it shouldn't matter > >what order things are in. > > I'm trying to do this so I don't need the patch to OpenBIOS: > > https://mail.coreboot.org/pipermail/openbios/2017-January/009867.html > > Unfortunately the code relying on this (which I can't change) seems to > have some assumptions about order of pci busses in the device tree and > only works if added before the exising entry (i.e. /pci at f0000000 has to > come before /pci at f2000000). What is that code you cannot change? Sounds like OS9? Segher From mark.cave-ayland at ilande.co.uk Wed May 31 08:31:00 2017 From: mark.cave-ayland at ilande.co.uk (Mark Cave-Ayland) Date: Wed, 31 May 2017 07:31:00 +0100 Subject: [OpenBIOS] Adding new device in the middle of device-tree In-Reply-To: References: <33aa4350-c85d-9b2f-87ad-bbfce3a400e0@tarl.net> Message-ID: On 28/05/17 11:38, BALATON Zoltan wrote: > On Sat, 27 May 2017, Tarl Neustaedter wrote: >> On 2017-May-27 16:59 , BALATON Zoltan wrote: >>> Is there a way to add a new device in the middle of the device tree >>> (before or after an existing node) from Forth? If I try: >>> >>> dev / new-device " newdev" device-name finish-device show-devs >>> >>> /newdev appears at the end of the device-tree but that's not what I >>> want. I need this device to go at a specific place in the middle but I >>> could not find out how to achieve that. Any ideas? >> >> Nope. That's the way it generally works, the node is added at the >> beginning or end of a linked list for that level. You'd have to fiddle >> with private structures to change the order. > > If there's a way to add it to the beginning instead of the end that may > work as well. How to do that? Or I was thinking about copying the > exising device tree one by one and insert the new device to the copy at > the right place, then replacing the device tree with the new one but I'm > not sure how to do that. Could you give some hints? > >> But why do you care where it appears in the tree? You should always be >> finding the node by name and/or unit address, so it shouldn't matter >> what order things are in. > > I'm trying to do this so I don't need the patch to OpenBIOS: > > https://mail.coreboot.org/pipermail/openbios/2017-January/009867.html > > Unfortunately the code relying on this (which I can't change) seems to > have some assumptions about order of pci busses in the device tree and > only works if added before the exising entry (i.e. /pci at f0000000 has to > come before /pci at f2000000). Would it still not be easier just to update OpenBIOS so that the PCI host bridge structure becomes and array, add the bus number, and then add an empty bus to QEMU? Just refreshing my memory, in the message above you mention that the bus number is wrong - this is because it is currently hardcoded to 0 in OpenBIOS. I do have a local fix for this based upon some work I'm doing to add support for PCI bridges, so is there any reason why combining these things together shouldn't work? ATB, Mark.