This patchset is a result of work to fix the rtl8139 card under Apple PPC machines in QEMU (both g3beige and mac99).
Primarily it fixes up pci_bus_addr_to_host_addr() to support both memory and IO spaces in order to generate a correct AAPL,address property for IO space mappings. As well as this, it removes the configuration space range from the PCI host bridge for all machines except SPARC64 which fixes an issue with Darwin/OS X calculating the wrong address spaces for PCI accesses.
As a final tidy-up the last patch in the series is a nice rework which properly generates the PCI node interrupt-map property from the device tree rather than using hardcoded (and incorrect) properties for openpic.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
v2: - Updated cover letter - Remove OLDWORLD() macro typo - Add constants suggested by Alex - Include extra patch to tidy up interrupt-map property
Mark Cave-Ayland (6): pci: switch ob_pci_map_in() to use physical addresses rather than region and size pci: support PCI spaces other than memory in pci_bus_addr_to_host_addr() pci: fix AAPL,address property for IO space mappings pci: enable AAPL,address property for all Apple PPC machines pci: remove the configuration space range from the PCI host bridge by default pci: don't hard-code PCI interrupt maps by default
openbios-devel/drivers/pci.c | 130 ++++++++++++++++++++++++----------------- openbios-devel/drivers/pci.fs | 68 +++------------------ openbios-devel/drivers/pci.h | 9 +++ openbios-devel/drivers/vga.fs | 11 ++-- 4 files changed, 100 insertions(+), 118 deletions(-)
This matches the parameters for the map-in word as defined in the IEEE-1275 PCI bindings and provides extra information about the address space in use to be used later. Even better this allows us to considerably simplify the Forth.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/drivers/pci.c | 3 +- openbios-devel/drivers/pci.fs | 68 +++++------------------------------------ openbios-devel/drivers/vga.fs | 11 ++++--- 3 files changed, 16 insertions(+), 66 deletions(-)
diff --git a/openbios-devel/drivers/pci.c b/openbios-devel/drivers/pci.c index 1cb25e6..5847ec3 100644 --- a/openbios-devel/drivers/pci.c +++ b/openbios-devel/drivers/pci.c @@ -340,7 +340,7 @@ ob_pci_encode_unit(int *idx) ss, dev, fn, buf); }
-/* ( pci-addr.lo pci-addr.hi size -- virt ) */ +/* ( pci-addr.lo pci-addr.mid pci-addr.hi size -- virt ) */
static void ob_pci_map_in(int *idx) @@ -353,6 +353,7 @@ ob_pci_map_in(int *idx)
size = POP(); POP(); + POP(); ba = POP();
phys = pci_bus_addr_to_host_addr(ba); diff --git a/openbios-devel/drivers/pci.fs b/openbios-devel/drivers/pci.fs index 563b652..a7b56e1 100644 --- a/openbios-devel/drivers/pci.fs +++ b/openbios-devel/drivers/pci.fs @@ -12,59 +12,19 @@ rot encode-int encode+ ;
-\ Get region offset for BAR reg -: pci-bar-offset@ ( bar-reg -- off.lo off.hi -1 | 0 ) - " reg" active-package get-package-property 0= if - begin - decode-phys \ ( reg prop prop-len phys.lo phys.mid phys.hi ) - ff and 5 pick = if - >r >r 3drop r> r> - -1 exit - else - 2drop - then - \ Drop the size as we don't need it - decode-int drop decode-int drop - dup 0= - until - 3drop - 0 exit - else - 0 - then - ; - -\ Get region size for BAR reg -: pci-bar-size@ ( bar-reg -- size ) - " reg" active-package get-package-property 0= if - begin - decode-phys \ ( reg prop prop-len phys.lo phys.mid phys.hi ) - ff and 5 pick = if - 2drop decode-int drop - decode-int - >r 3drop r> - exit - else - 2drop decode-int drop - decode-int drop - then - dup 0= - until - 3drop - 0 \ default size of 0 if BAR not found - then - ; - -\ Get base address for configured BAR reg -: pci-bar-base@ ( bar-reg -- addr.lo addr.hi -1 | 0 ) +\ Get PCI physical address and size for configured BAR reg +: pci-bar>pci-addr ( bar-reg -- addr.lo addr.mid addr.hi size -1 | 0 ) " assigned-addresses" active-package get-package-property 0= if begin decode-phys \ ( reg prop prop-len phys.lo phys.mid phys.hi ) - ff and 5 pick = if - >r >r 3drop r> r> + dup ff and 6 pick = if + >r >r >r rot drop + decode-int drop decode-int + -rot 2drop + r> swap r> r> rot -1 exit else - 2drop + 3drop then \ Drop the size as we don't need it decode-int drop decode-int drop @@ -77,16 +37,4 @@ then ;
-\ Get PCI bus address and size for configured BAR reg -: pci-bar>pci-region ( bar-reg -- addr.lo addr.hi size ) - dup - >r pci-bar-offset@ if - swap r@ pci-bar-base@ if - swap d+ - then - swap r@ pci-bar-size@ - then - r> drop - ; - [THEN] diff --git a/openbios-devel/drivers/vga.fs b/openbios-devel/drivers/vga.fs index ec4c6c5..29a043a 100644 --- a/openbios-devel/drivers/vga.fs +++ b/openbios-devel/drivers/vga.fs @@ -109,16 +109,17 @@ h# 1 constant VBE_DISPI_ENABLED \ PCI \
-" pci-bar>pci-region" (find-xt) value pci-bar>pci-region-xt -: pci-bar>pci-region pci-bar>pci-region-xt execute ; +" pci-bar>pci-addr" (find-xt) value pci-bar>pci-addr-xt +: pci-bar>pci-addr pci-bar>pci-addr-xt execute ;
h# 10 constant cfg-bar0 \ Framebuffer BAR -1 value fb-addr
: map-fb ( -- ) - cfg-bar0 pci-bar>pci-region \ ( pci-addr.lo pci-addr.hi size ) - " pci-map-in" $call-parent - to fb-addr + cfg-bar0 pci-bar>pci-addr if \ ( pci-addr.lo pci-addr.mid pci-addr.hi size ) + " pci-map-in" $call-parent + to fb-addr + then ;
\
Currently only PCI memory space is mapped in ob_pci_map_in(). By adding multi-space support to pci_bus_addr_to_host_addr(), it becomes possible to translate physical addresses for both memory and IO space.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk Reviewed-by: Alexander Graf agraf@suse.de Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/drivers/pci.c | 31 ++++++++++++++++++++++++------- openbios-devel/drivers/pci.h | 9 +++++++++ 2 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/openbios-devel/drivers/pci.c b/openbios-devel/drivers/pci.c index 5847ec3..713b2f2 100644 --- a/openbios-devel/drivers/pci.c +++ b/openbios-devel/drivers/pci.c @@ -144,9 +144,16 @@ static void dump_reg_property(const char* description, int nreg, u32 *reg) } #endif
-static unsigned long pci_bus_addr_to_host_addr(uint32_t ba) +static unsigned long pci_bus_addr_to_host_addr(int space, uint32_t ba) { - return arch->host_pci_base + (unsigned long)ba; + if (space == IO_SPACE) { + return arch->io_base + (unsigned long)ba; + } else if (space == MEMORY_SPACE_32) { + return arch->host_pci_base + (unsigned long)ba; + } else { + /* Return unaltered to aid debugging property values */ + return (unsigned long)ba; + } }
static void @@ -347,16 +354,20 @@ ob_pci_map_in(int *idx) { phys_addr_t phys; uint32_t ba; - ucell size, virt; + ucell size, virt, tmp; + int space;
PCI_DPRINTF("ob_pci_bar_map_in idx=%p\n", idx);
size = POP(); - POP(); + tmp = POP(); POP(); ba = POP();
- phys = pci_bus_addr_to_host_addr(ba); + /* Get the space from the pci-addr.hi */ + space = ((tmp & PCI_RANGE_TYPE_MASK) >> 24); + + phys = pci_bus_addr_to_host_addr(space, ba);
#if defined(CONFIG_OFMEM) ofmem_claim_phys(phys, size, 0); @@ -753,13 +764,19 @@ int macio_keylargo_config_cb (const pci_config_t *config) int vga_config_cb (const pci_config_t *config) { unsigned long rom; - uint32_t rom_size, size; + uint32_t rom_size, size, mask; + int flags, space_code; phandle_t ph;
if (config->assigned[0] != 0x00000000) { setup_video();
- rom = pci_bus_addr_to_host_addr(config->assigned[1] & ~0x0000000F); + pci_decode_pci_addr(config->assigned[1], + &flags, &space_code, &mask); + + rom = pci_bus_addr_to_host_addr(space_code, + config->assigned[1] & ~0x0000000F); + rom_size = config->sizes[1];
ph = get_cur_dev(); diff --git a/openbios-devel/drivers/pci.h b/openbios-devel/drivers/pci.h index 84a2b2c..d5aa5f8 100644 --- a/openbios-devel/drivers/pci.h +++ b/openbios-devel/drivers/pci.h @@ -59,6 +59,15 @@ #define PCI_MIN_GNT 0x3e /* 8 bits */ #define PCI_MAX_LAT 0x3f /* 8 bits */
+#define PCI_RANGE_RELOCATABLE 0x80000000 +#define PCI_RANGE_PREFETCHABLE 0x40000000 +#define PCI_RANGE_ALIASED 0x20000000 +#define PCI_RANGE_TYPE_MASK 0x03000000 +#define PCI_RANGE_MMIO_64BIT 0x03000000 +#define PCI_RANGE_MMIO 0x02000000 +#define PCI_RANGE_IOPORT 0x01000000 +#define PCI_RANGE_CONFIG 0x00000000 + typedef struct { u16 signature; u8 reserved[0x16];
According to "Designing PCI Cards and Drivers for Power Macintosh Computers" the AAPL,address property should be an array of virtual addresses representing the bus addresses in the assigned-addresses array.
While this works for PCI memory addresses, IO addresses are incorrect because the calculated address is still the PCI bus address. Switch over to using the new space-aware pci_bus_addr_to_host_addr() so that addresses in both memory and IO space are correctly calculated.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk Reviewed-by: Alexander Graf agraf@suse.de Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/drivers/pci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/openbios-devel/drivers/pci.c b/openbios-devel/drivers/pci.c index 713b2f2..c204f15 100644 --- a/openbios-devel/drivers/pci.c +++ b/openbios-devel/drivers/pci.c @@ -597,13 +597,18 @@ static void pci_set_AAPL_address(const pci_config_t *config) { phandle_t dev = get_cur_dev(); cell props[7]; - int ncells, i; + uint32_t mask; + int ncells, i, flags, space_code;
ncells = 0; for (i = 0; i < 6; i++) { if (!config->assigned[i] || !config->sizes[i]) continue; - props[ncells++] = config->assigned[i] & ~0x0000000F; + pci_decode_pci_addr(config->assigned[i], + &flags, &space_code, &mask); + + props[ncells++] = pci_bus_addr_to_host_addr(space_code, + config->assigned[i] & ~mask); } if (ncells) set_property(dev, "AAPL,address", (char *)props,
The property appears in device trees for both Old World and New World Macs so let's do the same.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk Reviewed-by: Alexander Graf agraf@suse.de Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/drivers/pci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/openbios-devel/drivers/pci.c b/openbios-devel/drivers/pci.c index c204f15..4a4b15b 100644 --- a/openbios-devel/drivers/pci.c +++ b/openbios-devel/drivers/pci.c @@ -1020,7 +1020,10 @@ static void ob_pci_add_properties(phandle_t phandle, }
pci_set_assigned_addresses(phandle, config, num_bars); - OLDWORLD(pci_set_AAPL_address(config)); + + if (is_apple()) { + pci_set_AAPL_address(config); + }
PCI_DPRINTF("\n"); }
While the configuration space range appears in real SPARC device trees, it isn't mentioned in the IEEE-1275 PCI bindings and in fact causes Darwin/OS X to calculate PCI address spaces incorrectly.
Disable this range in the PCI host bridge by default, except for SPARC64 where it can evidently still appear.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk Reviewed-by: Alexander Graf agraf@suse.de Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/drivers/pci.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/openbios-devel/drivers/pci.c b/openbios-devel/drivers/pci.c index 4a4b15b..eb00044 100644 --- a/openbios-devel/drivers/pci.c +++ b/openbios-devel/drivers/pci.c @@ -460,13 +460,18 @@ static void pci_host_set_ranges(const pci_config_t *config) int ncells;
ncells = 0; - /* first encode PCI configuration space */ - { - ncells += pci_encode_phys_addr(props + ncells, 0, CONFIGURATION_SPACE, + +#ifdef CONFIG_SPARC64 + /* While configuration space isn't mentioned in the IEEE-1275 PCI + bindings, it appears in the PCI host bridge ranges property in + real device trees. Hence we disable this range for all host + bridges except for SPARC, particularly as it causes Darwin/OS X + to incorrectly calculated PCI memory space ranges on PPC. */ + ncells += pci_encode_phys_addr(props + ncells, 0, CONFIGURATION_SPACE, config->dev, 0, 0); ncells += host_encode_phys_addr(props + ncells, arch->cfg_addr); ncells += pci_encode_size(props + ncells, arch->cfg_len); - } +#endif
if (arch->io_base) { ncells += pci_encode_phys_addr(props + ncells, 0, IO_SPACE,
On 2016-Jan-4 09:11 , Mark Cave-Ayland wrote:
While the configuration space range appears in real SPARC device trees, it isn't mentioned in the IEEE-1275 PCI bindings and in fact causes Darwin/OS X to calculate PCI address spaces incorrectly.
While not quibbling about whether it causes Darwin problems, config space *is* mentioned in the PCI binding, section 2.1.4.
See http://www.o3one.org/hwdocs/openfirmware/pci_supplement_2_1.pdf
On 04/01/16 20:55, Tarl Neustaedter wrote:
On 2016-Jan-4 09:11 , Mark Cave-Ayland wrote:
While the configuration space range appears in real SPARC device trees, it isn't mentioned in the IEEE-1275 PCI bindings and in fact causes Darwin/OS X to calculate PCI address spaces incorrectly.
While not quibbling about whether it causes Darwin problems, config space *is* mentioned in the PCI binding, section 2.1.4.
See http://www.o3one.org/hwdocs/openfirmware/pci_supplement_2_1.pdf
Hi Tarl,
Good to hear from you again! The part we're looking at is the ranges property for bridges (see section 3.1.1). The documentation mentions all the spaces other than configuration space, although the configuration space appears in the Sun device trees in the PCI host bridge (and it was this entry that was confusing Darwin/OS X).
ATB,
Mark.
The current code for openpic interrupts is incorrect for two reasons: firstly it generates an interrupt-map property with 8 IRQ pins (when only 4 are specified and so the last 4 entries are junk), and secondly it hard-codes the entries with a non-standard interrupt-mask to give one entry per pin rather than one entry per PCI device.
Switch everything over to use the existing code used by SPARC64 which dynamically enumerates the child nodes and builds up the correct properties on demand. This ensures that everything will work on PCI platforms particularly if extra cards are dynamically plugged into QEMU.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/drivers/pci.c | 71 +++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 39 deletions(-)
diff --git a/openbios-devel/drivers/pci.c b/openbios-devel/drivers/pci.c index eb00044..6d0af12 100644 --- a/openbios-devel/drivers/pci.c +++ b/openbios-devel/drivers/pci.c @@ -1428,9 +1428,11 @@ static void ob_pci_set_available(phandle_t host, unsigned long mem_base, unsigne
static void ob_pci_host_set_interrupt_map(phandle_t host) { - phandle_t dnode = 0; - u32 props[128]; - int i; + phandle_t dnode = 0, pci_childnode = 0; + u32 props[128], intno; + int i, ncells, len; + u32 *val, addr; + char *reg;
#if defined(CONFIG_PPC) phandle_t target_node; @@ -1474,69 +1476,60 @@ static void ob_pci_host_set_interrupt_map(phandle_t host)
target_node = find_dev("/pci"); set_int_property(target_node, "interrupt-parent", dnode); - - /* openpic interrupt mapping */ - for (i = 0; i < (7*8); i += 7) { - props[i + PCI_INT_MAP_PCI0] = 0; - props[i + PCI_INT_MAP_PCI1] = 0; - props[i + PCI_INT_MAP_PCI2] = 0; - props[i + PCI_INT_MAP_PCI_INT] = (i / 7) + 1; // starts at PINA=1 - props[i + PCI_INT_MAP_PIC_HANDLE] = dnode; - props[i + PCI_INT_MAP_PIC_INT] = arch->irqs[i / 7]; - props[i + PCI_INT_MAP_PIC_POL] = 3; - } - set_property(host, "interrupt-map", (char *)props, 7 * 8 * sizeof(props[0])); - - props[PCI_INT_MAP_PCI0] = 0; - props[PCI_INT_MAP_PCI1] = 0; - props[PCI_INT_MAP_PCI2] = 0; - props[PCI_INT_MAP_PCI_INT] = 0x7; - - set_property(host, "interrupt-map-mask", (char *)props, 4 * sizeof(props[0])); } -#elif defined(CONFIG_SPARC64) - int ncells, len; - u32 *val, addr; - char *reg; +#else + /* PCI host bridge is the default interrupt controller */ + dnode = host; +#endif
/* Set interrupt-map for PCI devices with an interrupt pin present */ ncells = 0;
PUSH(host); fword("child"); - dnode = POP(); - while (dnode) { - if (get_int_property(dnode, "interrupts", &len)) { - reg = get_property(dnode, "reg", &len); - if (reg) { + pci_childnode = POP(); + while (pci_childnode) { + intno = get_int_property(pci_childnode, "interrupts", &len); + if (len && intno) { + reg = get_property(pci_childnode, "reg", &len); + if (len && reg) { val = (u32 *)reg;
for (i = 0; i < (len / sizeof(u32)); i += 5) { addr = val[i];
/* Device address is in 1st 32-bit word of encoded PCI address for config space */ - if (!(addr & 0x03000000)) { + if ((addr & PCI_RANGE_TYPE_MASK) == PCI_RANGE_CONFIG) { +#ifdef CONFIG_SPARC64 + ncells += pci_encode_phys_addr(props + ncells, 0, 0, addr, 0, 0); + props[ncells++] = intno; + props[ncells++] = dnode; + props[ncells++] = SUN4U_INTERRUPT(addr, intno); +#endif + +#ifdef CONFIG_PPC ncells += pci_encode_phys_addr(props + ncells, 0, 0, addr, 0, 0); - props[ncells++] = 1; /* always interrupt pin 1 for QEMU */ - props[ncells++] = host; - props[ncells++] = SUN4U_INTERRUPT(addr, 1); + props[ncells++] = intno; + props[ncells++] = dnode; + props[ncells++] = arch->irqs[intno - 1]; + props[ncells++] = 3; +#endif } } } }
- PUSH(dnode); + PUSH(pci_childnode); fword("peer"); - dnode = POP(); + pci_childnode = POP(); } set_property(host, "interrupt-map", (char *)props, ncells * sizeof(props[0]));
props[0] = 0x0000f800; props[1] = 0x0; props[2] = 0x0; - props[3] = 7; + props[3] = 0x7; set_property(host, "interrupt-map-mask", (char *)props, 4 * sizeof(props[0])); -#endif }
int ob_pci_init(void)
On Jan 4, 2016, at 9:11 AM, Mark Cave-Ayland wrote:
This patchset is a result of work to fix the rtl8139 card under Apple PPC machines in QEMU (both g3beige and mac99).
Primarily it fixes up pci_bus_addr_to_host_addr() to support both memory and IO spaces in order to generate a correct AAPL,address property for IO space mappings. As well as this, it removes the configuration space range from the PCI host bridge for all machines except SPARC64 which fixes an issue with Darwin/OS X calculating the wrong address spaces for PCI accesses.
As a final tidy-up the last patch in the series is a nice rework which properly generates the PCI node interrupt-map property from the device tree rather than using hardcoded (and incorrect) properties for openpic.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
v2:
- Updated cover letter
- Remove OLDWORLD() macro typo
- Add constants suggested by Alex
- Include extra patch to tidy up interrupt-map property
Mark Cave-Ayland (6): pci: switch ob_pci_map_in() to use physical addresses rather than region and size pci: support PCI spaces other than memory in pci_bus_addr_to_host_addr() pci: fix AAPL,address property for IO space mappings pci: enable AAPL,address property for all Apple PPC machines pci: remove the configuration space range from the PCI host bridge by default pci: don't hard-code PCI interrupt maps by default
openbios-devel/drivers/pci.c | 130 ++++++++++++++++++++++++----------------- openbios-devel/drivers/pci.fs | 68 +++------------------ openbios-devel/drivers/pci.h | 9 +++ openbios-devel/drivers/vga.fs | 11 ++-- 4 files changed, 100 insertions(+), 118 deletions(-)
-- 1.7.10.4
I have tried this patch series. It allows the g3beige target to use the RTL8139 NIC, but the mac99 target still does not load the driver for this NIC. For some reason the IOKit is deciding that this device isn't going to have its driver loaded on the mac99 target. Hopefully the unknown requirement will be found.
Would you like a custom version of the RTL8139 driver for your Darwin installation? I can have it print information that could help you know if it is working and give you the installation directions.
On 04/01/16 20:11, Programmingkid wrote:
On Jan 4, 2016, at 9:11 AM, Mark Cave-Ayland wrote:
This patchset is a result of work to fix the rtl8139 card under Apple PPC machines in QEMU (both g3beige and mac99).
Primarily it fixes up pci_bus_addr_to_host_addr() to support both memory and IO spaces in order to generate a correct AAPL,address property for IO space mappings. As well as this, it removes the configuration space range from the PCI host bridge for all machines except SPARC64 which fixes an issue with Darwin/OS X calculating the wrong address spaces for PCI accesses.
As a final tidy-up the last patch in the series is a nice rework which properly generates the PCI node interrupt-map property from the device tree rather than using hardcoded (and incorrect) properties for openpic.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
v2:
- Updated cover letter
- Remove OLDWORLD() macro typo
- Add constants suggested by Alex
- Include extra patch to tidy up interrupt-map property
Mark Cave-Ayland (6): pci: switch ob_pci_map_in() to use physical addresses rather than region and size pci: support PCI spaces other than memory in pci_bus_addr_to_host_addr() pci: fix AAPL,address property for IO space mappings pci: enable AAPL,address property for all Apple PPC machines pci: remove the configuration space range from the PCI host bridge by default pci: don't hard-code PCI interrupt maps by default
openbios-devel/drivers/pci.c | 130 ++++++++++++++++++++++++----------------- openbios-devel/drivers/pci.fs | 68 +++------------------ openbios-devel/drivers/pci.h | 9 +++ openbios-devel/drivers/vga.fs | 11 ++-- 4 files changed, 100 insertions(+), 118 deletions(-)
-- 1.7.10.4
I have tried this patch series. It allows the g3beige target to use the RTL8139 NIC, but the mac99 target still does not load the driver for this NIC. For some reason the IOKit is deciding that this device isn't going to have its driver loaded on the mac99 target. Hopefully the unknown requirement will be found.
Would you like a custom version of the RTL8139 driver for your Darwin installation? I can have it print information that could help you know if it is working and give you the installation directions.
Thanks for testing. Unfortunately it works fine for me with -M mac99 and Darwin 8.0.1 with this patchset so you'll need to work out a test case that can reproduce the exact problem you're seeing :/
First of all, can you reproduce my setup with Darwin 8.0.1 (darwinppc-801.iso) and -M mac99 and see whether that works for you as a starting point?
ATB,
Mark.
On Jan 4, 2016, at 3:17 PM, Mark Cave-Ayland wrote:
On 04/01/16 20:11, Programmingkid wrote:
On Jan 4, 2016, at 9:11 AM, Mark Cave-Ayland wrote:
This patchset is a result of work to fix the rtl8139 card under Apple PPC machines in QEMU (both g3beige and mac99).
Primarily it fixes up pci_bus_addr_to_host_addr() to support both memory and IO spaces in order to generate a correct AAPL,address property for IO space mappings. As well as this, it removes the configuration space range from the PCI host bridge for all machines except SPARC64 which fixes an issue with Darwin/OS X calculating the wrong address spaces for PCI accesses.
As a final tidy-up the last patch in the series is a nice rework which properly generates the PCI node interrupt-map property from the device tree rather than using hardcoded (and incorrect) properties for openpic.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
v2:
- Updated cover letter
- Remove OLDWORLD() macro typo
- Add constants suggested by Alex
- Include extra patch to tidy up interrupt-map property
Mark Cave-Ayland (6): pci: switch ob_pci_map_in() to use physical addresses rather than region and size pci: support PCI spaces other than memory in pci_bus_addr_to_host_addr() pci: fix AAPL,address property for IO space mappings pci: enable AAPL,address property for all Apple PPC machines pci: remove the configuration space range from the PCI host bridge by default pci: don't hard-code PCI interrupt maps by default
openbios-devel/drivers/pci.c | 130 ++++++++++++++++++++++++----------------- openbios-devel/drivers/pci.fs | 68 +++------------------ openbios-devel/drivers/pci.h | 9 +++ openbios-devel/drivers/vga.fs | 11 ++-- 4 files changed, 100 insertions(+), 118 deletions(-)
-- 1.7.10.4
I have tried this patch series. It allows the g3beige target to use the RTL8139 NIC, but the mac99 target still does not load the driver for this NIC. For some reason the IOKit is deciding that this device isn't going to have its driver loaded on the mac99 target. Hopefully the unknown requirement will be found.
Would you like a custom version of the RTL8139 driver for your Darwin installation? I can have it print information that could help you know if it is working and give you the installation directions.
Thanks for testing. Unfortunately it works fine for me with -M mac99 and Darwin 8.0.1 with this patchset so you'll need to work out a test case that can reproduce the exact problem you're seeing :/
First of all, can you reproduce my setup with Darwin 8.0.1 (darwinppc-801.iso) and -M mac99 and see whether that works for you as a starting point?
Are you saying the RTL8139 NIC works on your Darwin setup? If so, how do you test it out? I can only guess you use command-line programs like ftp and ping.
Does this option work for Darwin? -netdev user,id=mynet0 -device rtl8139,netdev=mynet0
What are the command-line options you use?
I will begin testing using my Darwin iso file.
On 04/01/16 20:24, Programmingkid wrote:
Are you saying the RTL8139 NIC works on your Darwin setup? If so, how do you test it out? I can only guess you use command-line programs like ftp and ping.
Does this option work for Darwin? -netdev user,id=mynet0 -device rtl8139,netdev=mynet0
What are the command-line options you use?
I will begin testing using my Darwin iso file.
Correct. For my last test I did this:
qemu-system-ppc -hda darwin_x.qcow2 -cdrom darwinppc-801.iso -boot d -bios openbios-qemu.elf.nostrip -net nic,model=rtl8139 -net user -boot d -M mac99
The OpenBIOS binary is git master with the v2 patchset applied, while QEMU is git master. I ran all the way through the installer, rebooted, and the Realtek driver loaded on reboot with a valid en0 interface that could ping/ssh to external servers.
ATB,
Mark.
On Jan 4, 2016, at 3:29 PM, Mark Cave-Ayland wrote:
On 04/01/16 20:24, Programmingkid wrote:
Are you saying the RTL8139 NIC works on your Darwin setup? If so, how do you test it out? I can only guess you use command-line programs like ftp and ping.
Does this option work for Darwin? -netdev user,id=mynet0 -device rtl8139,netdev=mynet0
What are the command-line options you use?
I will begin testing using my Darwin iso file.
Correct. For my last test I did this:
qemu-system-ppc -hda darwin_x.qcow2 -cdrom darwinppc-801.iso -boot d -bios openbios-qemu.elf.nostrip -net nic,model=rtl8139 -net user -boot d -M mac99
The OpenBIOS binary is git master with the v2 patchset applied, while QEMU is git master. I ran all the way through the installer, rebooted, and the Realtek driver loaded on reboot with a valid en0 interface that could ping/ssh to external servers.
The RTL8139 does work with the Darwin iso file. Didn't even have to install Darwin, just typed 'shell' at the prompt and was able to do some tests.
The ioreg command does indicate the NIC is fully loaded. But I could not make the NIC work. 'ping google.com' gives me this error message: "ping: cannot resolve google.com: Unknown host". Telnet didn't work either. It said there was no route to host. I tried both 'telnet google.com' and 'telnet 64.53.251.42'. I thought the problem might be with DHCP so I tried renewing the lease this way 'sudo ipconfig set en0 DHCP'. It said ipconfig server not active.
On 04/01/16 21:08, Programmingkid wrote:
Correct. For my last test I did this:
qemu-system-ppc -hda darwin_x.qcow2 -cdrom darwinppc-801.iso -boot d -bios openbios-qemu.elf.nostrip -net nic,model=rtl8139 -net user -boot d -M mac99
The OpenBIOS binary is git master with the v2 patchset applied, while QEMU is git master. I ran all the way through the installer, rebooted, and the Realtek driver loaded on reboot with a valid en0 interface that could ping/ssh to external servers.
The RTL8139 does work with the Darwin iso file. Didn't even have to install Darwin, just typed 'shell' at the prompt and was able to do some tests.
The ioreg command does indicate the NIC is fully loaded. But I could not make the NIC work. 'ping google.com' gives me this error message: "ping: cannot resolve google.com: Unknown host". Telnet didn't work either. It said there was no route to host. I tried both 'telnet google.com' and 'telnet 64.53.251.42'. I thought the problem might be with DHCP so I tried renewing the lease this way 'sudo ipconfig set en0 DHCP'. It said ipconfig server not active.
Yeah, this is the bit I struggled with so in the end I ran through the whole install which was enough to verify that it worked here.
ATB,
Mark.