From nobody Mon Feb 9 21:02:54 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585903154; cv=none; d=zohomail.com; s=zohoarc; b=YUifUUEuuUPbj24F97C4ijE/nZm1EHeoU8LsTM9LCYuACGpsDC1+4LWjF4yQUAPWjE60amTYDfW3GVnIGiGXCe5KzvvhJwlZE9XGFj/SFuAqbc5oovXx4dGfTtYG/ErxaXDRZy0QrZEgkodxi0A3YyeedRkRZRZaPYZXMJ81mu4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585903154; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=DSsbvOboXkgffYb9lpFutWtoXXkDMUIg0p3HpxQX6fQ=; b=Z3jA2fm4D4pMbN0WkMFg+43wr3C5+DtydUYNSaCexEVMYI3Z+wrqLabBjxH6P6YB19n8BvTvSMP5plSJ3nYQUo/n27DHf1rMg5CLd/bFFAcGgeq9xLJtFMHKpzj9EHsJ4bfDbcx47G/M7aQ2lCU6Dmuyob+wlFdtOI6hAz5NDBg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1585903154539311.93419778489647; Fri, 3 Apr 2020 01:39:14 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 68BBAB01D15; Fri, 3 Apr 2020 08:39:10 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 79675B01A2D for ; Fri, 3 Apr 2020 08:38:05 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-497-0SX56FRjPyevryAc0jedWg-1; Fri, 03 Apr 2020 04:31:39 -0400 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B8E008017F4 for ; Fri, 3 Apr 2020 08:31:38 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTP id 35E1E1001B0B; Fri, 3 Apr 2020 08:31:35 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) id 9E16517502; Fri, 3 Apr 2020 10:31:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585903084; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HwlXHvJEntUUcd/BKDfa3DW+iOvWi6lUwqDF5wbBYAk=; b=ZKZ9GIidPoFK66mCnHSQ2Ej2uJpQO/EHKWlqkH3mL+JBCOsqmHOkPYu4h0HUUgKCZCdgfT AvljmvrIEclPwvIhicPDAVbR5gnGK/R9I4aimb7IATN3VwOWAy5Tr9u5F/2rAjlbS47LMh 14OpngjTHMvqSPV5stF+8UTCgnlVuzQ= X-MC-Unique: 0SX56FRjPyevryAc0jedWg-1 From: Gerd Hoffmann To: seabios@seabios.org Date: Fri, 3 Apr 2020 10:31:13 +0200 Message-Id: <20200403083121.10766-2-kraxel@redhat.com> In-Reply-To: <20200403083121.10766-1-kraxel@redhat.com> References: <20200403083121.10766-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Level: **** Message-ID-Hash: WHTD62MFOGILTL4ZS6GYTG5HHIDAQW3I X-Message-ID-Hash: WHTD62MFOGILTL4ZS6GYTG5HHIDAQW3I X-MailFrom: kraxel@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Gerd Hoffmann X-Mailman-Version: 3.3.1 Precedence: list Subject: [SeaBIOS] [PATCH 1/9] virtio-mmio: device registry List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: / X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Add a new virtio-mmio.c source file, providing a function to register virtio-mmio devices. Signed-off-by: Gerd Hoffmann --- Makefile | 2 +- src/hw/virtio-mmio.h | 6 ++++++ src/hw/virtio-mmio.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/hw/virtio-mmio.h create mode 100644 src/hw/virtio-mmio.c diff --git a/Makefile b/Makefile index 5f7d5370198a..985ef591a13b 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ SRC32FLAT=3D$(SRCBOTH) post.c e820map.c malloc.c romfile.= c x86.c optionroms.c \ fw/coreboot.c fw/lzmadecode.c fw/multiboot.c fw/csm.c fw/biostables.c \ fw/paravirt.c fw/shadow.c fw/pciinit.c fw/smm.c fw/smp.c fw/mtrr.c fw/= xen.c \ fw/acpi.c fw/mptable.c fw/pirtable.c fw/smbios.c fw/romfile_loader.c \ - hw/virtio-ring.c hw/virtio-pci.c hw/virtio-blk.c hw/virtio-scsi.c \ + hw/virtio-ring.c hw/virtio-pci.c hw/virtio-mmio.c hw/virtio-blk.c hw/v= irtio-scsi.c \ hw/tpm_drivers.c hw/nvme.c SRC32SEG=3Dstring.c output.c pcibios.c apm.c stacks.c hw/pci.c hw/serialio= .c DIRS=3Dsrc src/hw src/fw vgasrc diff --git a/src/hw/virtio-mmio.h b/src/hw/virtio-mmio.h new file mode 100644 index 000000000000..751984241f49 --- /dev/null +++ b/src/hw/virtio-mmio.h @@ -0,0 +1,6 @@ +#ifndef _VIRTIO_MMIO_H +#define _VIRTIO_MMIO_H + +void virtio_mmio_register(u64 mmio); + +#endif /* _VIRTIO_MMIO_H */ diff --git a/src/hw/virtio-mmio.c b/src/hw/virtio-mmio.c new file mode 100644 index 000000000000..6c969d787ec7 --- /dev/null +++ b/src/hw/virtio-mmio.c @@ -0,0 +1,30 @@ +#include "config.h" // CONFIG_DEBUG_LEVEL +#include "malloc.h" // free +#include "output.h" // dprintf +#include "virtio-pci.h" +#include "virtio-ring.h" + +/* qemu microvm supports 8 virtio-mmio devices */ +static u64 devs[8]; + +void virtio_mmio_register(u64 mmio) +{ + int i; + + for (i =3D 0; i < ARRAY_SIZE(devs); i++) { + if (devs[i] =3D=3D mmio) { + /* + * This can happen in case we have multiple scsi devices + * attached to a single virtio-scsi controller + */ + dprintf(3, "virtio-mmio: duplicate device at 0x%llx, ignoring\= n", mmio); + return; + } + if (devs[i] =3D=3D 0) { + dprintf(3, "virtio-mmio: register device at 0x%llx\n", mmio); + devs[i] =3D mmio; + return; + } + } + dprintf(1, "virtio-mmio: device list full\n"); +} --=20 2.18.2 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org