qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Alberto Garcia <agarcia@igalia.com>
Cc: Blue Swirl <blauwirbel@gmail.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v4 1/2] Add TEWS TPCI200 IndustryPack emulation
Date: Tue, 08 Jan 2013 14:55:56 +0100	[thread overview]
Message-ID: <50EC256C.5060607@suse.de> (raw)
In-Reply-To: <4773138dce3a8e61f90ebc20837ff4a283137eb3.1357607262.git.agarcia@igalia.com>

Am 08.01.2013 02:10, schrieb Alberto Garcia:
> The TPCI200 is a PCI board that supports up to 4 IndustryPack modules.
> 
> A new bus type called 'IndustryPack' has been created so any
> compatible module can be attached to this board.
> 
> Signed-off-by: Alberto Garcia <agarcia@igalia.com>
> ---
>  default-configs/pci.mak |    1 +
>  hw/Makefile.objs        |    3 +
>  hw/ipack.c              |  106 ++++++++
>  hw/ipack.h              |   75 ++++++
>  hw/pci/pci_ids.h        |    3 +
>  hw/tpci200.c            |  667 +++++++++++++++++++++++++++++++++++++++++++++++
>  6 ficheiros modificados, 855 adições(+)
>  create mode 100644 hw/ipack.c
>  create mode 100644 hw/ipack.h
>  create mode 100644 hw/tpci200.c
> 
> diff --git a/default-configs/pci.mak b/default-configs/pci.mak
> index ae9d1eb..ee2d18d 100644
> --- a/default-configs/pci.mak
> +++ b/default-configs/pci.mak
> @@ -21,3 +21,4 @@ CONFIG_ESP=y
>  CONFIG_ESP_PCI=y
>  CONFIG_SERIAL=y
>  CONFIG_SERIAL_PCI=y
> +CONFIG_IPACK=y
> diff --git a/hw/Makefile.objs b/hw/Makefile.objs
> index b8bbed3..a42518e 100644
> --- a/hw/Makefile.objs
> +++ b/hw/Makefile.objs
> @@ -100,6 +100,9 @@ common-obj-$(CONFIG_XGMAC) += xgmac.o
>  # PCI watchdog devices
>  common-obj-$(CONFIG_PCI) += wdt_i6300esb.o
>  
> +# IndustryPack
> +common-obj-$(CONFIG_IPACK) += tpci200.o ipack.o
> +
>  # PCI network cards
>  common-obj-$(CONFIG_NE2000_PCI) += ne2000.o
>  common-obj-$(CONFIG_EEPRO100_PCI) += eepro100.o
> diff --git a/hw/ipack.c b/hw/ipack.c
> new file mode 100644
> index 0000000..59e272b
> --- /dev/null
> +++ b/hw/ipack.c
> @@ -0,0 +1,106 @@
> +/*
> + * QEMU IndustryPack emulation
> + *
> + * Copyright (C) 2012 Igalia, S.L.
> + * Author: Alberto Garcia <agarcia@igalia.com>
> + *
> + * This code is licensed under the GNU GPL v2 or (at your option) any
> + * later version.
> + */
> +
> +#include "ipack.h"
> +
> +IPackDevice *ipack_device_find(IPackBus *bus, int32_t slot)
> +{
> +    BusChild *kid;
> +
> +    QTAILQ_FOREACH(kid, &bus->qbus.children, sibling) {
> +        DeviceState *qdev = kid->child;
> +        IPackDevice *ip = DO_UPCAST(IPackDevice, qdev, qdev);

IPACK_DEVICE(qdev)

> +        if (ip->slot == slot) {
> +            return ip;
> +        }
> +    }
> +    return NULL;
> +}
> +
> +static int ipack_device_dev_init(DeviceState *qdev)
> +{
> +    IPackBus *bus = DO_UPCAST(IPackBus, qbus, qdev->parent_bus);

IPACK_BUS()

> +    IPackDevice *dev = DO_UPCAST(IPackDevice, qdev, qdev);
[snip]

IPACK_DEVICE()

You have them defined in the header, please use them consistently.

Also, please avoid accessing internals like &s->bus.qbus (BUS(s->bus))
or &s->dev.qdev (DEVICE(s->dev)).

Another thing to check (could be a follow-up) is whether the initfn can
be split into instance_init (e.g., pci_set_*?) and initfn.

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  reply	other threads:[~2013-01-08 13:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-08  1:10 [Qemu-devel] [PATCH v4 0/2] Add TPCI200 and IP-Octal 232 IndustryPack emulation Alberto Garcia
2013-01-08  1:10 ` [Qemu-devel] [PATCH v4 1/2] Add TEWS TPCI200 " Alberto Garcia
2013-01-08 13:55   ` Andreas Färber [this message]
2013-01-08 15:57     ` Alberto Garcia
2013-01-08 16:22       ` Andreas Färber
2013-01-08 16:37         ` Alberto Garcia
2013-01-09  0:36       ` Andreas Färber
2013-01-09  1:20         ` Alberto Garcia
2013-01-08  1:10 ` [Qemu-devel] [PATCH v4 2/2] Add GE IP-Octal 232 " Alberto Garcia
2013-01-08 18:08   ` Andreas Färber
2013-01-09  0:56     ` Alberto Garcia

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=50EC256C.5060607@suse.de \
    --to=afaerber@suse.de \
    --cc=agarcia@igalia.com \
    --cc=aliguori@us.ibm.com \
    --cc=blauwirbel@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).