Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
hw/char/parallel-isa: Export struct ISAParallelState
Allows the struct to be embedded directly into device models without additional
allocation.

Suggested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230612081238.1742-3-shentey@gmail.com>
[PMD: Update MAINTAINERS entry and use SPDX license identifier]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
  • Loading branch information
shentok authored and philmd committed Jun 13, 2023
1 parent 8ff98e0 commit 9cc44d9
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 17 deletions.
2 changes: 1 addition & 1 deletion MAINTAINERS
Expand Up @@ -1740,7 +1740,7 @@ F: hw/rtc/mc146818rtc*
F: hw/watchdog/wdt_ib700.c
F: hw/watchdog/wdt_i6300esb.c
F: include/hw/display/vga.h
F: include/hw/char/parallel.h
F: include/hw/char/parallel*.h
F: include/hw/dma/i8257.h
F: include/hw/i2c/pm_smbus.h
F: include/hw/input/i8042.h
Expand Down
1 change: 1 addition & 0 deletions hw/char/parallel-isa.c
Expand Up @@ -13,6 +13,7 @@
#include "sysemu/sysemu.h"
#include "hw/isa/isa.h"
#include "hw/qdev-properties.h"
#include "hw/char/parallel-isa.h"
#include "hw/char/parallel.h"
#include "qapi/error.h"

Expand Down
12 changes: 1 addition & 11 deletions hw/char/parallel.c
Expand Up @@ -31,6 +31,7 @@
#include "hw/qdev-properties.h"
#include "hw/qdev-properties-system.h"
#include "migration/vmstate.h"
#include "hw/char/parallel-isa.h"
#include "hw/char/parallel.h"
#include "sysemu/reset.h"
#include "sysemu/sysemu.h"
Expand Down Expand Up @@ -73,17 +74,6 @@

#define PARA_CTR_SIGNAL (PARA_CTR_SELECT|PARA_CTR_INIT|PARA_CTR_AUTOLF|PARA_CTR_STROBE)

OBJECT_DECLARE_SIMPLE_TYPE(ISAParallelState, ISA_PARALLEL)

struct ISAParallelState {
ISADevice parent_obj;

uint32_t index;
uint32_t iobase;
uint32_t isairq;
ParallelState state;
};

static void parallel_update_irq(ParallelState *s)
{
if (s->irq_pending)
Expand Down
2 changes: 1 addition & 1 deletion hw/i386/pc_piix.c
Expand Up @@ -26,7 +26,7 @@
#include CONFIG_DEVICES

#include "qemu/units.h"
#include "hw/char/parallel.h"
#include "hw/char/parallel-isa.h"
#include "hw/dma/i8257.h"
#include "hw/loader.h"
#include "hw/i386/x86.h"
Expand Down
2 changes: 1 addition & 1 deletion hw/i386/pc_q35.c
Expand Up @@ -30,7 +30,7 @@

#include "qemu/osdep.h"
#include "qemu/units.h"
#include "hw/char/parallel.h"
#include "hw/char/parallel-isa.h"
#include "hw/loader.h"
#include "hw/i2c/smbus_eeprom.h"
#include "hw/rtc/mc146818rtc.h"
Expand Down
1 change: 1 addition & 0 deletions hw/isa/isa-superio.c
Expand Up @@ -21,6 +21,7 @@
#include "hw/isa/superio.h"
#include "hw/qdev-properties.h"
#include "hw/input/i8042.h"
#include "hw/char/parallel-isa.h"
#include "hw/char/serial.h"
#include "trace.h"

Expand Down
2 changes: 1 addition & 1 deletion hw/sparc64/sun4u.c
Expand Up @@ -35,7 +35,7 @@
#include "hw/qdev-properties.h"
#include "hw/pci-host/sabre.h"
#include "hw/char/serial.h"
#include "hw/char/parallel.h"
#include "hw/char/parallel-isa.h"
#include "hw/rtc/m48t59.h"
#include "migration/vmstate.h"
#include "hw/input/i8042.h"
Expand Down
30 changes: 30 additions & 0 deletions include/hw/char/parallel-isa.h
@@ -0,0 +1,30 @@
/*
* QEMU ISA Parallel PORT emulation
*
* Copyright (c) 2003-2005 Fabrice Bellard
* Copyright (c) 2007 Marko Kohtala
*
* SPDX-License-Identifier: MIT
*/

#ifndef HW_PARALLEL_ISA_H
#define HW_PARALLEL_ISA_H

#include "parallel.h"

#include "hw/isa/isa.h"
#include "qom/object.h"

#define TYPE_ISA_PARALLEL "isa-parallel"
OBJECT_DECLARE_SIMPLE_TYPE(ISAParallelState, ISA_PARALLEL)

struct ISAParallelState {
ISADevice parent_obj;

uint32_t index;
uint32_t iobase;
uint32_t isairq;
ParallelState state;
};

#endif /* HW_PARALLEL_ISA_H */
2 changes: 0 additions & 2 deletions include/hw/char/parallel.h
Expand Up @@ -25,8 +25,6 @@ typedef struct ParallelState {
PortioList portio_list;
} ParallelState;

#define TYPE_ISA_PARALLEL "isa-parallel"

void parallel_hds_isa_init(ISABus *bus, int n);

bool parallel_mm_init(MemoryRegion *address_space,
Expand Down

0 comments on commit 9cc44d9

Please sign in to comment.