Paul Brook | 12 Aug 2006 02:39
Gravatar

sparc esp scsi fixes

The ESP SCSI driver currently doesn't check whether a DMA requests has 
completed before checking its status. On older qemu versions this works ok 
because DMA happens instantly. On never qemu DMA can take an indeterminate 
amount of time ooto complete, just like on real hardware.

The patch below waits for the controller to raise the DMA interrupt after 
initiating a DMA request.

Paul

Index: drivers/esp.c
===================================================================
--- drivers/esp.c	(revision 61)
+++ drivers/esp.c	(working copy)
 <at>  <at>  -113,6 +113,8  <at>  <at>  do_command(esp_private_t *esp, sd_privat
     esp->espdma.regs->cond_reg = 0;
     // Set ATN, issue command
     esp->ll->regs[ESP_CMD] = ESP_CMD_SELA | ESP_CMD_DMA;
+    // Wait for DMA to complete
+    while ((esp->espdma.regs->cond_reg & DMA_HNDL_INTR) == 0) /* no-op */;
     // Check status
     status = esp->ll->regs[ESP_STATUS];

 <at>  <at>  -129,6 +131,8  <at>  <at>  do_command(esp_private_t *esp, sd_privat
     esp->espdma.regs->cond_reg = DMA_ST_WRITE;
     // Transfer
     esp->ll->regs[ESP_CMD] = ESP_CMD_TI | ESP_CMD_DMA;
+    // Wait for DMA to complete
+    while ((esp->espdma.regs->cond_reg & DMA_HNDL_INTR) == 0) /* no-op */;
     // Check status
(Continue reading)

Blue Swirl | 12 Aug 2006 09:18
Picon
Favicon

Re: sparc esp scsi fixes

>The ESP SCSI driver currently doesn't check whether a DMA requests has
>completed before checking its status. On older qemu versions this works ok
>because DMA happens instantly. On never qemu DMA can take an indeterminate
>amount of time ooto complete, just like on real hardware.
>
>The patch below waits for the controller to raise the DMA interrupt after
>initiating a DMA request.

Looks good to me. Please apply.

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

Paul Brook | 11 Aug 2006 22:37
Gravatar

qemu openbios scsi issues.

I'm currenttly converting the qemu scsi emulatin to use async IO. The main 
effect of this is that DMA tranfers take an indterminate amount of guest time 
to complete (just like they do on real hardware) instead of completing 
instantaneously.

I've got It working in linux, but OpenBIOS dies when trying to read from the 
disk/cdrom. The problem appears to be that the openbios ESP drivers isses 
read commands then blindly continues without waiting for them to complete.

The code in question is the end of ecp.c:do_command and its caller.

I'm working on a fix, I just wanted to check (a) this hasn't already been 
fixed, and (b) I'm not on totally the wrong track.

Paul

svn | 12 Aug 2006 11:52

r73 - openbios-devel/drivers

Author: stepan
Date: 2006-08-12 11:52:34 +0200 (Sat, 12 Aug 2006)
New Revision: 73

Modified:
   openbios-devel/drivers/esp.c
Log:
From Paul Brook:
The ESP SCSI driver currently doesn't check whether a DMA requests has
completed before checking its status. On older qemu versions this
works ok because DMA happens instantly. On never qemu DMA can take an
indeterminate amount of time ooto complete, just like on real
hardware.

The patch waits for the controller to raise the DMA interrupt after
initiating a DMA request.

Modified: openbios-devel/drivers/esp.c
===================================================================
--- openbios-devel/drivers/esp.c	2006-07-28 21:44:07 UTC (rev 72)
+++ openbios-devel/drivers/esp.c	2006-08-12 09:52:34 UTC (rev 73)
 <at>  <at>  -113,6 +113,8  <at>  <at> 
     esp->espdma.regs->cond_reg = 0;
     // Set ATN, issue command
     esp->ll->regs[ESP_CMD] = ESP_CMD_SELA | ESP_CMD_DMA;
+    // Wait for DMA to complete. Can this fail?
+    while ((esp->espdma.regs->cond_reg & DMA_HNDL_INTR) == 0) /* no-op */;
     // Check status
     status = esp->ll->regs[ESP_STATUS];

(Continue reading)

Stefan Reinauer | 17 Aug 2006 14:29
Picon

[ANNOUNCE] New FCode Suite available!

Dear OpenBIOS community,

today I am very glad to announce a new version of the OpenBIOS FCode
utilities toke and detok. David Paktor, of the IBM corporation,
contributed a couple of significant improvements over the old versions
of those utilities.

Toke and Detok now have a comprehensive regression test suite
of over 170 tests. This test suite makes it easy to verify 
that new contributions do not break existing functionality.

* among the new features:

  - detailed error reporting
  - local value support! See
    http://www.openbios.org/fcodesuite/Documents/TokenizerLocalValues.htm
  - much better handling of PCI option roms
  - improved compatibility to other tokenizers
  - bug fixes in flow control and string escape handling

Please be sure to check the complete list of new features at:
        http://www.openbios.org/fcodesuite/Documents/TokenizerNewFeatures.htm

I want to send a big THANK YOU out to David Paktor at this point.

NOTE: The contributed changes are not in the main repository yet. 
You can download the changed source code and binaries as well as the
test suite and test results as well as documentation from:
       http://www.openbios.org/development/fcode.html

(Continue reading)

David L Paktor | 17 Aug 2006 21:29
Picon
Favicon

Re: [ANNOUNCE] New FCode Suite available!


>
> Subject:
>
> [OpenBIOS] [ANNOUNCE] New FCode Suite available!
>
> Date:
>
> Thu, 17 Aug 2006 14:29:14 +0200
>
> From:
>
> Stefan Reinauer <stepan <at> coresystems.de>
>
> Reply-To:
>
> The OpenBIOS Mailinglist <openbios <at> lists.openbios.org>
>
> To:
>
> openbios <at> lists.openbios.org
>
>

> Dear OpenBIOS community,
>
> today I am very glad to announce a new version of the OpenBIOS FCode
> utilities toke and detok. David Paktor, of the IBM corporation,
> contributed a couple of significant improvements over the old versions
> of those utilities.
>
> Toke and Detok now have a comprehensive regression test suite
> of over 170 tests. This test suite makes it easy to verify
> that new contributions do not break existing functionality.
>
> * among the new features:
>
>   - detailed error reporting
>   - local value support! See
>     http://www.openbios.org/fcodesuite/Documents/TokenizerLocalValues.htm
>   - much better handling of PCI option roms
>   - improved compatibility to other tokenizers
>   - bug fixes in flow control and string escape handling
>  
> Please be sure to check the complete list of new features at:
>         http://www.openbios.org/fcodesuite/Documents/TokenizerNewFeatures.htm
>
> I want to send a big THANK YOU out to David Paktor at this point.
>
> NOTE: The contributed changes are not in the main repository yet.
> You can download the changed source code and binaries as well as the
> test suite and test results as well as documentation from:
>        http://www.openbios.org/development/fcode.html
>
> Please send any feedback to this mailing list.
>
> Best regards,
>
> Stefan Reinauer
>
>
> --
> coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
>       Tel.: +49 761 7668825 • Fax: +49 761 7664613
> Email: info <at> coresystems.de  • http://www.coresystems.de/
>
> --
> OpenBIOS                 http://openbios.org/
> Mailinglist:  http://lists.openbios.org/mailman/listinfo
> Free your System - May the Forth be with you


And thank you, Stefan, for your kind words and for the contribution you made initiating and maintaining
this project and web-site.

I would like to make two small amendments:

The test suite contains exactly 162 tests. Still a lot, but let's not mis-advertise even to a small degree.

Modesty prohibits me from saying much more than this, but I hope a look at the New Features document,
and at the Test Log files, will suffice to demonstrate that "a couple of significant improvements"
is very much an understatement... ;-}

That being said, let me again express my gratitude for the opportunity to make this contribution to the
Open Firmware community.

My goal was to create a truly professional-grade tool; I look forward to finding out whether I have achieved it.

-----

David L. Paktor System Firmware Developer
System and Technology Group Global Firmware Division
dlpaktor <at> us.ibm.com David L Paktor/Almaden/IBM <at> IBMUS

18880 Homestead Rd. Building 9945
Cupertino CA 95014 Room 1026
408-342-6110 T/L 560-6110

"The Bug Stops Here"

<div>
<p><br>
&gt; <br>
&gt; Subject: <br>&gt; <br>
&gt; [OpenBIOS] [ANNOUNCE] New FCode Suite available!<br>&gt; <br>
&gt; Date: <br>&gt; <br>
&gt; Thu, 17 Aug 2006 14:29:14 +0200<br>&gt; <br>
&gt; From: <br>&gt; <br>
&gt; Stefan Reinauer &lt;stepan <at> coresystems.de&gt;<br>&gt; <br>
&gt; Reply-To: <br>&gt; <br>
&gt; The OpenBIOS Mailinglist &lt;openbios <at> lists.openbios.org&gt;<br>&gt; <br>
&gt; To: <br>&gt; <br>
&gt; openbios <at> lists.openbios.org<br>&gt; <br>
&gt; <br><br>&gt; Dear OpenBIOS community,<br>
&gt; <br>
&gt; today I am very glad to announce a new version of the OpenBIOS FCode<br>
&gt; utilities toke and detok. David Paktor, of the IBM corporation,<br>
&gt; contributed a couple of significant improvements over the old versions<br>
&gt; of those utilities.<br>
&gt; <br>
&gt; Toke and Detok now have a comprehensive regression test suite<br>
&gt; of over 170 tests. This test suite makes it easy to verify <br>
&gt; that new contributions do not break existing functionality.<br>
&gt; <br>
&gt; * among the new features:<br>
&gt; <br>
&gt; &nbsp; - detailed error reporting<br>
&gt; &nbsp; - local value support! See<br>
&gt; &nbsp; &nbsp; <a href="http://www.openbios.org/fcodesuite/Documents/TokenizerLocalValues.htm">http://www.openbios.org/fcodesuite/Documents/TokenizerLocalValues.htm</a><br>
&gt; &nbsp; - much better handling of PCI option roms<br>
&gt; &nbsp; - improved compatibility to other tokenizers<br>
&gt; &nbsp; - bug fixes in flow control and string escape handling<br>
&gt; &nbsp; <br>
&gt; Please be sure to check the complete list of new features at:<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.openbios.org/fcodesuite/Documents/TokenizerNewFeatures.htm">http://www.openbios.org/fcodesuite/Documents/TokenizerNewFeatures.htm</a><br>
&gt; <br>
&gt; I want to send a big THANK YOU out to David Paktor at this point.<br>
&gt; <br>
&gt; NOTE: The contributed changes are not in the main repository yet. <br>
&gt; You can download the changed source code and binaries as well as the<br>
&gt; test suite and test results as well as documentation from:<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://www.openbios.org/development/fcode.html">http://www.openbios.org/development/fcode.html</a><br>
&gt; <br>
&gt; Please send any feedback to this mailing list.<br>
&gt; <br>
&gt; Best regards,<br>
&gt; <br>
&gt; Stefan Reinauer<br>
&gt; <br>
&gt; <br>
&gt; -- <br>
&gt; coresystems GmbH &bull; Brahmsstr. 16 &bull; D-79104 Freiburg i. Br.<br>
&gt; &nbsp; &nbsp; &nbsp; Tel.: +49 761 7668825 &bull; Fax: +49 761 7664613<br>
&gt; Email: info <at> coresystems.de &nbsp;&bull; <a href="http://www.coresystems.de/">http://www.coresystems.de/</a><br>
&gt; <br>
&gt; -- <br>
&gt; OpenBIOS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://openbios.org/">http://openbios.org/</a><br>
&gt; Mailinglist: &nbsp;<a href="http://lists.openbios.org/mailman/listinfo">http://lists.openbios.org/mailman/listinfo</a><br>
&gt; Free your System - May the Forth be with you<br><br><br>
And thank you, Stefan, for your kind words and for the contribution you made initiating and maintaining<br>
this project and web-site.<br><br>
 I would like to make two small amendments:<br><br>
The test suite contains exactly 162 tests.  Still a lot, but let's not mis-advertise even to a small degree.<br><br>
Modesty prohibits me from saying much more than this, but I hope a look at the New Features document,<br>
and at the Test Log files, will suffice to demonstrate that "a couple of significant improvements"<br>
is very much an understatement...  ;-}<br><br>
That being said, let me again express my gratitude for the opportunity to make this contribution to the<br>
Open Firmware community.<br><br>
My goal was to create a truly professional-grade tool; I look forward to finding out whether I have achieved it.<br><br>
-----<br><br>
David L. Paktor                  System Firmware Developer<br>
System and Technology Group      Global Firmware Division<br>
dlpaktor <at> us.ibm.com              David L Paktor/Almaden/IBM <at> IBMUS<br><br>
18880 Homestead Rd.              Building 9945<br>
Cupertino CA 95014               Room 1026<br>
408-342-6110                     T/L 560-6110<br><br>
"The Bug Stops Here"<br><br></p>
</div>
svn | 18 Aug 2006 11:07

