From nobody Sat Dec 21 16:05:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=koconnor.net Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 171208306215983.6551801102654; Tue, 2 Apr 2024 11:37:42 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 8D88F21AB3; Tue, 2 Apr 2024 18:37:37 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 3291E21CD3 for ; Tue, 2 Apr 2024 18:37:20 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) for ; Tue, 02 Apr 2024 11:37:19 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.gmail.com with ESMTPSA id z20-20020a056214041400b00698f01a958asm4734112qvx.77.2024.04.02.11.37.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 11:37:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=koconnor.net; s=google; t=1712083039; x=1712687839; darn=seabios.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=WGtSxR9fDboNQKiL9m7O5U3YF4ERyGxkwRzyzeSVbos=; b=N/iZffOZEiJsA+tqG9As2fuGftHqVzEsrz+MzS83p6WqlT/S8B73/gGvXO366QOBkA BYIeyBOEpvEmwVyUQAirWPkggdiL6bGdxevj6bSdBylGSfEr+O/EwI5R+yblMqvl823n fpCPDQ+v0rXejDdp11NAEQE+vYvjKvUQh8Tqo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712083039; x=1712687839; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WGtSxR9fDboNQKiL9m7O5U3YF4ERyGxkwRzyzeSVbos=; b=W3vCfb46CiZasuiPLskr4qqlkp4sI66AD5nl9+bGa04uyk2ovsBIDPw2DeLmbdG2Xq Q0qOO1gbNsU6bER0SX6MjqQg+D2KPmfowCotqwC0tfO7cMnHlu6BiM2PSGCM38g0S2Mm oqqNqd7eTtUAoHChivn0K3idg3i89fQEZlJ/yxhqc0YMdOLsqrvZVis/v7Qc26Q/Dy53 EEsPibGIgRovFl8DrYezo1iEiaEXLk75wFKjpKlqKZhvvcBKMtDjWJ+/H7RMf2kdD5zf 23zklVrPBU+bov5Kza6MKkK92slB2tFU74OegIAMt3YxL78oZEPO2FSATvQm8XOKkM74 itJw== X-Gm-Message-State: AOJu0YzcGI3LD4QA18tCDoRMAFU5NN+v5thwRAc5K+ptkRwbTtBg1DLH OScCVcn5bYLJeu1A5Xf0/FEY+KvwOioh+Ij+tfkX6tGXZP8gjaxmtU58plHSXPdQrlHSqN9xpj1 A X-Google-Smtp-Source: AGHT+IE7ZdUo9/b516of0IBhtA2401rsgweXU9gv4wZ1KYbw3jgl861ZdmasTYZXUM5QEm8k1Fgueg== X-Received: by 2002:ad4:5490:0:b0:699:1b90:5aad with SMTP id pv16-20020ad45490000000b006991b905aadmr2313396qvb.29.1712083038955; Tue, 02 Apr 2024 11:37:18 -0700 (PDT) From: Kevin O'Connor To: seabios@seabios.org Date: Tue, 2 Apr 2024 14:35:05 -0400 Message-ID: <20240402183715.941665-1-kevin@koconnor.net> MIME-Version: 1.0 Message-ID-Hash: O6IBMZHTMJQKHXSJA4F7CC7MKZNZLNJ7 X-Message-ID-Hash: O6IBMZHTMJQKHXSJA4F7CC7MKZNZLNJ7 X-MailFrom: kevin@koconnor.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [SeaBIOS] [PATCH] stdvga: Add stdvga_set_vertical_size() helper function List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: / X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1712083063963100001 Content-Type: text/plain; charset="utf-8" Add helper function and update the bochsvga.c code to use it. This emphasizes the relationship between stdvga_get_vertical_size() and stdvga_set_vertical_size() code. Signed-off-by: Kevin O'Connor -- This patch is on top of the recent "Improve comments in stdvga.c" series. -Kevin --- vgasrc/bochsvga.c | 8 +------- vgasrc/stdvga.c | 11 +++++++++++ vgasrc/stdvga.h | 1 + 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/vgasrc/bochsvga.c b/vgasrc/bochsvga.c index ab8f25e..3ef0f18 100644 --- a/vgasrc/bochsvga.c +++ b/vgasrc/bochsvga.c @@ -275,13 +275,7 @@ bochsvga_set_mode(struct vgamode_s *vmode_g, int flags) stdvga_crtc_write(crtc_addr, 0x11, 0x00); stdvga_crtc_write(crtc_addr, 0x01, width / 8 - 1); stdvga_set_linelength(vmode_g, width); - stdvga_crtc_write(crtc_addr, 0x12, height - 1); - u8 v =3D 0; - if ((height - 1) & 0x0100) - v |=3D 0x02; - if ((height - 1) & 0x0200) - v |=3D 0x40; - stdvga_crtc_mask(crtc_addr, 0x07, 0x42, v); + stdvga_set_vertical_size(height); =20 stdvga_crtc_write(crtc_addr, 0x09, 0x00); stdvga_crtc_mask(crtc_addr, 0x17, 0x00, 0x03); diff --git a/vgasrc/stdvga.c b/vgasrc/stdvga.c index 4bfa101..afe26db 100644 --- a/vgasrc/stdvga.c +++ b/vgasrc/stdvga.c @@ -286,6 +286,17 @@ stdvga_get_vertical_size(void) return vde + 1; } =20 +// Set vertical screen size (number of horizontal lines in the display) +void +stdvga_set_vertical_size(int lines) +{ + u16 crtc_addr =3D stdvga_get_crtc(); + u16 vde =3D lines - 1; + stdvga_crtc_write(crtc_addr, 0x12, vde); + u8 ovl =3D ((vde >> 7) & 0x02) + ((vde >> 3) & 0x40); + stdvga_crtc_mask(crtc_addr, 0x07, 0x42, ovl); +} + // Get offset into framebuffer accessible from real-mode 64K segment int stdvga_get_window(struct vgamode_s *curmode_g, int window) diff --git a/vgasrc/stdvga.h b/vgasrc/stdvga.h index 1828585..ce5a80a 100644 --- a/vgasrc/stdvga.h +++ b/vgasrc/stdvga.h @@ -67,6 +67,7 @@ void stdvga_set_cursor_shape(u16 cursor_type); void stdvga_set_cursor_pos(int address); void stdvga_set_character_height(u8 lines); u16 stdvga_get_vertical_size(void); +void stdvga_set_vertical_size(int lines); int stdvga_get_window(struct vgamode_s *curmode_g, int window); int stdvga_set_window(struct vgamode_s *curmode_g, int window, int val); int stdvga_minimum_linelength(struct vgamode_s *vmode_g); --=20 2.44.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org