forked from lowRISC/opentitan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpwrmgr.hjson
768 lines (700 loc) · 21 KB
/
pwrmgr.hjson
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
//
// ------------------- W A R N I N G: A U T O - G E N E R A T E D C O D E !! -------------------//
// PLEASE DO NOT HAND-EDIT THIS FILE. IT HAS BEEN AUTO-GENERATED WITH THE FOLLOWING COMMAND:
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
{
name: "pwrmgr",
human_name: "Power Manager",
one_line_desc: "Sequences on-chip power, clocks, and resets through different reset and power states",
one_paragraph_desc: '''
Power Manager sequences on-chip power, clocks, and reset signals on power-on reset (aka cold boot), low power entry and exit, and non-power-on resets.
To this end, it can turn power domains on and off, control root resets with Reset Manager, and control root clock enables with AST and Clock Manager.
During power up, Power Manager is responsible for triggering OTP sensing, initiating Life Cycle Controller, coordinating with ROM Controller for the startup ROM check, and eventually releasing software to execute.
It features several countermeasures to deter fault injection (FI) attacks.
'''
design_spec: "../doc",
dv_doc: "../doc/dv",
hw_checklist: "../doc/checklist",
sw_checklist: "/sw/device/lib/dif/dif_pwrmgr",
revisions: [
{
version: "0.1",
life_stage: "L1",
design_stage: "D1",
verification_stage: "V0", // this module is not verified at the block level
dif_stage: "S0",
commit_id: "b2abc989498f072d9a5530f8aab9b58c1f92c9fb"
}
{
version: "1.0",
life_stage: "L1",
design_stage: "D2S",
verification_stage: "V2S",
dif_stage: "S2",
}
]
clocking: [
{clock: "clk_i", reset: "rst_ni", primary: true},
{reset: "rst_main_ni"},
{clock: "clk_slow_i", reset: "rst_slow_ni"},
{clock: "clk_lc_i", reset: "rst_lc_ni"},
{clock: "clk_esc_i", reset: "rst_esc_ni"}
]
bus_interfaces: [
{ protocol: "tlul", direction: "device" }
],
interrupt_list: [
{ name: "wakeup", desc: "Wake from low power state. See wake info for more details" },
],
alert_list: [
{ name: "fatal_fault",
desc: '''
This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected.
'''
}
],
inter_signal_list: [
{ struct: "pwr_ast",
type: "req_rsp",
name: "pwr_ast",
act: "req",
package: "pwrmgr_pkg",
},
{ struct: "pwr_rst",
type: "req_rsp",
name: "pwr_rst",
act: "req",
package: "pwrmgr_pkg",
},
{ struct: "pwr_clk",
type: "req_rsp",
name: "pwr_clk",
act: "req",
package: "pwrmgr_pkg",
},
{ struct: "pwr_otp",
type: "req_rsp",
name: "pwr_otp",
act: "req",
package: "pwrmgr_pkg",
},
{ struct: "pwr_lc",
type: "req_rsp",
name: "pwr_lc",
act: "req",
package: "pwrmgr_pkg",
},
{ struct: "pwr_flash",
type: "uni",
name: "pwr_flash",
act: "rcv",
package: "pwrmgr_pkg",
},
{ struct: "esc_tx",
type: "uni",
name: "esc_rst_tx",
act: "rcv",
package: "prim_esc_pkg",
},
{ struct: "esc_rx",
type: "uni",
name: "esc_rst_rx",
act: "req",
package: "prim_esc_pkg",
},
{ struct: "pwr_cpu",
type: "uni",
name: "pwr_cpu",
act: "rcv",
package: "pwrmgr_pkg",
},
{ struct: "logic",
width: 6,
type: "uni",
name: "wakeups",
act: "rcv",
package: "",
},
{ struct: "logic",
width: 2,
type: "uni",
name: "rstreqs",
act: "rcv",
package: "",
},
{ struct: "logic",
type: "uni",
name: "ndmreset_req",
act: "rcv",
},
{ struct: "logic",
type: "uni",
name: "strap",
act: "req",
package: "",
},
{ struct: "logic",
type: "uni",
name: "low_power",
act: "req",
package: "",
},
{ struct: "pwrmgr_data",
type: "uni",
name: "rom_ctrl",
act: "rcv",
package: "rom_ctrl_pkg",
},
{ struct: "lc_tx",
type: "uni",
name: "fetch_en",
act: "req",
package: "lc_ctrl_pkg",
},
{ struct: "lc_tx",
type: "uni",
name: "lc_dft_en",
act: "rcv",
package: "lc_ctrl_pkg",
},
{ struct: "lc_tx",
type: "uni",
name: "lc_hw_debug_en",
act: "rcv",
package: "lc_ctrl_pkg",
},
{ struct: "mubi4",
type: "uni",
name: "sw_rst_req",
act: "rcv",
package: "prim_mubi_pkg",
},
],
param_list: [
{ name: "NumWkups",
desc: "Number of wakeups",
type: "int",
default: "6",
local: "true"
},
{ name: "SYSRST_CTRL_AON_WKUP_REQ_IDX",
desc: "Vector index for sysrst_ctrl_aon wkup_req, applies for WAKEUP_EN, WAKE_STATUS and WAKE_INFO",
type: "int",
default: "0",
local: "true"
},
{ name: "ADC_CTRL_AON_WKUP_REQ_IDX",
desc: "Vector index for adc_ctrl_aon wkup_req, applies for WAKEUP_EN, WAKE_STATUS and WAKE_INFO",
type: "int",
default: "1",
local: "true"
},
{ name: "PINMUX_AON_PIN_WKUP_REQ_IDX",
desc: "Vector index for pinmux_aon pin_wkup_req, applies for WAKEUP_EN, WAKE_STATUS and WAKE_INFO",
type: "int",
default: "2",
local: "true"
},
{ name: "PINMUX_AON_USB_WKUP_REQ_IDX",
desc: "Vector index for pinmux_aon usb_wkup_req, applies for WAKEUP_EN, WAKE_STATUS and WAKE_INFO",
type: "int",
default: "3",
local: "true"
},
{ name: "AON_TIMER_AON_WKUP_REQ_IDX",
desc: "Vector index for aon_timer_aon wkup_req, applies for WAKEUP_EN, WAKE_STATUS and WAKE_INFO",
type: "int",
default: "4",
local: "true"
},
{ name: "SENSOR_CTRL_WKUP_REQ_IDX",
desc: "Vector index for sensor_ctrl wkup_req, applies for WAKEUP_EN, WAKE_STATUS and WAKE_INFO",
type: "int",
default: "5",
local: "true"
},
{ name: "NumRstReqs",
desc: "Number of peripheral reset requets",
type: "int",
default: "2",
local: "true"
},
{ name: "NumIntRstReqs",
desc: "Number of pwrmgr internal reset requets",
type: "int",
default: "2",
local: "true"
},
{ name: "NumDebugRstReqs",
desc: "Number of debug reset requets",
type: "int",
default: "1",
local: "true"
},
{ name: "ResetMainPwrIdx",
desc: "Reset req idx for MainPwr",
type: "int",
default: "2",
local: "true"
},
{ name: "ResetEscIdx",
desc: "Reset req idx for Esc",
type: "int",
default: "3",
local: "true"
},
{ name: "ResetNdmIdx",
desc: "Reset req idx for Ndm",
type: "int",
default: "4",
local: "true"
},
],
countermeasures: [
{ name: "BUS.INTEGRITY",
desc: "End-to-end bus integrity scheme."
}
{ name: "LC_CTRL.INTERSIG.MUBI",
desc: "life cycle control / debug signals are multibit."
}
{ name: "ROM_CTRL.INTERSIG.MUBI",
desc: "rom control done/good signals are multibit."
}
{ name: "RSTMGR.INTERSIG.MUBI",
desc: "reset manager software request is multibit."
}
{ name: "ESC_RX.CLK.BKGN_CHK",
desc: "Escalation receiver has a background timeout check"
}
{ name: "ESC_RX.CLK.LOCAL_ESC",
desc: "Escalation receiver clock timeout has a local reset escalation"
}
{ name: "FSM.SPARSE",
desc: "Sparse encoding for slow and fast state machines."
}
{ name: "FSM.TERMINAL",
desc: '''
When FSMs reach a bad state, go into a terminate state that does not
recover without user or external host intervention.
'''
}
{ name: "CTRL_FLOW.GLOBAL_ESC",
desc: "When global escalation is received, proceed directly to reset."
}
{ name: "MAIN_PD.RST.LOCAL_ESC",
desc: "When main power domain reset glitches, proceed directly to reset."
}
{ name: "CTRL.CONFIG.REGWEN",
desc: "Main control protected by regwen."
}
{ name: "WAKEUP.CONFIG.REGWEN",
desc: "Wakeup configuration protected by regwen."
}
{ name: "RESET.CONFIG.REGWEN",
desc: "Reset configuration protected by regwen."
}
]
regwidth: "32",
registers: [
{ name: "CTRL_CFG_REGWEN",
swaccess: "ro",
hwaccess: "hwo",
hwext: "true",
desc: '''
Controls the configurability of the !!CONTROL register.
This register ensures the contents do not change once a low power hint and
WFI has occurred.
It unlocks whenever a low power transition has completed (transition back to the
ACTIVE state) for any reason.
''',
fields: [
{ bits: "0",
name: "EN",
desc: '''
Configuration enable.
This bit defaults to 1 and is set to 0 by hardware when low power entry is initiated.
When the device transitions back from low power state to active state, this bit is set
back to 1 to allow software configuration of !!CONTROL
''',
resval: "1",
},
]
tags: [// This regwen is completely under HW management and thus cannot be manipulated
// by software.
"excl:CsrNonInitTests:CsrExclCheck"]
},
{ name: "CONTROL",
desc: "Control register",
swaccess: "rw",
hwaccess: "hro",
regwen: "CTRL_CFG_REGWEN",
tags: [// Turning off USB clock in active state impacts other CSRs
// at the chip level (in other blocks, such as clkmgr),
// so we exclude writing from this register.
"excl:CsrAllTests:CsrExclWrite"]
fields: [
{ bits: "0",
hwaccess: "hrw",
name: "LOW_POWER_HINT",
desc: '''
The low power hint to power manager.
The hint is an indication for how the manager should treat the next WFI.
Once the power manager begins a low power transition, or if a valid reset request is registered,
this bit is automatically cleared by HW.
'''
resval: "0"
enum: [
{ value: "0",
name: "None",
desc: '''
No low power intent
'''
},
{ value: "1",
name: "Low Power",
desc: '''
Next WFI should trigger low power entry
'''
},
]
tags: [// The regwen for this reg is RO. CSR seq can't support to check this reg
"excl:CsrAllTests:CsrExclAll"]
},
{ bits: "4",
name: "CORE_CLK_EN",
desc: "core clock enable during low power state",
resval: "0"
enum: [
{ value: "0",
name: "Disabled",
desc: '''
Core clock disabled during low power state
'''
},
{ value: "1",
name: "Enabled",
desc: '''
Core clock enabled during low power state
'''
},
]
},
{ bits: "5",
name: "IO_CLK_EN",
desc: "IO clock enable during low power state",
resval: "0"
enum: [
{ value: "0",
name: "Disabled",
desc: '''
IO clock disabled during low power state
'''
},
{ value: "1",
name: "Enabled",
desc: '''
IO clock enabled during low power state
'''
},
]
},
{ bits: "6",
name: "USB_CLK_EN_LP",
desc: "USB clock enable during low power state",
resval: "0",
enum: [
{ value: "0",
name: "Disabled",
desc: '''
USB clock disabled during low power state
'''
},
{ value: "1",
name: "Enabled",
desc: '''
USB clock enabled during low power state.
However, if !!CONTROL.MAIN_PD_N is 0, USB clock is disabled
during low power state.
'''
},
]
},
{ bits: "7",
name: "USB_CLK_EN_ACTIVE",
desc: "USB clock enable during active power state",
resval: "1"
enum: [
{ value: "0",
name: "Disabled",
desc: '''
USB clock disabled during active power state
'''
},
{ value: "1",
name: "Enabled",
desc: '''
USB clock enabled during active power state
'''
},
]
},
{ bits: "8",
name: "MAIN_PD_N",
desc: "Active low, main power domain power down",
resval: "1"
enum: [
{ value: "0",
name: "Power down",
desc: '''
Main power domain is powered down during low power state.
'''
},
{ value: "1",
name: "Power up",
desc: '''
Main power domain is kept powered during low power state
'''
},
]
},
],
},
{ name: "CFG_CDC_SYNC",
swaccess: "rw",
hwaccess: "hrw",
hwqe: "true",
desc: '''
The configuration registers CONTROL, WAKEUP_EN, RESET_EN are all written in the
fast clock domain but used in the slow clock domain.
The configuration are not propagated across the clock boundary until this
register is triggered and read. See fields below for more details
''',
fields: [
{ bits: "0",
name: "SYNC",
desc: '''
Configuration sync. When this bit is written to 1, a sync pulse is generated. When
the sync completes, this bit then self clears.
Software should write this bit to 1, wait for it to clear, before assuming the slow clock
domain has accepted the programmed values.
''',
resval: "0",
},
]
tags: [// This bit triggers a payload synchronization and self clears when complete.
// Do not write this bit as there will be side effects and the value will not persist
"excl:CsrNonInitTests:CsrExclWrite"]
},
{ name: "WAKEUP_EN_REGWEN",
desc: "Configuration enable for wakeup_en register",
swaccess: "rw0c",
hwaccess: "none",
fields: [
{ bits: "0",
resval: "1"
name: "EN",
desc: '''
When 1, WAKEUP_EN register can be configured.
When 0, WAKEUP_EN register cannot be configured.
''',
},
]
},
{ multireg:
{ name: "WAKEUP_EN",
desc: "Bit mask for enabled wakeups",
swaccess: "rw",
hwaccess: "hro",
regwen: "WAKEUP_EN_REGWEN",
resval: "0"
cname: "wakeup_en",
count: "NumWkups"
fields: [
{ bits: "0",
name: "EN",
desc: '''
Whenever a particular bit is set to 1, that wakeup is also enabled.
Whenever a particular bit is set to 0, that wakeup cannot wake the device from low power.
''',
},
]
},
},
{ multireg:
{ name: "WAKE_STATUS",
desc: "A read only register of all current wake requests post enable mask",
swaccess: "ro",
hwaccess: "hwo",
resval: "0"
cname: "wake_status",
count: "NumWkups",
tags: [// Cannot auto-predict current wake request status
"excl:CsrNonInitTests:CsrExclWriteCheck"],
fields: [
{ bits: "0",
name: "VAL",
desc: '''
Current value of wake requests
''',
},
]
},
},
{ name: "RESET_EN_REGWEN",
desc: "Configuration enable for reset_en register",
swaccess: "rw0c",
hwaccess: "none",
fields: [
{ bits: "0",
resval: "1"
name: "EN",
desc: '''
When 1, RESET_EN register can be configured.
When 0, RESET_EN register cannot be configured.
''',
},
]
},
{ multireg:
{ name: "RESET_EN",
desc: "Bit mask for enabled reset requests",
swaccess: "rw",
hwaccess: "hro",
regwen: "RESET_EN_REGWEN",
resval: "0"
cname: "rstreq_en",
count: "NumRstReqs"
fields: [
{ bits: "0",
name: "EN",
desc: '''
Whenever a particular bit is set to 1, that reset request is enabled.
Whenever a particular bit is set to 0, that reset request cannot reset the device.
''',
},
]
tags: [// Self resets should never be triggered by automated tests
"excl:CsrAllTests:CsrExclWrite"]
},
},
{ multireg:
{ name: "RESET_STATUS",
desc: "A read only register of all current reset requests post enable mask",
swaccess: "ro",
hwaccess: "hwo",
resval: "0"
cname: "reset_status",
count: "NumRstReqs",
fields: [
{ bits: "0",
name: "VAL",
desc: '''
Current value of reset request
''',
},
]
},
},
{ name: "ESCALATE_RESET_STATUS",
desc: "A read only register of escalation reset request",
swaccess: "ro",
hwaccess: "hwo",
resval: "0"
fields: [
{ bits: "0",
name: "VAL",
desc: '''
When 1, an escalation reset has been seen.
When 0, there is no escalation reset.
''',
},
]
},
{ name: "WAKE_INFO_CAPTURE_DIS",
desc: "Indicates which functions caused the chip to wakeup",
swaccess: "rw",
hwaccess: "hro",
resval: "0"
fields: [
{ bits: "0",
name: "VAL",
desc: '''
When written to 1, this actively suppresses the wakeup info capture.
When written to 0, wakeup info capture timing is controlled by HW.
''',
},
]
},
{ name: "WAKE_INFO",
desc: '''
Indicates which functions caused the chip to wakeup.
The wake info recording begins whenever the device begins a valid low power entry.
This capture is continued until it is explicitly disabled through WAKE_INFO_CAPTURE_DIS.
This means it is possible to capture multiple wakeup reasons.
''',
swaccess: "rw1c",
hwaccess: "hrw",
hwext: "true",
hwqe: "true",
resval: "0"
fields: [
{ bits: "5:0",
name: "REASONS",
desc: "Various peripheral wake reasons"
},
{ bits: "6",
name: "FALL_THROUGH",
desc: '''
The fall through wakeup reason indicates that despite setting a WFI and providing a low power
hint, an interrupt arrived at just the right time to break the executing core out of WFI.
The power manager detects this condition, halts low power entry and reports as a wakeup reason
''',
},
{ bits: "7",
name: "ABORT",
desc: '''
The abort wakeup reason indicates that despite setting a WFI and providing a low power
hint, an active flash / lifecycle / otp transaction was ongoing when the power controller
attempted to initiate low power entry.
The power manager detects this condition, halts low power entry and reports as a wakeup reason
''',
},
]
tags: [// This regwen is completely under HW management and thus cannot be manipulated
// by software.
"excl:CsrNonInitTests:CsrExclCheck"]
},
{ name: "FAULT_STATUS",
desc: "A read only register that shows the existing faults",
swaccess: "ro",
hwaccess: "hrw",
sync: "clk_lc_i",
resval: "0"
fields: [
{ bits: "0",
name: "REG_INTG_ERR",
desc: '''
When 1, an integrity error has occurred.
''',
},
{ bits: "1",
name: "ESC_TIMEOUT",
desc: '''
When 1, an escalation clock / reset timeout has occurred.
''',
},
{ bits: "2",
name: "MAIN_PD_GLITCH",
desc: '''
When 1, unexpected power glitch was observed on main PD.
''',
},
]
},
]
}