r74 - / fcode-utils fcode-utils/toke

Author: stepan
Date: 2006-08-18 11:07:34 +0200 (Fri, 18 Aug 2006)
New Revision: 74

Added:
   fcode-utils/
   fcode-utils/detok/
   fcode-utils/romheaders/
   fcode-utils/toke/
Removed:
   fcode-utils/toke/build.xml
Log:
moving fcode suite to an extra directory

Copied: fcode-utils/detok (from rev 71, openbios-devel/utils/detok)

Copied: fcode-utils/romheaders (from rev 71, openbios-devel/utils/romheaders)

Copied: fcode-utils/toke (from rev 71, openbios-devel/toke)

Deleted: fcode-utils/toke/build.xml
===================================================================
--- openbios-devel/toke/build.xml	2006-07-23 14:29:29 UTC (rev 71)
+++ fcode-utils/toke/build.xml	2006-08-18 09:07:34 UTC (rev 74)
 <at>  <at>  -1,13 +0,0  <at>  <at> 
-<build>
-
- <executable name="toke" target="host">
-  <object source="toke.c"/>
-  <object source="emit.c"/>
-  <object source="dictionary.c"/>
-  <object source="stack.c"/>
-  <object source="stream.c"/>
-  <object source="macros.c"/>
-  <object source="scanner.c"/>
- </executable>
-  
-</build>

