xref: /openbmc/qemu/include/hw/core/split-irq.h (revision 4dad0a9aa818698e0735c8352bf7925a1660df6f)
15edb1b3fSPeter Maydell /*
25edb1b3fSPeter Maydell  * IRQ splitter device.
35edb1b3fSPeter Maydell  *
45edb1b3fSPeter Maydell  * Copyright (c) 2018 Linaro Limited.
55edb1b3fSPeter Maydell  * Written by Peter Maydell
65edb1b3fSPeter Maydell  *
75edb1b3fSPeter Maydell  * Permission is hereby granted, free of charge, to any person obtaining a copy
85edb1b3fSPeter Maydell  * of this software and associated documentation files (the "Software"), to deal
95edb1b3fSPeter Maydell  * in the Software without restriction, including without limitation the rights
105edb1b3fSPeter Maydell  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
115edb1b3fSPeter Maydell  * copies of the Software, and to permit persons to whom the Software is
125edb1b3fSPeter Maydell  * furnished to do so, subject to the following conditions:
135edb1b3fSPeter Maydell  *
145edb1b3fSPeter Maydell  * The above copyright notice and this permission notice shall be included in
155edb1b3fSPeter Maydell  * all copies or substantial portions of the Software.
165edb1b3fSPeter Maydell  *
175edb1b3fSPeter Maydell  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
185edb1b3fSPeter Maydell  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
195edb1b3fSPeter Maydell  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
205edb1b3fSPeter Maydell  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
215edb1b3fSPeter Maydell  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
225edb1b3fSPeter Maydell  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
235edb1b3fSPeter Maydell  * THE SOFTWARE.
245edb1b3fSPeter Maydell  */
255edb1b3fSPeter Maydell 
265edb1b3fSPeter Maydell /* This is a simple device which has one GPIO input line and multiple
275edb1b3fSPeter Maydell  * GPIO output lines. Any change on the input line is forwarded to all
285edb1b3fSPeter Maydell  * of the outputs.
295edb1b3fSPeter Maydell  *
305edb1b3fSPeter Maydell  * QEMU interface:
315edb1b3fSPeter Maydell  *  + one unnamed GPIO input: the input line
325edb1b3fSPeter Maydell  *  + N unnamed GPIO outputs: the output lines
335edb1b3fSPeter Maydell  *  + QOM property "num-lines": sets the number of output lines
345edb1b3fSPeter Maydell  */
355edb1b3fSPeter Maydell #ifndef HW_SPLIT_IRQ_H
365edb1b3fSPeter Maydell #define HW_SPLIT_IRQ_H
375edb1b3fSPeter Maydell 
385edb1b3fSPeter Maydell #include "hw/sysbus.h"
395edb1b3fSPeter Maydell #include "qom/object.h"
405edb1b3fSPeter Maydell 
415edb1b3fSPeter Maydell #define TYPE_SPLIT_IRQ "split-irq"
425edb1b3fSPeter Maydell 
435edb1b3fSPeter Maydell #define MAX_SPLIT_LINES 16
445edb1b3fSPeter Maydell 
455edb1b3fSPeter Maydell 
46*8063396bSEduardo Habkost OBJECT_DECLARE_SIMPLE_TYPE(SplitIRQ, SPLIT_IRQ)
475edb1b3fSPeter Maydell 
485edb1b3fSPeter Maydell struct SplitIRQ {
495edb1b3fSPeter Maydell     DeviceState parent_obj;
505edb1b3fSPeter Maydell 
515edb1b3fSPeter Maydell     qemu_irq out_irq[MAX_SPLIT_LINES];
525edb1b3fSPeter Maydell     uint16_t num_lines;
535edb1b3fSPeter Maydell };
545edb1b3fSPeter Maydell 
555edb1b3fSPeter Maydell #endif
56