From patchwork Thu Jan 5 13:52:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Langsdorf X-Patchwork-Id: 134481 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A39B81007D6 for ; Fri, 6 Jan 2012 00:52:38 +1100 (EST) Received: from localhost ([::1]:59874 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rink9-0001QC-Ny for incoming@patchwork.ozlabs.org; Thu, 05 Jan 2012 08:52:33 -0500 Received: from eggs.gnu.org ([140.186.70.92]:58137) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rink2-0001Pv-2L for qemu-devel@nongnu.org; Thu, 05 Jan 2012 08:52:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rink0-0005Q6-Vg for qemu-devel@nongnu.org; Thu, 05 Jan 2012 08:52:26 -0500 Received: from smtp111.dfw.emailsrvr.com ([67.192.241.111]:33368) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rink0-0005Q0-SU for qemu-devel@nongnu.org; Thu, 05 Jan 2012 08:52:24 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp21.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 327E3240483; Thu, 5 Jan 2012 08:52:24 -0500 (EST) X-Virus-Scanned: OK Received: by smtp21.relay.dfw1a.emailsrvr.com (Authenticated sender: mark.langsdorf-AT-calxeda.com) with ESMTPSA id 01AAD2404C6; Thu, 5 Jan 2012 08:52:23 -0500 (EST) From: Mark Langsdorf To: qemu-devel@nongnu.org Date: Thu, 5 Jan 2012 07:52:39 -0600 Message-Id: <1325771559-15570-2-git-send-email-mark.langsdorf@calxeda.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1325771559-15570-1-git-send-email-mark.langsdorf@calxeda.com> References: <1325771559-15570-1-git-send-email-mark.langsdorf@calxeda.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 67.192.241.111 Cc: kwolf@redhat.com, peter.maydell@linaro.org, Rob Herring , afaerber@suse.de, Mark Langsdorf Subject: [Qemu-devel] [PATCH v3 2/2] ahci: add support for non-PCI based controllers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Rob Herring Add support for ahci on sysbus. Signed-off-by: Rob Herring Signed-off-by: Mark Langsdorf --- Changes from v1, v2 Corrected indentation of PlatAHCIState members Made plat_ahci_info into a single structure, not a list hw/ide/ahci.c | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-) diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index 135d0ee..f052e55 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "monitor.h" #include "dma.h" @@ -1214,3 +1215,33 @@ void ahci_reset(void *opaque) ahci_reset_port(s, i); } } + +typedef struct PlatAHCIState { + SysBusDevice busdev; + AHCIState ahci; +} PlatAHCIState; + +static int plat_ahci_init(SysBusDevice *dev) +{ + PlatAHCIState *s = FROM_SYSBUS(PlatAHCIState, dev); + ahci_init(&s->ahci, &dev->qdev, 1); + + sysbus_init_mmio(dev, &s->ahci.mem); + sysbus_init_irq(dev, &s->ahci.irq); + + qemu_register_reset(ahci_reset, &s->ahci); + return 0; +} + +static SysBusDeviceInfo plat_ahci_info = { + .qdev.name = "plat-ahci", + .qdev.size = sizeof(PlatAHCIState), + .init = plat_ahci_init, +}; + +static void plat_ahci_register(void) +{ + sysbus_register_withprop(&plat_ahci_info); +} +device_init(plat_ahci_register); +