svn | 18 Aug 2006 11:45

r75 - fcode-utils/romheaders

Author: stepan
Date: 2006-08-18 11:45:11 +0200 (Fri, 18 Aug 2006)
New Revision: 75

Modified:
   fcode-utils/romheaders/romheaders.c
Log:
add missing header

Modified: fcode-utils/romheaders/romheaders.c
===================================================================
--- fcode-utils/romheaders/romheaders.c	2006-08-18 09:07:34 UTC (rev 74)
+++ fcode-utils/romheaders/romheaders.c	2006-08-18 09:45:11 UTC (rev 75)
 <at>  <at>  -1,3 +1,27  <at>  <at> 
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( romheaders utility )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@...>
+ *  Copyright (C) 2006 coresystems GmbH <info@...>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */

 
 #include <stdio.h>
 <at>  <at>  -12,9 +36,6  <at>  <at> 

 #define PCI_DATA_HDR (u32) ( ('R' << 24) | ('I' << 16) | ('C' << 8) | 'P' )

-char *rom=NULL;
-size_t romlen=0;
-
 typedef struct {
 	u16	signature;
 	u8	reserved[0x16];
 <at>  <at>  -37,6 +58,8  <at>  <at> 
 	u16	reserved_2;
 } pci_data_t;

+char *rom=NULL;
+size_t romlen=0;

 /* make this endian safe without fancy system headers */
 static u16 little_word(u16 val)

svn | 18 Aug 2006 14:57

r78 - fcode-utils/toke

Author: stepan
Date: 2006-08-18 14:57:14 +0200 (Fri, 18 Aug 2006)
New Revision: 78

Added:
   fcode-utils/toke/toke.doxygen
Modified:
   fcode-utils/toke/Makefile
Log:
add toke doxygen documentation target

Modified: fcode-utils/toke/Makefile
===================================================================
--- fcode-utils/toke/Makefile	2006-08-18 12:56:03 UTC (rev 77)
+++ fcode-utils/toke/Makefile	2006-08-18 12:57:14 UTC (rev 78)
 <at>  <at>  -51,6 +51,9  <at>  <at> 
 .dependencies: *.c 
 	 <at> $(CC) $(CFLAGS) $(INCLUDES) -MM *.c > .dependencies

+documentation:: *.c *.h toke.doxygen
+	 <at> doxygen toke.doxygen
+
 .PHONY: all clean distclean 

 -include .dependencies

Added: fcode-utils/toke/toke.doxygen
===================================================================
--- fcode-utils/toke/toke.doxygen	                        (rev 0)
+++ fcode-utils/toke/toke.doxygen	2006-08-18 12:57:14 UTC (rev 78)
 <at>  <at>  -0,0 +1,272  <at>  <at> 
