From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by mx.groups.io with SMTP id smtpd.web11.1751.1677028934345565902 for ; Tue, 21 Feb 2023 17:22:14 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Jw3274SU; spf=pass (domain: gmail.com, ip: 209.85.210.180, mailfrom: pedro.falcato@gmail.com) Received: by mail-pf1-f180.google.com with SMTP id u20so827203pfm.7 for ; Tue, 21 Feb 2023 17:22:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=tC0WJL9uZJTRLmXeVnI6DjeUAJj8Hf9n9iEyMKOtV5c=; b=Jw3274SUZtj20pYQwxgR9g9eVDgSvCm3/2xW0Fa+PR8YYF0L5deCJ3SarizBJtIpyD XSG3XmtYjauahXIRm2yUwpkd6MpGZn5dF3UHurO4o3a+UwXPKmvC+G+yS3ZW7JcZoDtN 5MZQLccxZRyNxPZJN7AfsP+1D7fD5JoXBsKxYxDy5se77U+SH/BhM9gvsvTMqPIOBeHo V+8OF4a4zli/ne13Q87NIEQIi+JnS/nhpUXtWRt2jkgt8wY6byzBHMl11AN/PWqyfgBQ /SV51vAyHeVJ1LglRSEmOD8FlunFHPOro/taZm6/sEzJXVWoEo/s3MsHvMFeOEQ1sEn9 XoJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tC0WJL9uZJTRLmXeVnI6DjeUAJj8Hf9n9iEyMKOtV5c=; b=oN4aKEgneDJLGEOBC1eWmgDY7RDBGZ13gjri059KlGnupzGWYYQrE6jBNH2f2F8Snv YfdXHZ5QTlt7EyscBhRGw7GS8zwaBqj6L1hjPaEfqogtSG0AgSrsYkvWllUJ3M4wQdJO r1XW4hfoMXc95wk8v8NWdXIc3KjybmYP5ekfD+FSGpfr7YMpP6U69UjTcj4JF7Hkf2v2 A3hmVBsbfPa0TbO42X1cr6zmPbilaKbvaN7iLBA6TBaaAPePQ6y6qBakAiF5xSL/OWcB kOMGjiWCwj3FrRACcW+XA8iVbLqeVUzWLPkQYF6i5fDdLRwoJVRWz5iMEKM/C3nLi/2p NaEQ== X-Gm-Message-State: AO0yUKWOLzjkWDwQTlfuH04G1bXiJchmPGuQB64yG+sFqvWFsrt9VsLv ejdn4gZVVUNz9Mzg2n/pViGaN1YHAMIZZR+NxJ8= X-Google-Smtp-Source: AK7set9tMd53cfmzEfVxeYQMvF04ug5YD8HbWZNRGkSCZAxV9y1I+lNxdJyjaZKbLUVIeUyCiAsUaF0dMU4E9tHmHI0= X-Received: by 2002:a62:878d:0:b0:5a9:4af:b05c with SMTP id i135-20020a62878d000000b005a904afb05cmr1092370pfe.56.1677028933598; Tue, 21 Feb 2023 17:22:13 -0800 (PST) MIME-Version: 1.0 References: <153cddfb.10e9.183a7eb0792.Coremail.yoshinoyatoko@163.com> <74daa6ed.1623.184553d61a8.Coremail.yoshinoyatoko@163.com> <229C72F3-0994-425F-8D89-B3CB3ACCA8CE@apple.com> <2ee1fd81.20a.1866204f2cb.Coremail.yoshinoyatoko@163.com> In-Reply-To: From: "Pedro Falcato" Date: Wed, 22 Feb 2023 01:22:02 +0000 Message-ID: Subject: Re: [edk2-devel] PciBus scan: Does it support scan from EndBusNum to StartBusNum? To: "Tiger Liu(BJ-RD)" Cc: "devel@edk2.groups.io" , "yoshinoyatoko@163.com" Content-Type: text/plain; charset="UTF-8" On Wed, Feb 22, 2023 at 1:10 AM Tiger Liu(BJ-RD) wrote: > > Hi, Pedro: > Thanks for your reply! > > For example: > There are 4 root bridges in a server motherboard, named them as : RP-A / RP-B / RP-C / RP-D > RP-A : PCI Bus num range is 0 ~0x40 (hardware pre-configured) > RP-B : PCI Bus num range is 0x40 ~0x80 (hardware pre-configured) > RP-C : PCI Bus num range is 0x80 ~0xA0 (hardware pre-configured) > RP-D : PCI Bus num range is 0xA0 ~0xE0 (hardware pre-configured) > > Usually, we create pci root bridge instances with sequence RP-A / RP-B / RP-C / RP-D. > So, Pci bus driver scan pci root bridge sequence is RP-A/RP-B/RP-C/RP-D. > > So, could I rewrite pci root bridge driver with different root bridge report sequence? > For example: > I let pci root bridge driver create RP-D's pci root bridge io protocol first, and then RP-C / RP-B / RP-A, and so pci bus briver could scan RP-D's pci bus range first? Hi, >>From a brief look at MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c, it does seem that it should enumerate in the order the root bridges were given by PciHostBridgeGetRootBridges. I don't know if this reflects your internal code. If so, I would try just swapping the bridges in your PciHostBridgeGetRootBridges implementation. Although since I'm lacking details, I'll assume you really shouldn't do this? I'm failing to see what purpose this can have, apart from some other code that needs to be fixed. -- Pedro