This patchset is loosely based on earlier work by BALATON Zoltan balaton@eik.bme.hu and provides basic infrastructure to allow OpenBIOS to enable PCI device bus mastering.
Following on from discussions on the QEMU mailing list, it seems that Apple's OF enables bus mastering for some PCI devices by default, and as a result some buggy drivers forget to explicitly enable it and hence these devices fail under QEMU's emulation.
The first 3 patches add the basic support routines while the last 2 patches enable bus mastering for the rtl8139 card on Apple PPC machines which is required for OS X and MorphOS.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
Mark Cave-Ayland (5): pci: introduce ob_pci_enable_bus_master() function pci: introduce ob_pci_is_bus_master_capable() function pci: add PCI database entry for rtl8139 network card pci: add rtl8139_config_cb() to configure rtl8139 network cards ppc: mark PCI slots 0-2 for Apple PPC machies as bus master capable
openbios-devel/arch/ppc/qemu/init.c | 9 ++++--- openbios-devel/drivers/pci.c | 44 +++++++++++++++++++++++++++++++++ openbios-devel/drivers/pci_database.c | 6 +++++ openbios-devel/drivers/pci_database.h | 4 +++ openbios-devel/include/drivers/pci.h | 2 ++ 5 files changed, 62 insertions(+), 3 deletions(-)
This will active the bus mastering bit for the device represented by the given PCI configuration.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/drivers/pci.c | 12 ++++++++++++ openbios-devel/drivers/pci_database.h | 2 ++ 2 files changed, 14 insertions(+)
diff --git a/openbios-devel/drivers/pci.c b/openbios-devel/drivers/pci.c index 935ecb8..9405e28 100644 --- a/openbios-devel/drivers/pci.c +++ b/openbios-devel/drivers/pci.c @@ -887,6 +887,18 @@ int usb_ohci_config_cb(const pci_config_t *config) return 0; }
+void ob_pci_enable_bus_master(const pci_config_t *config) +{ + /* Enable bus mastering for the PCI device */ + uint16_t cmd; + pci_addr addr = PCI_ADDR( + PCI_BUS(config->dev), PCI_DEV(config->dev), PCI_FN(config->dev)); + + cmd = pci_config_read16(addr, PCI_COMMAND); + cmd |= PCI_COMMAND_BUS_MASTER; + pci_config_write16(addr, PCI_COMMAND, cmd); +} + static void ob_pci_add_properties(phandle_t phandle, pci_addr addr, const pci_dev_t *pci_dev, const pci_config_t *config, int num_bars) diff --git a/openbios-devel/drivers/pci_database.h b/openbios-devel/drivers/pci_database.h index 7f053d8..9e8dc05 100644 --- a/openbios-devel/drivers/pci_database.h +++ b/openbios-devel/drivers/pci_database.h @@ -55,3 +55,5 @@ static inline int pci_compat_len(const pci_dev_t *dev) extern const pci_dev_t *pci_find_device(uint8_t class, uint8_t subclass, uint8_t iface, uint16_t vendor, uint16_t product); + +extern void ob_pci_enable_bus_master(const pci_config_t *config);
This function indicates whether the device represented by the given PCI configuration is capable of becoming a bus master. Currently this information is encoded in the PCI bus pci_arch_t structure as an array of bitmaps similar to the Open Firmware bus-master-capable property with one entry per PCI bus.
Currently we use a default maximum of 2 PCI buses, however this can always be extended at a later date if required.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/drivers/pci.c | 17 +++++++++++++++++ openbios-devel/drivers/pci_database.h | 1 + openbios-devel/include/drivers/pci.h | 1 + 3 files changed, 19 insertions(+)
diff --git a/openbios-devel/drivers/pci.c b/openbios-devel/drivers/pci.c index 9405e28..0108a0d 100644 --- a/openbios-devel/drivers/pci.c +++ b/openbios-devel/drivers/pci.c @@ -899,6 +899,23 @@ void ob_pci_enable_bus_master(const pci_config_t *config) pci_config_write16(addr, PCI_COMMAND, cmd); }
+int ob_pci_is_bus_master_capable(const pci_config_t *config) +{ + /* Return true if this device is bus-master capable, false otherwise */ + uint32_t bus = PCI_BUS(config->dev); + uint32_t dev = PCI_DEV(config->dev); + + if (bus >= sizeof(arch->bus_master_capable)) { + return 0; + } + + if (arch->bus_master_capable[bus] & (1U << dev)) { + return -1; + } + + return 0; +} + static void ob_pci_add_properties(phandle_t phandle, pci_addr addr, const pci_dev_t *pci_dev, const pci_config_t *config, int num_bars) diff --git a/openbios-devel/drivers/pci_database.h b/openbios-devel/drivers/pci_database.h index 9e8dc05..92234fc 100644 --- a/openbios-devel/drivers/pci_database.h +++ b/openbios-devel/drivers/pci_database.h @@ -57,3 +57,4 @@ extern const pci_dev_t *pci_find_device(uint8_t class, uint8_t subclass, uint16_t product);
extern void ob_pci_enable_bus_master(const pci_config_t *config); +extern int ob_pci_is_bus_master_capable(const pci_config_t *config); diff --git a/openbios-devel/include/drivers/pci.h b/openbios-devel/include/drivers/pci.h index 2eb5685..bee9183 100644 --- a/openbios-devel/include/drivers/pci.h +++ b/openbios-devel/include/drivers/pci.h @@ -21,6 +21,7 @@ struct pci_arch_t { unsigned long rbase; unsigned long rlen; uint8_t irqs[4]; + uint32_t bus_master_capable[2]; /* Default to 2 PCI buses */ };
extern const pci_arch_t *arch;
Hi,
Le 30/12/2015 17:44, Mark Cave-Ayland a écrit :
This function indicates whether the device represented by the given PCI configuration is capable of becoming a bus master. Currently this information is encoded in the PCI bus pci_arch_t structure as an array of bitmaps similar to the Open Firmware bus-master-capable property with one entry per PCI bus.
Currently we use a default maximum of 2 PCI buses, however this can always be extended at a later date if required.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
openbios-devel/drivers/pci.c | 17 +++++++++++++++++ openbios-devel/drivers/pci_database.h | 1 + openbios-devel/include/drivers/pci.h | 1 + 3 files changed, 19 insertions(+)
diff --git a/openbios-devel/drivers/pci.c b/openbios-devel/drivers/pci.c index 9405e28..0108a0d 100644 --- a/openbios-devel/drivers/pci.c +++ b/openbios-devel/drivers/pci.c @@ -899,6 +899,23 @@ void ob_pci_enable_bus_master(const pci_config_t *config) pci_config_write16(addr, PCI_COMMAND, cmd); }
+int ob_pci_is_bus_master_capable(const pci_config_t *config) +{
- /* Return true if this device is bus-master capable, false otherwise */
- uint32_t bus = PCI_BUS(config->dev);
- uint32_t dev = PCI_DEV(config->dev);
- if (bus >= sizeof(arch->bus_master_capable)) {
return 0;
- }
Here, you probably want sizeof(arch->bus_master_capable)/sizeof(arch->bus_master_capable[0]), or some macro which does the same thing.
- if (arch->bus_master_capable[bus] & (1U << dev)) {
return -1;
- }
- return 0;
+}
- static void ob_pci_add_properties(phandle_t phandle, pci_addr addr, const pci_dev_t *pci_dev, const pci_config_t *config, int num_bars)
diff --git a/openbios-devel/drivers/pci_database.h b/openbios-devel/drivers/pci_database.h index 9e8dc05..92234fc 100644 --- a/openbios-devel/drivers/pci_database.h +++ b/openbios-devel/drivers/pci_database.h @@ -57,3 +57,4 @@ extern const pci_dev_t *pci_find_device(uint8_t class, uint8_t subclass, uint16_t product);
extern void ob_pci_enable_bus_master(const pci_config_t *config); +extern int ob_pci_is_bus_master_capable(const pci_config_t *config); diff --git a/openbios-devel/include/drivers/pci.h b/openbios-devel/include/drivers/pci.h index 2eb5685..bee9183 100644 --- a/openbios-devel/include/drivers/pci.h +++ b/openbios-devel/include/drivers/pci.h @@ -21,6 +21,7 @@ struct pci_arch_t { unsigned long rbase; unsigned long rlen; uint8_t irqs[4];
uint32_t bus_master_capable[2]; /* Default to 2 PCI buses */ };
extern const pci_arch_t *arch;
On 30/12/15 16:51, Hervé Poussineau wrote:
Hi,
Le 30/12/2015 17:44, Mark Cave-Ayland a écrit :
This function indicates whether the device represented by the given PCI configuration is capable of becoming a bus master. Currently this information is encoded in the PCI bus pci_arch_t structure as an array of bitmaps similar to the Open Firmware bus-master-capable property with one entry per PCI bus.
Currently we use a default maximum of 2 PCI buses, however this can always be extended at a later date if required.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
openbios-devel/drivers/pci.c | 17 +++++++++++++++++ openbios-devel/drivers/pci_database.h | 1 + openbios-devel/include/drivers/pci.h | 1 + 3 files changed, 19 insertions(+)
diff --git a/openbios-devel/drivers/pci.c b/openbios-devel/drivers/pci.c index 9405e28..0108a0d 100644 --- a/openbios-devel/drivers/pci.c +++ b/openbios-devel/drivers/pci.c @@ -899,6 +899,23 @@ void ob_pci_enable_bus_master(const pci_config_t *config) pci_config_write16(addr, PCI_COMMAND, cmd); }
+int ob_pci_is_bus_master_capable(const pci_config_t *config) +{
- /* Return true if this device is bus-master capable, false
otherwise */
- uint32_t bus = PCI_BUS(config->dev);
- uint32_t dev = PCI_DEV(config->dev);
- if (bus >= sizeof(arch->bus_master_capable)) {
return 0;
- }
Here, you probably want sizeof(arch->bus_master_capable)/sizeof(arch->bus_master_capable[0]), or some macro which does the same thing.
Indeed, yes - I've fixed this up in my local copy for now but will repost the series if anyone else has any further comments. Thanks for the review!
ATB,
Mark.
This is taken from a patch submitted earlier by BALATON Zoltan balaton@eik.bme.hu.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/drivers/pci_database.c | 6 ++++++ openbios-devel/include/drivers/pci.h | 1 + 2 files changed, 7 insertions(+)
diff --git a/openbios-devel/drivers/pci_database.c b/openbios-devel/drivers/pci_database.c index 0070a78..9104c0b 100644 --- a/openbios-devel/drivers/pci_database.c +++ b/openbios-devel/drivers/pci_database.c @@ -129,6 +129,12 @@ static const pci_dev_t eth_devices[] = { NULL, "ethernet", }, { + PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_RTL8139, + NULL, "RTL8139", "RTL8139 PCI", NULL, + 0, 0, 0, + NULL, "ethernet", + }, + { /* Virtio-network controller */ PCI_VENDOR_ID_REDHAT_QUMRANET, PCI_DEVICE_ID_VIRTIO_NET, NULL, "virtio-net", NULL, diff --git a/openbios-devel/include/drivers/pci.h b/openbios-devel/include/drivers/pci.h index bee9183..d4d8757 100644 --- a/openbios-devel/include/drivers/pci.h +++ b/openbios-devel/include/drivers/pci.h @@ -203,6 +203,7 @@ extern const pci_arch_t *arch;
#define PCI_VENDOR_ID_REALTEK 0x10ec #define PCI_DEVICE_ID_REALTEK_RTL8029 0x8029 +#define PCI_DEVICE_ID_REALTEK_RTL8139 0x8139
#define PCI_VENDOR_ID_QEMU 0x1234 #define PCI_DEVICE_ID_QEMU_VGA 0x1111
If the device is marked as bus master capable (currently disabled) and we are running on an Apple PPC platform, enable bus mastering for this card. This is currently tied to this particular card although it is likely that in future this check could be loosened to other bus master capable cards on Apple PPC.
This is because it seems that Apple's OF implementation enables bus mastering on some cards by default and so some drivers forget to explicitly enable bus mastering, even though the driver requires it. The rtl8139 driver is one such buggy driver and this has been reported as necessary for both OS X and MorphOS.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/drivers/pci.c | 15 +++++++++++++++ openbios-devel/drivers/pci_database.c | 2 +- openbios-devel/drivers/pci_database.h | 1 + 3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/openbios-devel/drivers/pci.c b/openbios-devel/drivers/pci.c index 0108a0d..04cc230 100644 --- a/openbios-devel/drivers/pci.c +++ b/openbios-devel/drivers/pci.c @@ -550,6 +550,21 @@ int eth_config_cb (const pci_config_t *config) return 0; }
+int rtl8139_config_cb(const pci_config_t *config) +{ +#ifdef CONFIG_PPC + /* Apple's OF seemingly enables bus mastering on some cards by + * default, which means that some buggy drivers forget to + * explicitly set it (OS X, MorphOS). Mimic this behaviour so + * that these buggy drivers work under emulation. */ + if (is_apple() && ob_pci_is_bus_master_capable(config)) { + ob_pci_enable_bus_master(config); + } +#endif + + return eth_config_cb(config); +} + static inline void pci_decode_pci_addr(pci_addr addr, int *flags, int *space_code, uint32_t *mask) { diff --git a/openbios-devel/drivers/pci_database.c b/openbios-devel/drivers/pci_database.c index 9104c0b..67767c8 100644 --- a/openbios-devel/drivers/pci_database.c +++ b/openbios-devel/drivers/pci_database.c @@ -132,7 +132,7 @@ static const pci_dev_t eth_devices[] = { PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_RTL8139, NULL, "RTL8139", "RTL8139 PCI", NULL, 0, 0, 0, - NULL, "ethernet", + rtl8139_config_cb, "ethernet", }, { /* Virtio-network controller */ diff --git a/openbios-devel/drivers/pci_database.h b/openbios-devel/drivers/pci_database.h index 92234fc..e96b3b1 100644 --- a/openbios-devel/drivers/pci_database.h +++ b/openbios-devel/drivers/pci_database.h @@ -39,6 +39,7 @@ extern int bridge_config_cb(const pci_config_t *config); extern int ebus_config_cb(const pci_config_t *config); extern int i82378_config_cb(const pci_config_t *config); extern int usb_ohci_config_cb(const pci_config_t *config); +extern int rtl8139_config_cb(const pci_config_t *config);
static inline int pci_compat_len(const pci_dev_t *dev) {
With the previous commit, assuming an rtl8139 network card is placed in PCI slots 0-2 on an Apple PPC machine then this will cause rtl8139_config_cb() to enable bus mastering on this particular network card.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/arch/ppc/qemu/init.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/openbios-devel/arch/ppc/qemu/init.c b/openbios-devel/arch/ppc/qemu/init.c index 2b5b8e1..a8fe63b 100644 --- a/openbios-devel/arch/ppc/qemu/init.c +++ b/openbios-devel/arch/ppc/qemu/init.c @@ -124,7 +124,8 @@ static const pci_arch_t known_arch[] = { .io_len = 0x00800000, .rbase = 0x00000000, .rlen = 0x01000000, - .irqs = { 0x1b, 0x1c, 0x1d, 0x1e } + .irqs = { 0x1b, 0x1c, 0x1d, 0x1e }, + .bus_master_capable = { 0x7 } }, [ARCH_MAC99_U3] = { .name = "MAC99_U3", @@ -141,7 +142,8 @@ static const pci_arch_t known_arch[] = { .io_len = 0x00800000, .rbase = 0x00000000, .rlen = 0x01000000, - .irqs = { 0x1b, 0x1c, 0x1d, 0x1e } + .irqs = { 0x1b, 0x1c, 0x1d, 0x1e }, + .bus_master_capable = { 0x7 } }, [ARCH_HEATHROW] = { .name = "HEATHROW", @@ -158,7 +160,8 @@ static const pci_arch_t known_arch[] = { .io_len = 0x00800000, .rbase = 0xfd000000, .rlen = 0x01000000, - .irqs = { 21, 22, 23, 24 } + .irqs = { 21, 22, 23, 24 }, + .bus_master_capable = { 0x7 } }, }; unsigned long isa_io_base;
On 30/12/15 16:44, Mark Cave-Ayland wrote:
This patchset is loosely based on earlier work by BALATON Zoltan balaton@eik.bme.hu and provides basic infrastructure to allow OpenBIOS to enable PCI device bus mastering.
Following on from discussions on the QEMU mailing list, it seems that Apple's OF enables bus mastering for some PCI devices by default, and as a result some buggy drivers forget to explicitly enable it and hence these devices fail under QEMU's emulation.
The first 3 patches add the basic support routines while the last 2 patches enable bus mastering for the rtl8139 card on Apple PPC machines which is required for OS X and MorphOS.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
Mark Cave-Ayland (5): pci: introduce ob_pci_enable_bus_master() function pci: introduce ob_pci_is_bus_master_capable() function pci: add PCI database entry for rtl8139 network card pci: add rtl8139_config_cb() to configure rtl8139 network cards ppc: mark PCI slots 0-2 for Apple PPC machies as bus master capable
openbios-devel/arch/ppc/qemu/init.c | 9 ++++--- openbios-devel/drivers/pci.c | 44 +++++++++++++++++++++++++++++++++ openbios-devel/drivers/pci_database.c | 6 +++++ openbios-devel/drivers/pci_database.h | 4 +++ openbios-devel/include/drivers/pci.h | 2 ++ 5 files changed, 62 insertions(+), 3 deletions(-)
Actually it seems that this patch is completely bogus for Darwin/OS X - it's really a bug in the way that Darwin parses the /pci "ranges" property causing it to map the PCI address spaces incorrectly.
Hence this patchset should be ignored and I will post a follow-up patchset containing the fix and some other PCI address fixups for Apple machines shortly.
ATB,
Mark.
On 30/12/15 16:44, Mark Cave-Ayland wrote:
This patchset is loosely based on earlier work by BALATON Zoltan balaton@eik.bme.hu and provides basic infrastructure to allow OpenBIOS to enable PCI device bus mastering.
Following on from discussions on the QEMU mailing list, it seems that Apple's OF enables bus mastering for some PCI devices by default, and as a result some buggy drivers forget to explicitly enable it and hence these devices fail under QEMU's emulation.
The first 3 patches add the basic support routines while the last 2 patches enable bus mastering for the rtl8139 card on Apple PPC machines which is required for OS X and MorphOS.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
Mark Cave-Ayland (5): pci: introduce ob_pci_enable_bus_master() function pci: introduce ob_pci_is_bus_master_capable() function pci: add PCI database entry for rtl8139 network card pci: add rtl8139_config_cb() to configure rtl8139 network cards ppc: mark PCI slots 0-2 for Apple PPC machies as bus master capable
openbios-devel/arch/ppc/qemu/init.c | 9 ++++--- openbios-devel/drivers/pci.c | 44 +++++++++++++++++++++++++++++++++ openbios-devel/drivers/pci_database.c | 6 +++++ openbios-devel/drivers/pci_database.h | 4 +++ openbios-devel/include/drivers/pci.h | 2 ++ 5 files changed, 62 insertions(+), 3 deletions(-)
Following up from this, I found out today that the reason OS 9 rtl8139 drivers don't work in QEMU is due to the same issue, i.e. by default Apple OF appears to enable bus mastering upon boot (OpenBIOS currently doesn't) and so many driver authors forget to explicitly enable this.
So taking this patch and making a few minor tweaks I was able to get the rtl8139 working in OS 9.2 and surf the web in Classilla :) I'm not sure whether it solves similar issues people were having in 10.4.11 but I'd invite people to test and report back.
I'm also of the mind that for OpenBIOS I think this patch is a bit of overkill - if BM is to be enabled, then it would be configured by the on-board FCode ROM regardless of bus/slot id so I'm going to remove this part of the patch for the respin.
ATB,
Mark.
On 05 Aug 2016, at 17:59, Mark Cave-Ayland mark.cave-ayland@ilande.co.uk wrote:
On 30/12/15 16:44, Mark Cave-Ayland wrote:
This patchset is loosely based on earlier work by BALATON Zoltan balaton@eik.bme.hu and provides basic infrastructure to allow OpenBIOS to enable PCI device bus mastering.
Following on from discussions on the QEMU mailing list, it seems that Apple's OF enables bus mastering for some PCI devices by default, and as a result some buggy drivers forget to explicitly enable it and hence these devices fail under QEMU's emulation.
The first 3 patches add the basic support routines while the last 2 patches enable bus mastering for the rtl8139 card on Apple PPC machines which is required for OS X and MorphOS.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
Mark Cave-Ayland (5): pci: introduce ob_pci_enable_bus_master() function pci: introduce ob_pci_is_bus_master_capable() function pci: add PCI database entry for rtl8139 network card pci: add rtl8139_config_cb() to configure rtl8139 network cards ppc: mark PCI slots 0-2 for Apple PPC machies as bus master capable
openbios-devel/arch/ppc/qemu/init.c | 9 ++++--- openbios-devel/drivers/pci.c | 44 +++++++++++++++++++++++++++++++++ openbios-devel/drivers/pci_database.c | 6 +++++ openbios-devel/drivers/pci_database.h | 4 +++ openbios-devel/include/drivers/pci.h | 2 ++ 5 files changed, 62 insertions(+), 3 deletions(-)
Following up from this, I found out today that the reason OS 9 rtl8139 drivers don't work in QEMU is due to the same issue, i.e. by default Apple OF appears to enable bus mastering upon boot (OpenBIOS currently doesn't) and so many driver authors forget to explicitly enable this.
So taking this patch and making a few minor tweaks I was able to get the rtl8139 working in OS 9.2 and surf the web in Classilla :) I'm not sure whether it solves similar issues people were having in 10.4.11 but I'd invite people to test and report back.
I'm also of the mind that for OpenBIOS I think this patch is a bit of overkill - if BM is to be enabled, then it would be configured by the on-board FCode ROM regardless of bus/slot id so I'm going to remove this part of the patch for the respin.
ATB,
Mark.
Hi, testing with the resulting OpenBIOS from these patches revealed that 9.0, 9.1, 9.2, 10.0 and 10.1 now all support networking with the realtek driver. 10.0 and 10.1 boot rather slow. 10.2, 10.4 and 10.5 do not boot anymore, neither from cd/dvd nor hard disk image. Strangely enough a 10.3 hd still works. 10.5 now reports “EXIT” at the openbios prompt. The others just display Trying hd:,\;tbxi smb://;tbxi
Best, Howard
On 05/08/16 21:11, Howard Spoelstra wrote:
On 05 Aug 2016, at 17:59, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk mailto:mark.cave-ayland@ilande.co.uk> wrote:
On 30/12/15 16:44, Mark Cave-Ayland wrote:
This patchset is loosely based on earlier work by BALATON Zoltan <balaton@eik.bme.hu mailto:balaton@eik.bme.hu> and provides basic infrastructure to allow OpenBIOS to enable PCI device bus mastering.
Following on from discussions on the QEMU mailing list, it seems that Apple's OF enables bus mastering for some PCI devices by default, and as a result some buggy drivers forget to explicitly enable it and hence these devices fail under QEMU's emulation.
The first 3 patches add the basic support routines while the last 2 patches enable bus mastering for the rtl8139 card on Apple PPC machines which is required for OS X and MorphOS.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk mailto:mark.cave-ayland@ilande.co.uk>
Mark Cave-Ayland (5): pci: introduce ob_pci_enable_bus_master() function pci: introduce ob_pci_is_bus_master_capable() function pci: add PCI database entry for rtl8139 network card pci: add rtl8139_config_cb() to configure rtl8139 network cards ppc: mark PCI slots 0-2 for Apple PPC machies as bus master capable
openbios-devel/arch/ppc/qemu/init.c | 9 ++++--- openbios-devel/drivers/pci.c | 44 +++++++++++++++++++++++++++++++++ openbios-devel/drivers/pci_database.c | 6 +++++ openbios-devel/drivers/pci_database.h | 4 +++ openbios-devel/include/drivers/pci.h | 2 ++ 5 files changed, 62 insertions(+), 3 deletions(-)
Following up from this, I found out today that the reason OS 9 rtl8139 drivers don't work in QEMU is due to the same issue, i.e. by default Apple OF appears to enable bus mastering upon boot (OpenBIOS currently doesn't) and so many driver authors forget to explicitly enable this.
So taking this patch and making a few minor tweaks I was able to get the rtl8139 working in OS 9.2 and surf the web in Classilla :) I'm not sure whether it solves similar issues people were having in 10.4.11 but I'd invite people to test and report back.
I'm also of the mind that for OpenBIOS I think this patch is a bit of overkill - if BM is to be enabled, then it would be configured by the on-board FCode ROM regardless of bus/slot id so I'm going to remove this part of the patch for the respin.
ATB,
Mark.
Hi, testing with the resulting OpenBIOS from these patches revealed that 9.0, 9.1, 9.2, 10.0 and 10.1 now all support networking with the realtek driver. 10.0 and 10.1 boot rather slow. 10.2, 10.4 and 10.5 do not boot anymore, neither from cd/dvd nor hard disk image. Strangely enough a 10.3 hd still works. 10.5 now reports “EXIT” at the openbios prompt. The others just display Trying hd:,\;tbxi smb://;tbxi
Hi Howard,
Thanks for testing! The patches are based on top of my next branch, and I don't see any problems booting 10.2 from CD to the installer?
I've pushed my branch to https://github.com/mcayland/openbios/commits/ppc-busmaster for comparision - does that match what you see? I'm also using QEMU git master rather than the ppc-for-2.8 branch if you could also check that?
Many thanks,
Mark.
I built OpenBIOS on top of the patches from Ben and qemu-for-28 with Ben's patch. I'll check using the more conservative line...
Best, Howard
On Fri, Aug 5, 2016 at 10:32 PM, Mark Cave-Ayland < mark.cave-ayland@ilande.co.uk> wrote:
On 05/08/16 21:11, Howard Spoelstra wrote:
On 05 Aug 2016, at 17:59, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk mailto:mark.cave-ayland@ilande.co.uk> wrote:
On 30/12/15 16:44, Mark Cave-Ayland wrote:
This patchset is loosely based on earlier work by BALATON Zoltan <balaton@eik.bme.hu mailto:balaton@eik.bme.hu> and provides basic infrastructure to allow OpenBIOS to enable PCI
device
bus mastering.
Following on from discussions on the QEMU mailing list, it seems that Apple's OF enables bus mastering for some PCI devices by default, and as a result some buggy drivers forget to explicitly enable it and hence these devices fail under QEMU's emulation.
The first 3 patches add the basic support routines while the last 2 patches enable bus mastering for the rtl8139 card on Apple PPC machines which is required for OS X and MorphOS.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk mailto:mark.cave-ayland@ilande.co.uk>
Mark Cave-Ayland (5): pci: introduce ob_pci_enable_bus_master() function pci: introduce ob_pci_is_bus_master_capable() function pci: add PCI database entry for rtl8139 network card pci: add rtl8139_config_cb() to configure rtl8139 network cards ppc: mark PCI slots 0-2 for Apple PPC machies as bus master capable
openbios-devel/arch/ppc/qemu/init.c | 9 ++++--- openbios-devel/drivers/pci.c | 44 +++++++++++++++++++++++++++++++++ openbios-devel/drivers/pci_database.c | 6 +++++ openbios-devel/drivers/pci_database.h | 4 +++ openbios-devel/include/drivers/pci.h | 2 ++ 5 files changed, 62 insertions(+), 3 deletions(-)
Following up from this, I found out today that the reason OS 9 rtl8139 drivers don't work in QEMU is due to the same issue, i.e. by default Apple OF appears to enable bus mastering upon boot (OpenBIOS currently doesn't) and so many driver authors forget to explicitly enable this.
So taking this patch and making a few minor tweaks I was able to get the rtl8139 working in OS 9.2 and surf the web in Classilla :) I'm not sure whether it solves similar issues people were having in 10.4.11 but I'd invite people to test and report back.
I'm also of the mind that for OpenBIOS I think this patch is a bit of overkill - if BM is to be enabled, then it would be configured by the on-board FCode ROM regardless of bus/slot id so I'm going to remove this part of the patch for the respin.
ATB,
Mark.
Hi, testing with the resulting OpenBIOS from these patches revealed that 9.0, 9.1, 9.2, 10.0 and 10.1 now all support networking with the realtek driver. 10.0 and 10.1 boot rather slow. 10.2, 10.4 and 10.5 do not boot anymore, neither from cd/dvd nor hard disk image. Strangely enough a 10.3 hd still works. 10.5 now reports “EXIT” at the openbios prompt. The others just display Trying hd:,\;tbxi smb://;tbxi
Hi Howard,
Thanks for testing! The patches are based on top of my next branch, and I don't see any problems booting 10.2 from CD to the installer?
I've pushed my branch to https://github.com/mcayland/openbios/commits/ppc-busmaster for comparision - does that match what you see? I'm also using QEMU git master rather than the ppc-for-2.8 branch if you could also check that?
Many thanks,
Mark.
On 05 Aug 2016, at 22:32, Mark Cave-Ayland mark.cave-ayland@ilande.co.uk wrote:
On 05/08/16 21:11, Howard Spoelstra wrote:
On 05 Aug 2016, at 17:59, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk mailto:mark.cave-ayland@ilande.co.uk> wrote:
On 30/12/15 16:44, Mark Cave-Ayland wrote:
This patchset is loosely based on earlier work by BALATON Zoltan <balaton@eik.bme.hu mailto:balaton@eik.bme.hu> and provides basic infrastructure to allow OpenBIOS to enable PCI device bus mastering.
Following on from discussions on the QEMU mailing list, it seems that Apple's OF enables bus mastering for some PCI devices by default, and as a result some buggy drivers forget to explicitly enable it and hence these devices fail under QEMU's emulation.
The first 3 patches add the basic support routines while the last 2 patches enable bus mastering for the rtl8139 card on Apple PPC machines which is required for OS X and MorphOS.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk mailto:mark.cave-ayland@ilande.co.uk>
Mark Cave-Ayland (5): pci: introduce ob_pci_enable_bus_master() function pci: introduce ob_pci_is_bus_master_capable() function pci: add PCI database entry for rtl8139 network card pci: add rtl8139_config_cb() to configure rtl8139 network cards ppc: mark PCI slots 0-2 for Apple PPC machies as bus master capable
openbios-devel/arch/ppc/qemu/init.c | 9 ++++--- openbios-devel/drivers/pci.c | 44 +++++++++++++++++++++++++++++++++ openbios-devel/drivers/pci_database.c | 6 +++++ openbios-devel/drivers/pci_database.h | 4 +++ openbios-devel/include/drivers/pci.h | 2 ++ 5 files changed, 62 insertions(+), 3 deletions(-)
Following up from this, I found out today that the reason OS 9 rtl8139 drivers don't work in QEMU is due to the same issue, i.e. by default Apple OF appears to enable bus mastering upon boot (OpenBIOS currently doesn't) and so many driver authors forget to explicitly enable this.
So taking this patch and making a few minor tweaks I was able to get the rtl8139 working in OS 9.2 and surf the web in Classilla :) I'm not sure whether it solves similar issues people were having in 10.4.11 but I'd invite people to test and report back.
I'm also of the mind that for OpenBIOS I think this patch is a bit of overkill - if BM is to be enabled, then it would be configured by the on-board FCode ROM regardless of bus/slot id so I'm going to remove this part of the patch for the respin.
ATB,
Mark.
Hi, testing with the resulting OpenBIOS from these patches revealed that 9.0, 9.1, 9.2, 10.0 and 10.1 now all support networking with the realtek driver. 10.0 and 10.1 boot rather slow. 10.2, 10.4 and 10.5 do not boot anymore, neither from cd/dvd nor hard disk image. Strangely enough a 10.3 hd still works. 10.5 now reports “EXIT” at the openbios prompt. The others just display Trying hd:,\;tbxi smb://;tbxi
Hi Howard,
Thanks for testing! The patches are based on top of my next branch, and I don't see any problems booting 10.2 from CD to the installer?
I've pushed my branch to https://github.com/mcayland/openbios/commits/ppc-busmaster for comparision - does that match what you see? I'm also using QEMU git master rather than the ppc-for-2.8 branch if you could also check that?
Many thanks,
Mark.
I repeated all tests with Qemu master and your busmaster OpenBIOS. All previously tested CD/HDs do boot. Networking is functional for 9.0 through 10.4.11(!), with the exception of 10.2, which needs the realtek driver. 10.2 gets an IP address from slirp, but has no internet connection.
Best, Howard
Are you able to post your compiled openbios? I am currently unable to compile it for ppc on my osx workstation. Thanks!
On Aug 5, 2016 3:11 PM, "Howard Spoelstra" hsp.cat7@gmail.com wrote:
On 05 Aug 2016, at 22:32, Mark Cave-Ayland <
mark.cave-ayland@ilande.co.uk> wrote:
On 05/08/16 21:11, Howard Spoelstra wrote:
On 05 Aug 2016, at 17:59, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk mailto:mark.cave-ayland@ilande.co.uk> wrote:
On 30/12/15 16:44, Mark Cave-Ayland wrote:
This patchset is loosely based on earlier work by BALATON Zoltan <balaton@eik.bme.hu mailto:balaton@eik.bme.hu> and provides basic infrastructure to allow OpenBIOS to enable PCI
device
bus mastering.
Following on from discussions on the QEMU mailing list, it seems that Apple's OF enables bus mastering for some PCI devices by default, and as a result some buggy drivers forget to explicitly enable it and hence these devices fail under QEMU's emulation.
The first 3 patches add the basic support routines while the last 2 patches enable bus mastering for the rtl8139 card on Apple PPC machines which is required for OS X and MorphOS.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk mailto:mark.cave-ayland@ilande.co.uk>
Mark Cave-Ayland (5): pci: introduce ob_pci_enable_bus_master() function pci: introduce ob_pci_is_bus_master_capable() function pci: add PCI database entry for rtl8139 network card pci: add rtl8139_config_cb() to configure rtl8139 network cards ppc: mark PCI slots 0-2 for Apple PPC machies as bus master capable
openbios-devel/arch/ppc/qemu/init.c | 9 ++++--- openbios-devel/drivers/pci.c | 44 +++++++++++++++++++++++++++++++++ openbios-devel/drivers/pci_database.c | 6 +++++ openbios-devel/drivers/pci_database.h | 4 +++ openbios-devel/include/drivers/pci.h | 2 ++ 5 files changed, 62 insertions(+), 3 deletions(-)
Following up from this, I found out today that the reason OS 9 rtl8139 drivers don't work in QEMU is due to the same issue, i.e. by default Apple OF appears to enable bus mastering upon boot (OpenBIOS currently doesn't) and so many driver authors forget to explicitly enable this.
So taking this patch and making a few minor tweaks I was able to get
the
rtl8139 working in OS 9.2 and surf the web in Classilla :) I'm not
sure
whether it solves similar issues people were having in 10.4.11 but I'd invite people to test and report back.
I'm also of the mind that for OpenBIOS I think this patch is a bit of overkill - if BM is to be enabled, then it would be configured by the on-board FCode ROM regardless of bus/slot id so I'm going to remove
this
part of the patch for the respin.
ATB,
Mark.
Hi, testing with the resulting OpenBIOS from these patches revealed that 9.0, 9.1, 9.2, 10.0 and 10.1 now all support networking with the realtek driver. 10.0 and 10.1 boot rather slow. 10.2, 10.4 and 10.5 do not boot anymore, neither from cd/dvd nor hard disk image. Strangely enough a 10.3 hd still works. 10.5 now reports “EXIT” at the openbios prompt. The others just display Trying hd:,\;tbxi smb://;tbxi
Hi Howard,
Thanks for testing! The patches are based on top of my next branch, and I don't see any problems booting 10.2 from CD to the installer?
I've pushed my branch to https://github.com/mcayland/openbios/commits/ppc-busmaster for comparision - does that match what you see? I'm also using QEMU git master rather than the ppc-for-2.8 branch if you could also check that?
Many thanks,
Mark.
I repeated all tests with Qemu master and your busmaster OpenBIOS. All previously tested CD/HDs do boot. Networking is functional for 9.0 through 10.4.11(!), with the exception of 10.2, which needs the realtek driver. 10.2 gets an IP address from slirp, but has no internet connection.
Best, Howard -- OpenBIOS http://openbios.org/ Mailinglist: http://lists.openbios.org/mailman/listinfo Free your System - May the Forth be with you
On 05/08/16 23:11, Howard Spoelstra wrote:
On 05 Aug 2016, at 22:32, Mark Cave-Ayland mark.cave-ayland@ilande.co.uk wrote:
On 05/08/16 21:11, Howard Spoelstra wrote:
On 05 Aug 2016, at 17:59, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk mailto:mark.cave-ayland@ilande.co.uk> wrote:
On 30/12/15 16:44, Mark Cave-Ayland wrote:
This patchset is loosely based on earlier work by BALATON Zoltan <balaton@eik.bme.hu mailto:balaton@eik.bme.hu> and provides basic infrastructure to allow OpenBIOS to enable PCI device bus mastering.
Following on from discussions on the QEMU mailing list, it seems that Apple's OF enables bus mastering for some PCI devices by default, and as a result some buggy drivers forget to explicitly enable it and hence these devices fail under QEMU's emulation.
The first 3 patches add the basic support routines while the last 2 patches enable bus mastering for the rtl8139 card on Apple PPC machines which is required for OS X and MorphOS.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk mailto:mark.cave-ayland@ilande.co.uk>
Mark Cave-Ayland (5): pci: introduce ob_pci_enable_bus_master() function pci: introduce ob_pci_is_bus_master_capable() function pci: add PCI database entry for rtl8139 network card pci: add rtl8139_config_cb() to configure rtl8139 network cards ppc: mark PCI slots 0-2 for Apple PPC machies as bus master capable
openbios-devel/arch/ppc/qemu/init.c | 9 ++++--- openbios-devel/drivers/pci.c | 44 +++++++++++++++++++++++++++++++++ openbios-devel/drivers/pci_database.c | 6 +++++ openbios-devel/drivers/pci_database.h | 4 +++ openbios-devel/include/drivers/pci.h | 2 ++ 5 files changed, 62 insertions(+), 3 deletions(-)
Following up from this, I found out today that the reason OS 9 rtl8139 drivers don't work in QEMU is due to the same issue, i.e. by default Apple OF appears to enable bus mastering upon boot (OpenBIOS currently doesn't) and so many driver authors forget to explicitly enable this.
So taking this patch and making a few minor tweaks I was able to get the rtl8139 working in OS 9.2 and surf the web in Classilla :) I'm not sure whether it solves similar issues people were having in 10.4.11 but I'd invite people to test and report back.
I'm also of the mind that for OpenBIOS I think this patch is a bit of overkill - if BM is to be enabled, then it would be configured by the on-board FCode ROM regardless of bus/slot id so I'm going to remove this part of the patch for the respin.
ATB,
Mark.
Hi, testing with the resulting OpenBIOS from these patches revealed that 9.0, 9.1, 9.2, 10.0 and 10.1 now all support networking with the realtek driver. 10.0 and 10.1 boot rather slow. 10.2, 10.4 and 10.5 do not boot anymore, neither from cd/dvd nor hard disk image. Strangely enough a 10.3 hd still works. 10.5 now reports “EXIT” at the openbios prompt. The others just display Trying hd:,\;tbxi smb://;tbxi
Hi Howard,
Thanks for testing! The patches are based on top of my next branch, and I don't see any problems booting 10.2 from CD to the installer?
I've pushed my branch to https://github.com/mcayland/openbios/commits/ppc-busmaster for comparision - does that match what you see? I'm also using QEMU git master rather than the ppc-for-2.8 branch if you could also check that?
Many thanks,
Mark.
I repeated all tests with Qemu master and your busmaster OpenBIOS. All previously tested CD/HDs do boot. Networking is functional for 9.0 through 10.4.11(!), with the exception of 10.2, which needs the realtek driver. 10.2 gets an IP address from slirp, but has no internet connection.
Great news, thanks for testing!
So is what you're saying that either the OpenBIOS patches to provide the VGA driver or one or more the patches queued in the dgibson's ppc-for-2.8 branch break this?
ATB,
Mark.
On Fri, 5 Aug 2016, Mark Cave-Ayland wrote:
On 30/12/15 16:44, Mark Cave-Ayland wrote:
This patchset is loosely based on earlier work by BALATON Zoltan balaton@eik.bme.hu and provides basic infrastructure to allow OpenBIOS to enable PCI device bus mastering.
Following on from discussions on the QEMU mailing list, it seems that Apple's OF enables bus mastering for some PCI devices by default, and as a result some buggy drivers forget to explicitly enable it and hence these devices fail under QEMU's emulation.
The first 3 patches add the basic support routines while the last 2 patches enable bus mastering for the rtl8139 card on Apple PPC machines which is required for OS X and MorphOS.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
Mark Cave-Ayland (5): pci: introduce ob_pci_enable_bus_master() function pci: introduce ob_pci_is_bus_master_capable() function pci: add PCI database entry for rtl8139 network card pci: add rtl8139_config_cb() to configure rtl8139 network cards ppc: mark PCI slots 0-2 for Apple PPC machies as bus master capable
openbios-devel/arch/ppc/qemu/init.c | 9 ++++--- openbios-devel/drivers/pci.c | 44 +++++++++++++++++++++++++++++++++ openbios-devel/drivers/pci_database.c | 6 +++++ openbios-devel/drivers/pci_database.h | 4 +++ openbios-devel/include/drivers/pci.h | 2 ++ 5 files changed, 62 insertions(+), 3 deletions(-)
Following up from this, I found out today that the reason OS 9 rtl8139 drivers don't work in QEMU is due to the same issue, i.e. by default Apple OF appears to enable bus mastering upon boot (OpenBIOS currently doesn't) and so many driver authors forget to explicitly enable this.
So taking this patch and making a few minor tweaks I was able to get the rtl8139 working in OS 9.2 and surf the web in Classilla :) I'm not sure whether it solves similar issues people were having in 10.4.11 but I'd invite people to test and report back.
I'm not sure if this is the correct fix but I've found it before this was needed to get RTL8139 working.
Recently I've seen changes in QEMU to calling realize functions for some devices that were not realized due to not being connected via a bridge and that mentioned that bus master is set on realize and this was needed to fix that (or something similar, not sure I got it completely and I've forgot it since; I think these were around commit 685f9a3 on QEMU). I've hoped this might also fix this issue but haven't tested that yet.
Also on real hardware there's a bridge chip which is currently disabled due to OpenBIOS not handling it correctly according to a comment in uninorth.c.
I'm not sure any of this is related to this issue, just mentioning it in case it rings a bell for someone.
Regards, BALATON Zoltan
On 05/08/16 21:44, BALATON Zoltan wrote:
Following up from this, I found out today that the reason OS 9 rtl8139 drivers don't work in QEMU is due to the same issue, i.e. by default Apple OF appears to enable bus mastering upon boot (OpenBIOS currently doesn't) and so many driver authors forget to explicitly enable this.
So taking this patch and making a few minor tweaks I was able to get the rtl8139 working in OS 9.2 and surf the web in Classilla :) I'm not sure whether it solves similar issues people were having in 10.4.11 but I'd invite people to test and report back.
I'm not sure if this is the correct fix but I've found it before this was needed to get RTL8139 working.
Recently I've seen changes in QEMU to calling realize functions for some devices that were not realized due to not being connected via a bridge and that mentioned that bus master is set on realize and this was needed to fix that (or something similar, not sure I got it completely and I've forgot it since; I think these were around commit 685f9a3 on QEMU). I've hoped this might also fix this issue but haven't tested that yet.
Also on real hardware there's a bridge chip which is currently disabled due to OpenBIOS not handling it correctly according to a comment in uninorth.c.
I'm not sure any of this is related to this issue, just mentioning it in case it rings a bell for someone.
AFAICT the bus mastering part is still needed since in QEMU the bus master memory region (which is aliased onto system memory) is disabled unless the bus master bit is set. It's fairly easy to spot this in the monitor with "info mtree".
My interpretation of this is that any PCI device in QEMU which wishes to read/write from system memory which isn't mapped via a BAR must also have the bus master bit set. I'm not a PCI expert so someone feel free to provide a more correct explanation :)
ATB,
Mark.