+# Doxyfile 1.4.4
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = Toke 
+PROJECT_NUMBER         = 
+OUTPUT_DIRECTORY       = .
+CREATE_SUBDIRS         = YES
+OUTPUT_LANGUAGE        = English
+USE_WINDOWS_ENCODING   = NO
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = 
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = YES
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = NO
+INHERIT_DOCS           = YES
+DISTRIBUTE_GROUP_DOC   = NO
+SEPARATE_MEMBER_PAGES  = NO
+TAB_SIZE               = 8
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = NO
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = YES
+EXTRACT_STATIC         = YES
+EXTRACT_LOCAL_CLASSES  = YES
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = NO
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = YES
+GENERATE_TESTLIST      = YES
+GENERATE_BUGLIST       = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = YES
+FILE_VERSION_FILTER    = 
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = 
+FILE_PATTERNS          = *.c \
+                         *.cc \
+                         *.cxx \
+                         *.cpp \
+                         *.c++ \
+                         *.d \
+                         *.java \
+                         *.ii \
+                         *.ixx \
+                         *.ipp \
+                         *.i++ \
+                         *.inl \
+                         *.h \
+                         *.hh \
+                         *.hxx \
+                         *.hpp \
+                         *.h++ \
+                         *.idl \
+                         *.odl \
+                         *.cs \
+                         *.php \
+                         *.php3 \
+                         *.inc \
+                         *.m \
+                         *.mm \
+                         *.dox \
+                         *.C \
+                         *.CC \
+                         *.C++ \
+                         *.II \
+                         *.I++ \
+                         *.H \
+                         *.HH \
+                         *.H++ \
+                         *.CS \
+                         *.PHP \
+                         *.PHP3 \
+                         *.M \
+                         *.MM
+RECURSIVE              = YES
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = 
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = YES
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+USE_HTAGS              = NO
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = YES
+HTML_OUTPUT            = toke-html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = NO
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = NO
+TOC_EXPAND             = NO
+DISABLE_INDEX          = NO
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = YES
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = YES
+USE_PDFLATEX           = YES
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = NO
+RTF_OUTPUT             = rtf
+COMPACT_RTF            = NO
+RTF_HYPERLINKS         = NO
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = NO
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = 
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = YES
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = YES
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = YES
+TEMPLATE_RELATIONS     = NO
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = YES
+CALLER_GRAPH             = YES
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+MAX_DOT_GRAPH_WIDTH    = 1024
+MAX_DOT_GRAPH_HEIGHT   = 1024
+MAX_DOT_GRAPH_DEPTH    = 1000
+DOT_TRANSPARENT        = NO
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
+INPUT= clflags.c clflags.h conditl.c conditl.h devnode.c devnode.h dictionary.c dictionary.h
emit.c emit.h errhandler.c errhandler.h flowcontrol.c flowcontrol.h macros.c macros.h nextfcode.c
nextfcode.h parselocals.c parselocals.h scanner.c scanner.h stack.c stack.h stream.c stream.h
strsubvocab.c strsubvocab.h ticvocab.c ticvocab.h toke.c toke.h tokzesc.c tokzesc.h tracesyms.c
tracesyms.h usersymbols.c usersymbols.h vocabfuncts.h

svn | 18 Aug 2006 14:56

r77 - in fcode-utils: . shared

Author: stepan
Date: 2006-08-18 14:56:03 +0200 (Fri, 18 Aug 2006)
New Revision: 77

Added:
   fcode-utils/Makefile
   fcode-utils/shared/
   fcode-utils/shared/classcodes.c
   fcode-utils/shared/pcihdr.h
   fcode-utils/shared/types.h
Log:
add shared files

Added: fcode-utils/Makefile
===================================================================
--- fcode-utils/Makefile	                        (rev 0)
+++ fcode-utils/Makefile	2006-08-18 12:56:03 UTC (rev 77)
 <at>  <at>  -0,0 +1,47  <at>  <at> 
+#
+#                     OpenBIOS - free your system!
+#                             ( Utilities )
+#
+#  This program is part of a free implementation of the IEEE 1275-1994
+#  Standard for Boot (Initialization Configuration) Firmware.
+#
+#  Copyright (C) 2006 coresystems GmbH <info@...>
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; version 2 of the License.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+#
+
+all:
+	make -C toke
+	make -C detok
+	make -C romheaders
+
+install:
+	make -C toke install
+	make -C detok install
+	make -C romheaders install
+
+clean:	
+	make -C toke clean
+	make -C detok clean
+	make -C romheaders clean
+
+distclean: clean
+	make -C toke distclean
+	make -C detok distclean
+	make -C romheaders distclean
+
+
+
+.PHONY: all clean distclean toke detok romheaders
+

