From patchwork Wed Feb 15 16:16:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 653716 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp431712wrr; Wed, 15 Feb 2023 08:19:11 -0800 (PST) X-Google-Smtp-Source: AK7set/NMYb+myHJ1W6LRscaZXTjfWi/svLh6z0Vbjpx8tmz/yvgkRYI+k5a3v+SHv4w6/AlV7f9 X-Received: by 2002:a05:622a:15d5:b0:3ba:13e4:527f with SMTP id d21-20020a05622a15d500b003ba13e4527fmr4551538qty.13.1676477951002; Wed, 15 Feb 2023 08:19:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676477950; cv=none; d=google.com; s=arc-20160816; b=RUJA9yZVzmQ6h9dbC5GMIvJOdw+OEvA96ro8fVIlHicP6DHKCv3pxZgtO1M5iebTwW tjDUfIgt0tHvQQKnp/RgSRutyWBOKP9O2LFTYMI3ZiTPAjmPJ//qDeW34liRkooutSiW +65qzsaE+kxryjLkHD6AEgiUwjIkXw0rIcLZdJ2Yxbi58dvVeQvt8k9kYRLqFWUCHORE 1uTUbA9bXEsmkPgC2j5QAGOfF1zt5g25AF6CSelf2Rr4PIJFqD5CAOqOQ8aT+r8RNTNs 91xau2ikOX3j2n7X1V+gI9aeeLFIXMD1ubvgbcbZHfbFVNaunYPRuXu3lGhdrJKNXUs+ Nu7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LaRrQzpsNkq8chPrf481OHT2Dybo/sVF5goX8elaTUo=; b=nAvcMD+DNUX1AeRga5k1M7eX0jiOQLeHMWlvadTDc3PTFjPez9HNB08Bbxt7icdU06 HwFy9OY5onbyiXxzVo65bx6ny1gfJAmhN7+VXwBRTWi+aeuhwXhqNxvSKe9dDhXyHtp8 3DvhuO9Y2RmxIdUYhj2SoXIzPvwOXe+LsAwTsk4A2aO4KoKpkKCBQgCKxnpkMdaGITlh X+jH1iY72P0Af/jSFQ3iVHofC6QGhggCc/klunVV7Xw7yrbgLCBgXi4lw58aC0u1c0HL DezBUuPVb3hzJ//e1eid8kb6TSapsQfewGlE6L18T3UPQd+8EP4eVb/gH9HuQlOfcPcn gy5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gJNplsGC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g3-20020ac87f43000000b003b81b32738dsi13750198qtk.393.2023.02.15.08.19.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 08:19:10 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gJNplsGC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSKU1-00005Z-Ua; Wed, 15 Feb 2023 11:18:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSKTn-000895-Uo for qemu-devel@nongnu.org; Wed, 15 Feb 2023 11:18:00 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSKTl-0008Pz-9V for qemu-devel@nongnu.org; Wed, 15 Feb 2023 11:17:59 -0500 Received: by mail-wr1-x42d.google.com with SMTP id r2so19707658wrv.7 for ; Wed, 15 Feb 2023 08:17:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LaRrQzpsNkq8chPrf481OHT2Dybo/sVF5goX8elaTUo=; b=gJNplsGCi34nC2PeByIpDMB8+tuLAp2G4wxiI3bsCguEMb/czRkttBHvVTkSX0Hk4I yFYzKSrojVj4lP/PQ67R28TntPZj93ZRLsg4F5JU7xhNJAfeqebtfuqnURrsFstOB9QL QeTaoPJYg9FuoQ9M72dGoIhdi6mHTQESUDj2AHwfmqQtXfGi1+T+vqJiCIcHZw9aLRax rVgcsidolO3SU0DDRs/6jPvdtSRZuqSriY19q+W/1e8IYxoVX2QrwKWuQIOEp3L/p+kt Z9OkBELz5verOI4fauLVlpA1QF3s+zA9oXs5COyccSoLpHf6t/uk78WIQP5BbwmYaM+Y ZtPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LaRrQzpsNkq8chPrf481OHT2Dybo/sVF5goX8elaTUo=; b=Px+TzQHDphLw3INW1MmrxTAkIP4xctIRu2sF3So56hcK8y2/6fnnEEa1Y4iSX6naTW YzfQbBEp+on0OpRwCLCAP07eEc/rFIpKEwviXDbJQ8bH/KxciYPo+OfiQztwWCn3bkTN 3Dl2saI3qS2pVdj2yrk9niO2nqrchdLFBQUmNJffR24jxAzouoFuxRTbSAApypqCFLaS h3lnh/KyIdt2XRngu7/RNdt7hX9chb31bdhMttoNrcIfvqvo45GBtL6iBJROqyauFQUe +qCW1asm7i+4J51xxMRNxtPShokFvEcugFG9bgkwHTmPGK1KNq/ELaIpngHBVD/et6/N Ywjg== X-Gm-Message-State: AO0yUKWSfJRzfqXC9PEkkATigjNqnY9Y5G08LhNPicU9ZMoW8YMrfi/j kFxQ2dRHS6RFIujS58kmjjhBd6d4nzjmcOlk X-Received: by 2002:a5d:6aca:0:b0:2c5:588f:84a0 with SMTP id u10-20020a5d6aca000000b002c5588f84a0mr2223236wrw.3.1676477874767; Wed, 15 Feb 2023 08:17:54 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id m32-20020a05600c3b2000b003e2066a6339sm1521491wms.5.2023.02.15.08.17.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 15 Feb 2023 08:17:54 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, John Snow , Eduardo Habkost , Paolo Bonzini , Kevin Wolf , qemu-ppc@nongnu.org, Hanna Reitz , "Michael S. Tsirkin" , Richard Henderson , Gerd Hoffmann , Mark Cave-Ayland Subject: [PATCH v2 13/18] hw/ide: Introduce generic ide_init_ioport() Date: Wed, 15 Feb 2023 17:16:36 +0100 Message-Id: <20230215161641.32663-14-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230215161641.32663-1-philmd@linaro.org> References: <20230215161641.32663-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Add ide_init_ioport() which is not restricted to the ISA bus. (Next commit will use it for a PCI device). Inspired-by: Mark Cave-Ayland Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- hw/ide/ioport.c | 12 ++++++++++-- include/hw/ide/internal.h | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/hw/ide/ioport.c b/hw/ide/ioport.c index d869f8018a..1d4711dd91 100644 --- a/hw/ide/ioport.c +++ b/hw/ide/ioport.c @@ -46,8 +46,6 @@ int ide_bus_init_ioport_isa(IDEBus *bus, ISADevice *dev, { int ret; - /* ??? Assume only ISA and PCI configurations, and that the PCI-ISA - bridge has been setup properly to always register with ISA. */ ret = isa_register_portio_list(dev, &bus->portio_list, iobase, ide_portio_list, bus, "ide"); @@ -58,3 +56,13 @@ int ide_bus_init_ioport_isa(IDEBus *bus, ISADevice *dev, return ret; } + +void ide_bus_init_ioport(IDEBus *bus, Object *owner, MemoryRegion *io, + int iobase, int iobase2) +{ + portio_list_init(&bus->portio_list, owner, ide_portio_list, bus, "ide"); + portio_list_add(&bus->portio_list, io, iobase); + + portio_list_init(&bus->portio2_list, owner, ide_portio2_list, bus, "ide"); + portio_list_add(&bus->portio2_list, io, iobase2); +} diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h index d3b7fdc504..6967ca13e0 100644 --- a/include/hw/ide/internal.h +++ b/include/hw/ide/internal.h @@ -617,6 +617,8 @@ int ide_init_drive(IDEState *s, BlockBackend *blk, IDEDriveKind kind, uint32_t cylinders, uint32_t heads, uint32_t secs, int chs_trans, Error **errp); void ide_exit(IDEState *s); +void ide_bus_init_ioport(IDEBus *bus, Object *owner, MemoryRegion *io, + int iobase, int iobase2); void ide_bus_init_output_irq(IDEBus *bus, qemu_irq irq_out); void ide_bus_set_irq(IDEBus *bus); void ide_bus_register_restart_cb(IDEBus *bus);