From patchwork Tue Jun 13 08:34:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Lagerwall X-Patchwork-Id: 9783329 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 334D3602DC for ; Tue, 13 Jun 2017 08:36:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2419028651 for ; Tue, 13 Jun 2017 08:36:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18CEA2866B; Tue, 13 Jun 2017 08:36:59 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3F83E28651 for ; Tue, 13 Jun 2017 08:36:57 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKhHh-0003Kv-JZ; Tue, 13 Jun 2017 08:34:45 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKhHf-0003Kp-Tu for xen-devel@lists.xen.org; Tue, 13 Jun 2017 08:34:44 +0000 Received: from [193.109.254.147] by server-9.bemta-6.messagelabs.com id 3D/A2-03557-3A3AF395; Tue, 13 Jun 2017 08:34:43 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrLLMWRWlGSWpSXmKPExsXitHSDve6ixfa RBkvuG1ss+biYxYHR4+ju30wBjFGsmXlJ+RUJrBmzJ81jKejnrJg/8TpTA+MR9i5GTg4JAX+J dasfMILYbAIGErcufWcGsUUEZCVWd80BquHiYBZYzChx88NlsCJhAXuJF+s/M4HYLAKqEl8vn AFq4ODgFbCV+HgoGGKmnMTS7dfB5ggJqEm8XX6GBcTmFRCUODnzCZjNLCAhcfDFC+YJjNyzkK RmIUktYGRaxahRnFpUllqka2ykl1SUmZ5RkpuYmaNraGCml5taXJyYnpqTmFSsl5yfu4kRGAw MQLCD8fS6wEOMkhxMSqK8W67YRArxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4N21yD5SSLAoNT21 Ii0zBxiWMGkJDh4lEV6JDqA0b3FBYm5xZjpE6hSjopQ4bztInwBIIqM0D64NFguXGGWlhHkZg Q4R4ilILcrNLEGVf8UozsGoJMz7DWQKT2ZeCdz0V0CLmYAWXwe5mbe4JBEhJdXAOOvxDOPvHZ e2X9A/UX9zWc5+RdlFbOEHrsduOZhVdPLEQjOzBbFTZr7sy05a17//902/j0EFpf+P996ZJjI lot+8/diaOwIHl09yjjuYsUeyzq5o1QdvWebote4Lc0+KZ+Ts3tbV9Ex82f6X93iXeh/e37vD +qpscqvaXg1N568VTIunfGG5I6rEUpyRaKjFXFScCACwCEoDgAIAAA== X-Env-Sender: prvs=3301d63ee=ross.lagerwall@citrix.com X-Msg-Ref: server-6.tower-27.messagelabs.com!1497342881!107562170!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 55263 invoked from network); 13 Jun 2017 08:34:42 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-6.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 13 Jun 2017 08:34:42 -0000 X-IronPort-AV: E=Sophos;i="5.39,337,1493683200"; d="scan'208";a="436162414" From: Ross Lagerwall To: Date: Tue, 13 Jun 2017 09:34:32 +0100 Message-ID: <20170613083432.5418-1-ross.lagerwall@citrix.com> X-Mailer: git-send-email 2.9.4 MIME-Version: 1.0 Cc: Ross Lagerwall , Ian Jackson , Wei Liu , Andrew Cooper Subject: [Xen-devel] [PATCH] rombios/ata: Wait for BSY to clear after write X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP After rombios transfers the data for a write, it checks the status and fails if BSY is set. qemu-trad doesn't set BSY for PIO writes, but QEMU upstream does, and this causes rombios to fail writes because they are marked as BSY. Instead, wait for BSY to clear after a write. INT 13 writes are probably rarely used these days, but they are used by GRUB 2 to write to its environment file which happens by default on Ubuntu. Signed-off-by: Ross Lagerwall Acked-by: Andrew Cooper --- tools/firmware/rombios/rombios.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/firmware/rombios/rombios.c b/tools/firmware/rombios/rombios.c index 58ace9b..51558ee 100644 --- a/tools/firmware/rombios/rombios.c +++ b/tools/firmware/rombios/rombios.c @@ -3226,7 +3226,7 @@ ASM_END current++; write_word(ebda_seg, &EbdaData->ata.trsfsectors,current); count--; - status = inb(iobase1 + ATA_CB_STAT); + status = await_ide(NOT_BSY, iobase1, IDE_TIMEOUT); if (count == 0) { if ( (status & (ATA_CB_STAT_BSY | ATA_CB_STAT_RDY | ATA_CB_STAT_DF | ATA_CB_STAT_DRQ | ATA_CB_STAT_ERR) ) != ATA_CB_STAT_RDY ) {