Added: fcode-utils/shared/classcodes.c
===================================================================
--- fcode-utils/shared/classcodes.c	                        (rev 0)
+++ fcode-utils/shared/classcodes.c	2006-08-18 12:56:03 UTC (rev 77)
 <at>  <at>  -0,0 +1,415  <at>  <at> 
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@...>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      Functions to correlate PCI Device Class-Codes and PCI Code Types
+ *      with their printable names.
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@...
+ *
+ **************************************************************************** */
+
+#include <stdlib.h>
+#include "types.h"
+
+/* **************************************************************************
+ *
+ *      Functions Eported:
+ *          pci_device_class_name
+ *              Convert a numeric PCI Class Code to the Device Class Name
+ *
+ *          pci_code_type_name
+ *              Convert a numeric PCI Code Type to a printable Name
+ *
+ **************************************************************************** */
+
+const char *pci_device_class_name( u32 code);
+const char *pci_code_type_name(u8 code);
+
+
+typedef struct {
+    const u32    classcode;
+    const char  *classname;
+} num_to_name_table ;
+
+
+/* **************************************************************************
+ *
+ *      Function name:  convert_num_to_name
+ *      Synopsis:   Find the Name, in the given table, for the given Number.
+ *                  Support function for Exported Functions.
+ *      
+ *      Inputs:
+ *          Parameters:     
+ *              u32 num           Number to look up       
+ *      num_to_name_table *table  Pointer to Table to scan        
+ *              int max           Maximum Index of Table
+ *            char *not_found     String to return if Number not in Table
+ *
+ *      Outputs:
+ *          Returned Value: Pointer to string giving the Name
+ *
+ *      Error Detection:
+ *          Unrecognized Number
+ *              Return "not_found" string
+ *
+ *      Process Explanation:
+ *          Scan the Table for a match.
+ *
+ *      Still to be done / Misc remarks:
+ *          Had been considering a more sophisticated binary search,
+ *          but the database is too small to merit the extra code.
+ *          Stayed with the KISS principle...
+ *      
+ *
+ **************************************************************************** */
+
+static const char *convert_num_to_name(u32 num,
+                                 num_to_name_table *table,
+                                 int max,
+                                 const char *not_found)
+{
+    int indx;
+    const char *retval;
+
+    retval = not_found;
+
+    for (indx = 0;  indx < max ; indx++)
+    {
+        if ( num == table[indx].classcode )
+        {
+            retval = table[indx].classname ;
+            break ;
+        }
+     }
+     return ( retval );
+}
+
+
+/* **************************************************************************
+ *
+ *
+ *          Structures:
+ *      pci_code_type_name_table    Constant Data Table that correlates
+ *                                      PCI Code Types with their Names.
+ *      
+ *      pci_dev_class_name_table    Constant Data Table that correlates
+ *                                      Class Codes with their Class Names.
+ *                                  This list of codes and names is current
+ *                                      as of PCI Local Bus Specification
+ *                                      Revision 3.0 dated February 3, 2004
+ *
+ **************************************************************************** */
+
+
+static const num_to_name_table pci_code_type_name_table[] = {
+    { 0 , "Intel x86" },
+    { 1 , "Open Firmware" },
+    { 2 , "HP PA Risc" },
+    { 3 , "Intel EFI (unofficial)" }
+};
+
+
+static const num_to_name_table pci_dev_class_name_table[] = {
+    { 0x000000 , "Legacy Device" },
+    { 0x000100 , "VGA-Compatible Device" },
+
+    { 0x010000 , "SCSI bus controller" },
+ /* { 0x0101xx , "IDE controller" },    */
+    { 0x010200 , "Floppy disk controller" },
+    { 0x010300 , "IPI bus controller" },
+    { 0x010400 , "RAID controller" },
+    { 0x010520 , "ATA controller, single stepping" },
+    { 0x010530 , "ATA controller, continuous" },
+    { 0x010600 , "Serial ATA controller - vendor specific interface" },
+    { 0x010601 , "Serial ATA controller - AHCI 1.0 interface" },
+    { 0x010700 , "Serial Attached SCSI controller" },
+    { 0x018000 , "Mass Storage controller" },
+
+    { 0x020000 , "Ethernet controller"     },
+    { 0x020100 , "Token Ring controller"   },
+    { 0x020200 , "FDDI controller"         },
+    { 0x020300 , "ATM controller"          },
+    { 0x020400 , "ISDN controller" },
+    { 0x020500 , "WorldFip controller" },
+ /* { 0x0206xx , "PICMG 2.14 Multi Computing" },    */
+    { 0x028000 , "Network controller"      },
+
+    { 0x030000 , "VGA Display controller"  },
+    { 0x030001 , "8514-compatible Display controller"  },
+    { 0x030100 , "XGA Display controller"  },
+    { 0x030200 , "3D Display controller"   },
+    { 0x038000 , "Display controller"      },
+
+    { 0x040000 , "Video device" },
+    { 0x040100 , "Audio device" },
+    { 0x040200 , "Computer Telephony device" },
+    { 0x048000 , "Multimedia device" },
+
+    { 0x050000 , "RAM memory controller" },
+    { 0x050100 , "Flash memory controller" },
+    { 0x058000 , "Memory controller" },
+
+    { 0x060000 , "Host bridge" },
+    { 0x060100 , "ISA bridge" },
+    { 0x060200 , "EISA bridge" },
+    { 0x060300 , "MCA bridge" },
+    { 0x060400 , "PCI-to-PCI bridge" },
+    { 0x060401 , "PCI-to-PCI bridge (subtractive decoding)" },
+    { 0x060500 , "PCMCIA bridge" },
+    { 0x060600 , "NuBus bridge" },
+    { 0x060700 , "CardBus bridge" },
+ /* { 0x0608xx , "RACEway bridge" },    */
+    { 0x060940 , "PCI-to-PCI bridge, Semi-transparent, primary facing Host" },
+    { 0x060980 , "PCI-to-PCI bridge, Semi-transparent, secondary facing Host" },
+    { 0x060A00 , "InfiniBand-to-PCI host bridge" },
+    { 0x068000 , "Bridge device" },
+
+    { 0x070000 , "Generic XT-compatible serial controller" },
+    { 0x070001 , "16450-compatible serial controller" },
+    { 0x070002 , "16550-compatible serial controller" },
+    { 0x070003 , "16650-compatible serial controller" },
+    { 0x070004 , "16750-compatible serial controller" },
+    { 0x070005 , "16850-compatible serial controller" },
+    { 0x070006 , "16950-compatible serial controller" },
+
+    { 0x070100 , "Parallel port" },
+    { 0x070101 , "Bi-directional parallel port" },
+    { 0x070102 , "ECP 1.X compliant parallel port" },
+    { 0x070103 , "IEEE1284 controller" },
+    { 0x0701FE , "IEEE1284 target device" },
+    { 0x070200 , "Multiport serial controller" },
+
+    { 0x070300 , "Generic modem" },
+    { 0x070301 , "Hayes 16450-compatible modem" },
+    { 0x070302 , "Hayes 16550-compatible modem" },
+    { 0x070303 , "Hayes 16650-compatible modem" },
+    { 0x070304 , "Hayes 16750-compatible modem" },
+    { 0x070400 , "GPIB (IEEE 488.1/2) controller" },
+    { 0x070500 , "Smart Card" },
+    { 0x078000 , "Communications device" },
+
+    { 0x080000 , "Generic 8259 PIC" },
+    { 0x080001 , "ISA PIC" },
+    { 0x080002 , "EISA PIC" },
+    { 0x080010 , "I/O APIC interrupt controller" },
+    { 0x080020 , "I/O(x) APIC interrupt controller" },
+
+    { 0x080100 , "Generic 8237 DMA controller" },
+    { 0x080101 , "ISA DMA controller" },
+    { 0x080102 , "EISA DMA controller" },
+
+    { 0x080200 , "Generic 8254 system timer" },
+    { 0x080201 , "ISA system timer" },
+    { 0x080202 , "EISA system timer-pair" },
+
+    { 0x080300 , "Generic RTC controller" },
+    { 0x080301 , "ISA RTC controller" },
+
+    { 0x080400 , "Generic PCI Hot-Plug controller" },
+    { 0x080500 , "SD Host controller" },
+    { 0x088000 , "System peripheral" },
+
+    { 0x090000 , "Keyboard controller" },
+    { 0x090100 , "Digitizer (pen)" },
+    { 0x090200 , "Mouse controller" },
+    { 0x090300 , "Scanner controller" },
+    { 0x090400 , "Generic Gameport controller" },
+    { 0x090410 , "Legacy Gameport controller" },
+    { 0x098000 , "Input controller" },
+
+    { 0x0a0000 , "Generic docking station" },
+    { 0x0a8000 , "Docking station" },
+
+    { 0x0b0000 , "386 Processor" },
+    { 0x0b0100 , "486 Processor" },
+    { 0x0b0200 , "Pentium Processor" },
+    { 0x0b1000 , "Alpha Processor" },
+    { 0x0b2000 , "PowerPC Processor" },
+    { 0x0b3000 , "MIPS Processor" },
+    { 0x0b4000 , "Co-processor" },
+
+    { 0x0c0000 , "IEEE 1394 (FireWire)" },
+    { 0x0c0010 , "IEEE 1394 -- OpenHCI spec" },
+    { 0x0c0100 , "ACCESS.bus" },
+    { 0x0c0200 , "SSA" },
+    { 0x0c0300 , "Universal Serial Bus (UHC spec)" },
+    { 0x0c0310 , "Universal Serial Bus (Open Host spec)" },
+    { 0x0c0320 , "USB2 Host controller (Intel Enhanced HCI spec)" },
+    { 0x0c0380 , "Universal Serial Bus (no PI spec)" },
+    { 0x0c03FE , "USB Target Device" },
+    { 0x0c0400 , "Fibre Channel" },
+    { 0x0c0500 , "System Management Bus" },
+    { 0x0c0600 , "InfiniBand" },
+    { 0x0c0700 , "IPMI SMIC Interface" },
+    { 0x0c0701 , "IPMI Kybd Controller Style Interface" },
+    { 0x0c0702 , "IPMI Block Transfer Interface" },
+ /* { 0x0c08xx , "SERCOS Interface" },    */
+    { 0x0c0900 , "CANbus" },
+ 
+    { 0x0d100 , "iRDA compatible controller" },
+    { 0x0d100 , "Consumer IR controller" },
+    { 0x0d100 , "RF controller" },
+    { 0x0d100 , "Bluetooth controller" },
+    { 0x0d100 , "Broadband controller" },
+    { 0x0d100 , "Ethernet (802.11a 5 GHz) controller" },
+    { 0x0d100 , "Ethernet (802.11b 2.4 GHz) controller" },
+    { 0x0d100 , "Wireless controller" },
+     
+ /* { 0x0e00xx , "I2O Intelligent I/O, spec 1.0" },    */
+    { 0x0e0000 , "Message FIFO at offset 040h" },
+
+    { 0x0f0100 , "TV satellite comm. controller" },
+    { 0x0f0200 , "Audio satellite comm. controller" },
+    { 0x0f0300 , "Voice satellite comm. controller" },
+    { 0x0f0400 , "Data satellite comm. controller" },
+
+    { 0x100000 , "Network and computing en/decryption" },
+    { 0x101000 , "Entertainment en/decryption" },
+    { 0x108000 , "En/Decryption" },
+
+    { 0x110000 , "DPIO modules" },
+    { 0x110100 , "Perf. counters" },
+    { 0x111000 , "Comm. synch., time and freq. test" },
+    { 0x112000 , "Management card" },
+    { 0x118000 , "Data acq./Signal proc." },
+
+};
+
+
+/* **************************************************************************
+ *
+ *      PCI Class Code name calculations are further complicated by the
+ *          fact that there are some combinations of Base Class and
+ *          Sub-Class for which no specific register-level programming
+ *          interfaces are defined, or, in other words, for which all
+ *          possible numeric values of Programming Interface codes
+ *          (i.e., the low-byte) are valid.
+ *
+ *     The following table lists the Base Class / Sub-Class pairs to
+ *          accept without matching the Programming Interface, along
+ *          with their names.
+ *
+ **************************************************************************** */
+
+
+static const num_to_name_table pci_all_prg_intfcs_table[] = {
+    { 0x0101 , "IDE controller" },
+    { 0x0206 , "PICMG 2.14 Multi Computing" },
+    { 0x0608 , "RACEway bridge" },
+    { 0x0c08 , "SERCOS Interface" },
+    { 0x0e00 , "I2O Intelligent I/O, spec 1.0" },
+};
+
+
+/* **************************************************************************
+ *
+ *      Function name:  pci_device_class_name
+ *      Synopsis:   Return the Device Class Name for the given Class Code
+ *      
+ *      Inputs:
+ *          Parameters:
+ *                  u32 code        Numeric PCI Class Code
+ *
+ *      Outputs:
+ *          Returned Value:  Pointer to string giving the Device Class Name
+ *
+ *      Error Detection:
+ *          Unrecognized Class Code
+ *              String returned is "unknown"
+ *
+ *      Process Explanation:
+ *          Scan the pci_dev_class_name_table for a match.
+ *          If one is not found there, drop the low (Programming Interface)
+ *              byte of the code and scan the  pci_all_prg_intfcs_table
+ *              for a match that way
+ *          If you didn't find one there, you've exhausted your options...
+ *
+ **************************************************************************** */
+
+const char *pci_device_class_name( u32 code)
+{
+    const int pdc_max_indx =
+        sizeof(pci_dev_class_name_table)/sizeof(num_to_name_table) ;
+    const char *result ;
+
+    result = convert_num_to_name(
+           code,
+                (num_to_name_table *)pci_dev_class_name_table,
+                        pdc_max_indx,
+                         NULL);
+
+    if ( result == NULL)
+    {
+        const int pallpi_max_indx =
+            sizeof(pci_all_prg_intfcs_table)/sizeof(num_to_name_table) ;
+
+	result = convert_num_to_name(
+	    code>>8,
+                (num_to_name_table *)pci_all_prg_intfcs_table,
+                        pallpi_max_indx,
+                         "unknown");
+    }
+    return ( result );
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  pci_code_type_name
+ *      Synopsis:   Return a printable Name for the given PCI Code Type
+ *      
+ *      Inputs:
+ *          Parameters:
+ *              u8 code          Numeric PCI Code Type
+ *
+ *      Outputs:
+ *              Returned Value:  Pointer to string giving printable Name
+ *
+ *      Error Detection:
+ *          Unrecognized PCI Code Type
+ *              String returned is "unknown as of PCI specs 2.2"
+ *
+ *      Process Explanation:
+ *          Scan the pci_code_type_name_table for a match.
+ *
+ *
+ **************************************************************************** */
+
+const char *pci_code_type_name(u8 code)
+{
+    const int pct_max_indx =
+        sizeof(pci_code_type_name_table)/sizeof(num_to_name_table) ;
+    const char *result ;
+
+    result = convert_num_to_name(
+          (u32)code,
+                (num_to_name_table *)pci_code_type_name_table,
+                        pct_max_indx,
+                                "unknown as of PCI specs 2.2");
+    return ( result );
+}
+

Added: fcode-utils/shared/pcihdr.h
===================================================================
--- fcode-utils/shared/pcihdr.h	                        (rev 0)
+++ fcode-utils/shared/pcihdr.h	2006-08-18 12:56:03 UTC (rev 77)
 <at>  <at>  -0,0 +1,176  <at>  <at> 
+#ifndef _PCIHDR_H
+#define _PCIHDR_H
+/*
+ *                     OpenBIOS - free your system!
+ *                            ( PCI headers )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@...>
+ *  Copyright (C) 2006 coresystems GmbH <info@...>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      PCI Header and PCI Data Structures, as defined in
+ *              PCI FIRMWARE SPECIFICATION, REV. 3.
+ *      taken from openbios/utils/romheaders/romheaders.c
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@...
+ *
+ *
+ **************************************************************************** */
+
+
+/* **************************************************************************
+ *
+ *      Structures:
+ *          rom_header_t        Type definition for a PCI ROM Header
+ *          pci_data_t          Type definition for a PCI Data Header
+ *      
+ *
+ *      Macros:
+ *          PCI_DATA_HDR                 Construct the PCI Data Header signature
+ *                                           as an integer.  Use this to create
+ *                                           a constant, in order to allow its
+ *                                           value to be calculated at compile-
+ *                                           -time rather than at run-time.
+ *          BIG_ENDIAN_WORD_FETCH        Fetch a big-endian word from 2
+ *                                           unsigned chars in sequence.
+ *          LITTLE_ENDIAN_WORD_FETCH     ...... little-endian word from 2 ....
+ *          BIG_ENDIAN_LONG_FETCH        ...... big-endian long from 4 ...
+ *          LITTLE_ENDIAN_LONG_FETCH     ...... little-endian long from 4 ....
+ *          LITTLE_ENDIAN_TRIPLET_FETCH  ...... little-endian triplet from 3 ...
+ *          CLASS_CODE_FETCH             Special fetch for Class-Code triplet
+ *          BIG_ENDIAN_WORD_STORE        Store an integer into 2 unsigned
+ *                                           chars in big-endian sequence
+ *          LITTLE_ENDIAN_WORD_STORE     ..... into 2 ... little-endian ...
+ *          BIG_ENDIAN_LONG_STORE        ..... into 4 ... big-endian  ... 
+ *          LITTLE_ENDIAN_LONG_STORE     ..... into 4 ... little-endian ...
+ *          LITTLE_ENDIAN_TRIPLET_STORE  .....   3 ... little-endian triplet ...
+ *          CLASS_CODE_STORE             Special store for Class-Code triplet
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Still to be done:
+ *          The "Endian" macros are beginning to appear to be more
+ *              generally useful that previously thought, and should,
+ *              perhaps, be moved into types.h
+ *
+ **************************************************************************** */
+
+#include "types.h"
+/*  Construct the PCI Data Header signature as an integer   */
+#define PCI_DATA_HDR (u32) ( ('P' << 24) | ('C' << 16) | ('I' << 8) | 'R' )
+
+#ifndef bswap_16
+#define bswap_16(x) \
+	((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
+#endif
+
+#define little_word(x)  bswap_16(x)
+
+/*  These are mnemonics for the programmer.  The compiler doesn't care...   */
+#define le_u16(x) u8  x[2]
+#define be_u16(x) u8  x[2]
+#define le_u32(x) u8  x[4]
+#define be_u32(x) u8  x[4]
+
+/*  Fetch a big-endian word from 2 unsigned chars in sequence  */
+#define BIG_ENDIAN_WORD_FETCH(x)   (u16)( (x[0] << 8) | x[1] )
+
+/*  Fetch a little-endian word from 2 unsigned chars in sequence  */
+#define LITTLE_ENDIAN_WORD_FETCH(x)   (u16)( (x[1] << 8) | x[0] )
+
+/*  Fetch a big-endian long from 4 unsigned chars in sequence  */
+#define BIG_ENDIAN_LONG_FETCH(x)   (u32)( (x[0] << 24) | (x[1] << 16) | (x[2] << 8) | x[3] )
+
+/*  Fetch a little-endian long from 4 unsigned chars in sequence  */
+#define LITTLE_ENDIAN_LONG_FETCH(x)   (u32)( (x[3] << 24) | (x[2] << 16) | (x[1] << 8) | x[0] )
+
+#define LE_U24(x) u8  x[3]
+/*  Fetch a little-endian triplet from 3 unsigned chars in sequence  */
+#define LITTLE_ENDIAN_TRIPLET_FETCH(x)   (u32)( (x[2] << 16) | (x[1] << 8) | x[0] )
+
+
+/*  Special case for Class-Code triplet:  lo, mid, hi  */
+#define class_code_u24(x) u8  x[3]
+/*  Special fetch for Class-Code triplet  */
+#define CLASS_CODE_FETCH(x)   (u32)( (x[2] << 16) | (x[1] << 8) | x[0] )
+/*  Special store for Class-Code triplet  */
+#define CLASS_CODE_STORE(dest,x)    \
+    dest[2] = (u8)( x >> 16); dest[1] = (u8)(x >>  8);  dest[0] = (u8)x;
+    /*  NOTE   Class-Code triplet is the same as  little-endian triplet  */
+    /*   Change over some time, eh?   */
+
+/* Store an integer into 2 unsigned chars in big-endian sequence */
+#define BIG_ENDIAN_WORD_STORE(dest,x)  dest[0] = (u8)(x >> 8); dest[1]=(u8)x;
+
+/* Store an integer into 2 unsigned chars in little-endian sequence */
+#define LITTLE_ENDIAN_WORD_STORE(dest,x)  dest[1] = (u8)(x >> 8); dest[0]=(u8)x;
+
+/* Store an integer into 4 unsigned chars in big-endian sequence */
+#define BIG_ENDIAN_LONG_STORE(dest,x)    \
+    dest[0] = (u8)(x >> 24); dest[1] =(u8)( x >> 16);   \
+    dest[2] = (u8)(x >>  8); dest[3] =(u8)x;
+
+/* Store an integer into 4 unsigned chars in little-endian sequence */
+#define LITTLE_ENDIAN_LONG_STORE(dest,x)    \
+    dest[3] = (u8)(x >> 24); dest[2] =(u8)( x >> 16);   \
+    dest[1] = (u8)(x >>  8); dest[0] =(u8)x;
+
+/* Store an integer into 3 unsigned chars in little-endian triplet sequence */
+#define LITTLE_ENDIAN_TRIPLET_STORE(dest,x)    \
+    dest[2] = (u8)( x >> 16); dest[1] = (u8)(x >>  8);  dest[0] = (u8)x;
+  
+
+typedef struct {
+    be_u16(signature);
+    u8	reserved[0x16];
+    le_u16(data_ptr);
+    le_u16(padd);
+} rom_header_t;
+
+
+typedef struct {
+    be_u32	(signature);
+    le_u16	(vendor);
+    le_u16	(device);
+    le_u16	(vpd);
+    le_u16	(dlen);
+    u8	 drevision;
+    class_code_u24	(class_code);
+    le_u16	(ilen);
+    le_u16	(irevision);
+    u8	code_type;
+    u8	last_image_flag;
+    u16	reserved_2;
+} pci_data_t;
+
+#define PCI_DATA_STRUCT_REV  0
+
+/*  Prototypes for functions exported from  devsupp/pci/classcodes.c   */
+char *pci_device_class_name( u32 code);
+char *pci_code_type_name(u8 code);
+
+
+
+#endif   /*  _PCIHDR_H   */

Added: fcode-utils/shared/types.h
===================================================================
--- fcode-utils/shared/types.h	                        (rev 0)
+++ fcode-utils/shared/types.h	2006-08-18 12:56:03 UTC (rev 77)
 <at>  <at>  -0,0 +1,97  <at>  <at> 
+#ifndef _OPENBIOS_TYPES_H
+#define _OPENBIOS_TYPES_H
+
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@...>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      Convert system short-name data-types found in  asm/types.h
+ *          to OpenBios-style names.  (Mainly, remove the leading
+ *          double-Underbar).
+ *
+ *     Also, define a very useful "bool" type for logical operations,
+ *          and maybe a macro (or several) to go with it...
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@...
+ *
+ **************************************************************************** */
+
+
+#include <asm/types.h>
+
+typedef __s8    s8;
+typedef __u8    u8;
+
+typedef __s16   s16;
+typedef __u16   u16;
+
+typedef __s32   s32;
+typedef __u32   u32;
+
+#ifdef FALSE            /*  Hack for AIX.     */
+#undef FALSE
+#undef TRUE
+#endif                  /*  Hack for AIX.     */
+
+typedef  enum boolean  {  FALSE = 0 ,  TRUE = -1 } bool ;
+
+
+/* **************************************************************************
+ *          Macro Name:    BOOLVAL
+ *                        Convert the supplied variable or expression to
+ *                            a formal boolean.
+ *   Argument:
+ *       x        (bool)           Variable or expression, operand.
+ *
+ **************************************************************************** */
+
+#define BOOLVAL(x)   (x ? TRUE : FALSE)
+
+
+/* **************************************************************************
+ *          Macro Name:    INVERSE
+ *                        Return the logical inversion of the
+ *                            supplied boolean variable or expression.
+ *   Argument:
+ *       x        (bool)           Variable or expression, operand.
+ *
+ **************************************************************************** */
+
+#define INVERSE(x)   (x ? FALSE : TRUE)
+
+
+/* **************************************************************************
+*
+ *          Some hacks stuck in for systems w/ incomplete includes
+ *              or libraries or whatever.
+ *
+ **************************************************************************** */
+
+#ifndef  _PTR
+#define  _PTR        void *
+#endif
+
+#endif /* _OPENBIOS_TYPES_H */


Gmane