From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::632; helo=mail-pl1-x632.google.com; envelope-from=bcr@google.com; receiver=edk2-devel@lists.01.org Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) (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 4DE4821A09130 for ; Wed, 21 Nov 2018 16:07:10 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id b22-v6so7707051pls.7 for ; Wed, 21 Nov 2018 16:07:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=dSg2PNsZ1MYopTGoUO3DIyRtUERhbDY02EMwPkbKd8E=; b=SmFlSec08kJ6A7v4pyW94hileVa032dQsYWDtaBXR9Qcf99fsH8D6G4vqesDiJMvNo JhCy0YwW2ZjyYMtuQafVUBx+E9fNg/yMe3+WAeby3dO27/NVChT5DGg+cJeI+p222u0R d/F+WPH6nsQWTmyi5Xy/BgO+4RX4FlmecOnutSZKQGfkGepJUdY8z8HLnTkO0djs+/up XFBiPRPIr1JyvY4LoDhlL1WuRZoMJDtQNs+khNWxRnTjGO7uoDfA4KPjLAtF0Zi8JHRC GKSH6ZVzVOMRkPM9PEeq9NoEtyBE0eQ4GHuyNBXgT58jeeDvKdmafqR7rRtQHNa+8lC3 CsfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=dSg2PNsZ1MYopTGoUO3DIyRtUERhbDY02EMwPkbKd8E=; b=M/DBbCy1yjYIlKFEOZ8ZUOgowc7tbFbl5KFDdZ5F1JpJncv/6Wd1UjW/6rgncqbCMZ xvwWuXA0ooZmuhZBlaSYp6BAyqee2JS+lQSeWM8aJdm0qFundYuT9As9hiNk4TRO2NdW 7Y5ux23Pxd1h0q7iPEg6HRadN5DT1CqJphuYvqa+JNqY2xBQMNxTIpZzjxkAnqem3LzZ vroigQF/NR8DlAs2ThfvQ2aJak6UHmNJQD3PFvOelPS/Wub7OegVvDjIl1rdf9eotSds y3M6O43HHLf7OOgIGk6DJIZ1wJd/EfiFJ19/nm06P+J4gKBAjHp5T1/gEiOw/TxM+0Mt CQSA== X-Gm-Message-State: AA+aEWYMfryiTGN+svxOjaEd086/hcHFY2QXXoWIgNvq7W131IGTlFIK g6wiUENpUqpGVX/76f9NBESSxieVg5nYxNW86Bj6WsV61W9/ZA== X-Google-Smtp-Source: AFSGD/U9lfZhfWp4HG09l0EcP55KNhfaUGnd4Ev4VVZp9cz2Ue11RuhNOFdzhvhT0X3sy8eLxQqiQALRx8CHR38HE+w= X-Received: by 2002:a17:902:7e44:: with SMTP id a4mr8956609pln.338.1542845229195; Wed, 21 Nov 2018 16:07:09 -0800 (PST) MIME-Version: 1.0 From: Bryan Rosario Date: Wed, 21 Nov 2018 16:06:58 -0800 Message-ID: To: edk2-devel@lists.01.org Cc: Alain Gefflaut X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Hardcoded IDE Controller B/D/F (0/1/1) in BdsPlatform.c? X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Nov 2018 00:07:10 -0000 Content-Type: text/plain; charset="UTF-8" Hi all, I noticed that there is apparently a hardcoded B/D/F for an IDE Controller in BdsPlatform.c, when setting bit 15 of a particular register: https://github.com/tianocore/edk2/blob/14923c1a6bf9940b48feeaf47cb5d6c662b6528c/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c#L1612-L1617 . Why is this hardcoded? Is it just old code that has hung around? I noticed that this code is from this commit, and the surrounding code at the time had lots of hardcoded B/D/Fs: https://github.com/tianocore/edk2/commit/40f2c454343be84ab3bacf9955cc8d7842c70b5c . The context of this question is that I'm trying to make this work in a configuration with an IDE Controller located at a different B/D/F, and so the hardcoded value of 0/1/1 doesn't work for me. If I want to change this so that it's not hardcoded, what is a good approach? I've added some code locally to the IdeInitSetTiming function in SataController.c to set the bit using the PciIo structure which is opened specifically on the controller in question -- does that sound like the right approach? Link to the function I'm referring to: https://github.com/tianocore/edk2/blob/f6b0258d25a63ae3d3bc6430abe30fb625abc52a/OvmfPkg/SataControllerDxe/SataController.c#L1091-L1099 Thanks, Bryan