[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 5/6] acpi: serial: don't use _STA method
From: |
Gerd Hoffmann |
Subject: |
Re: [PATCH 5/6] acpi: serial: don't use _STA method |
Date: |
Tue, 31 Mar 2020 17:23:42 +0200 |
> > -static Aml *build_com_device_aml(uint8_t uid)
> > +static void build_com_device_aml(Aml *scope, uint8_t uid)
> > {
> > Aml *dev;
> > Aml *crs;
> > - Aml *method;
> > - Aml *if_ctx;
> > - Aml *else_ctx;
> > - Aml *zero = aml_int(0);
> > - Aml *is_present = aml_local(0);
> > - const char *enabled_field = "CAEN";
> > uint8_t irq = 4;
> > uint16_t io_port = 0x03F8;
> >
> > assert(uid == 1 || uid == 2);
> > if (uid == 2) {
> > - enabled_field = "CBEN";
> > irq = 3;
> > io_port = 0x02F8;
> > }
> > + if (!memory_region_present(get_system_io(), io_port)) {
> ^^^^^^
> even though acpi_setup() is a part of board code, usually it's not
> recommended to
> use get_system_foo() outside of machine_init()
>
> how about fishing out present serial ports from isa device in a helper
> like acpi_get_misc_info(), and then generalize AML like
> build_com_device_aml(Aml *scope, uint8_t uid, io_port, irq)
Hmm, I'm wondering whenever it would be useful to have ...
ISADeviceClass->build_aml(Aml *scope, ISADevice *dev);
... then just walk all isa devices and call the handler
(if present). Maybe the same for sysbus.
cheers,
Gerd
- [PATCH 0/6] acpi: i386 tweaks, Gerd Hoffmann, 2020/03/27
- [PATCH 2/6] acpi: make build_madt() more generic., Gerd Hoffmann, 2020/03/27
- [PATCH 6/6] acpi: parallel: don't use _STA method, Gerd Hoffmann, 2020/03/27
- [PATCH 1/6] acpi: split hw/i386/acpi-build.c, Gerd Hoffmann, 2020/03/27
- Re: [PATCH 0/6] acpi: i386 tweaks, no-reply, 2020/03/27
- Re: [PATCH 0/6] acpi: i386 tweaks, no-reply, 2020/03/27
- Re: [PATCH 0/6] acpi: i386 tweaks, Michael S. Tsirkin, 2020/03/29