<!doctype book public "-//OASIS//DTD DocBook V3.1//EN"
 [ <!ENTITY header system "header.sgml">
]>

<book id="index">
 <bookinfo>
 <title>MDF-Specification</title>
 <pubdate>$Id: MDF-Specification.sgml,v 1.1 2001/04/20 17:28:48 nico Exp $</pubdate> 
 <author><firstname>Nico</firstname><surname>Schmoigl</surname></author>
 <abstract><para>A binary orientated network-wide protocol for submitting information about bad memory modules.</para></abstract>
</bookinfo>

<chapter id="intro"><title>Introduction</title>
<para>
The MDF (<emphasis>M</emphasis>emory <emphasis>D</emphasis>ata <emphasis>F</emphasis>ormat) procotol is a block-orientated, abstract protocol, normally (but not necessarily) restricted to files and to memory areas.
The block size depends on the amount of data specified with the given command. A sequence of MDF commands (see later) describes one (or more) memory modules (and its bad areas) uniquely.</para>

<section id="command"><title>A MDF command</title>
<para>
A MDF command consists at least of the following bytes:</para>
<table frame="all">
 <title>mdf_cmd structure</title>
 <tgroup cols="4">
 <colspec colname="offset">
 <colspec colname="type">
 <colspec colname="name">
 <colspec colname="description">
 <thead>
  <row><entry>offset</entry><entry>type</entry><entry>name</entry><entry>description</entry></row>
 </thead>
 <tbody>
  <row>
   <entry>0x00</entry>
   <entry>unsigned 8-bit</entry>
   <entry>command</entry>
   <entry>Describes the type of action which should be taken when reading this command; see reference below for more details which actions can be triggered.</entry> 
  </row>
  <row>
   <entry>0x01</entry>
   <entry>unsigned 16-bit network order</entry>
   <entry>sub-command</entry>
   <entry>A (not-yet-used) sub command for specifing the exact action which should be taken</entry> 
  </row>
  <row>
   <entry>0x03</entry>
   <entry>unsigned 8-bit</entry>
   <entry>length</entry>
   <entry>Stores how many bytes are in the data area which will follow this MDF command</entry>
  </row>
 </tbody>
 </tgroup>
</table>
<para>
Summarized, you can see that this structure has a total length of four bytes. Please note that after these bytes, there might be additional data which length is stated in the <emphasis>length</emphasis> field. Note that therefore the maximal amount of bytes in the data area is always restricted to 255 bytes; a <emphasis>length</emphasis> of zero means that no additional data is available.</para> 
</section>

<section id="sequence"><title>A sequence of MDF commands</title>
<para>
A sequence of MDF commands is one (or normally more) MDF commands concatinated in a specific, user-defined order. Please note that between the given commands there may be additional data as already stated during the definition of the command.</para>
<para>
Therefore a valid sequence may look like this:</para>
<screen>
| cmd1 | subcmd1 | len1 | ***** data1 ***** | cmd2 | subcmd2 | len2 | cmd3 | subcmd3 | len3 | ** data3 ** |
</screen>
<para>But please note that the length of the data1-field is always the same as len1 (the same on data3 and len3, too, for sure!)</para>
</section>
</chapter>

<chapter id="cmdreference"><title>The MDF command reference</title>
<para>Every bit combination of the <emphasis>command</emphasis> field in a MDF command symbolizes a certain action to be performed. Here are their meanings:</para>
<table frame="all">
 <title>valid constants for the command field of an MDF command</title>
 <tgroup cols="3">
  <thead>
   <row><entry>content in the <emphasis>command</emphasis> field</entry>
   <entry>abbrevation</entry>
   <entry>description</entry></row>  
  </thead>
  <tbody>
   <row><entry>0x01</entry><entry>MDFCMD_VERSION</entry><entry>Defines the current version of this protocol</entry></row>
   <row><entry>0xff</entry><entry>MDFCMD_END</entry><entry>The MDF protocol ends here; all data after this mark should not be interpretated as MDF commands</entry></row>
   <row><entry>0x10</entry><entry>MDFCMD_MODULENAME</entry><entry>Definition of module identification name</entry></row>
   <row><entry>0x11</entry><entry>MDFCMD_SIZE</entry><entry>Definition of module size</entry></row>
   <row><entry>0x20</entry><entry>MDFCMD_PATTERN</entry><entry>Submission of a pattern line for bad spots in a memory module</entry></row>
  </tbody>
 </tgroup>
