From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::231; helo=mail-wm0-x231.google.com; envelope-from=guyraviv8@gmail.com; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x231.google.com (mail-wm0-x231.google.com [IPv6:2a00:1450:400c:c09::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 89F9E2096AEDF for ; Tue, 8 May 2018 22:50:20 -0700 (PDT) Received: by mail-wm0-x231.google.com with SMTP id a137-v6so21714276wme.1 for ; Tue, 08 May 2018 22:50:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=gUnfxEuWNV+u+KzL5N5YoVLdvowg296t32KNAZl0ZMU=; b=omoNyNDhLj48WBdK2gT8PNzYGqoyEbFPzAog8VzmfgaGGVktAk49gO2VZ+6pBb8Y16 jP4m9wjOjbvKVtVeNtQpOvPMXY3jb1tWMDv+FVLQN9frHLTaoz2fC14WZx5AY/eWRFP7 awrLTZ3yKPVdrmNmFCMsbNRTFVq0Y9/bkUd6AMgW4Oz/QgEt3X+VrvBrww450OlU3yxt mApngIX/BL/bcpW7UAM7Ovx+Q/PoL/mL0KrEGeHqyPqx2+fGGORVPY1FGk+OR1QE6DYR Tdu84p2E6j2hdkluG/Ok10H6p0IcJFSiFUf5Puk09Efl28u+2GgOgDwtMd179FgWxQKL BEGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=gUnfxEuWNV+u+KzL5N5YoVLdvowg296t32KNAZl0ZMU=; b=V7t5aVuR1qCo6xmgJIMNVPrR4F8JQ6a9PpVwhAnPIXwDi8HAcYJq0omguZyouFUuYO NqXXN6JpVEykMcaaz+fZuAldDI2NLjoKWsLsNg1rfgvojmG1ZXNYTeuEPXWq+1cNBIrU k0ChGC1WdJp9ylRrct+vOuif7s/In/OuIsO0MRVpd7c05mmja3uBd8CFeMPQdVEXeXe2 HSFBd5bcH6CkzEdmyqj8OH8O15fSBH/8TyB1BZg01Ye5Wn2fCABDC7XoOHkNCfItCvuK aNYXBiABJ8EBZUMEQI++4HpG9fc4HEy+cO9fT6auHlQvoYVFwKi+6/5Ygvun0oiGG7rm CXkg== X-Gm-Message-State: ALKqPwdiaJD+Ze4fDn9LmeJZm28ORU9wDzZTBMYtUVeGoI2Mv2g4JKvs c9Ft51p+BrzscXL+S2YLkhbiSFwbnepMeKdIdRM= X-Google-Smtp-Source: AB8JxZqsq5zO+KSkybSLfY93TjJAXGSz8wjg6N+MzVA3q93+m9Ws7OpixBCDiLVf/sjGvLU6/bwhHKAazMTazUn5EcM= X-Received: by 2002:a1c:e60b:: with SMTP id d11-v6mr5206186wmh.128.1525845018834; Tue, 08 May 2018 22:50:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.105.73 with HTTP; Tue, 8 May 2018 22:50:18 -0700 (PDT) In-Reply-To: References: From: Guy Raviv Date: Wed, 9 May 2018 08:50:18 +0300 Message-ID: To: Laszlo Ersek Cc: edk2-devel@lists.01.org X-Content-Filtered-By: Mailman/MimeDel 2.1.26 Subject: Re: Dynamic Pci configuration devices X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2018 05:50:20 -0000 Content-Type: text/plain; charset="UTF-8" Thanks for the detailed answer. if i choose the 2nd approach would it be possible to modify the structrue itself of the pci tree, and not only a specific device number? example: if i add a pci bridge between my board and a graphic card. Thanks, On Tue, May 8, 2018 at 5:47 PM, Laszlo Ersek wrote: > On 05/08/18 16:16, Guy Raviv wrote: > > Hi all, > > > > currently in > > > > \Vlv2DeviceRefCodePkg\AcpiTablesPCAT\HOST_BUS.ASL > > > > The PCI devices are declared statically. > > > > i want to make this declaration dynamic - so that the device number can > change > > > > according according to my hardware setup. Is it possible? > > There are generally two ways for this. > > One is to write the bulk of the ASL like seen here, statically, but all > the customizable values are referenced as external objects / fields. > Then, a platform ACPI DXE driver in the firmware computes those values, > and installs a small SSDT with just those objects. The AML is generated > manually by the firmware, which is super awkward, but due to the small > size of the integer objects etc, it is tolerable. > > A similar approach can be seen e.g. in "OvmfPkg/AcpiPlatformDxe/Qemu.c", > function QemuInstallAcpiSsdtTable(). And the referring ASL code is in > "OvmfPkg/AcpiTables/Dsdt.asl". (Search both for "FWDT".) > > (Note however that said function is not used nowadays on QEMU, because > now QEMU generates *all* of the AML dynamically.) > > The other approach is to process the (static) AML before installing it > with EFI_ACPI_TABLE_PROTOCOL.InstallAcpiTable(). If you know the exact > path to / structure of the AML node that you want to modify, the > EFI_ACPI_SDT_PROTOCOL lets you navigate to the node, and patch it > in-place, in a memory array. Then you can install the modified table > blob with EFI_ACPI_TABLE_PROTOCOL. (Important: do not modify a table > *after* it is installed.) > > One example for the 2nd approach should be > "QuarkPlatformPkg/Acpi/Dxe/AcpiPlatform/AcpiPciUpdate.c". > > Thanks > Laszlo >