From patchwork Thu Aug 17 23:12:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Bezzubikov X-Patchwork-Id: 9907281 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4583D6038C for ; Thu, 17 Aug 2017 23:14:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3624827FA3 for ; Thu, 17 Aug 2017 23:14:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 28C97281B7; Thu, 17 Aug 2017 23:14:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AEB5D27FA3 for ; Thu, 17 Aug 2017 23:14:17 +0000 (UTC) Received: from localhost ([::1]:57038 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1diTyy-0005KX-Ly for patchwork-qemu-devel@patchwork.kernel.org; Thu, 17 Aug 2017 19:13:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1diTy5-0005JU-PB for qemu-devel@nongnu.org; Thu, 17 Aug 2017 19:12:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1diTy2-000701-KO for qemu-devel@nongnu.org; Thu, 17 Aug 2017 19:12:49 -0400 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]:34488) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1diTy2-0006zh-Ct for qemu-devel@nongnu.org; Thu, 17 Aug 2017 19:12:46 -0400 Received: by mail-lf0-x241.google.com with SMTP id o85so5235796lff.1 for ; Thu, 17 Aug 2017 16:12:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JkYh3oQ9fyVfBf1WCfQknt9ahHGwgKu5WzdZIV13rjI=; b=CCnU5clB3027mw6hrija/HVoe3/8UtM32LP3seV62dOE+Gpe+sHVdgG2geOlWBQYQA GjcjKr+EdTJclS6Co1L1n+g/uY5eYgVePnKMLoeQPb00dUyv9FFgOZru/zpdmhM5IJ7S 21j0o+KHd8wVSBnBmTmuefOO4z8cje9wMjEcA4j9WfkwljAz62KTVjEIqQ/ioeNWf+lH OYYkGdeVQiMurYCPMADLdNsFGyMBgcP1Xz2abgqmrxDFJy/Maf851XdUX4E9lIwoHWbl P8by3K0y/Q2PK4jNHr4blkpPH1uNxKnBBCDSrUI7X/iAHvGMEhBq427hcgl0PgrQFJ7z k8UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JkYh3oQ9fyVfBf1WCfQknt9ahHGwgKu5WzdZIV13rjI=; b=TjAFdTXP1d30wQHMf7f6/XguShJXMljxZap/b2DmSLI04I9iz7IxqAFnzahjN6iIOr 5+cH5iAYgAbh9WInUHHWSGp5KxCmCIJs9hr4s30bNOr2HbWPwLUJVchjP0eoOzjZRZ4m VYFHcTdCMRJv7xhqD18ThkWYUSXf707tQaGtgKZyy1uTMKFQcLIC/jBMzhqalwvYjbVv L6dOeJSeOGsk5ILxhOj2Jv/PeTGZ/hxZwAm7V26f8NCulrpdANsAFNqRlYInVcskl0oq 6FH460nUpu+tdW7NwUPoFaDRD0/MQDoWlsN+qJmn8eFg4qP6jsuiJCKCPkiJKera1mYU SY9A== X-Gm-Message-State: AHYfb5h685CK/t93ATDSEAW5hUd1bRKU1S1Tp0/+LyAZFamfHgPkrDUV yTRphjqq9NpE4JbF+sw= X-Received: by 10.25.225.12 with SMTP id y12mr2991185lfg.83.1503011565227; Thu, 17 Aug 2017 16:12:45 -0700 (PDT) Received: from localhost.localdomain ([93.185.28.201]) by smtp.gmail.com with ESMTPSA id d17sm987659lfl.86.2017.08.17.16.12.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Aug 2017 16:12:44 -0700 (PDT) From: Aleksandr Bezzubikov To: seabios@seabios.org Date: Fri, 18 Aug 2017 02:12:30 +0300 Message-Id: <1503011551-7246-3-git-send-email-zuban32s@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503011551-7246-1-git-send-email-zuban32s@gmail.com> References: <1503011551-7246-1-git-send-email-zuban32s@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::241 Subject: [Qemu-devel] [PATCH v7 2/3] pci: add QEMU-specific PCI capability structure X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mst@redhat.com, qemu-devel@nongnu.org, Aleksandr Bezzubikov , kevin@koconnor.net, kraxel@redhat.com, marcel@redhat.com, lersek@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP On PCI init PCI bridge devices may need some extra info about bus number to reserve, IO, memory and prefetchable memory limits. QEMU can provide this with special vendor-specific PCI capability. This capability is intended to be used only for Red Hat PCI bridges, i.e. QEMU cooperation. Signed-off-by: Aleksandr Bezzubikov Reviewed-by: Marcel Apfelbaum --- src/fw/dev-pci.h | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/fw/dev-pci.h diff --git a/src/fw/dev-pci.h b/src/fw/dev-pci.h new file mode 100644 index 0000000..0dc5556 --- /dev/null +++ b/src/fw/dev-pci.h @@ -0,0 +1,53 @@ +#ifndef _PCI_CAP_H +#define _PCI_CAP_H + +#include "types.h" + +/* + * + * QEMU-specific vendor(Red Hat)-specific capability. + * It's intended to provide some hints for firmware to init PCI devices. + * + * Its structure is shown below: + * + * Header: + * + * u8 id; Standard PCI Capability Header field + * u8 next; Standard PCI Capability Header field + * u8 len; Standard PCI Capability Header field + * u8 type; Red Hat vendor-specific capability type + * Data: + * + * u32 bus_res; minimum bus number to reserve; + * this is necessary for PCI Express Root Ports + * to support PCI bridges hotplug + * u64 io; IO space to reserve + * u32 mem; non-prefetchable memory to reserve + * + * At most of the following two fields may be set to a value + * different from 0xFF...F: + * u32 prefetchable_mem_32; prefetchable memory to reserve (32-bit MMIO) + * u64 prefetchable_mem_64; prefetchable memory to reserve (64-bit MMIO) + * + * If any field value in Data section is 0xFF...F, + * it means that such kind of reservation is not needed and must be ignored. + * +*/ + +/* Offset of vendor-specific capability type field */ +#define PCI_CAP_REDHAT_TYPE_OFFSET 3 + +/* List of valid Red Hat vendor-specific capability types */ +#define REDHAT_CAP_RESOURCE_RESERVE 1 + + +/* Offsets of RESOURCE_RESERVE capability fields */ +#define RES_RESERVE_BUS_RES 4 +#define RES_RESERVE_IO 8 +#define RES_RESERVE_MEM 16 +#define RES_RESERVE_PREF_MEM_32 20 +#define RES_RESERVE_PREF_MEM_64 24 +#define RES_RESERVE_CAP_SIZE 32 + +#endif /* _PCI_CAP_H */ +