summaryrefslogtreecommitdiffstats
path: root/docs/xmlformat.md
blob: fb3729b2b189376a1fb6fdfaefdf99bb5ce116b6 (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
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
## Introduction

This file will describe the xml of the vpd template file format used to
describe the contents of a VPD image

## High Level Description

The template VPD format is XML, used to describe the contents of a binary VPD image.  The template file is fed into createVpd.py.  It in turn interprets that XML, error checks it and creates a binary VPD image.

The template consists of 3 levels
* `<vpd>` - information about the overall VPD image
* `<record>` - information about a record in `<vpd>`
* `<keyword>` - information about a keyword contained in a `<record>`

The XML Hierarchy looks like the following:
``` xml
<vpd>
  <record>
    <keyword>
    </keyword>
    <keyword>
    </keyword>
  </record>
  <record>
    <keyword>
    ..
  </record>
  <record>
  ..
</vpd>
```

## `<vpd>`
This section covers the required tags in the <vpd> section of the template description
 
The top level `<vpd>` tag is required in all template files, whether it is a top level manifest description of a full image or simply a record level description.  The tag requirements in the <vpd> section depend upon usage.

### Tags included in the `<vpd>` section
`<name></name>`  
Used to define the output name of the files created by the tool.  This information is not stuck into the binary VPD image.

If the special name of FILENAME is given, then the name of the top level manifest file will be used for the name on any output files.

Can be used only once in the top level description  
Cannot be included in single record definitions  

`<size></size>`  
Used to define the maximum size of the binary image.  If the create image will exceede this size, an error is generated by the tool.

Can be used only once in the top level description  
Cannot be included in single record definitions  

`<VD></VD>`  
The hex value to be stuck in for the VD keyword in the VHDR

Can be used only once in the top level description  
Cannot be included in single record definitions  

``` xml
<record>
  ..
</record>
```
Defines the creation of a record within VPD.  Please see the section on the `<record>` tag for more information on valid fields and syntax

When creating a top level VPD template, at least 1 `<record>` must be defined.
When creating a record only template description, only 1 `<record>` tag can be used.  It is not allowed to include different records in a record only template.

A sample `<vpd>` section would look like this:
``` xml
<vpd>
  <name>simple</name>
  <size>16kb</size>
  <VD>01</VD>
  <record ..>
</vpd>
```

## `<record>`
The record tag is used to describe the information that will go into a VPD record.  You can specify this information 3 different ways.
 * By defining the keywords to go in the record using the `<keyword>` tag
 * By pointing to a different file with the `<rtvpdfile>` tag.  That file contains the record definition that uses the `<keyword>` tag
 * By pointing to a fully created binary representation of the record using the `<rbinfile>` tag
One 1 of these 3 tags can be given at a time and the creation program checks to make sure that is the case.

``` xml
<record name=”NAME”>
</record>
```
The name attribute is required in a ```<record>``` and must be 4 characters long. 

### Tags included in the `<record>`  
`<rdesc></rdesc>`
A text description of the contents/purpose of a record.  Only 1 `<rdesc>` is allowed per record

``` xml
<keyword>
  ..
</keyword>
```
Defines a keyword within a record.  Please see the `<keyword>` section of the document for further descriptions.

`<rtvpdfile></rtvpdfile>`
Contains the name or path and name to a file describing the record

`<rbinfile></rbinfile>`
Contains the name or path and name to the binary version of a record.  It is assumed that this file is correctly formatted and only minimally checked to make sure the record names match.

A sample `<record>` section would look like this:

``` xml
<record name=”NAME”>
  <rdesc> The NAME record</rdesc>
  <keyword..>
</record>
```

The inclusion of a record tvpd file would look like this:
``` xml
<record name=”NAME”>
  <rtvdfile>record-NAME.tvpd</rtvpdfile>
</record>
```

The inclusion of a record binary file would look like this:
``` xml
<record name=”NAME”>
  <rbinfile>record-NAME.bin</rbinfile>
</record>
```

## `<keyword>`
The `<keyword>` tag is used to describe the contents of a keyword within a record.

``` xml
<keyword NAME=”NM”>
  ..
</keyword>
```
The name attribute is required and only 2 characters long

### Tags included in the `<keyword>`

`<ktvpdfile></ktvpdfile>`
Contains the name or path and name to a file describing the keyword
This tag is mutually exclusive from the `<kwdesc>`, `<kwformat>`, `<kwlen>` and `<kwdata>` below

`<kwdesc></kwdesc>`
A description of the contents of the keyword.  Only 1 tag allowed per keyword.

`<kwformat></kwformat>`
The  format of the data in the `<kwdata>` tag.  It can be three different values
 * hex
 * ascii
 * bin
hex and ascii data are both specified within the `<kwdata>` tag.  When using the bin type, the `<kwdata>` tag is a reference to a binary file that contains just data for the keyword

`<kwlen></kwlen>`
The length of the keyword.  If the data given is shorter than the keyword, the data will be right padded with zeros.  If the data is longer than the `<kwlen>`, then an error is generated.

`<kwdata></kwdata>`
The data to go into the keyword.  It is checked to make sure it matches the format specified.  For example, that hex data has only valid hex characters.

Sample keyword sections would look like this:

For hex data:
``` xml
<keyword name="NM">
  <kwdesc>The name keyword</kwdesc>
  <kwformat>hex</kwformat>
  <kwlen>4</kwlen>
  <kwdata>01AEF78DB</kwdata>
</keyword>
```

For ascii data:
``` xml
<keyword name="NM">
  <kwdesc>The name keyword</kwdesc>
  <kwformat>ascii</kwformat>
  <kwlen>4</kwlen>
  <kwdata>NAME</kwdata>
</keyword>
```

For bin data:
``` xml
<keyword name="NM">
  <kwdesc>The name keyword</kwdesc>
  <kwformat>bin</kwformat>
  <kwlen>4</kwlen>
  <kwdata>name.bin</kwdata>
</keyword>
```

The inclusion of a keyword ktvpdfile would look like this:
``` xml
<keyword name=”NM”>
  <ktvpdfile>vini-nm.xml</ktvpdfile>
</keyword>
```

## Examples
Please see the examples dir in this repo for complete representations multiple types of template files
OpenPOWER on IntegriCloud