Message ID | 1453540813-15764-20-git-send-email-zhaoshenglong@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
>>> On 23.01.16 at 10:20, <zhaoshenglong@huawei.com> wrote: > --- a/xen/include/acpi/actbl2.h > +++ b/xen/include/acpi/actbl2.h > @@ -815,6 +815,15 @@ struct acpi_table_spcr { > > #define ACPI_SPCR_DO_NOT_DISABLE (1) > > +/* SPCR Interface type */ > +#define ACPI_SPCR_TYPE_16550 0 > +#define ACPI_SPCR_TYPE_16550_SUB 0x1 > +#define ACPI_SPCR_TYPE_PL011 0x3 > +#define ACPI_SPCR_TYPE_SBSA_32 0xd > +#define ACPI_SPCR_TYPE_SBSA 0xe > +#define ACPI_SPCR_TYPE_DCC 0xf > +#define ACPI_SPCR_TYPE_BCM2835 0x10 It seems very likely to me that this part of the change actually would have a Linux counterpart, in which case it should be submitted as such. Jan
On 2016/1/25 23:05, Jan Beulich wrote: >>>> On 23.01.16 at 10:20, <zhaoshenglong@huawei.com> wrote: >> --- a/xen/include/acpi/actbl2.h >> +++ b/xen/include/acpi/actbl2.h >> @@ -815,6 +815,15 @@ struct acpi_table_spcr { >> >> #define ACPI_SPCR_DO_NOT_DISABLE (1) >> >> +/* SPCR Interface type */ >> +#define ACPI_SPCR_TYPE_16550 0 >> +#define ACPI_SPCR_TYPE_16550_SUB 0x1 >> +#define ACPI_SPCR_TYPE_PL011 0x3 >> +#define ACPI_SPCR_TYPE_SBSA_32 0xd >> +#define ACPI_SPCR_TYPE_SBSA 0xe >> +#define ACPI_SPCR_TYPE_DCC 0xf >> +#define ACPI_SPCR_TYPE_BCM2835 0x10 > > It seems very likely to me that this part of the change actually would > have a Linux counterpart, in which case it should be submitted as such. > I checked it with Linux master. Those interface types are shared with DGB2 table. But Linux master only adds ACPI_DBG2_16550_COMPATIBLE and ACPI_DBG2_16550_SUBSET, doesn't have other types. And actually we only need the interface type not the DBG2 table. Yes, it could port commit [1] first then add other types. Is that fine? [1]4e2f9c278ad84196991fcf6f6646a3e15967fe90 Thanks,
>>> On 28.01.16 at 13:33, <zhaoshenglong@huawei.com> wrote: > On 2016/1/25 23:05, Jan Beulich wrote: >>>>> On 23.01.16 at 10:20, <zhaoshenglong@huawei.com> wrote: >>> --- a/xen/include/acpi/actbl2.h >>> +++ b/xen/include/acpi/actbl2.h >>> @@ -815,6 +815,15 @@ struct acpi_table_spcr { >>> >>> #define ACPI_SPCR_DO_NOT_DISABLE (1) >>> >>> +/* SPCR Interface type */ >>> +#define ACPI_SPCR_TYPE_16550 0 >>> +#define ACPI_SPCR_TYPE_16550_SUB 0x1 >>> +#define ACPI_SPCR_TYPE_PL011 0x3 >>> +#define ACPI_SPCR_TYPE_SBSA_32 0xd >>> +#define ACPI_SPCR_TYPE_SBSA 0xe >>> +#define ACPI_SPCR_TYPE_DCC 0xf >>> +#define ACPI_SPCR_TYPE_BCM2835 0x10 >> >> It seems very likely to me that this part of the change actually would >> have a Linux counterpart, in which case it should be submitted as such. >> > > I checked it with Linux master. Those interface types are shared with > DGB2 table. But Linux master only adds ACPI_DBG2_16550_COMPATIBLE and > ACPI_DBG2_16550_SUBSET, doesn't have other types. And actually we only > need the interface type not the DBG2 table. Yes, it could port commit > [1] first then add other types. Is that fine? Yes please. Jan
On Sat, 23 Jan 2016, Shannon Zhao wrote: > From: Shannon Zhao <shannon.zhao@linaro.org> > > Parse ACPI SPCR (Serial Port Console Redirection table) table and > initialize the serial port pl011. > > Signed-off-by: Parth Dixit <parth.dixit@linaro.org> > Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> > --- > V4: Add other fields of SPCR Interface type Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > xen/drivers/char/pl011.c | 37 +++++++++++++++++++++++++++++++++++++ > xen/include/acpi/actbl2.h | 9 +++++++++ > 2 files changed, 46 insertions(+) > > diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c > index 7e16294..9d47299 100644 > --- a/xen/drivers/char/pl011.c > +++ b/xen/drivers/char/pl011.c > @@ -27,6 +27,7 @@ > #include <asm/device.h> > #include <xen/mm.h> > #include <xen/vmap.h> > +#include <xen/acpi.h> > #include <asm/pl011-uart.h> > #include <asm/io.h> > > @@ -308,6 +309,42 @@ DT_DEVICE_START(pl011, "PL011 UART", DEVICE_SERIAL) > .init = pl011_dt_uart_init, > DT_DEVICE_END > > +#ifdef CONFIG_ACPI > +static int __init pl011_acpi_uart_init(const void *data) > +{ > + acpi_status status; > + struct acpi_table_spcr *spcr = NULL; > + int res; > + > + status = acpi_get_table(ACPI_SIG_SPCR, 0, > + (struct acpi_table_header **)&spcr); > + > + if ( ACPI_FAILURE(status) ) > + { > + printk("pl011: Failed to get SPCR table\n"); > + return -EINVAL; > + } > + > + /* trigger/polarity information is not available in spcr */ > + irq_set_type(spcr->interrupt, IRQ_TYPE_EDGE_BOTH); > + > + res = pl011_uart_init(spcr->interrupt, spcr->serial_port.address, > + PAGE_SIZE); > + if ( res < 0 ) > + { > + printk("pl011: Unable to initialize\n"); > + return res; > + } > + > + return 0; > +} > + > +ACPI_DEVICE_START(apl011, "PL011 UART", DEVICE_SERIAL) > + .class_type = ACPI_SPCR_TYPE_PL011, > + .init = pl011_acpi_uart_init, > +ACPI_DEVICE_END > +#endif > + > /* > * Local variables: > * mode: C > diff --git a/xen/include/acpi/actbl2.h b/xen/include/acpi/actbl2.h > index 87bc6b3..d0508be 100644 > --- a/xen/include/acpi/actbl2.h > +++ b/xen/include/acpi/actbl2.h > @@ -815,6 +815,15 @@ struct acpi_table_spcr { > > #define ACPI_SPCR_DO_NOT_DISABLE (1) > > +/* SPCR Interface type */ > +#define ACPI_SPCR_TYPE_16550 0 > +#define ACPI_SPCR_TYPE_16550_SUB 0x1 > +#define ACPI_SPCR_TYPE_PL011 0x3 > +#define ACPI_SPCR_TYPE_SBSA_32 0xd > +#define ACPI_SPCR_TYPE_SBSA 0xe > +#define ACPI_SPCR_TYPE_DCC 0xf > +#define ACPI_SPCR_TYPE_BCM2835 0x10 > + > /******************************************************************************* > * > * SPMI - Server Platform Management Interface table > -- > 2.0.4 > >
diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c index 7e16294..9d47299 100644 --- a/xen/drivers/char/pl011.c +++ b/xen/drivers/char/pl011.c @@ -27,6 +27,7 @@ #include <asm/device.h> #include <xen/mm.h> #include <xen/vmap.h> +#include <xen/acpi.h> #include <asm/pl011-uart.h> #include <asm/io.h> @@ -308,6 +309,42 @@ DT_DEVICE_START(pl011, "PL011 UART", DEVICE_SERIAL) .init = pl011_dt_uart_init, DT_DEVICE_END +#ifdef CONFIG_ACPI +static int __init pl011_acpi_uart_init(const void *data) +{ + acpi_status status; + struct acpi_table_spcr *spcr = NULL; + int res; + + status = acpi_get_table(ACPI_SIG_SPCR, 0, + (struct acpi_table_header **)&spcr); + + if ( ACPI_FAILURE(status) ) + { + printk("pl011: Failed to get SPCR table\n"); + return -EINVAL; + } + + /* trigger/polarity information is not available in spcr */ + irq_set_type(spcr->interrupt, IRQ_TYPE_EDGE_BOTH); + + res = pl011_uart_init(spcr->interrupt, spcr->serial_port.address, + PAGE_SIZE); + if ( res < 0 ) + { + printk("pl011: Unable to initialize\n"); + return res; + } + + return 0; +} + +ACPI_DEVICE_START(apl011, "PL011 UART", DEVICE_SERIAL) + .class_type = ACPI_SPCR_TYPE_PL011, + .init = pl011_acpi_uart_init, +ACPI_DEVICE_END +#endif + /* * Local variables: * mode: C diff --git a/xen/include/acpi/actbl2.h b/xen/include/acpi/actbl2.h index 87bc6b3..d0508be 100644 --- a/xen/include/acpi/actbl2.h +++ b/xen/include/acpi/actbl2.h @@ -815,6 +815,15 @@ struct acpi_table_spcr { #define ACPI_SPCR_DO_NOT_DISABLE (1) +/* SPCR Interface type */ +#define ACPI_SPCR_TYPE_16550 0 +#define ACPI_SPCR_TYPE_16550_SUB 0x1 +#define ACPI_SPCR_TYPE_PL011 0x3 +#define ACPI_SPCR_TYPE_SBSA_32 0xd +#define ACPI_SPCR_TYPE_SBSA 0xe +#define ACPI_SPCR_TYPE_DCC 0xf +#define ACPI_SPCR_TYPE_BCM2835 0x10 + /******************************************************************************* * * SPMI - Server Platform Management Interface table