Skip to content

Commit

Permalink
service group: Combine return format as array
Browse files Browse the repository at this point in the history
Combine return format as single array.

Signed-off-by: Joshua Yeong <[email protected]>
  • Loading branch information
Joshua Yeong committed Jul 25, 2024
1 parent 7c35941 commit db0b9bf
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 151 deletions.
67 changes: 36 additions & 31 deletions src/srvgrp-clock.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ifndef::rootpath[]
endif::rootpath[]

=== Service Group - *CLOCK* (servicegroup_id: 0x00007)
This service group is for the management of system clocks. Services defined in
This service group is for the management of system clocks. Services defined in
this group are used to enable or disable clocks, and to set/get clock rates.

Each clock in the system is identified by the clock ID, which is an integer
Expand All @@ -30,6 +30,20 @@ through supported hardware description mechanisms.
Each clock rate is a tuple of two `32 bits` values `(uint32, uint32)` represented
as `(clock_rate_low, clock_rate_high)` and packed in the same order where
`clock_rate_low` is at the lower index than the `clock_rate_high`.
[#table_clock_rate]
.CLOCK rate
[cols="1,1,5" width=100%, align="center"]
|===
3+| *Discrete Format*
| *Word* | *Name* | *Description*
| 0 | volt_uV | Fixed Voltage (uV)
3+|
3+| *Linear Format*
| *Word* | *Name* | *Description*
| 0 | min_Hz | lowest physical rate
| 1 | max_Hz | highest physical rate
| 2 | step_Hz | Step between two successive rates
|===

Below table lists the services in this group:
[#table_clock_services]
Expand Down Expand Up @@ -57,13 +71,13 @@ The platform can optionally support notifications of events which might occur in
the platform. The PuC can send these notification messages to AP if they are
implemented and the AP has subscribed to these. The supported events are described
in <<clock-notifications>>.

[#table_clock_ennotification_request_data]
.Request Data
[cols="1, 2, 1, 7", width=100%, align="center", options="header"]
|===
| Word | Name | Type | Description
| 0 | EVENT_ID | uint32 | Event to be subscribed for
| 0 | EVENT_ID | uint32 | Event to be subscribed for
notification.
|===

Expand Down Expand Up @@ -141,21 +155,14 @@ the future, as needed.
! RPMI_ERROR_NOT_FOUND ! Clock not found
!===
- Other errors <<table_error_codes>>
| 1 | FLAGS | uint32 |
| 1 | FLAGS | uint32 |
[cols="2,5a"]
!===
! *Bits* ! *Description*
! [31:30] ! CLOCK_FORMAT
! [31:30] ! CLOCK_FORMAT (Refer to <<table_clock_rate>>)
----
0b00: Discrete Format
Each element in the CLOCK_RATE array is a supported discrete clock rate value packed in ascending order. Each rate is in Hertz.
0b01: Linear Range
The CLOCK_RATE array contains the triplet (min_Hz, max_Hz, step_Hz).
Each item in the triplet is a clock rate value.
CLOCK_RATE[0] = min_Hz (lowest physical rate that the clock can synthesize)
CLOCK_RATE[1] = max_Hz (highest physical rate that the clock can synthesize)
CLOCK_RATE[2] = step_Hz (Step between two successive rates)
----
! [29:0] ! _Reserved_
!===
Expand All @@ -165,24 +172,24 @@ CLOCK_RATE[2] = step_Hz (Step between two successive rates)
|===

==== Service: *CLK_GET_SUPPORTED_RATES*
Each domain may support multiple clock rate values which are allowed by the
Each domain may support multiple clock rate values which are allowed by the
domain to operate. Message can also pass the `CLOCK_RATE_INDEX` which is the index
to the first rate value to be described in the return rate array. If all
supported rate values are required then this index value can be `0`.
to the first rate value to be described in the return rate array. If all
supported rate values are required then this index value can be `0`.

If the CLOCK_FORMAT is discrete then the clock rate in the received data is an
If the CLOCK_FORMAT is discrete then the clock rate in the received data is an
array of supported discrete rate values packed in ascending order starting from
the lower index in the CLOCK_RATE field. If the CLOCK_FORMAT is a linear range,
the lower index in the CLOCK_RATE field. If the CLOCK_FORMAT is a linear range,
then the CLOCK_RATE array contains a triplet of `(min_Hz, max_Hz, step_Hz)` where
each item in the triplet is a clock rate value.
each item in the triplet is a clock rate value.

Total words required for the number of clock rates according to the format in
one message cannot exceed the total words available in one message DATA field.
Total words required for the number of clock rates according to the format in
one message cannot exceed the total words available in one message DATA field.
If they exceed then the PuC will return the number of clock rates which can be
accommodated in one message and set the REMAINING field accordingly. The AP,
when REMAINING field is not `0` must call this service again with appropriate
CLOCK_RATE_INDEX set to get the remaining clock rates. It's possible that
multiple service calls may be required to get all the clock rates.
CLOCK_RATE_INDEX set to get the remaining clock rates. It's possible that
multiple service calls may be required to get all the clock rates.
In case the CLOCK_FORMAT is a linear range the RETURNED field will be set to `3`.

[#table_clock_getsupprates_request_data]
Expand All @@ -208,12 +215,10 @@ In case the CLOCK_FORMAT is a linear range the RETURNED field will be set to `3`
! RPMI_ERROR_INVALID_PARAMETER ! CLOCK_RATE_INDEX is not in valid range.
!===
- Other errors <<table_error_codes>>
| 1 | FLAGS | uint32 | _Reserved_ and must be `0`.
| 2 | REMAINING | uint32 | Remaining number of clock rates.
| 3 | RETURNED | uint32 | Number of clock rates returned in this request.
| 4 | CLOCK_RATE[0] | (uint32, uint32) | Clock rate value.
| 5 | CLOCK_RATE[1] | (uint32, uint32) | Clock rate value.
| ... | CLOCK_RATE[N-1] | (uint32, uint32) | Clock rate value.
| 1 | FLAGS | uint32 | _Reserved_ and must be `0`.
| 2 | REMAINING | uint32 | Remaining number of clock rates.
| 3 | RETURNED | uint32 | Number of clock rates returned in this request.
| 4 | CLOCK_RATE[N] | struct | Clock rate. (<<table_clock_rate>>)
|===

==== Service: *CLK_SET_CONFIG*
Expand All @@ -230,7 +235,7 @@ Set clock config, enable or disable the clock.
!===
! *Bits* ! *Description*
! [31:1] ! _Reserved_
! [0] !
! [0] !

0b0: Disable clock
0b1: Enable clock
Expand Down Expand Up @@ -282,7 +287,7 @@ Get the current status of a clock, if it's enabled or disabled.
[cols="2,5a"]
!===
! *Value* ! *Description*
! 0x0 ! Disabled
! 0x0 ! Disabled
! 0x1 ! Enabled
!===
|===
Expand All @@ -307,7 +312,7 @@ Set clock rate.
0b10: Auto. Platform autonomously choose rate closest to the requested rate.
----

! [29:0] ! _Reserved_
! [29:0] ! _Reserved_
!===
| 2 | CLOCK_RATE_LOW | uint32 | Lower 32 bits of the clock rate in Hertz.
| 3 | CLOCK_RATE_HIGH | uint32 | Upper 32 bits of the clock rate in Hertz.
Expand Down
Loading

0 comments on commit db0b9bf

Please sign in to comment.