summaryrefslogtreecommitdiffstats
path: root/qemu/roms/SLOF/board-js2x/slof/ipmi-vpd.fs
blob: bfb3e5014534b76f5d238b43a6deaee7bd23e238 (plain)
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
\ *****************************************************************************
\ * Copyright (c) 2004, 2008 IBM Corporation
\ * All rights reserved.
\ * This program and the accompanying materials
\ * are made available under the terms of the BSD License
\ * which accompanies this distribution, and is available at
\ * http://www.opensource.org/licenses/bsd-license.php
\ *
\ * Contributors:
\ *     IBM Corporation - initial implementation
\ ****************************************************************************/

: vpd-read-bootlist  ( -- )
   837 4 vpd-bootlist rtas-read-vpd IF vpd-bootlist 4 erase THEN
;

: vpd-write-bootlist  ( offset len data -- )
   837 4 vpd-bootlist rtas-write-vpd
;

: .vpd-machine-type
	e 7 vpd-cb rtas-read-vpd drop
	0 vpd-cb 7 + c!
	vpd-cb zcount type
;

: .vpd-machine-serial
	15 7 vpd-cb rtas-read-vpd drop
	0 vpd-cb 7 + c!
	vpd-cb zcount type
;

: .vpd-card-serial
	54 6 vpd-cb rtas-read-vpd drop
	0 vpd-cb 6 + c!
	vpd-cb zcount type
;
: .vpd-cardprefix-serial
	5a 6 vpd-cb rtas-read-vpd drop
	0 vpd-cb 6 + c!
	vpd-cb zcount type
;

: .vpd-hw-revision
	65 1 vpd-cb rtas-read-vpd drop
	vpd-cb c@ .
;

: .vpd-part-number
	3c c vpd-cb rtas-read-vpd drop
	vpd-cb c type
;

: .vpd-fru-number
	48 c vpd-cb rtas-read-vpd drop
	vpd-cb c type
;

: .vpd-manufacturer-date
	6b 4 vpd-cb rtas-read-vpd drop
	0 vpd-cb 4 + c!
	vpd-cb zcount type
;

: .vpd-uuid
	9f 10 vpd-cb rtas-read-vpd drop
	10 0 do i vpd-cb + c@ 2 0.r loop
;

: vpd-read-model  ( -- addr len )
   60 4 vpd-cb rtas-read-vpd drop vpd-cb 4 -leading s" ," $cat 
   e 7 vpd-cb rtas-read-vpd drop vpd-cb 4 $cat s" -" $cat vpd-cb 4 + 3 $cat
;

: .vpd
	." ===================== VPD =====================" 
	cr ." Machine Type        : " .vpd-machine-type
	cr ." Machine Serial No.  : " .vpd-machine-serial
	cr ." Hardware Revision   : " .vpd-hw-revision	
	cr ." Manuf. Date         : " .vpd-manufacturer-date
	cr ." Part Number         : " .vpd-part-number
	cr ." FRU Number          : " .vpd-fru-number
	cr ." FRU Serial No.      : " .vpd-cardprefix-serial .vpd-card-serial
	cr ." UUID                : " .vpd-uuid
;

: vpd-write-revision-and-build-id  ( -- )
   406 24 vpd-cb rtas-read-vpd drop 0
   vpd-cb 1a + zcount bdate2human drop a string=ci 0=
   IF  bdate2human drop a vpd-cb 1a + zplace drop 1  THEN
   vpd-cb zcount slof-revision string=ci 0=
   IF  slof-revision vpd-cb zplace drop 1  THEN
   vpd-cb 4 + zcount slof-build-id string=ci 0=
   IF  slof-build-id vpd-cb 4 + rzplace drop 1  THEN
   1 =  IF  406 24 vpd-cb rtas-write-vpd drop  THEN
;

vpd-write-revision-and-build-id