This patchset is really a roll-up/rework of ESCC patches posted by Hervé and John along with a general tidy-up of the ESCC channel code and addition of DBDMA properties.
The most interesting change with this patchset is that a basic OS 9.2 image with just OT extensions enabled now hangs in QEMU in a loop constantly polling ESCC registers rather than crashing into MacsBug.
There are still some issues accessing the serial ports in BSD/Linux but fortunately no regressions/hangs show in testing here with this patchset applied.
NOTE: for OS 9 testers, QEMU's default G4 CPU for mac99 seems buggy and always crashes into MacsBug. Make sure that you have the interpreter.fs patch applied and run QEMU with -cpu G3.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
Mark Cave-Ayland (6): escc.c: rename offset to index ppc: fix ESCC reg properties escc.c: tidy-up legacy and non-legacy codepaths escc.c: add empty slot-names property to serial ports escc.c: add DBDMA addresses to reg property escc.c: add DBDMA interrupt properties
openbios-devel/drivers/escc.c | 92 +++++++++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 36 deletions(-)
This better describes the variable since it contains a reference to the channel rather than an offset.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/drivers/escc.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/openbios-devel/drivers/escc.c b/openbios-devel/drivers/escc.c index afb97fa..9b87083 100644 --- a/openbios-devel/drivers/escc.c +++ b/openbios-devel/drivers/escc.c @@ -386,15 +386,15 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr, phandle_t dnode, aliases;
cell props[10]; - int offset; + int index; int legacy;
switch (esnum) { - case 2: offset = 1; legacy = 0; break; - case 3: offset = 0; legacy = 0; break; - case 4: offset = 1; legacy = 1; break; - case 5: offset = 0; legacy = 1; break; - default: return; + case 2: index = 1; legacy = 0; break; + case 3: index = 0; legacy = 0; break; + case 4: index = 1; legacy = 1; break; + case 5: index = 0; legacy = 1; break; + default: return; }
/* add device */ @@ -425,32 +425,32 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr, set_property(dnode, "compatible", buf, 9);
if (legacy) { - props[0] = IO_ESCC_LEGACY_OFFSET + offset * 0x4; + props[0] = IO_ESCC_LEGACY_OFFSET + index * 0x4; props[1] = 0x00000001; - props[2] = IO_ESCC_LEGACY_OFFSET + offset * 0x4 + 2; + props[2] = IO_ESCC_LEGACY_OFFSET + index * 0x4 + 2; props[3] = 0x00000001; - props[4] = IO_ESCC_LEGACY_OFFSET + offset * 0x4 + 6; + props[4] = IO_ESCC_LEGACY_OFFSET + index * 0x4 + 6; props[5] = 0x00000001; set_property(dnode, "reg", (char *)&props, 6 * sizeof(cell)); } else { - props[0] = IO_ESCC_OFFSET + offset * 0x20; + props[0] = IO_ESCC_OFFSET + index * 0x20; props[1] = 0x00000020; set_property(dnode, "reg", (char *)&props, 2 * sizeof(cell)); }
if (legacy) { - props[0] = addr + IO_ESCC_LEGACY_OFFSET + offset * 0x4; + props[0] = addr + IO_ESCC_LEGACY_OFFSET + index * 0x4; } else { - props[0] = addr + IO_ESCC_OFFSET + offset * 0x20; + props[0] = addr + IO_ESCC_OFFSET + index * 0x20; } OLDWORLD(set_property(dnode, "AAPL,address", (char *)&props, 1 * sizeof(cell)));
- props[0] = 0x00000010 - offset; + props[0] = 0x00000010 - index; OLDWORLD(set_property(dnode, "AAPL,interrupts", (char *)&props, 1 * sizeof(cell)));
- props[0] = (0x24) + offset; + props[0] = (0x24) + index; props[1] = 0; props[2] = 0; NEWWORLD(set_property(dnode, "interrupts", @@ -460,11 +460,11 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr,
if (legacy) { uart_init_line( - (unsigned char*)addr + IO_ESCC_LEGACY_OFFSET + offset * 0x4, + (unsigned char*)addr + IO_ESCC_LEGACY_OFFSET + index * 0x4, CONFIG_SERIAL_SPEED); } else { uart_init_line( - (unsigned char*)addr + IO_ESCC_OFFSET + offset * 0x20, + (unsigned char*)addr + IO_ESCC_OFFSET + index * 0x20, CONFIG_SERIAL_SPEED); } }
I/O offsets were wrong in legacy mode and some were missing in non-legacy mode. This fixes serial port detection in NetBSD, which was ignoring it. This also partly fixes MacOS 9.2, which relies on them to initialize OpenTransport.
Based upon an original patch from Hervé Poussineau hpoussin@reactos.org.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/drivers/escc.c | 43 ++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-)
diff --git a/openbios-devel/drivers/escc.c b/openbios-devel/drivers/escc.c index 9b87083..a6d92a4 100644 --- a/openbios-devel/drivers/escc.c +++ b/openbios-devel/drivers/escc.c @@ -388,7 +388,20 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr, cell props[10]; int index; int legacy; - + int reg_offsets[2][2][3] = { + { + /* ch-b */ + { 0x20, 0x30, 0x50 }, + /* ch-a */ + { 0x00, 0x10, 0x40 } + },{ + /* legacy ch-b */ + { 0x4, 0x6, 0xa }, + /* legacy ch-a */ + { 0x0, 0x2, 0x8 } + } + }; + switch (esnum) { case 2: index = 1; legacy = 0; break; case 3: index = 0; legacy = 0; break; @@ -425,17 +438,21 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr, set_property(dnode, "compatible", buf, 9);
if (legacy) { - props[0] = IO_ESCC_LEGACY_OFFSET + index * 0x4; - props[1] = 0x00000001; - props[2] = IO_ESCC_LEGACY_OFFSET + index * 0x4 + 2; - props[3] = 0x00000001; - props[4] = IO_ESCC_LEGACY_OFFSET + index * 0x4 + 6; - props[5] = 0x00000001; + props[0] = IO_ESCC_LEGACY_OFFSET + reg_offsets[legacy][index][0]; + props[1] = 0x1; + props[2] = IO_ESCC_LEGACY_OFFSET + reg_offsets[legacy][index][1]; + props[3] = 0x1; + props[4] = IO_ESCC_LEGACY_OFFSET + reg_offsets[legacy][index][2]; + props[5] = 0x1; set_property(dnode, "reg", (char *)&props, 6 * sizeof(cell)); } else { - props[0] = IO_ESCC_OFFSET + index * 0x20; - props[1] = 0x00000020; - set_property(dnode, "reg", (char *)&props, 2 * sizeof(cell)); + props[0] = IO_ESCC_OFFSET + reg_offsets[legacy][index][0]; + props[1] = 0x1; + props[2] = IO_ESCC_OFFSET + reg_offsets[legacy][index][1]; + props[3] = 0x1; + props[4] = IO_ESCC_OFFSET + reg_offsets[legacy][index][2]; + props[5] = 0x1; + set_property(dnode, "reg", (char *)&props, 6 * sizeof(cell)); }
if (legacy) { @@ -446,13 +463,13 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr, OLDWORLD(set_property(dnode, "AAPL,address", (char *)&props, 1 * sizeof(cell)));
- props[0] = 0x00000010 - index; + props[0] = 0x10 - index; OLDWORLD(set_property(dnode, "AAPL,interrupts", (char *)&props, 1 * sizeof(cell)));
props[0] = (0x24) + index; - props[1] = 0; - props[2] = 0; + props[1] = 0x0; + props[2] = 0x0; NEWWORLD(set_property(dnode, "interrupts", (char *)&props, 3 * sizeof(cell)));
Now that the reg addresses are all table-driven, it is possible to simplify and almost remove the legacy and non-legacy codepaths.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/drivers/escc.c | 42 ++++++++++++++--------------------------- 1 file changed, 14 insertions(+), 28 deletions(-)
diff --git a/openbios-devel/drivers/escc.c b/openbios-devel/drivers/escc.c index a6d92a4..f194957 100644 --- a/openbios-devel/drivers/escc.c +++ b/openbios-devel/drivers/escc.c @@ -386,6 +386,7 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr, phandle_t dnode, aliases;
cell props[10]; + ucell offset; int index; int legacy; int reg_offsets[2][2][3] = { @@ -438,28 +439,20 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr, set_property(dnode, "compatible", buf, 9);
if (legacy) { - props[0] = IO_ESCC_LEGACY_OFFSET + reg_offsets[legacy][index][0]; - props[1] = 0x1; - props[2] = IO_ESCC_LEGACY_OFFSET + reg_offsets[legacy][index][1]; - props[3] = 0x1; - props[4] = IO_ESCC_LEGACY_OFFSET + reg_offsets[legacy][index][2]; - props[5] = 0x1; - set_property(dnode, "reg", (char *)&props, 6 * sizeof(cell)); + offset = IO_ESCC_LEGACY_OFFSET; } else { - props[0] = IO_ESCC_OFFSET + reg_offsets[legacy][index][0]; - props[1] = 0x1; - props[2] = IO_ESCC_OFFSET + reg_offsets[legacy][index][1]; - props[3] = 0x1; - props[4] = IO_ESCC_OFFSET + reg_offsets[legacy][index][2]; - props[5] = 0x1; - set_property(dnode, "reg", (char *)&props, 6 * sizeof(cell)); + offset = IO_ESCC_OFFSET; }
- if (legacy) { - props[0] = addr + IO_ESCC_LEGACY_OFFSET + index * 0x4; - } else { - props[0] = addr + IO_ESCC_OFFSET + index * 0x20; - } + props[0] = offset + reg_offsets[legacy][index][0]; + props[1] = 0x1; + props[2] = offset + reg_offsets[legacy][index][1]; + props[3] = 0x1; + props[4] = offset + reg_offsets[legacy][index][2]; + props[5] = 0x1; + set_property(dnode, "reg", (char *)&props, 6 * sizeof(cell)); + + props[0] = addr + offset + reg_offsets[legacy][index][0]; OLDWORLD(set_property(dnode, "AAPL,address", (char *)&props, 1 * sizeof(cell)));
@@ -475,15 +468,8 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr,
device_end();
- if (legacy) { - uart_init_line( - (unsigned char*)addr + IO_ESCC_LEGACY_OFFSET + index * 0x4, - CONFIG_SERIAL_SPEED); - } else { - uart_init_line( - (unsigned char*)addr + IO_ESCC_OFFSET + index * 0x20, - CONFIG_SERIAL_SPEED); - } + uart_init_line((unsigned char*)addr + offset + reg_offsets[legacy][index][0], + CONFIG_SERIAL_SPEED); }
void
This is required to enable the ports to be detected by OS X.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/drivers/escc.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/openbios-devel/drivers/escc.c b/openbios-devel/drivers/escc.c index f194957..bb7b34c 100644 --- a/openbios-devel/drivers/escc.c +++ b/openbios-devel/drivers/escc.c @@ -466,6 +466,8 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr, NEWWORLD(set_property(dnode, "interrupts", (char *)&props, 3 * sizeof(cell)));
+ set_int_property(dnode, "slot-names", 0); + device_end();
uart_init_line((unsigned char*)addr + offset + reg_offsets[legacy][index][0],
On Feb 20, 2016, at 10:51 AM, Mark Cave-Ayland wrote:
This is required to enable the ports to be detected by OS X.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
openbios-devel/drivers/escc.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/openbios-devel/drivers/escc.c b/openbios-devel/drivers/escc.c index f194957..bb7b34c 100644 --- a/openbios-devel/drivers/escc.c +++ b/openbios-devel/drivers/escc.c @@ -466,6 +466,8 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr, NEWWORLD(set_property(dnode, "interrupts", (char *)&props, 3 * sizeof(cell)));
set_int_property(dnode, "slot-names", 0);
device_end();
uart_init_line((unsigned char*)addr + offset + reg_offsets[legacy][index][0],
-- 1.7.10.4
Sorry but this logical change to the slot-names property does not make Mac OS X happy. The driver will just assume there is more than just a 32-bit number set to this property.
http://www.opensource.apple.com/source/AppleSCCSerial/AppleSCCSerial-126.4.0... This is the source code for the driver Mac OS X uses to read the slot-names property.
tmpName = (char *) s->getBytesNoCopy() + sizeof(UInt32); The s->getBytesNoCopy() code here is what is used to get the address of the start of the slot-names property's value. The " + sizeof(UInt32); " code is used to just skip over the beginning integer part of the property so that the driver can read the string part. In a perfect world the driver for Mac OS 9 and X would just see the zero and not bother trying to use the serial port. But unfortunately we don't have drivers that do something so logical. I did submit a patch that sets this property to this: 1 Modem
This is the value on real hardware. It also allows the Mac OS X driver to continue past where it would usually fail. The next thing to fix I would guess is adding dma support to the escc.c file.
On 20/02/16 16:17, Programmingkid wrote:
On Feb 20, 2016, at 10:51 AM, Mark Cave-Ayland wrote:
This is required to enable the ports to be detected by OS X.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
openbios-devel/drivers/escc.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/openbios-devel/drivers/escc.c b/openbios-devel/drivers/escc.c index f194957..bb7b34c 100644 --- a/openbios-devel/drivers/escc.c +++ b/openbios-devel/drivers/escc.c @@ -466,6 +466,8 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr, NEWWORLD(set_property(dnode, "interrupts", (char *)&props, 3 * sizeof(cell)));
set_int_property(dnode, "slot-names", 0);
device_end();
uart_init_line((unsigned char*)addr + offset + reg_offsets[legacy][index][0],
-- 1.7.10.4
Sorry but this logical change to the slot-names property does not make Mac OS X happy. The driver will just assume there is more than just a 32-bit number set to this property.
http://www.opensource.apple.com/source/AppleSCCSerial/AppleSCCSerial-126.4.0... This is the source code for the driver Mac OS X uses to read the slot-names property.
tmpName = (char *) s->getBytesNoCopy() + sizeof(UInt32); The s->getBytesNoCopy() code here is what is used to get the address of the start of the slot-names property's value. The " + sizeof(UInt32); " code is used to just skip over the beginning integer part of the property so that the driver can read the string part. In a perfect world the driver for Mac OS 9 and X would just see the zero and not bother trying to use the serial port. But unfortunately we don't have drivers that do something so logical. I did submit a patch that sets this property to this: 1 Modem
This is the value on real hardware. It also allows the Mac OS X driver to continue past where it would usually fail. The next thing to fix I would guess is adding dma support to the escc.c file.
So my understanding of this was that failure here was enough to prevent OS X from booting completely, or have I misunderstood?
I've just discovered a couple of extra fixes so expect a v2 fairly soon. If you could rebase against that version and confirm that OS X can still boot, it may be that we can still apply it in time for freeze.
ATB,
Mark.
On Feb 20, 2016, at 11:48 AM, Mark Cave-Ayland wrote:
On 20/02/16 16:17, Programmingkid wrote:
On Feb 20, 2016, at 10:51 AM, Mark Cave-Ayland wrote:
This is required to enable the ports to be detected by OS X.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
openbios-devel/drivers/escc.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/openbios-devel/drivers/escc.c b/openbios-devel/drivers/escc.c index f194957..bb7b34c 100644 --- a/openbios-devel/drivers/escc.c +++ b/openbios-devel/drivers/escc.c @@ -466,6 +466,8 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr, NEWWORLD(set_property(dnode, "interrupts", (char *)&props, 3 * sizeof(cell)));
set_int_property(dnode, "slot-names", 0);
device_end();
uart_init_line((unsigned char*)addr + offset + reg_offsets[legacy][index][0],
-- 1.7.10.4
Sorry but this logical change to the slot-names property does not make Mac OS X happy. The driver will just assume there is more than just a 32-bit number set to this property.
http://www.opensource.apple.com/source/AppleSCCSerial/AppleSCCSerial-126.4.0... This is the source code for the driver Mac OS X uses to read the slot-names property.
tmpName = (char *) s->getBytesNoCopy() + sizeof(UInt32); The s->getBytesNoCopy() code here is what is used to get the address of the start of the slot-names property's value. The " + sizeof(UInt32); " code is used to just skip over the beginning integer part of the property so that the driver can read the string part. In a perfect world the driver for Mac OS 9 and X would just see the zero and not bother trying to use the serial port. But unfortunately we don't have drivers that do something so logical. I did submit a patch that sets this property to this: 1 Modem
This is the value on real hardware. It also allows the Mac OS X driver to continue past where it would usually fail. The next thing to fix I would guess is adding dma support to the escc.c file.
So my understanding of this was that failure here was enough to prevent OS X from booting completely, or have I misunderstood?
A failure here does not stop Mac OS X from booting. I'm actually hoping we can have dma working for the escc so it can work in Mac OS 9 and X. Making the escc work with dma support might make booting Mac OS 9 a lot easier.
I've just discovered a couple of extra fixes so expect a v2 fairly soon. If you could rebase against that version and confirm that OS X can still boot, it may be that we can still apply it in time for freeze.
That would be nice if we could make it in time. If not no problem.
On 20/02/16 16:52, Programmingkid wrote:
I've just discovered a couple of extra fixes so expect a v2 fairly soon. If you could rebase against that version and confirm that OS X can still boot, it may be that we can still apply it in time for freeze.
That would be nice if we could make it in time. If not no problem.
Done. Rather obviously it seems that the offsets vs. channels were the wrong way around, and now with v2 the serial ports actually work on Linux under QEMU. So you may find that you get a bit further now.
ATB,
Mark.
On Feb 20, 2016, at 12:26 PM, Mark Cave-Ayland wrote:
On 20/02/16 16:52, Programmingkid wrote:
I've just discovered a couple of extra fixes so expect a v2 fairly soon. If you could rebase against that version and confirm that OS X can still boot, it may be that we can still apply it in time for freeze.
That would be nice if we could make it in time. If not no problem.
Done. Rather obviously it seems that the offsets vs. channels were the wrong way around, and now with v2 the serial ports actually work on Linux under QEMU. So you may find that you get a bit further now.
How do you test out the serial ports in Linux? I'm betting you using a command in the terminal.
Is there a way to write to QEMU's serial console from Linux?
On 20/02/16 17:43, Programmingkid wrote:
On Feb 20, 2016, at 12:26 PM, Mark Cave-Ayland wrote:
On 20/02/16 16:52, Programmingkid wrote:
I've just discovered a couple of extra fixes so expect a v2 fairly soon. If you could rebase against that version and confirm that OS X can still boot, it may be that we can still apply it in time for freeze.
That would be nice if we could make it in time. If not no problem.
Done. Rather obviously it seems that the offsets vs. channels were the wrong way around, and now with v2 the serial ports actually work on Linux under QEMU. So you may find that you get a bit further now.
How do you test out the serial ports in Linux? I'm betting you using a command in the terminal.
Is there a way to write to QEMU's serial console from Linux?
I'm currently testing using Aurelien's image at https://people.debian.org/~aurel32/qemu/powerpc/debian_wheezy_powerpc_standa....
This automatically attaches a tty to the serial port, so I load up the GTK GUI as normal, switch to the serial monitor and then I can log in as you would over a standard serial console.
ATB,
Mark.
On Sat, 20 Feb 2016, Programmingkid wrote:
On Feb 20, 2016, at 10:51 AM, Mark Cave-Ayland wrote:
This is required to enable the ports to be detected by OS X.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
openbios-devel/drivers/escc.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/openbios-devel/drivers/escc.c b/openbios-devel/drivers/escc.c index f194957..bb7b34c 100644 --- a/openbios-devel/drivers/escc.c +++ b/openbios-devel/drivers/escc.c @@ -466,6 +466,8 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr, NEWWORLD(set_property(dnode, "interrupts", (char *)&props, 3 * sizeof(cell)));
set_int_property(dnode, "slot-names", 0);
device_end();
uart_init_line((unsigned char*)addr + offset + reg_offsets[legacy][index][0],
-- 1.7.10.4
Sorry but this logical change to the slot-names property does not make Mac OS X happy. The driver will just assume there is more than just a 32-bit number set to this property.
http://www.opensource.apple.com/source/AppleSCCSerial/AppleSCCSerial-126.4.0... This is the source code for the driver Mac OS X uses to read the slot-names property.
tmpName = (char *) s->getBytesNoCopy() + sizeof(UInt32);
The s->getBytesNoCopy() code here is what is used to get the address of the start of the slot-names property's value. The " + sizeof(UInt32); " code is used to just skip over the beginning integer part of the property so that the driver can read the string part.
But if I'm reading it right (I assume this is the AppleSCCSerial::setPortName method we are talking about) this code will not be reached at all because first it will do
UInt32 *nWords = (UInt32*)s->getBytesNoCopy();
and find that no names are specified so the code you've quoted will be skipped as it is enclosed within if (*nWords > 0) { }
Instead it will move on to the last part with the comment saying that for PowerMacX,X ch-a is assumed to be the modem port and ch-b is nothing but even that is only true for PowerMac1,1 so for PowerMac3,1 it will use "none" or "serial" if some debug key is set as default values which may be OK.
In a perfect world the driver for Mac OS 9 and X would just see the zero and not bother trying to use the serial port.
I think it sees the 0 and does not try to get a name from this property and just use some defaults instead as noted above. I'm not sure how does this influence trying to use a modem or something else on the port though.
But unfortunately we don't have drivers that do something so logical. I did submit a patch that sets this property to this: 1 Modem
Why do you think that claiming to have a modem we don't emulate is better than claiming we have an empty port which is what we actually emulate? I think saying we have a modem is more likely to make it try to access it and get an error due to missing emulation than otherwise.
This is the value on real hardware. It also allows the Mac OS X driver to continue past where it would usually fail.
According to device trees I've posted before I've seen both empty slot-names and one saying modem on real hardware so I think both could be correct. I don't know it the modem was removable maybe if it was disabled or removed the slot-name property was empty or the modem was only present on PowerMac1,1 as the driver code suggests.
In any case I was wondering if setting this property to modem just makes it take a detour and try to access the modem and fail before reaching the point it crashes normally so if we emulated a modem we would eventually get to the same crash, only later.
The next thing to fix I would guess is adding dma support to the escc.c file.
It seems more likely to me that this is the reason it is not working now and if this is implemented we may not need the modem slot-name.
Regards, BALATON Zoltan
These are required for MacOS to locate the serial port.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland> --- openbios-devel/drivers/escc.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/openbios-devel/drivers/escc.c b/openbios-devel/drivers/escc.c index bb7b34c..45ab97f 100644 --- a/openbios-devel/drivers/escc.c +++ b/openbios-devel/drivers/escc.c @@ -389,6 +389,14 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr, ucell offset; int index; int legacy; + + int dbdma_offsets[2][2] = { + /* ch-b */ + { 0x6, 0x7 }, + /* ch-a */ + { 0x4, 0x5 } + }; + int reg_offsets[2][2][3] = { { /* ch-b */ @@ -450,7 +458,11 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr, props[3] = 0x1; props[4] = offset + reg_offsets[legacy][index][2]; props[5] = 0x1; - set_property(dnode, "reg", (char *)&props, 6 * sizeof(cell)); + props[6] = 0x8000 + dbdma_offsets[index][0] * 0x100; + props[7] = 0x1; + props[8] = 0x8000 + dbdma_offsets[index][1] * 0x100; + props[9] = 0x1; + set_property(dnode, "reg", (char *)&props, 10 * sizeof(cell));
props[0] = addr + offset + reg_offsets[legacy][index][0]; OLDWORLD(set_property(dnode, "AAPL,address",
These are required for MacOS to locate the serial port. Also make sure we add the 2nd integer to each interrupt in order to indicate level/edge triggering.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/drivers/escc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/openbios-devel/drivers/escc.c b/openbios-devel/drivers/escc.c index 45ab97f..f03e536 100644 --- a/openbios-devel/drivers/escc.c +++ b/openbios-devel/drivers/escc.c @@ -473,10 +473,13 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr, (char *)&props, 1 * sizeof(cell)));
props[0] = (0x24) + index; - props[1] = 0x0; - props[2] = 0x0; + props[1] = 0x1; + props[2] = dbdma_offsets[index][0]; + props[3] = 0x0; + props[4] = dbdma_offsets[index][1]; + props[5] = 0x0; NEWWORLD(set_property(dnode, "interrupts", - (char *)&props, 3 * sizeof(cell))); + (char *)&props, 6 * sizeof(cell)));
set_int_property(dnode, "slot-names", 0);