2014-01-06 09:00:08

by joeyli

[permalink] [raw]
Subject: Re: [RFC PATCH 04/14] ACPI: Add ACPI 5.0 Time and Alarm Device driver

於 二,2013-12-31 於 16:42 -0800,H. Peter Anvin 提到:
> On 12/19/2013 09:41 PM, joeyli wrote:
> >>
> >> What platform do you have that has TAD support? I am wondering how this
> >> was tested.
> >>
> >
> > It's a testing platform that's only support get/set time functions of
> > ACPI TAD.
> >
>
> It would be really, really good to get this into Qemu (either SeaBIOS or
> OVMF, or ideally both) so we can have anyone test.
>
> -hpa
>

I will try to add to OVMF first.


Thanks
Joey Lee


2014-01-07 05:38:46

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [RFC PATCH 04/14] ACPI: Add ACPI 5.0 Time and Alarm Device driver

On 01/06/2014 12:58 AM, joeyli wrote:
> 於 二,2013-12-31 於 16:42 -0800,H. Peter Anvin 提到:
>> On 12/19/2013 09:41 PM, joeyli wrote:
>>>>
>>>> What platform do you have that has TAD support? I am wondering how this
>>>> was tested.
>>>>
>>>
>>> It's a testing platform that's only support get/set time functions of
>>> ACPI TAD.
>>>
>>
>> It would be really, really good to get this into Qemu (either SeaBIOS or
>> OVMF, or ideally both) so we can have anyone test.
>>
>> -hpa
>
> I will try to add to OVMF first.
>

For the record, I posted a patch to Qemu about a year ago to store the
timezone in the CMOS, which might be useful for this implementation. It
was rejected because of no firmware support, so if you implement it for
OVMF we can (update and) push this patch again.

-hpa




Attachments:
Attached Message (6.07 kB)

2014-01-07 10:42:27

by joeyli

[permalink] [raw]
Subject: Re: [RFC PATCH 04/14] ACPI: Add ACPI 5.0 Time and Alarm Device driver

於 一,2014-01-06 於 21:37 -0800,H. Peter Anvin 提到:
> On 01/06/2014 12:58 AM, joeyli wrote:
> > 於 二,2013-12-31 於 16:42 -0800,H. Peter Anvin 提到:
> >> On 12/19/2013 09:41 PM, joeyli wrote:
> >>>>
> >>>> What platform do you have that has TAD support? I am wondering how this
> >>>> was tested.
> >>>>
> >>>
> >>> It's a testing platform that's only support get/set time functions of
> >>> ACPI TAD.
> >>>
> >>
> >> It would be really, really good to get this into Qemu (either SeaBIOS or
> >> OVMF, or ideally both) so we can have anyone test.
> >>
> >> -hpa
> >
> > I will try to add to OVMF first.
> >
>
> For the record, I posted a patch to Qemu about a year ago to store the
> timezone in the CMOS, which might be useful for this implementation. It
> was rejected because of no firmware support, so if you implement it for
> OVMF we can (update and) push this patch again.
>
> -hpa
>

Thanks for your patch.

Due to accessing CMOS through ASL need enable SMM support in OVMF, I am
looking Laszlo's OVMF S3 patches:

https://www.mail-archive.com/[email protected]/msg04969.html

Honestly I am not good on this area, I need to spend more time to
understand it.


Regards
Joey Lee

2014-01-07 16:36:51

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [RFC PATCH 04/14] ACPI: Add ACPI 5.0 Time and Alarm Device driver

On 01/07/2014 02:40 AM, joeyli wrote:
>
> Due to accessing CMOS through ASL need enable SMM support in OVMF,

Why? The CMOS is its own ASL address space, and you need that anyway to
be able to access the RTC proper. If you don't want to use it because
you don't want to export any indication of a legacy RTC you should be
able to just do I/O port references directly in your ASL.

-hpa

2014-01-08 15:00:49

by joeyli

[permalink] [raw]
Subject: Re: [RFC PATCH 04/14] ACPI: Add ACPI 5.0 Time and Alarm Device driver

於 二,2014-01-07 於 08:35 -0800,H. Peter Anvin 提到:
> On 01/07/2014 02:40 AM, joeyli wrote:
> >
> > Due to accessing CMOS through ASL need enable SMM support in OVMF,
>
> Why? The CMOS is its own ASL address space, and you need that anyway to
> be able to access the RTC proper. If you don't want to use it because
> you don't want to export any indication of a legacy RTC you should be
> able to just do I/O port references directly in your ASL.
>
> -hpa
>
>

ACPICA denied AML access RTC ports.

I tried to access 0x70, 0x71 ports in ASL on a real machine, ACPICA
denied AML access to those ports. I got the following dmesg:

hwvalid-0188 hw_validate_io_request: Denied AML access to port
0x0000000000000071/1


The code in acpica denied it:

linux/drivers/acpi/acpica/hwvalid.c

