i8259_internal.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * QEMU 8259 - internal interfaces
  3. *
  4. * Copyright (c) 2011 Jan Kiszka, Siemens AG
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7. * of this software and associated documentation files (the "Software"), to deal
  8. * in the Software without restriction, including without limitation the rights
  9. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. * copies of the Software, and to permit persons to whom the Software is
  11. * furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in
  14. * all copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  19. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22. * THE SOFTWARE.
  23. */
  24. #ifndef QEMU_I8259_INTERNAL_H
  25. #define QEMU_I8259_INTERNAL_H
  26. #include "hw/isa/isa.h"
  27. #include "hw/intc/intc.h"
  28. #include "hw/intc/i8259.h"
  29. #include "qom/object.h"
  30. #define TYPE_PIC_COMMON "pic-common"
  31. OBJECT_DECLARE_TYPE(PICCommonState, PICCommonClass, PIC_COMMON)
  32. struct PICCommonClass {
  33. DeviceClass parent_class;
  34. void (*pre_save)(PICCommonState *s);
  35. void (*post_load)(PICCommonState *s);
  36. };
  37. struct PICCommonState {
  38. ISADevice parent_obj;
  39. uint8_t last_irr; /* edge detection */
  40. uint8_t irr; /* interrupt request register */
  41. uint8_t imr; /* interrupt mask register */
  42. uint8_t isr; /* interrupt service register */
  43. uint8_t priority_add; /* highest irq priority */
  44. uint8_t irq_base;
  45. uint8_t read_reg_select;
  46. uint8_t poll;
  47. uint8_t special_mask;
  48. uint8_t init_state;
  49. uint8_t auto_eoi;
  50. uint8_t rotate_on_auto_eoi;
  51. uint8_t special_fully_nested_mode;
  52. uint8_t init4; /* true if 4 byte init */
  53. uint8_t single_mode; /* true if slave pic is not initialized */
  54. uint8_t elcr; /* PIIX edge/trigger selection*/
  55. uint8_t elcr_mask;
  56. uint8_t ltim; /* Edge/Level Bank Select (pre-PIIX, chip-wide) */
  57. qemu_irq int_out[1];
  58. uint32_t master; /* reflects /SP input pin */
  59. uint32_t iobase;
  60. uint32_t elcr_addr;
  61. MemoryRegion base_io;
  62. MemoryRegion elcr_io;
  63. };
  64. void pic_reset_common(PICCommonState *s);
  65. ISADevice *i8259_init_chip(const char *name, ISABus *bus, bool master);
  66. void pic_stat_update_irq(int irq, int level);
  67. #endif /* QEMU_I8259_INTERNAL_H */