aboutsummaryrefslogtreecommitdiff
path: root/hw/i8259.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2011-10-07 09:19:47 +0200
committerBlue Swirl <blauwirbel@gmail.com>2011-10-16 11:11:08 +0000
commit8d484caa84dbaca5597cfbbf657ebdcd8f06b0c3 (patch)
tree3485eb9b6a9c85b9fb36d8c4e75f68e00fe3b1f3 /hw/i8259.c
parentb76750c1ab50e23ef3ebc8cb6018dda41f174d84 (diff)
i8259: Fix poll command
This was probably never used so far: According to the spec, polling means ack'ing the pending IRQ and setting its corresponding bit in isr. Moreover, we have to signal a pending IRQ via bit 7 of the returned value, and we must not return a spurious IRQ if none is pending. This implements the poll command without the help of pic_poll_read which is left untouched as pic_intack_read is still using it. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw/i8259.c')
-rw-r--r--hw/i8259.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/hw/i8259.c b/hw/i8259.c
index bb257e642c..31962c0f93 100644
--- a/hw/i8259.c
+++ b/hw/i8259.c
@@ -393,7 +393,13 @@ static uint64_t pic_ioport_read(void *opaque, target_phys_addr_t addr1,
int ret;
if (s->poll) {
- ret = pic_poll_read(s);
+ ret = pic_get_irq(s);
+ if (ret >= 0) {
+ pic_intack(s, ret);
+ ret |= 0x80;
+ } else {
+ ret = 0;
+ }
s->poll = 0;
} else {
if (addr == 0) {