* This provides ACPICA with the desired port protections and
* Microsoft compatibility.
*
* Description of port entries:
[...]
* RTC: Real-time clock
* CMOS: Extended CMOS
[...]
*/
static const struct acpi_port_info acpi_protected_ports[] = {
[...]
{"RTC", 0x0070, 0x0071, ACPI_OSI_WIN_XP},
{"CMOS", 0x0074, 0x0076, ACPI_OSI_WIN_XP},


Document of Windows XP:
http://www.freelists.org/post/windows_errors/what-error-messages-really-mean-WinXP-IO-Ports-Blocked-from-Bios-AML-on-Windows-XP


If just for ACPI TAD testing, we can remove the port protection check of
RTC ports in hwvalid.c. I have read 0x70/0x71 port success after removed
the checking in acpica/hwvalid.c.

I will try to write RTC port in AML after remove acpica check, maybe
have other unpredictable situation.


Thanks a lot!
Joey Lee

2014-01-08 17:57:15

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [RFC PATCH 04/14] ACPI: Add ACPI 5.0 Time and Alarm Device driver

On 01/08/2014 06:59 AM, joeyli wrote:
>
> ACPICA denied AML access RTC ports.
>
> I tried to access 0x70, 0x71 ports in ASL on a real machine, ACPICA
> denied AML access to those ports. I got the following dmesg:
>
> hwvalid-0188 hw_validate_io_request: Denied AML access to port
> 0x0000000000000071/1
>
> The code in acpica denied it:
>
> linux/drivers/acpi/acpica/hwvalid.c
>
> * This provides ACPICA with the desired port protections and
> * Microsoft compatibility.
> *
> * Description of port entries:
> [...]
> * RTC: Real-time clock
> * CMOS: Extended CMOS
> [...]
> */
> static const struct acpi_port_info acpi_protected_ports[] = {
> [...]
> {"RTC", 0x0070, 0x0071, ACPI_OSI_WIN_XP},
> {"CMOS", 0x0074, 0x0076, ACPI_OSI_WIN_XP},
>
>
> Document of Windows XP:
> http://www.freelists.org/post/windows_errors/what-error-messages-really-mean-WinXP-IO-Ports-Blocked-from-Bios-AML-on-Windows-XP
>
> If just for ACPI TAD testing, we can remove the port protection check of
> RTC ports in hwvalid.c. I have read 0x70/0x71 port success after removed
> the checking in acpica/hwvalid.c.
>
> I will try to write RTC port in AML after remove acpica check, maybe
> have other unpredictable situation.
>

Now *THERE* is a good use of the "no RTC bit". In the case that bit is
set we should presumably remove these ports from the block list.

Otherwise we should use the CMOS address space, not the I/O port address
space.

-hpa

2014-01-09 03:49:27

by joeyli

[permalink] [raw]
Subject: Re: [RFC PATCH 04/14] ACPI: Add ACPI 5.0 Time and Alarm Device driver

於 三,2014-01-08 於 09:56 -0800,H. Peter Anvin 提到:
[...]
> > Document of Windows XP:
> >
> http://www.freelists.org/post/windows_errors/what-error-messages-really-mean-WinXP-IO-Ports-Blocked-from-Bios-AML-on-Windows-XP
> >
> > If just for ACPI TAD testing, we can remove the port protection
> check of
> > RTC ports in hwvalid.c. I have read 0x70/0x71 port success after
> removed
> > the checking in acpica/hwvalid.c.
> >
> > I will try to write RTC port in AML after remove acpica check, maybe
> > have other unpredictable situation.
> >
>
> Now *THERE* is a good use of the "no RTC bit". In the case that bit
> is
> set we should presumably remove these ports from the block list.

Thanks for your suggestion, I will put a testing patch on this.

>
> Otherwise we should use the CMOS address space, not the I/O port
> address
> space.
>
> -hpa

Unfortunately current acpica leaks the SystemCMOS handler:

ACPI Error: Region SystemCMOS (ID=5) has no handler (20131115/exfldio-299)


Regards
Joey Lee

2014-01-09 04:01:45

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [RFC PATCH 04/14] ACPI: Add ACPI 5.0 Time and Alarm Device driver

On 01/08/2014 07:47 PM, joeyli wrote:
>
> Unfortunately current acpica leaks the SystemCMOS handler:
>
> ACPI Error: Region SystemCMOS (ID=5) has no handler (20131115/exfldio-299)
>

I'm sorry, I can't parse either your statement or the error message...
sounds like there is a bug here, too.

-hpa

2014-01-09 12:02:39

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [RFC PATCH 04/14] ACPI: Add ACPI 5.0 Time and Alarm Device driver

On Thursday, January 09, 2014 11:47:39 AM joeyli wrote:
> 於 三,2014-01-08 於 09:56 -0800,H. Peter Anvin 提到:
> [...]
> > > Document of Windows XP:
> > >
> > http://www.freelists.org/post/windows_errors/what-error-messages-really-mean-WinXP-IO-Ports-Blocked-from-Bios-AML-on-Windows-XP
> > >
> > > If just for ACPI TAD testing, we can remove the port protection
> > check of
> > > RTC ports in hwvalid.c. I have read 0x70/0x71 port success after
> > removed
> > > the checking in acpica/hwvalid.c.
> > >
> > > I will try to write RTC port in AML after remove acpica check, maybe
> > > have other unpredictable situation.
> > >
> >
> > Now *THERE* is a good use of the "no RTC bit". In the case that bit
> > is
> > set we should presumably remove these ports from the block list.
>
> Thanks for your suggestion, I will put a testing patch on this.
>
> >
> > Otherwise we should use the CMOS address space, not the I/O port
> > address
> > space.
> >
> > -hpa
>
> Unfortunately current acpica leaks the SystemCMOS handler:
>
> ACPI Error: Region SystemCMOS (ID=5) has no handler (20131115/exfldio-299)

This is not an ACPICA problem. We have no CMOS address space handler in Linux
and arguably there should be one. So I'd suggest implementing that to start
with or we risk conflicts between kernel code and AML accessing registers in
that space.

Thanks!

--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.