Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / SLOF / board-js2x / slof / ipmi-vpd.fs
1 \ *****************************************************************************
2 \ * Copyright (c) 2004, 2008 IBM Corporation
3 \ * All rights reserved.
4 \ * This program and the accompanying materials
5 \ * are made available under the terms of the BSD License
6 \ * which accompanies this distribution, and is available at
7 \ * http://www.opensource.org/licenses/bsd-license.php
8 \ *
9 \ * Contributors:
10 \ *     IBM Corporation - initial implementation
11 \ ****************************************************************************/
12
13 : vpd-read-bootlist  ( -- )
14    837 4 vpd-bootlist rtas-read-vpd IF vpd-bootlist 4 erase THEN
15 ;
16
17 : vpd-write-bootlist  ( offset len data -- )
18    837 4 vpd-bootlist rtas-write-vpd
19 ;
20
21 : .vpd-machine-type
22         e 7 vpd-cb rtas-read-vpd drop
23         0 vpd-cb 7 + c!
24         vpd-cb zcount type
25 ;
26
27 : .vpd-machine-serial
28         15 7 vpd-cb rtas-read-vpd drop
29         0 vpd-cb 7 + c!
30         vpd-cb zcount type
31 ;
32
33 : .vpd-card-serial
34         54 6 vpd-cb rtas-read-vpd drop
35         0 vpd-cb 6 + c!
36         vpd-cb zcount type
37 ;
38 : .vpd-cardprefix-serial
39         5a 6 vpd-cb rtas-read-vpd drop
40         0 vpd-cb 6 + c!
41         vpd-cb zcount type
42 ;
43
44 : .vpd-hw-revision
45         65 1 vpd-cb rtas-read-vpd drop
46         vpd-cb c@ .
47 ;
48
49 : .vpd-part-number
50         3c c vpd-cb rtas-read-vpd drop
51         vpd-cb c type
52 ;
53
54 : .vpd-fru-number
55         48 c vpd-cb rtas-read-vpd drop
56         vpd-cb c type
57 ;
58
59 : .vpd-manufacturer-date
60         6b 4 vpd-cb rtas-read-vpd drop
61         0 vpd-cb 4 + c!
62         vpd-cb zcount type
63 ;
64
65 : .vpd-uuid
66         9f 10 vpd-cb rtas-read-vpd drop
67         10 0 do i vpd-cb + c@ 2 0.r loop
68 ;
69
70 : vpd-read-model  ( -- addr len )
71    60 4 vpd-cb rtas-read-vpd drop vpd-cb 4 -leading s" ," $cat 
72    e 7 vpd-cb rtas-read-vpd drop vpd-cb 4 $cat s" -" $cat vpd-cb 4 + 3 $cat
73 ;
74
75 : .vpd
76         ." ===================== VPD =====================" 
77         cr ." Machine Type        : " .vpd-machine-type
78         cr ." Machine Serial No.  : " .vpd-machine-serial
79         cr ." Hardware Revision   : " .vpd-hw-revision  
80         cr ." Manuf. Date         : " .vpd-manufacturer-date
81         cr ." Part Number         : " .vpd-part-number
82         cr ." FRU Number          : " .vpd-fru-number
83         cr ." FRU Serial No.      : " .vpd-cardprefix-serial .vpd-card-serial
84         cr ." UUID                : " .vpd-uuid
85 ;
86
87 : vpd-write-revision-and-build-id  ( -- )
88    406 24 vpd-cb rtas-read-vpd drop 0
89    vpd-cb 1a + zcount bdate2human drop a string=ci 0=
90    IF  bdate2human drop a vpd-cb 1a + zplace drop 1  THEN
91    vpd-cb zcount slof-revision string=ci 0=
92    IF  slof-revision vpd-cb zplace drop 1  THEN
93    vpd-cb 4 + zcount slof-build-id string=ci 0=
94    IF  slof-build-id vpd-cb 4 + rzplace drop 1  THEN
95    1 =  IF  406 24 vpd-cb rtas-write-vpd drop  THEN
96 ;
97
98 vpd-write-revision-and-build-id