From patchwork Thu Aug 10 23:21:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Bezzubikov X-Patchwork-Id: 9894699 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 2FFE760352 for ; Thu, 10 Aug 2017 23:22:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2145F28BAE for ; Thu, 10 Aug 2017 23:22:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15ED828BB5; Thu, 10 Aug 2017 23:22:40 +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 A2F0928AF1 for ; Thu, 10 Aug 2017 23:22:39 +0000 (UTC) Received: from localhost ([::1]:57401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfwmg-00038S-Oa for patchwork-qemu-devel@patchwork.kernel.org; Thu, 10 Aug 2017 19:22:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfwlo-00037g-Ae for qemu-devel@nongnu.org; Thu, 10 Aug 2017 19:21:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dfwlm-0002lV-9T for qemu-devel@nongnu.org; Thu, 10 Aug 2017 19:21:40 -0400 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]:35015) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dfwlm-0002kq-1v for qemu-devel@nongnu.org; Thu, 10 Aug 2017 19:21:38 -0400 Received: by mail-lf0-x241.google.com with SMTP id w199so1367217lff.2 for ; Thu, 10 Aug 2017 16:21:37 -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=hFN+yM4WCJUeicW8KR6rwDTmVoViQRFuPVsqkazL6O4=; b=NW68FMzRY12ZcvtoFb3X4HFs3axkEOtFjwiUqmJj493bzN1PzZtG//WyMd7hqB4SWW NXLQmaJK9Cimtm+HoqW9aSBp8b00KsFQ6q0jowWmW4KUsFwmnZ0a61BlRQ8YBQkYUvaY 9is40UprGgt9QFnrnyXxitkY9qkhMu9Fkjt5eX5eVcWNLo++yY2ClOGMhS5n0RyDK9Rp YvgdP8LPog+WBb6fXZiexX/69E0CVWaG9foCHWWPx6ZTzoe8FnT6PWCUGiSzbXPmRMK0 yNknPVdIn2m1lJJZ6EKgopDMws05ViKF1wjilVATpicUlTLWpcXieYdGfED5OIoWLPZF 7azg== 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=hFN+yM4WCJUeicW8KR6rwDTmVoViQRFuPVsqkazL6O4=; b=atA4Gt+oH7p9PmxeB+617WwNQ0QvbUPCZ9ZqEdTVJx6KJSc39ZJ6Z4EZ+/jeT0YPzI Ecmeg83SI9Xie5ir5mK0Fc/M9Y4xHbX8SwZdtUMZyfb10hFjPdHWDhcwmSd5C4poVN2i Iz6MmL6QzZkcpO3X+u41bOQkRoOPOyJTbvTKg10XMFeSNWZ0GZPt5HYpoJAFTXMeF8Vj 583mFrSChKk3JXgvyz5uAqg7/uB9kVevw2mxkxwWqgs9KJnU2gAMAPTboFeCq9XYZLMT BT/kUz0OQQlynrl0+gWcc2mLPFD++X5Sdj09DhmstjvSQHqRxTtEHGAqfTwDKWI3H9o3 JUaw== X-Gm-Message-State: AHYfb5hJYM24XXPS7T76K3oiI7njQ6eOpk4hDu3oijTEfQyyZbj9vCEw u8pNyEVZRbzwRA== X-Received: by 10.25.83.139 with SMTP id h11mr4104273lfl.166.1502407296806; Thu, 10 Aug 2017 16:21:36 -0700 (PDT) Received: from localhost.localdomain (broadband-109-173-19-108.moscow.rt.ru. [109.173.19.108]) by smtp.gmail.com with ESMTPSA id g84sm1399994lfl.61.2017.08.10.16.21.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Aug 2017 16:21:36 -0700 (PDT) From: Aleksandr Bezzubikov To: seabios@seabios.org Date: Fri, 11 Aug 2017 02:21:27 +0300 Message-Id: <1502407288-22226-3-git-send-email-zuban32s@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502407288-22226-1-git-send-email-zuban32s@gmail.com> References: <1502407288-22226-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 v5 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 --- src/fw/dev-pci.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 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..cf16b2e --- /dev/null +++ b/src/fw/dev-pci.h @@ -0,0 +1,52 @@ +#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 + * + * this two fields are mutually exclusive: + * 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 */