genode/repos/dde_bsd/patches/azalia_c.patch
Josef Söntgen 9d7a58f6a7 dde_bsd: update audio driver to OpenBSD 6.6
Besides updating to a newer version the update adds the AC97 ICH driver
and addresses shortcomings with the OpenBSD emulation environment:

* Fix 'delay(9)' implementation - it now properly uses 'us' as unit,
  which results on faster initialization of the drivers.

* Fix LOG output that got lost during commit f23579532 and bring over
  the printf implementation from dde_linux for more structured
  printing.

* As said the driver now recognizes the AUICH devices. So far it was
  only tested with the device model in VirtualBox where it produces
  stuttering audio, investigating the cause is still ongoing.

Fixes #3641.
2020-02-20 12:08:16 +01:00

56 lines
1.6 KiB
Diff

--- a/dev/pci/azalia.c
+++ b/dev/pci/azalia.c
@@ -492,7 +492,7 @@
azalia_t *sc;
struct pci_attach_args *pa;
pcireg_t v;
- uint8_t reg;
+ // uint8_t reg;
pci_intr_handle_t ih;
const char *interrupt_str;
@@ -518,12 +518,18 @@
azalia_configure_pci(sc);
- /* disable MSI, use INTx instead */
- if (PCI_VENDOR(sc->pciid) == PCI_VENDOR_INTEL) {
- reg = azalia_pci_read(sc->pc, sc->tag, ICH_PCI_MMC);
- reg &= ~(ICH_PCI_MMC_ME);
- azalia_pci_write(sc->pc, sc->tag, ICH_PCI_MMC, reg);
- }
+ // This was added in CVS rev 1.168 because certain devices do not
+ // support MSIs. For reasons that are not clear yet, this breaks
+ // when using the platform_drv on x86 with MSI support and IOMMU
+ // enabled. All hw we tested seems to work fine when it is removed,
+ // even older kernels, e.g. OKL4, that use legacy IRQs,
+ //
+ // /* disable MSI, use INTx instead */
+ // if (PCI_VENDOR(sc->pciid) == PCI_VENDOR_INTEL) {
+ // reg = azalia_pci_read(sc->pc, sc->tag, ICH_PCI_MMC);
+ // reg &= ~(ICH_PCI_MMC_ME);
+ // azalia_pci_write(sc->pc, sc->tag, ICH_PCI_MMC, reg);
+ // }
/* disable MSI for AMD Summit Ridge/Raven Ridge HD Audio */
if (PCI_VENDOR(sc->pciid) == PCI_VENDOR_AMD) {
@@ -3973,6 +3979,10 @@
azalia_set_blksz(void *v, int mode,
struct audio_params *p, struct audio_params *r, unsigned int blksz)
{
+ // XXX using mult leads to a blksz of 416 in case of a
+ // requested blksz of 441 which in return results in distored
+ // playback.
+#if 0
int mult;
/* must be multiple of 128 bytes */
@@ -3981,6 +3991,7 @@
blksz -= blksz % mult;
if (blksz == 0)
blksz = mult;
+#endif
return blksz;
}