From nobody Thu May 2 03:31:22 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1579232750; cv=none; d=zohomail.com; s=zohoarc; b=SPh/+hPUws/9MeM9qg48nlspc0xhfd6ebooCR7ZvGwMTq234HJGdHc7VgomVGzsbkO0kc71MZI5FVjSbT/8cie1uxVhdelw+dan4g6AosZ7MR/0uUzNOcVdSpSqCairudb2fLlLJuC24EQ0DIAqKdIr2ApY2lOWJy73DnmuLrjw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579232750; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=zr78V70sMNw720oGKJiO88/a15oQp7OZ1xjBSnNMVW4=; b=iSC7RhYEEBp+t/rsvYTIlruwavnjRaGrvSkWyj2RdoPLfe8T8n7vHbqDrQRE3MAP8iwgJPbzdiqATAvG0p0ZJbzlWeIP17FoL/7cTcmUMkI6ZlhBB8WhnMo/atBpMoCtsUSw4LWczuxl4T6Py8/vjePLM7MTPg7bOUkTFHKqfaA= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1579232750250802.0455365057918; Thu, 16 Jan 2020 19:45:50 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1isIZ2-00015a-Bp; Fri, 17 Jan 2020 03:44:52 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1isIZ0-00015V-Gs for xen-devel@lists.xenproject.org; Fri, 17 Jan 2020 03:44:50 +0000 Received: from huawei.com (unknown [45.249.212.32]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id af6708f4-38db-11ea-b89f-bc764e2007e4; Fri, 17 Jan 2020 03:44:39 +0000 (UTC) Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 057E82E1E6815E486D0C; Fri, 17 Jan 2020 11:44:37 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.439.0; Fri, 17 Jan 2020 11:44:28 +0800 X-Inumbo-ID: af6708f4-38db-11ea-b89f-bc764e2007e4 From: Wei Xu To: , , Andrew Cooper , George Dunlap , "Ian Jackson" , Jan Beulich , "Konrad Rzeszutek Wilk" , Wei Liu , Date: Fri, 17 Jan 2020 11:40:58 +0800 Message-ID: <1579232458-26803-1-git-send-email-xuwei5@hisilicon.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Subject: [Xen-devel] [PATCH] ns16550: Add ACPI support X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: prime.zeng@hisilicon.com, shameerali.kolothum.thodi@huawei.com, xuwei5@hisilicon.com, linuxarm@huawei.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Parse the ACPI SPCR table and initialize the 16550 compatible serial port. Signed-off-by: Wei Xu --- xen/drivers/char/ns16550.c | 55 ++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 55 insertions(+) diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index aa87c57..eb32891 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -1620,6 +1620,61 @@ DT_DEVICE_START(ns16550, "NS16550 UART", DEVICE_SERI= AL) DT_DEVICE_END =20 #endif /* HAS_DEVICE_TREE */ + +#ifdef CONFIG_ACPI +#include + +static int __init ns16550_acpi_uart_init(const void *data) +{ + struct acpi_table_spcr *spcr =3D NULL; + acpi_status status; + struct ns16550 *uart; + + status =3D acpi_get_table(ACPI_SIG_SPCR, 0, + (struct acpi_table_header **)&spcr); + + if ( ACPI_FAILURE(status) ) + { + printk("ns16550: Failed to get SPCR table\n"); + return -EINVAL; + } + + uart =3D &ns16550_com[0]; + + ns16550_init_common(uart); + + uart->baud =3D BAUD_AUTO; + uart->data_bits =3D 8; + uart->parity =3D spcr->parity; + uart->stop_bits =3D spcr->stop_bits; + uart->io_base =3D spcr->serial_port.address; + uart->io_size =3D 8; + uart->reg_shift =3D spcr->serial_port.bit_offset; + uart->reg_width =3D 1; + + /* trigger/polarity information is not available in spcr */ + irq_set_type(spcr->interrupt, IRQ_TYPE_LEVEL_HIGH); + uart->irq =3D spcr->interrupt; + + uart->vuart.base_addr =3D uart->io_base; + uart->vuart.size =3D uart->io_size; + uart->vuart.data_off =3D UART_THR << uart->reg_shift; + uart->vuart.status_off =3D UART_LSR << uart->reg_shift; + uart->vuart.status =3D UART_LSR_THRE | UART_LSR_TEMT; + + /* Register with generic serial driver. */ + serial_register_uart(uart - ns16550_com, &ns16550_driver, uart); + + return 0; +} + +ACPI_DEVICE_START(ans16550, "NS16550 UART", DEVICE_SERIAL) + .class_type =3D ACPI_DBG2_16550_COMPATIBLE, + .init =3D ns16550_acpi_uart_init, +ACPI_DEVICE_END + +#endif /* CONFIG_ACPI */ + /* * Local variables: * mode: C --=20 2.8.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel