From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) (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 2F027391E79 for ; Sat, 11 Apr 2026 15:36:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775921766; cv=none; b=f0D3xxIsstA7ouZbTKdBa2unvRKAdv/ej+N2+WqCCVJpdSP0EFqOx7SjgoEy/LvOXpK0YP6BjrnQt6idOqKdKXfiviOpMdKyqSQD2stRwb5ILtSz4B9xbRO2xTQ6ut7t4XaQI5r6M1023N2YW78yeNIjFSgVPegwL6MFW66KWzU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775921766; c=relaxed/simple; bh=4T+wbjuxt/NfO+636mWwscgmMU+9T4Op5jh7s8QiU6o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bB3HqzDwfvas/coONvjgB3MptSWo7IIlhdPYE/PDvsicRrf7mI9wQ3etZsVx+iq6f0Xih+B0iwCSdMbXPqqYL4D+hFg5G/SvNiB5N1Q2kmajJ0GMEm6SxaQK+Ta2ul1COiyX2HrquC2ieYuS4MkkvyXauYc5JnTFaP4wuWSgR88= 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=Y4rtHIXE; arc=none smtp.client-ip=91.218.175.188 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="Y4rtHIXE" 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=1775921763; 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=FX1pQzkq7EBKF9JhGCGmVL4fRsJY8Zu3wS34kF3lZHQ=; b=Y4rtHIXEYVUtuAov0vpg9q2kkyvUtBkZvBhgxlombfWJc4E7wLDDcxaRgKF6KIWhJq2idD 3WdP0kYfP09MxlCuG86RU9IEXU+W9flnoVcy2uazgbhR2yx0ggrRm1wN4UqZG0TVIUFamW ZgiW+MqDVoTI4T670wabD+iIcrRX7zw= 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 2/2] x86/boot: use BASE_BAUD and DEFAULT_SERIAL_PORT Date: Sat, 11 Apr 2026 17:34:51 +0200 Message-ID: <20260411153449.69384-6-thorsten.blum@linux.dev> In-Reply-To: <20260411153449.69384-4-thorsten.blum@linux.dev> References: <20260411153449.69384-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=1377; i=thorsten.blum@linux.dev; h=from:subject; bh=4T+wbjuxt/NfO+636mWwscgmMU+9T4Op5jh7s8QiU6o=; b=owGbwMvMwCUWt7pQ4caZUj3G02pJDJm3shQymO8c939re9VUXMVjuW7QmiNBuv/vT+Dv7Eliu tz/7KNARykLgxgXg6yYIsuDWT9m+JbWVG4yidgJM4eVCWQIAxenAEzkYgbD/9zNEku+/mNU+q0s d3idfXzPN9fl8vNVY/8fyag8pn+Tl5uRYfGFQ8ZrLouuWDhbdLaupMgO3cCMDTqhu2ZncElm9d/ vYwEA 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 fe0c8c1022f4..420f50f3bd1e 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] == ',')