</table>
<para>All other bytes not specified above are still unused; their meaning is not defined here. Therefore they should not be used in practice.</para>
<para>The commands above will now be discussed:</para>

<section id="MDFCMDVERSION"><title>MDFCMD_VERSION - Version definition</title>
<para><emphasis>command</emphasis>: MDFCMD_VERSION</para>
<para><emphasis>sub-command</emphasis>: see description</para>
<para><emphasis>length</emphasis>: always 0</para>
<para><emphasis>data</emphasis>: nothing</para>
<section><title>Description</title>
<para>Defines the protocol version. The sub-command holds the version number. As this is the first release, sub-command should be always 1.  </para>
<para>Further releases will always be compatible to earlier versions. Therefore, unknown commands should be skipped without taking any action.</para>
<para><emphasis>Important:</emphasis>Any MDF data should begin with this command to make sure that the interpreter may use the correct command set</para>
</section></section>

<section id="MDFCMDEND"><title>MDFCMD_END - End of protocol</title>
<para><emphasis>command</emphasis>: MDFCMD_END</para>
<para><emphasis>sub-command</emphasis>: does not matter</para>
<para><emphasis>length</emphasis>: always 0</para>
<para><emphasis>data</emphasis>: nothing</para>
<section><title>Description</title>
<para>This tells the interpreter that beyond this mark, no new command should be looked at.</para>
<para>This features enables the MDF specification to be included into other (network) protocols.</para>
</section></section>

<section id="MDFCMDMODULENAME"><title>MDFCMD_MODULENAME - Start of a new module</title>
<para><emphasis>command</emphasis>: MDFCMD_MODULENAME</para>
<para><emphasis>sub-command</emphasis>: always 0</para>
<para><emphasis>length</emphasis>: see description</para>
<para><emphasis>data</emphasis>: see description</para>
<section><title>Description</title>
<para>MDFCMD_MODULENAME starts a new module definition. There is no "MODULE END" command; the next MDFCMD_MODULENAME starts a new module, closing the old one.</para>
<para>In the field <emphasis>data</emphasis>, you must specify an unique (globally, if possible) qualifier. The length of this qualifier is stored in the <emphasis>length</emphasis> field. The qualifier can consist of any byte combination. Please do not use the 0x0 byte as this may be confusing. It is recommended to use only tty-characters.</para>
</section></section>

<section id="MDFCMDMODULESIZE"><title>MDFCMD_MODULESIZE - Setting the size of a module</title>
<para>requires: a MDFCMD_MODULENAME must be prior this command</para>
<para><emphasis>command</emphasis>: MDFCMD_MODULESIZE</para>
<para><emphasis>sub-command</emphasis>: always 0</para>
<para><emphasis>length</emphasis>: see description (recommendation: 4)</para>
<para><emphasis>data</emphasis>: see description</para>
<section><title>Description</title>
<para>Defines the maximal size of the modules, defined by latest MDFCMD_MODULENAME command. If specified more than once for a module, the <emphasis>last</emphasis> MDFCMD_MODULESIZE is the valid one.</para> 
<para>The actual module size is store in the <emphasis>data</emphasis> field. The field <emphasis>length</emphasis> stores its length. The data is in network order. The unit of the size is in (pure) bytes.</para>
<para>It is recommended to use an unsigned 32-bit value in network order for submission.</para>
</section></section>

