Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D3BDDC001B0 for ; Sun, 23 Jul 2023 04:41:40 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 70C19867B2; Sun, 23 Jul 2023 06:41:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=tinylab.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id F40BF86663; Sun, 23 Jul 2023 06:41:09 +0200 (CEST) Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.221.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AC24C865B5 for ; Sun, 23 Jul 2023 06:41:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=tinylab.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng@tinylab.org X-QQ-mid: bizesmtp84t1690087256tyjdfepw Received: from ubuntu.. ( [111.196.130.174]) by bizesmtp.qq.com (ESMTP) with id ; Sun, 23 Jul 2023 12:40:55 +0800 (CST) X-QQ-SSF: 01200000000000F0H000000A0000000 X-QQ-FEAT: hTFdq+IbOf9vhgv9tdMB1SvgjAx7NG0D4ivZrI9GnB7zT9y+6BgrSi6B06mCt eA6OImFPtH+mW+PnzlTVzCARAog+m8GFe/BrznIVP68zhTAGHM6D/aE2l9TPhbo1jajM8dN SjjqOUF4Vjn4RA50ChUGnNrXDNgu36ktkxLo1TIFuac1gpdxSA8+pwHE3XVbOXpznBzeeC4 DfuDmhPj5/iC56sWczCqxOXINdUqCxaW6fql4fBkFp3QVa4kc70HPN23Lpe2P3OID8Un7nT /HzDxleSF4HJItQG8C3xqSPIuHzY27S5pws/rNFaFG2YT9GOVprdM1lJYADR/ocUtWH920z qa17/VVyRYLM7fzOJes1aQMaXZx7tJiALholKKDCH4ulp1XBGw= X-QQ-GoodBg: 0 X-BIZMAIL-ID: 7170979734585308954 From: Bin Meng To: Simon Glass , u-boot@lists.denx.de Cc: Anatolij Gustschin Subject: [PATCH 04/18] video: bochs: Avoid using IO instructions to access VGA IO port Date: Sun, 23 Jul 2023 12:40:27 +0800 Message-Id: <20230723044041.1089804-5-bmeng@tinylab.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230723044041.1089804-1-bmeng@tinylab.org> References: <20230723044041.1089804-1-bmeng@tinylab.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz7a-0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean At present the driver uses IO instructions to access the legacy VGA IO ports, which unfortunately limits the driver to work only on x86. It turns out the IO instruction is not necessary as Bochs VGA card remaps the legacy VGA IO ports (0x3c0 -> 0x3df) to its memory mapped register space from offset 0x400. Update the driver to use MMIO access for VGA IO port. Signed-off-by: Bin Meng --- drivers/video/bochs.c | 6 +++--- drivers/video/bochs.h | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/video/bochs.c b/drivers/video/bochs.c index 2d4526c714..5923ff81c6 100644 --- a/drivers/video/bochs.c +++ b/drivers/video/bochs.c @@ -27,9 +27,9 @@ static int bochs_read(void *mmio, int index) return readw(mmio + MMIO_BASE + index * 2); } -static void bochs_vga_write(uint8_t val) +static void bochs_vga_write(void *mmio, int index, uint8_t val) { - outb(val, VGA_ATT_W); + writeb(val, mmio + VGA_BASE + index); } static int bochs_init_fb(struct udevice *dev) @@ -79,7 +79,7 @@ static int bochs_init_fb(struct udevice *dev) bochs_write(mmio, INDEX_ENABLE, ENABLED | LFB_ENABLED); /* disable blanking */ - bochs_vga_write(VGA_AR_ENABLE_DISPLAY); + bochs_vga_write(mmio, VGA_ATT_W - VGA_INDEX, VGA_AR_ENABLE_DISPLAY); plat->base = fb; diff --git a/drivers/video/bochs.h b/drivers/video/bochs.h index 71d3d60141..3facf690e5 100644 --- a/drivers/video/bochs.h +++ b/drivers/video/bochs.h @@ -11,9 +11,6 @@ #define VGA_ATT_W 0x3c0 #define VGA_AR_ENABLE_DISPLAY 0x20 -#define IOPORT_INDEX 0x01ce -#define IOPORT_DATA 0x01cf - enum { INDEX_ID, INDEX_XRES, @@ -34,6 +31,7 @@ enum { #define LFB_ENABLED BIT(6) #define NOCLEARMEM BIT(7) +#define VGA_BASE 0x400 #define MMIO_BASE 0x500 #endif -- 2.34.1