diff --git a/src/acpi.c b/src/acpi.c index 614deaa8c..fd38bae29 100644 --- a/src/acpi.c +++ b/src/acpi.c @@ -128,14 +128,14 @@ acpi_update_irq(acpi_t *dev) else if (dev->irq_mode == 2) pci_set_mirq(5, dev->mirq_is_level, &dev->irq_state); else - pci_set_mirq(PCI_DIRQ_BASE | dev->irq_line, 1, &dev->irq_state); + picintlevel(1 << dev->irq_line, &dev->irq_state); } else { if (dev->irq_mode == 1) pci_clear_irq(dev->slot, dev->irq_pin, &dev->irq_state); else if (dev->irq_mode == 2) pci_clear_mirq(5, dev->mirq_is_level, &dev->irq_state); else - pci_clear_mirq(PCI_DIRQ_BASE | dev->irq_line, 1, &dev->irq_state); + picintclevel(1 << dev->irq_line, &dev->irq_state); } acpi_timer_update(dev, (dev->regs.pmen & TMROF_EN) && !(dev->regs.pmsts & TMROF_STS)); diff --git a/src/config.c b/src/config.c index ea314997a..f0b48dc1a 100644 --- a/src/config.c +++ b/src/config.c @@ -1805,7 +1805,7 @@ load_other_removable_devices(void) if (p[0] != 0x00) { if (path_abs(p)) { if (strlen(p) > 511) - fatal("load_other_removable_devices(): strlen(p) > 511 (mo_drives[%i].image_path)\n", + fatal("load_other_removable_devices(): strlen(p) > 511 (mo_drives[%i].image_path)\n", c); else strncpy(mo_drives[c].image_path, p, 511); diff --git a/src/ini.c b/src/ini.c index 604c3d5eb..35c7504eb 100644 --- a/src/ini.c +++ b/src/ini.c @@ -348,7 +348,7 @@ ini_read(const char *fn) while (1) { memset(buff, 0x00, sizeof(buff)); #ifdef __HAIKU__ - ini_fgetws(buff, sizeof_w(buff), f); + ini_fgetws(buff, sizeof_w(buff), fp); #else (void) !fgetws(buff, sizeof_w(buff), fp); #endif diff --git a/src/pic.c b/src/pic.c index c01053268..490468410 100644 --- a/src/pic.c +++ b/src/pic.c @@ -630,6 +630,7 @@ picint_common(uint16_t num, int level, int set, uint8_t *irq_state) int raise; uint8_t b; uint8_t slaves = 0; + uint16_t lines = 0x0000; /* Make sure to ignore all slave IRQ's, and in case of AT+, translate IRQ 2 to IRQ 9. */ @@ -659,7 +660,7 @@ picint_common(uint16_t num, int level, int set, uint8_t *irq_state) if (num & 0x0100) acpi_rtc_status = !!set; - if (set) { + if (set) { if (smi_irq_mask & num) { smi_raise(); smi_irq_status |= num; @@ -709,8 +710,12 @@ picint_common(uint16_t num, int level, int set, uint8_t *irq_state) if (level) { for (uint8_t i = 0; i < 8; i++) { b = (uint8_t) (1 << i); - if (((num >> 8) & b) && ((!!*irq_state) != !!set)) - pic2.lines[i]--; + if ((num >> 8) & b) { + if ((!!*irq_state) != !!set) + pic2.lines[i]--; + if (!pic_level_triggered(&pic2, i) || (pic2.lines[i] == 0)) + lines |= ((uint16_t) b << 8); + } } if ((!!*irq_state) != !!set) @@ -721,15 +726,20 @@ picint_common(uint16_t num, int level, int set, uint8_t *irq_state) if ((num & 0x1000) && mouse_latch) latched_irqs &= 0xefff; - pic2.irr &= ~(num >> 8); + if (!level || lines) + pic2.irr &= ~(num >> 8); } if (num & 0x00ff) { if (level) { for (uint8_t i = 0; i < 8; i++) { b = (uint8_t) (1 << i); - if ((num & b) && ((!!*irq_state) != !!set)) - pic.lines[i]--; + if (num & b) { + if ((!!*irq_state) != !!set) + pic.lines[i]--; + if (!pic_level_triggered(&pic, i) || (pic.lines[i] == 0)) + lines |= ((uint16_t) b << 8); + } } if ((!!*irq_state) != !!set) @@ -740,7 +750,8 @@ picint_common(uint16_t num, int level, int set, uint8_t *irq_state) if (kbd_latch && (num & 0x0002)) latched_irqs &= 0xfffd; - pic.irr &= ~(num & 0x00ff); + if (!level || lines) + pic.irr &= ~(num & 0x00ff); } }