From: BALATON Zoltan <balaton@eik.bme.hu>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
Michael Tokarev <mjt@tls.msk.ru>,
Gerd Hoffmann <kraxel@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-trivial] [PATCH v3] serial-pci: Set prog interface field of pci config to 16550 compatible
Date: Wed, 14 May 2014 20:01:09 -0000 [thread overview]
Message-ID: <20140514200030.E7E842F456@mono.eik.bme.hu> (raw)
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
v2: resubmission after pc-2.1 is added with the multiport case
v3: added compatibility check to avoid changing earlier than pc-2.1
hw/char/serial-pci.c | 11 +++++++++++
include/hw/i386/pc.h | 15 +++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c
index 991c99f..ae57098 100644
--- a/hw/char/serial-pci.c
+++ b/hw/char/serial-pci.c
@@ -34,6 +34,7 @@
typedef struct PCISerialState {
PCIDevice dev;
SerialState state;
+ uint8_t compat;
} PCISerialState;
typedef struct PCIMultiSerialState {
@@ -44,6 +45,7 @@ typedef struct PCIMultiSerialState {
SerialState state[PCI_SERIAL_MAX_PORTS];
uint32_t level[PCI_SERIAL_MAX_PORTS];
qemu_irq *irqs;
+ uint8_t compat;
} PCIMultiSerialState;
static int serial_pci_init(PCIDevice *dev)
@@ -60,6 +62,9 @@ static int serial_pci_init(PCIDevice *dev)
return -1;
}
+ if (!pci->compat) {
+ pci->dev.config[PCI_CLASS_PROG] = 0x02; /* 16550 compatible */
+ }
pci->dev.config[PCI_INTERRUPT_PIN] = 0x01;
s->irq = pci_allocate_irq(&pci->dev);
@@ -101,6 +106,9 @@ static int multi_serial_pci_init(PCIDevice *dev)
assert(pci->ports > 0);
assert(pci->ports <= PCI_SERIAL_MAX_PORTS);
+ if (!pci->compat) {
+ pci->dev.config[PCI_CLASS_PROG] = 0x02; /* 16550 compatible */
+ }
pci->dev.config[PCI_INTERRUPT_PIN] = 0x01;
memory_region_init(&pci->iobar, OBJECT(pci), "multiserial", 8 * pci->ports);
pci_register_bar(&pci->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &pci->iobar);
@@ -177,12 +185,14 @@ static const VMStateDescription vmstate_pci_multi_serial = {
static Property serial_pci_properties[] = {
DEFINE_PROP_CHR("chardev", PCISerialState, state.chr),
+ DEFINE_PROP_UINT8("compat", PCISerialState, compat, 0),
DEFINE_PROP_END_OF_LIST(),
};
static Property multi_2x_serial_pci_properties[] = {
DEFINE_PROP_CHR("chardev1", PCIMultiSerialState, state[0].chr),
DEFINE_PROP_CHR("chardev2", PCIMultiSerialState, state[1].chr),
+ DEFINE_PROP_UINT8("compat", PCIMultiSerialState, compat, 0),
DEFINE_PROP_END_OF_LIST(),
};
@@ -191,6 +201,7 @@ static Property multi_4x_serial_pci_properties[] = {
DEFINE_PROP_CHR("chardev2", PCIMultiSerialState, state[1].chr),
DEFINE_PROP_CHR("chardev3", PCIMultiSerialState, state[2].chr),
DEFINE_PROP_CHR("chardev4", PCIMultiSerialState, state[3].chr),
+ DEFINE_PROP_UINT8("compat", PCIMultiSerialState, compat, 0),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 32a7687..8fb8046 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -271,6 +271,21 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
.driver = "apic",\
.property = "version",\
.value = stringify(0x11),\
+ },\
+ {\
+ .driver = "pci-serial",\
+ .property = "compat",\
+ .value = stringify(1),\
+ },\
+ {\
+ .driver = "pci-serial-2x",\
+ .property = "compat",\
+ .value = stringify(1),\
+ },\
+ {\
+ .driver = "pci-serial-4x",\
+ .property = "compat",\
+ .value = stringify(1),\
}
#define PC_COMPAT_1_7 \
--
1.8.1.5
WARNING: multiple messages have this Message-ID (diff)
From: BALATON Zoltan <balaton@eik.bme.hu>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
Michael Tokarev <mjt@tls.msk.ru>,
Gerd Hoffmann <kraxel@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PATCH v3] serial-pci: Set prog interface field of pci config to 16550 compatible
Date: Wed, 14 May 2014 20:00:56 -0000 [thread overview]
Message-ID: <20140514200030.E7E842F456@mono.eik.bme.hu> (raw)
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
v2: resubmission after pc-2.1 is added with the multiport case
v3: added compatibility check to avoid changing earlier than pc-2.1
hw/char/serial-pci.c | 11 +++++++++++
include/hw/i386/pc.h | 15 +++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c
index 991c99f..ae57098 100644
--- a/hw/char/serial-pci.c
+++ b/hw/char/serial-pci.c
@@ -34,6 +34,7 @@
typedef struct PCISerialState {
PCIDevice dev;
SerialState state;
+ uint8_t compat;
} PCISerialState;
typedef struct PCIMultiSerialState {
@@ -44,6 +45,7 @@ typedef struct PCIMultiSerialState {
SerialState state[PCI_SERIAL_MAX_PORTS];
uint32_t level[PCI_SERIAL_MAX_PORTS];
qemu_irq *irqs;
+ uint8_t compat;
} PCIMultiSerialState;
static int serial_pci_init(PCIDevice *dev)
@@ -60,6 +62,9 @@ static int serial_pci_init(PCIDevice *dev)
return -1;
}
+ if (!pci->compat) {
+ pci->dev.config[PCI_CLASS_PROG] = 0x02; /* 16550 compatible */
+ }
pci->dev.config[PCI_INTERRUPT_PIN] = 0x01;
s->irq = pci_allocate_irq(&pci->dev);
@@ -101,6 +106,9 @@ static int multi_serial_pci_init(PCIDevice *dev)
assert(pci->ports > 0);
assert(pci->ports <= PCI_SERIAL_MAX_PORTS);
+ if (!pci->compat) {
+ pci->dev.config[PCI_CLASS_PROG] = 0x02; /* 16550 compatible */
+ }
pci->dev.config[PCI_INTERRUPT_PIN] = 0x01;
memory_region_init(&pci->iobar, OBJECT(pci), "multiserial", 8 * pci->ports);
pci_register_bar(&pci->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &pci->iobar);
@@ -177,12 +185,14 @@ static const VMStateDescription vmstate_pci_multi_serial = {
static Property serial_pci_properties[] = {
DEFINE_PROP_CHR("chardev", PCISerialState, state.chr),
+ DEFINE_PROP_UINT8("compat", PCISerialState, compat, 0),
DEFINE_PROP_END_OF_LIST(),
};
static Property multi_2x_serial_pci_properties[] = {
DEFINE_PROP_CHR("chardev1", PCIMultiSerialState, state[0].chr),
DEFINE_PROP_CHR("chardev2", PCIMultiSerialState, state[1].chr),
+ DEFINE_PROP_UINT8("compat", PCIMultiSerialState, compat, 0),
DEFINE_PROP_END_OF_LIST(),
};
@@ -191,6 +201,7 @@ static Property multi_4x_serial_pci_properties[] = {
DEFINE_PROP_CHR("chardev2", PCIMultiSerialState, state[1].chr),
DEFINE_PROP_CHR("chardev3", PCIMultiSerialState, state[2].chr),
DEFINE_PROP_CHR("chardev4", PCIMultiSerialState, state[3].chr),
+ DEFINE_PROP_UINT8("compat", PCIMultiSerialState, compat, 0),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 32a7687..8fb8046 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -271,6 +271,21 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
.driver = "apic",\
.property = "version",\
.value = stringify(0x11),\
+ },\
+ {\
+ .driver = "pci-serial",\
+ .property = "compat",\
+ .value = stringify(1),\
+ },\
+ {\
+ .driver = "pci-serial-2x",\
+ .property = "compat",\
+ .value = stringify(1),\
+ },\
+ {\
+ .driver = "pci-serial-4x",\
+ .property = "compat",\
+ .value = stringify(1),\
}
#define PC_COMPAT_1_7 \
--
1.8.1.5
next reply other threads:[~2014-05-14 20:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-14 20:00 BALATON Zoltan [this message]
2014-05-14 20:01 ` [Qemu-trivial] [PATCH v3] serial-pci: Set prog interface field of pci config to 16550 compatible BALATON Zoltan
2014-05-15 6:40 ` Michael S. Tsirkin
2014-05-15 6:40 ` [Qemu-devel] " Michael S. Tsirkin
2014-05-15 6:42 ` [Qemu-trivial] " Gerd Hoffmann
2014-05-15 6:42 ` [Qemu-devel] " Gerd Hoffmann
2014-05-15 6:42 ` [Qemu-trivial] " Michael S. Tsirkin
2014-05-15 6:42 ` [Qemu-devel] " Michael S. Tsirkin
2014-05-15 6:53 ` [Qemu-trivial] " Gerd Hoffmann
2014-05-15 6:53 ` [Qemu-devel] " Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140514200030.E7E842F456@mono.eik.bme.hu \
--to=balaton@eik.bme.hu \
--cc=kraxel@redhat.com \
--cc=mjt@tls.msk.ru \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.