<section id="MDFCMDPATTERN"><title>MDFCMD_PATTERN - Submission of a BadMEM pattern </title>
<para><emphasis>command</emphasis>: MDFCMD_PATTERN</para>
<para><emphasis>sub-command</emphasis>: depends on type</para>
<para><emphasis>length</emphasis>: depends on type</para>
<para><emphasis>data</emphasis>: see description</para>
<section><title>Description</title>
<para>There are several types of patterns:</para>
<table frame="all">
 <title>Pattern type definition</title>
 <tgroup cols="3">
  <thead><row><entry>sub-command</entry><entry>type</entry><entry>comment</entry></row></thead>
  <tbody>
  <row><entry>0x0000</entry><entry>ANCIENT</entry><entry>Please not use this pattern type - it is too old</entry></row>
  <row><entry>0x0001</entry><entry>unused</entry><entry></entry></row>
  <row><entry>0x0002</entry><entry>V2</entry><entry>Due to the lack of upper bounds, please do not use the standard V2-type</entry></row>
  <row><entry>0x0003</entry><entry>V2-with-ubound</entry><entry>This is the preferred pattern type</entry></row> 
 </tbody>
 </tgroup>
</table>
</section>
<section><title>The V2-with-ubound pattern standard</title>
<para>A V2-with-ubound structure consists of four fields:</para>
<table frame="all">
 <title>structure of the V2-with-ubound pattern</title>
 <tgroup cols="4">
 <colspec colname="offset">
 <colspec colname="type">
 <colspec colname="name">
 <colspec colname="description">
 <thead>
  <row><entry>offset</entry><entry>type</entry><entry>name</entry><entry>description</entry></row>
 </thead>
 <tbody>
  <row>
   <entry>0x00</entry>
   <entry>unsigned 32-bit network order</entry>
   <entry>lbound</entry>
   <entry>contains the lower bound of the pattern</entry>
  </row>
  <row>
   <entry>0x04</entry>
   <entry>unsigned 32-bit network order</entry>
   <entry>mask</entry>
   <entry>contains the general mask of the pattern</entry>
  </row>
  <row>
   <entry>0x08</entry>
   <entry>unsigned 32-bit network order</entry>
   <entry>ubound</entry>
   <entry>contains the upper bound of the pattern</entry>
  </row>
  <row>
   <entry>0x0b</entry>
   <entry>unsigned 32-bit network order</entry>
   <entry>offset</entry>
   <entry>contains the (logical) offset of the pattern</entry>
  </row>
 </tbody>
 </tgroup>
</table>
<para>If you need futher information what the single fields do, please read the BadMEM Pattern Specification, which you can download from <ulink url="http://badmem.sourceforge.net">http://badmem.sourceforge.net</ulink></para>
<para>Please note that the normal length of a V2-with-ubound structure is 16 bytes.</para>
</section>
</section>
</chapter>

<chapter id="recommendedmdf"><title>A recommended MDF sequence</title>
<para>
The following sequence of MDF commands is a recommended prototype:</para>
<itemizedlist>
<listitem><para>MDFCMD_VERSION</para></listitem>
<listitem><para>first MDFCMD_MODULENAME</para></listitem>
<listitem><para>first MDFCMD_MODULESIZE</para></listitem>
<listitem><para>zero, one or more MDFCMD_PATTERN</para></listitem>
<listitem><para>second MDFCMD_MODULENAME</para></listitem>
<listitem><para>second MDFCMD_MODULESIZE</para></listitem>
<listitem><para>zero, one or more MDFCMD_PATTERN</para></listitem>
<listitem><para>repeat the last three steps for any module you want to define</para></listitem>
<listitem><para>MDFCMD_END</para></listitem>
</itemizedlist>
</chapter>
</book>

<!-- templates:
<para><emphasis>command</emphasis>: MDFCMD_</para>
<para><emphasis>sub-command</emphasis>: </para>
<para><emphasis>length</emphasis>: </para>
<para><emphasis>data</emphasis>: </para>
<section><title>Description</title>-->
