From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-179.mta1.migadu.com (out-179.mta1.migadu.com [95.215.58.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 045264963C8 for ; Wed, 13 May 2026 16:50:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778691021; cv=none; b=RItJlZszgxOTxt6ull9vnqD9XO3RVGjJnAln7KzvZMIZDYF6u1HdO+4HqdYJ1Fn9TXGYv4mEea/sqgYTa7ZtfuTyKyx5tnrAlKxr4m0Bk3iTUuk5kM705PC3C0MyE5KcoWCVmtqutjvFADsvED7uuhAGJ4UlomLwNloIerz6vTY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778691021; c=relaxed/simple; bh=SiEGwThJCgYTyVb/WdTuYDUJ5tloYtK8F92XNKbWMds=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tLk3489upVDn8IBJT9czuktaaKdaCaiHynZC2RsR+I1Q5jIfL0pU3umA03cBgSUsVnt9i2L6pjgDd4bCOwBW0Imlw3ugt1RhEwo/O/bTeWvcrQltTZMhAaEw/3hEBlr5K5O7din1kubVbrZMBHX+32fKVTozugjWUWISnNW6dL4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=W6VtdmqQ; arc=none smtp.client-ip=95.215.58.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="W6VtdmqQ" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1778691012; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Zn1OpjkhjXzfjJrlisV+xrxyqVhBlH/fEafcGeiQgpE=; b=W6VtdmqQA6gTDZFOhu0RSesTf1Dznw7uUBLLYYGSWEXI3EFw3PDZzM+TC4+4E4MPBumfgW xJAOfLwmZVDIcTGWa4MY9RYihQdrROIlOzZ7bZq/v2+ctGUJYn7FVgAW/zr8wkpRRNkTjB K5OV8N1iMLxINONcifvygZ3993PZKkE= From: Thorsten Blum To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" Cc: Thorsten Blum , linux-kernel@vger.kernel.org Subject: [PATCH RESEND 2/2] x86/boot: use BASE_BAUD and DEFAULT_SERIAL_PORT Date: Wed, 13 May 2026 18:48:46 +0200 Message-ID: <20260513164844.449910-5-thorsten.blum@linux.dev> In-Reply-To: <20260513164844.449910-4-thorsten.blum@linux.dev> References: <20260513164844.449910-4-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1373; i=thorsten.blum@linux.dev; h=from:subject; bh=SiEGwThJCgYTyVb/WdTuYDUJ5tloYtK8F92XNKbWMds=; b=owGbwMvMwCUWt7pQ4caZUj3G02pJDFksqytTw/KKtGUqs6XYj6us+/e8W5V5kXbBubn9ezdce THlmpReRykLgxgXg6yYIsuDWT9m+JbWVG4yidgJM4eVCWQIAxenAEzkcgrD/4RpJ+V2rDp9r+XK eiuhdza5zVdYynrk8tS1N08sXMX6TYuRYeXKY7Gny6S/FBv9kjJILfruz2FbWVJjMuf0nVo3sWc TOQE= X-Developer-Key: i=thorsten.blum@linux.dev; a=openpgp; fpr=1D60735E8AEF3BE473B69D84733678FD8DFEEAD4 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Replace the hard-coded divisor and ttyS0 port with the existing BASE_BAUD and DEFAULT_SERIAL_PORT macros. In parse_earlyprintk(), assign port directly and drop the redundant index variable as well as the bases array to simplify the code. Signed-off-by: Thorsten Blum --- arch/x86/boot/early_serial_console.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/arch/x86/boot/early_serial_console.c b/arch/x86/boot/early_serial_console.c index ad12b377cce0..aca62801f614 100644 --- a/arch/x86/boot/early_serial_console.c +++ b/arch/x86/boot/early_serial_console.c @@ -34,7 +34,7 @@ static void early_serial_init(int port, int baud) outb(0, port + FCR); /* no fifo */ outb(0x3, port + MCR); /* DTR + RTS */ - divisor = 115200 / baud; + divisor = BASE_BAUD / baud; c = inb(port + LCR); outb(c | DLAB, port + LCR); outb(divisor & 0xff, port + DLL); @@ -75,16 +75,13 @@ static void parse_earlyprintk(void) else pos = e - arg; } else if (!strncmp(arg + pos, "ttyS", 4)) { - static const int bases[] = { 0x3f8, 0x2f8 }; - int idx = 0; - /* += strlen("ttyS"); */ pos += 4; if (arg[pos++] == '1') - idx = 1; - - port = bases[idx]; + port = 0x2f8; /* ttyS1 */ + else + port = DEFAULT_SERIAL_PORT; } if (arg[pos] == ',')