pax_global_header00006660000000000000000000000064127010762340014514gustar00rootroot0000000000000052 comment=e56a016511a38bc1e965e8f9cff01a8bd40b7bc1 librtas-2.0.0/000077500000000000000000000000001270107623400131535ustar00rootroot00000000000000librtas-2.0.0/COPYING.LESSER000066400000000000000000000636311270107623400152130ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! librtas-2.0.0/Changelog000066400000000000000000000350701270107623400147720ustar00rootroot00000000000000Changelog for librtas-2.0.0 ======================================= commit da9f484ab2429525101432d57176f376576c3dac Author: Adam Conrad Date: Tue Apr 5 04:11:23 2016 -0600 Modernize and parameterize the RPM specfile slightly. Signed-off-by: Adam Conrad commit 9c1591cd262116290b5a651bc09192b6c34da9ce Author: Adam Conrad Date: Tue Apr 5 01:38:33 2016 -0600 librtasevent: Fix build failure with -Wformat -Werror=format-security Signed-off-by: Adam Conrad commit 2644f9d269be8b852aa024f1364a5199aac268db Author: Adam Conrad Date: Tue Apr 5 01:35:51 2016 -0600 librtas*/Makefile: install/uninstall static libs Signed-off-by: Adam Conrad commit f9bb81502e5fa3894caa1761292ec69580dc087e Author: Adam Conrad Date: Tue Apr 5 01:30:41 2016 -0600 librtasevent: Generate static library. Signed-off-by: Adam Conrad commit 2b43240db6fe721288bf09a6f2c75743ae4f8855 Author: Adam Conrad Date: Fri Apr 1 08:34:16 2016 -0600 Use MAJOR_NO to define the SONAME symlinks, instead of hardcoding "1" Signed-off-by: Adam Conrad Changelog for librtas-1.4.1 ======================================= commit af07fde662985cb574fe56497847c4c6cdf1d1a8 Author: Vasant Hegde Date: Thu Mar 17 18:53:48 2016 -0400 librtas: Do not enable debug message by default Commit eae18de3 removed dbg1 macro. But accidently enabled logging debug message by default. This is confusing end users. Hence remove logging debug message by default. Fixes: eae18de3 (librtas: Update the dbg() macro) Signed-off-by: Vasant Hegde CC: Nathan Fontenot commit c5e9dcf993e9e20bbe14bc06fb0ec6dd5031f935 Author: Vasant Hegde Date: Mon Feb 15 07:33:14 2016 -0500 librtas: Release lock in error path Release RMO buffer lock in error path. Otherwise we will continue to hold the lock and subsequent RMO buffer allocation request fails. Reported-by: Bharata B Rao Signed-off-by: Vasant Hegde commit 9683c7b393d48922a14b09a898fbe3cf698cd71a Author: Vasant Hegde Date: Wed Feb 10 16:15:19 2016 -0500 librtas: Fix Makefile Commit 90f24679 switched package license from CPL to LGPL. But we forgot to update Makefile. So creating tarball from source fails. This patch replaces COPYRIGHT with COPYING.LESSER in Makefile. Also updated Makefile header with proper license text. Signed-off-by: Vasant Hegde Changelog for librtas-1.4.0 ======================================= commit 2a279559111e4f68ed270f28e21a042a97ad41cd Author: Nathan Fontenot Date: Thu Jan 7 11:55:47 2016 -0500 Update README for correct contact information. Signed-off-by: Nathan Fontenot commit 90f24679c795ea8224ba836994366dec31529663 Author: Nathan Fontenot Date: Thu Jan 7 11:19:33 2016 -0500 Switch librtas package to LGPL License. Signed-off-by: Nathan Fontenot commit 5bbe4e9382b2e298227af13d1b600c59a5f1768b Author: Rafael Fonseca Date: Tue Dec 15 15:06:10 2015 -0500 From: Rafael Fonseca Fix print formats for width-based types. Signed-off-by: NAthan Fontenot commit 9d930daa58c3c6f2fc2fb6e82c005726d22ef8b5 Author: Rafael Fonseca Date: Tue Dec 15 14:58:20 2015 -0500 From: Rafael Fonseca Fix potential memory leaks Signed-off-by: Nathan Fontenot commit 1d0ec08104077bcc4dd8f76524cb2493aaf04a60 Author: Sam Bobroff Date: Tue Dec 15 14:53:55 2015 -0500 librtasevent: correct files left after uninstall Signed-off-by: Sam Bobroff Reviewed-by: Vasant Hegde commit 22b418b8758c60c9e250f495e2d58db2394ee3c4 Author: Sam Bobroff Date: Tue Dec 15 14:52:49 2015 -0500 librtas: correct files left after uninstall Signed-off-by: Sam Bobroff Reviewed-by: Vasant Hegde commit 9c1403ab4da25db47fcdfa7cfa26c0b465e0a5ed Author: Sam Bobroff Date: Tue Dec 15 14:50:02 2015 -0500 librtas: install librtas.so.1 symlink Add a line to the librtas Makefile to create librtas.so.1 when performing "make install". This matches the librtasevent.so.1 that is already created. This allows systems that rely on the existance of that link to successfully build programs using librtas when it is installed directly from the source. Signed-off-by: Sam Bobroff commit 0afce7b27cc5e1581f7ec6c0acf3d7b3b6419b5b Author: Nathan Fontenot Date: Tue Dec 15 14:46:54 2015 -0500 librtas: Correct multiple build warnings Correct the warnings produced during the build of librtas. Signed-off-by: Nathan Fontenot commit bb77762b4f3310854bdf07ef3fcebc01ddd0d798 Author: Nathan Fontenot Date: Tue Dec 15 14:37:17 2015 -0500 librtas: deprecate libofdt The libofdt library is a project that was started a long time ago in the hopes of providing a common infrastructure for accessing the device tree. The code is mostly complete andd I really don't think there are any users of it so I am proposing to deprecate the library. Signed-off-by: Nathan Fontenot commit 015c0f95fc10e595cd1a90634ac831d93d9ba4e2 Author: Nathan Fontenot Date: Tue Dec 15 14:30:13 2015 -0500 librtas: coding style updates Correct a few style issues to give the code a more consistant look. No functional changes. Signed-off-by: Nathan Fontenot commit 21de2c69433e23450d4fad4f9c48fbf8d2f5d04a Author: Nathan Fontenot Date: Tue Dec 15 14:27:56 2015 -0500 librtas: Make SANITY_CHECKS() a real function Make the SANITY_CHECKS() macro a regular function. Signed-off-by: Nathan Fontenot commit e5451d028d6981728840e1960f2d1de90e994f60 Author: Nathan Fontenot Date: Tue Dec 15 14:24:53 2015 -0500 librtas: Move rtas_token() declaration to internal header Move rtas_token decalration to internal header file. Signed-off-by: Nathan Fontenot commit f06f03493a3f4c8e8cc5a96db857f0ba01a66e6c Author: Nathan Fontenot Date: Tue Dec 15 14:23:41 2015 -0500 librtas: Remove declaration of open_proc_rtas_file() Make the open_proc_rtas_file() routine static and remove its declaration from librtas.h. Signed-off-by: Nathan Fotnenot commit c01583d8bde5dd4c3e1ce7d0b4d5ced4008bffd4 Author: Nathan Fontenot Date: Tue Dec 15 14:21:45 2015 -0500 librtas: Move declaration of read_entire_file() Move declaration of read_entire_file() to an internal header. Signed-off-by: Nathan Fontenot commit 52222bf6c8fb1d3ce6fdf5ba7e97653771ea9843 Author: Nathan Fontenot Date: Tue Dec 15 14:19:14 2015 -0500 librtas: Break up the librtas_config struct Break up the librtas_config struct into its two pieces and remove the definitions from the public header. Signed-off-by: Nathan Fontenot commit eae18de31155d109a0160485ee7d93bbdb32d2e0 Author: Thomas Falcon Date: Tue Dec 15 14:14:26 2015 -0500 librtas: Update the dbg() macro Remove the useless indirect of dbg1() macro and move the definition to an internal .h file. Signed-off-by: Nathan Fontenot commit ee457b1c21bd913913243e54c5a7dca63d3545a4 Author: Nathan Fontenot Date: Tue Dec 15 14:11:16 2015 -0500 librtas: consolidate common actions in making a rtas call Consolidate common actions, such as getting the rtas token and handling extended delays, when making a rtas call into a routine. This change presents to new ways to make a rtas call; rtas_call() - Which handles any delays rtas_call_no_delay() - Which does not handle any delays The no delay variant was needed for the few instances where some work needs to be done in between rtas calls when a delay occurs. Signed-off-by: Nathan Fontenot commit 4b18e100dcf1672590aee49b2c1bbc15debee4a7 Author: Thomas Falcon Date: Tue Dec 15 13:54:45 2015 -0500 librtas: rtas calls fully implemented in syscalls Since the procfs and common interfaces are being removed, all rtas calls will be fully implemented in the syscall_calls.c and syscall_rmo.c files. Signed-off-by: Thomas Falcon commit 94efe8cb14637820af35bba555997d5bd5f92704 Author: Thomas Falcon Date: Tue Dec 15 13:25:40 2015 -0500 librtas: common.h merged into librtas.h Code in common.h was added to librtas.h Signed-off-by: Thomas Falcon commit 3bc2d9277c6ac6679f7ee308127f90255453d76e Author: Thomas Falcon Date: Tue Dec 15 13:23:51 2015 -0500 librtas: removal of common code The common files are being removed with the removal of procfs in order to simplify librtas. Signed-off-by: Thomas Falcon commit b8ad1ec918230379f612a4e976e74600660cebdc Author: Thomas Falcon Date: Tue Dec 15 13:20:06 2015 -0500 librtas: removing procfs interface The procfs interface is no longer used. As a result, it is being removed to simplify librtas. Signed-off-by: Thomas Falcon Changelog for librtas-1.3.14 ======================================= commit 4e46c718f42bf05e797c7fcfdd6cfc2a21fb4c91 Author: Tyrel Datwyler Date: Wed Jan 7 14:26:15 2015 -0500 PAPR requires that the status word is the first parameter in the return buffer for rtas calls. Due to this requirement the librtas sc_rtas_call function always performs a be32toh operation on the first parameter in the return buffer. However, the ibm,open-errinjct rtas is special in that its return buffer is switched. The "Open Token" is the first return parameter while the "Status" word is second. This patch fixes this special case in the sc_errinjct_open function such that the byteswapping of "status" and "otoken" are handled correctly. Signed-off-by: Tyrel Datwyler Changelog for librtas-1.3.13 ======================================= commit 1d54a4a346f9111e1326dfdec756fd78360add42 Author: Nathan Fontenot Date: Fri Oct 17 10:18:40 2014 -0400 When we pass _hi and _lo 32bits of a 64bit value, we should convert the host endian value carefully. i.e, X_hi = htobe32(BITS32_HI(X)) X_lo = htobe32(BITS32_LO(X)) and not : X_hi = BITS32_HI(htobe64(X)) NOTE: This patch is untested, but I believe this patch is good to have than the current faulty conversion. This patch fixes all such occurrences in librtas. Signed-off-by: Suzuki K. Poulose commit e5541e1a5c83ce47cc492abcd7343d65763dcefe Author: Nathan Fontenot Date: Fri Oct 17 10:17:28 2014 -0400 Use rpm macros for standard paths Signed-off-by: Suzuki K. Poulose commit 8ef7f827e28e3cd284f6be5686a987786be7502d Author: Nathan Fontenot Date: Fri Oct 17 10:16:16 2014 -0400 This patch fixes the conversion of args for paltform-dump call. platform dump passes 64bit values as, a pair of 32bit values. val_hi and val_lo. So when we convert a value 'X' to 32bit hi and lo values in BE, we should follow the below approach : X_hi = htobe32(BITS32_HI(X)) X_lo = htobe32(BITS32_LO(X)) and NOT X_tmp = htobe64(X); X_hi = BITS32_HI(X_tmp), X_lo = BITS32_LO(X_tmp) This patch has been tested with rtas_errd/extract_platdump to retrieve a dump from FSP. Signed-off-by: Suzuki K. Poulose commit 52263814c46210b51e564748050299620726dfd1 Author: Nathan Fontenot Date: Fri Oct 17 10:12:54 2014 -0400 Fix LE parsing of SRC/FRU events Signed-off-by: Thomas L Falcon Signed-off-by: Suzuki K. Poulose commit ac0a91d2730740cd279d80ccd4c83b0a04827d1d Author: Nathan Fontenot Date: Fri Oct 17 10:10:29 2014 -0400 LE Support for SRC/FRU events Signed-off-by: Nathan Fontenot Changelog for librtas-1.3.12 ======================================= commit 1f045d8df135cfdc232a49f0992ab60913c0b043 Author: Anshuman Khandual Date: Wed Aug 13 13:04:29 2014 -0500 get_sensor, set_sensor: Handle big endian data in little endian This patch handles big endian location code length data in little endian platform. This enables the tools to work on little endian platform after having passed big endian buffer data. Signed-off-by: Anshuman Khandual Reviewed-by: Vasant Hegde commit 18f353d3477fb137e9773bcda0c1f60fb071d5b7 Author: Thomas Falcon Date: Wed Aug 13 13:02:17 2014 -0500 librtas: fix for sc_platform_dump endian handling Some mistakes were made in adding little endian support for the sc_platform_dump function. As the values being handled are 64-bit integers, it makes much more sense to use the 64-bit byteswap function. The endianness of seq_next also needs to be handled. Signed-off-by: Thomas Falcon librtas-2.0.0/Makefile000066400000000000000000000026161270107623400146200ustar00rootroot00000000000000# # Makefile for librtas # include rules.mk .SILENT: FILES = README COPYING.LESSER SUBDIRS = librtas_src librtasevent_src TARBALL_FILES += $(FILES) doc/doxygen.rtas doc/doxygen.rtasevent Changelog all: @$(foreach d,$(SUBDIRS), $(MAKE) -C $d;) # Update spec file for build type @sed "s|\@LIB_DIR\@|$(LIB_DIR)$(call is_lib64,librtas_src/librtas.so.$(VERSION))|g" $(SPECFILE_IN) > $(SPECFILE) install: @$(call install_doc,$(FILES),$(DESTDIR)) @$(foreach d,$(SUBDIRS), $(MAKE) -C $d install;) uninstall: @$(call uninstall_doc,$(FILES),$(DESTDIR)) @$(foreach d,$(SUBDIRS), $(MAKE) -C $d uninstall;) rpm: all @echo "Creating rpm..." @export DESTDIR=$(SHIPDIR); $(MAKE) install @rm $(SHIPDIR)$(LIB_DIR)$(call is_lib64,librtas_src/librtas.so.$(VERSION))/librtas.so @rm $(SHIPDIR)$(LIB_DIR)$(call is_lib64,librtasevent_src/librtasevent.so.$(VERSION))/librtasevent.so @$(RPM) -bb $(SPECFILE) @rm -rf $(SHIPDIR) docs: @echo "Creating doxygen documents..." @mkdir -p doc/librtasevent @mkdir -p doc/librtas @$(DOXYGEN) doc/doxygen.rtas @$(DOXYGEN) doc/doxygen.rtasevent tarball: clean @echo "Creating release tarball..." @$(BUILD_TARBALL) devball: clean @echo "Creating snapshot tarball..." @$(BUILD_DEVBALL) clean: @$(foreach d,$(SUBDIRS), $(MAKE) -C $d clean;) @echo "Cleaning up doxygen files..." @rm -rf doc/librtas doc/librtasevent @$(CLEAN) $(SHIPDIR) $(TARBALL) $(DEVBALL) $(SPECFILE) librtas-2.0.0/README000066400000000000000000000030441270107623400140340ustar00rootroot00000000000000 librtas ------------------------------------------------ Mailing List: librtas-devel@googlegroups.com Librtas provides a set of libraries for user-space access to the Run-Time Abstraction Services (RTAS) on the ppc64 architecture. librtas.so This library that allows user-space programs to make RTAS calls which provide support for low-level system hardware configuration and operations, such as getting hardware sensor (temp, fan speed, etc.) data, setting the operator panel LEDS, getting hardware error logs, injecting artificial hardware errors (for testing), getting VPD (Vital Product Data), and loading new firmware. librtasevent.so This library provides a set of definitions and useful routines for analyzing RTAS events, such as parsing out the sections of an RTAS event and printing the contents of a RTAS event in human-readable form (used by many of the RAS tools on ppc64). Building & Installing: ---------------------- To compile, do the following: make su - root make install /sbin/ldconfig Endian Concerns: ---------------- RTAS expects integer values to be in a 32 bit, big endian format. This requirement will be handled by librtas except when values are passed to or from RTAS via a buffer. In this case, we expect the caller to handle the endianess of these values. The librtas calls that employ this method are listed below: rtas_cfg_connector rtas_errinjct rtas_get_indices rtas_get_sysparm rtas_get_vpd rtas_lpar_perftools rtas_set_sysparm rtas_update_nodes rtas_update_properties librtas-2.0.0/doc/000077500000000000000000000000001270107623400137205ustar00rootroot00000000000000librtas-2.0.0/doc/doxygen.rtas000066400000000000000000001342751270107623400163040ustar00rootroot00000000000000# Doxyfile 1.3.8 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = librtas # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = doc/librtas # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of source # files, where putting all generated files in the same directory would otherwise # cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, # Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, # Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, # Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, # Swedish, and Ukrainian. OUTPUT_LANGUAGE = English # This tag can be used to specify the encoding used in the generated output. # The encoding is not always determined by the language that is chosen, # but also whether or not the output is meant for Windows or non-Windows users. # In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES # forces the Windows encoding (this is the default for the Windows binary), # whereas setting the tag to NO uses a Unix-style encoding (the default for # all platforms other than Windows). USE_WINDOWS_ENCODING = NO # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = NO # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is used # as the annotated text. Otherwise, the brief description is used as-is. If left # blank, the following values are used ("$name" is automatically replaced with the # name of the entity): "The $name class" "The $name widget" "The $name file" # "is" "provides" "specifies" "contains" "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited # members of a class in the documentation of that class as if those members were # ordinary class members. Constructors, destructors and assignment operators of # the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like the Qt-style comments (thus requiring an # explicit @brief command for a brief description. JAVADOC_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the DETAILS_AT_TOP tag is set to YES then Doxygen # will output the detailed description near the top, like JavaDoc. # If set to NO, the detailed description appears after the member # documentation. DETAILS_AT_TOP = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = YES # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources # only. Doxygen will then generate output that is more tailored for Java. # For instance, namespaces will be presented as packages, qualified scopes # will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = NO #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = ./librtas_src # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp # *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm FILE_PATTERNS = # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories # that are symbolic links (a Unix filesystem feature) are excluded from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. EXCLUDE_PATTERNS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES (the default) # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES (the default) # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compressed HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # If the GENERATE_TREEVIEW tag is set to YES, a side panel will be # generated containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = NO # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = NO # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_PREDEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse the # parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or # super classes. Setting the tag to NO turns the diagrams off. Note that this # option is superseded by the HAVE_DOT option below. This is only a fallback. It is # recommended to install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = YES # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will # generate a call dependency graph for every global function or class method. # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable call graphs for selected # functions only using the \callgraph command. CALL_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found on the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width # (in pixels) of the graphs generated by dot. If a graph becomes larger than # this value, doxygen will try to truncate the graph, so that it fits within # the specified constraint. Beware that most browsers cannot cope with very # large images. MAX_DOT_GRAPH_WIDTH = 1024 # The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height # (in pixels) of the graphs generated by dot. If a graph becomes larger than # this value, doxygen will try to truncate the graph, so that it fits within # the specified constraint. Beware that most browsers cannot cope with very # large images. MAX_DOT_GRAPH_HEIGHT = 1024 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes that # lay further from the root node will be omitted. Note that setting this option to # 1 or 2 may greatly reduce the computation time needed for large code bases. Also # note that a graph may be further truncated if the graph's image dimensions are # not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT). # If 0 is used for the depth value (the default), the graph is not depth-constrained. MAX_DOT_GRAPH_DEPTH = 0 # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO librtas-2.0.0/doc/doxygen.rtasevent000066400000000000000000001343141270107623400173400ustar00rootroot00000000000000# Doxyfile 1.3.8 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = librtasevent # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = doc/librtasevent # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of source # files, where putting all generated files in the same directory would otherwise # cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, # Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, # Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, # Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, # Swedish, and Ukrainian. OUTPUT_LANGUAGE = English # This tag can be used to specify the encoding used in the generated output. # The encoding is not always determined by the language that is chosen, # but also whether or not the output is meant for Windows or non-Windows users. # In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES # forces the Windows encoding (this is the default for the Windows binary), # whereas setting the tag to NO uses a Unix-style encoding (the default for # all platforms other than Windows). USE_WINDOWS_ENCODING = NO # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = NO # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is used # as the annotated text. Otherwise, the brief description is used as-is. If left # blank, the following values are used ("$name" is automatically replaced with the # name of the entity): "The $name class" "The $name widget" "The $name file" # "is" "provides" "specifies" "contains" "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited # members of a class in the documentation of that class as if those members were # ordinary class members. Constructors, destructors and assignment operators of # the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like the Qt-style comments (thus requiring an # explicit @brief command for a brief description. JAVADOC_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the DETAILS_AT_TOP tag is set to YES then Doxygen # will output the detailed description near the top, like JavaDoc. # If set to NO, the detailed description appears after the member # documentation. DETAILS_AT_TOP = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = YES # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources # only. Doxygen will then generate output that is more tailored for Java. # For instance, namespaces will be presented as packages, qualified scopes # will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = NO #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = ./librtasevent_src # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp # *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm FILE_PATTERNS = # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories # that are symbolic links (a Unix filesystem feature) are excluded from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. EXCLUDE_PATTERNS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES (the default) # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES (the default) # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compressed HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # If the GENERATE_TREEVIEW tag is set to YES, a side panel will be # generated containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = NO # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = NO # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_PREDEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse the # parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or # super classes. Setting the tag to NO turns the diagrams off. Note that this # option is superseded by the HAVE_DOT option below. This is only a fallback. It is # recommended to install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = YES # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will # generate a call dependency graph for every global function or class method. # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable call graphs for selected # functions only using the \callgraph command. CALL_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found on the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width # (in pixels) of the graphs generated by dot. If a graph becomes larger than # this value, doxygen will try to truncate the graph, so that it fits within # the specified constraint. Beware that most browsers cannot cope with very # large images. MAX_DOT_GRAPH_WIDTH = 1024 # The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height # (in pixels) of the graphs generated by dot. If a graph becomes larger than # this value, doxygen will try to truncate the graph, so that it fits within # the specified constraint. Beware that most browsers cannot cope with very # large images. MAX_DOT_GRAPH_HEIGHT = 1024 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes that # lay further from the root node will be omitted. Note that setting this option to # 1 or 2 may greatly reduce the computation time needed for large code bases. Also # note that a graph may be further truncated if the graph's image dimensions are # not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT). # If 0 is used for the depth value (the default), the graph is not depth-constrained. MAX_DOT_GRAPH_DEPTH = 0 # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO librtas-2.0.0/librtas.spec.in000066400000000000000000000036651270107623400161060ustar00rootroot00000000000000%define name librtas %define version 2.0.0 %define sover 2 %define release 1 Summary: Libraries to provide access to RTAS calls and RTAS events. Name: %{name} Version: %{version} Release: %{release} License: GNU Lesser General Public License (LGPL) Source: %{name}-%{version}.tar.gz Group: System Environment/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) ExclusiveArch: ppc ppc64 ppc64le %description The librtas shared library provides userspace with an interface through which certain RTAS calls can be made. The library uses either of the RTAS User Module or the RTAS system call to direct the kernel in making these calls. The librtasevent shared library provides users with a set of definitions and common routines useful in parsing and dumping the contents of RTAS events. %package devel Summary: C header files for development with librtas Group: Development/Libraries Requires: %{name}%{?_isa} = %{version}-%{release} %description devel The librtas-devel package contains the header files necessary for developing programs using librtas. %package static Summary: Static verions of the librtas libraries Group: Development/Libraries %description static The librtas-static package contains the static libraries which correspond to the librtas and librtas-devel packages. %prep %setup -q %build %{__make} %{?_smp_mflags} %install %{__rm} -rf $RPM_BUILD_ROOT %{__make} install DESTDIR=$RPM_BUILD_ROOT %post ldconfig %postun ldconfig %files %defattr(-, root, root) %{_docdir}/%{name}/COPYING.LESSER %{_docdir}/%{name}/README %{_libdir}/librtas.so.%{sover} %{_libdir}/librtas.so.%{version} %{_libdir}/librtasevent.so.%{version} %{_libdir}/librtasevent.so.%{sover} %files devel %{_libdir}/librtas.so %{_libdir}/librtasevent.so %{_includedir}/librtas.h %{_includedir}/librtasevent.h %{_includedir}/librtasevent_v4.h %{_includedir}/librtasevent_v6.h %files static %{_libdir}/librtas.a %{_libdir}/librtasevent.a librtas-2.0.0/librtas_src/000077500000000000000000000000001270107623400154625ustar00rootroot00000000000000librtas-2.0.0/librtas_src/Makefile000066400000000000000000000041371270107623400171270ustar00rootroot00000000000000# # Makefile for librtas # # Copyright (C) 2005 IBM Corporation # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library 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 # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA include ../rules.mk LIBRTAS_SONAME = librtas.so LIBRTAS_STATIC = librtas.a LIBRTAS = $(LIBRTAS_SONAME).$(VERSION) LIBRTAS_OBJS = ofdt.o syscall_calls.o syscall_rmo.o LIBRTAS_HDR = librtas.h HEADERS = $(LIBRTAS_HDR) CFLAGS += -fPIC -DPIC LDFLAGS += -shared -Wl,-soname -Wl,$(LIBRTAS_SONAME).$(MAJOR_NO) all: librtas_shared librtas_static librtas_shared: $(LIBRTAS_OBJS) $(HEADERS) @echo "LD $(WORK_DIR)/$(LIBRTAS)..." @$(CC) $(LIBRTAS_OBJS) $(LDFLAGS) -o $(LIBRTAS) librtas_static: $(LIBRTAS_OBJS) $(HEADERS) @echo "AR $(LIBRTAS_STATIC)..." @ar rcs $(LIBRTAS_STATIC) $(LIBRTAS_OBJS) install: @$(call install_lib,$(LIBRTAS),$(DESTDIR)) @$(call install_lib,$(LIBRTAS_STATIC),$(DESTDIR)) @$(call install_inc,$(HEADERS),$(DESTDIR)) @ln -sf $(LIBRTAS) $(DESTDIR)/$(LIB_DIR)$(call is_lib64,$(LIBRTAS))/$(LIBRTAS_SONAME) @ln -sf $(LIBRTAS) $(DESTDIR)/$(LIB_DIR)$(call is_lib64,$(LIBRTAS))/$(LIBRTAS_SONAME).$(MAJOR_NO) uninstall: @$(call uninstall_lib,$(LIBRTAS),$(DESTDIR)) @$(call uninstall_lib,$(LIBRTAS_STATIC),$(DESTDIR)) @$(call uninstall_inc,$(HEADERS),$(DESTDIR)) @rm -f $(DESTDIR)/$(LIB_DIR)$(call is_lib64,$(LIBRTAS))/$(LIBRTAS_SONAME) @rm -f $(DESTDIR)/$(LIB_DIR)$(call is_lib64,$(LIBRTAS))/$(LIBRTAS_SONAME).$(MAJOR_NO) clean: @echo "Cleaning up $(WORK_DIR) files..." @rm -f $(LIBRTAS_OBJS) $(LIBRTAS) $(LIBRTAS_STATIC) librtas-2.0.0/librtas_src/librtas.h000066400000000000000000000110521270107623400172720ustar00rootroot00000000000000/** * @file librtas.h * * Copyright (C) 2005 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author John Rose */ #ifndef _LIBRTAS_H_ #define _LIBRTAS_H_ #include #include #include #include #define RTAS_KERNEL_INT -1001 /* No Kernel Interface to Firmware */ #define RTAS_KERNEL_IMP -1002 /* No Kernel Implementation of Function */ #define RTAS_PERM -1003 /* Non-root caller */ #define RTAS_NO_MEM -1004 /* Out of heap memory */ #define RTAS_NO_LOWMEM -1005 /* Kernel out of low memory */ #define RTAS_FREE_ERR -1006 /* Attempt to free nonexistant rmo buffer */ #define RTAS_TIMEOUT -1007 /* RTAS delay exceeded specified timeout */ #define RTAS_IO_ASSERT -1098 /* Unexpected I/O Error */ #define RTAS_UNKNOWN_OP -1099 /* No Firmware Implementation of Function */ #define RC_BUSY -2 #define EXTENDED_DELAY_MIN 9900 #define EXTENDED_DELAY_MAX 9905 #define PAGE_SIZE 4096 /* Adding a new RTAS call requires the following: * 1) A function prototype in librtas.h (this file) that roughly matches * the RTAS call name. * 2) An implementation of the RTAS function, in syscall_calls.c. */ #ifdef __cplusplus extern "C" { #endif extern int rtas_activate_firmware(); extern int rtas_cfg_connector(char *workarea); extern int rtas_delay_timeout(uint64_t timeout_ms); extern int rtas_display_char(char c); extern int rtas_display_msg(char *buf); extern int rtas_errinjct(int etoken, int otoken, char *workarea); extern int rtas_errinjct_close(int otoken); extern int rtas_errinjct_open(int *otoken); extern int rtas_free_rmo_buffer(void *buf, uint32_t phys_addr, size_t size); extern int rtas_get_config_addr_info2(uint32_t cfg_addr, uint64_t phb_id, uint32_t func, uint32_t *info); extern int rtas_get_dynamic_sensor(int sensor, void *loc_code, int *state); extern int rtas_get_indices(int is_sensor, int type, char *workarea, size_t size, int start, int *next); extern int rtas_get_power_level(int powerdomain, int *level); extern int rtas_get_rmo_buffer(size_t size, void **buf, uint32_t *phys_addr); extern int rtas_get_sensor(int sensor, int index, int *state); extern int rtas_get_sysparm(unsigned int parameter, unsigned int length, char *data); extern int rtas_get_time(uint32_t *year, uint32_t *month, uint32_t *day, uint32_t *hour, uint32_t *min, uint32_t *sec, uint32_t *nsec); extern int rtas_get_vpd(char *loc_code, char *workarea, size_t size, unsigned int sequence, unsigned int *seq_next, unsigned int *bytes_ret); extern int rtas_lpar_perftools(int subfunc, char *workarea, unsigned int length, unsigned int sequence, unsigned int *seq_next); extern int rtas_platform_dump(uint64_t dump_tag, uint64_t sequence, void *buffer, size_t length, uint64_t *next_seq, uint64_t *bytes_ret); extern int rtas_read_slot_reset(uint32_t cfg_addr, uint64_t phbid, int *state, int *eeh); extern int rtas_scan_log_dump(void *buffer, size_t length); extern int rtas_set_debug(int level); extern int rtas_set_dynamic_indicator(int indicator, int new_value, void *loc_code); extern int rtas_set_eeh_option(uint32_t cfg_addr, uint64_t phbid, int function); extern int rtas_set_indicator(int indicator, int index, int new_value); extern int rtas_set_power_level(int powerdomain, int level, int *setlevel); extern int rtas_set_poweron_time(uint32_t year, uint32_t month, uint32_t day, uint32_t hour, uint32_t min, uint32_t sec, uint32_t nsec); extern int rtas_set_sysparm(unsigned int parameter, char *data); extern int rtas_set_time(uint32_t year, uint32_t month, uint32_t day, uint32_t hour, uint32_t min, uint32_t sec, uint32_t nsec); extern int rtas_suspend_me(uint64_t streamid); extern int rtas_update_nodes(char *workarea, unsigned int scope); extern int rtas_update_properties(char *workarea, unsigned int scope); #ifdef __cplusplus } #endif #endif /* _LIBRTAS_H_ */ librtas-2.0.0/librtas_src/ofdt.c000066400000000000000000000071051270107623400165650ustar00rootroot00000000000000/** * @file ofdt.c * * Copyright (C) 2005 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author John Rose */ #include #include #include #include #include #include #include "librtas.h" #include "syscall.h" static const char *ofdt_rtas_path = "/proc/device-tree/rtas"; /** * open_prop_file * @brief Open the property name located at the specified property path * * @param prop_path path to the property name * @param prop_name property name * @param fd reference to file descriptor * @return 0 on success, -1 on failure */ static int open_prop_file(const char *prop_path, const char *prop_name, int *fd) { char *path; int len; /* allocate enough for two string, a slash and trailing NULL */ len = strlen(prop_path) + strlen(prop_name) + 1 + 1; path = malloc(len); if (path == NULL) { errno = ENOMEM; return -1; } snprintf(path, len, "%s/%s", prop_path, prop_name); *fd = open(path, O_RDONLY); free(path); if (*fd < 0) { errno = ENOSYS; return -1; } return 0; } /** * get_property * @brief Open a property file and read in its contents * * @param prop_path path to the property file * @param prop_name propery name * @param prop_val * @param prop_len * @return 0 on success, !0 otherwise */ static int get_property(const char *prop_path, const char *prop_name, char **prop_val, size_t *prop_len) { int rc, fd; rc = open_prop_file(prop_path, prop_name, &fd); if (rc) return rc; rc = read_entire_file(fd, prop_val, prop_len); close(fd); return rc; } /** * rtas_token * @brief Retrive a rtas token for a given name * * @param call_name rtas name to retrieve token for * @return 0 on success, !0 otherwise */ int rtas_token(const char *call_name) { char *prop_buf = NULL; size_t len; int rc; rc = get_property(ofdt_rtas_path, call_name, &prop_buf, &len); if (rc < 0) { if (prop_buf) free(prop_buf); return RTAS_UNKNOWN_OP; } #if __BYTE_ORDER == __LITTLE_ENDIAN rc = bswap_32(*(int *)prop_buf); #else rc = *(int *)prop_buf; #endif free(prop_buf); return rc; } #define BLOCK_SIZE 4096 /** * read_entire_file * @brief Read in an entire file into the supplied buffer * * @param fd opened file descriptor for file to read * @param buf buffer to read file into * @param len variable to return amount read into buffer * @return 0 on success, !0 otherwise */ int read_entire_file(int fd, char **buf, size_t * len) { size_t buf_size = 0; size_t off = 0; int rc; *buf = NULL; do { buf_size += BLOCK_SIZE; if (*buf == NULL) *buf = malloc(buf_size); else *buf = realloc(*buf, buf_size); if (*buf == NULL) { errno = ENOMEM; return -1; } rc = read(fd, *buf + off, BLOCK_SIZE); if (rc < 0) { dbg("read failed\n"); errno = EIO; return -1; } off += rc; } while (rc == BLOCK_SIZE); if (len) *len = off; return 0; } librtas-2.0.0/librtas_src/syscall.h000066400000000000000000000037301270107623400173100ustar00rootroot00000000000000/** * @file syscall.h * * Copyright (C) 2005 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author John Rose */ #ifndef _SYSCALL_H_ #define _SYSCALL_H_ #include /* Syscall number */ #ifndef __NR_rtas #define __NR_rtas 255 #endif #define MAX_ARGS 16 typedef uint32_t rtas_arg_t; /* Based on include/asm-ppc64/rtas.h */ struct rtas_args { uint32_t token; uint32_t ninputs; uint32_t nret; rtas_arg_t args[MAX_ARGS]; rtas_arg_t *rets; /* Pointer to return values in args[]. */ }; struct region { uint64_t addr; uint32_t size; struct region *next; }; extern int rtas_get_rmo_buffer(size_t size, void **buf, uint32_t *phys_addr); extern int rtas_free_rmo_buffer(void *buf, uint32_t phys_addr, size_t size); extern int interface_exists(); extern int read_entire_file(int fd, char **buf, size_t *len); extern int rtas_token(const char *call_name); extern int sanity_check(void); #define BITS32_LO(_num) (uint32_t) (_num & 0xffffffffll) #define BITS32_HI(_num) (uint32_t) (_num >> 32) #define BITS64(_high, _low) (uint64_t) (((uint64_t) _high << 32) | _low) extern int dbg_lvl; #define dbg(_fmt, _args...) \ do { \ if (dbg_lvl > 0) \ printf("librtas %s(): " _fmt, __func__, ##_args); \ } while (0) #endif librtas-2.0.0/librtas_src/syscall_calls.c000066400000000000000000000742741270107623400204740ustar00rootroot00000000000000/** * @file syscall_calls.c * * Provide user space rtas functions that go through the RTAS system call. * * Copyright (C) 2005 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author John Rose */ #include #include #include #include #include #include #include #include "syscall.h" #include "librtas.h" /* The original librtas used the _syscall1 interface to get to the rtas * system call. On recent versions of Linux though the _syscall1 * interface was removed from unistd.h so we have moved to using the * syscall() interface instead. The use of _syscall1 is left as the * default to avoid breaking the library on older systems. */ #ifdef _syscall1 _syscall1(int, rtas, void *, args); #endif #define CALL_AGAIN 1 int dbg_lvl = 0; static uint64_t rtas_timeout_ms; /** * sanity_check * @brief validate the caller credentials and rtas interface * * @return 0 for success, !o on failure */ int sanity_check(void) { if (geteuid() != (uid_t)0) return RTAS_PERM; if (!interface_exists()) return RTAS_KERNEL_INT; return 0; } /** * handle_delay * @brief sleep for the specified delay time * * @param status * @param elapsed * @return * 0 if the status isn't delay-related * CALL_AGAIN if the status is delay related * RTAS_TIMEOUT if the requested timeout has been exceeded */ static unsigned int handle_delay(int status, uint64_t * elapsed) { int order = status - EXTENDED_DELAY_MIN; unsigned long ms = 0; uint64_t remaining; if (status >= EXTENDED_DELAY_MIN && status <= EXTENDED_DELAY_MAX) { /* Extended Delay */ for (ms = 1; order > 0; order--) ms = ms * 10; } else if (status == RC_BUSY) { /* Regular Delay */ ms = 1; } else { /* Not a delay return code */ return 0; } if (rtas_timeout_ms) { if (*elapsed >= rtas_timeout_ms) return RTAS_TIMEOUT; remaining = rtas_timeout_ms - *elapsed; if (ms > remaining) ms = remaining; } *elapsed += ms; dbg("Return status %d, delaying for %ld ms\n", status, ms); usleep(ms * 1000); return 1; } /** * display_rtas_buf * @brief Dump the contents of the rtas call buffer * * @param args * @param after */ static void display_rtas_buf(struct rtas_args *args, int after) { int i, ninputs, nret; if (dbg_lvl < 2) return; ninputs = be32toh(args->ninputs); nret = be32toh(args->nret); /* It doesn't make sense to byte swap the input and return arguments * as we don't know here what they really mean (it could be a 64 bit * value split accross two 32 bit arguments). Printing them as hex * values is enough for debugging purposes. */ if (!after) { printf("RTAS call args.token = %d\n", be32toh(args->token)); printf("RTAS call args.ninputs = %d\n", ninputs); printf("RTAS call args.nret = %d\n", nret); for (i = 0; i < ninputs; i++) printf("RTAS call input[%d] = 0x%x (BE)\n", i, args->args[i]); } else { for (i = ninputs; i < ninputs + nret; i++) printf("RTAS call output[%d] = 0x%x (BE)\n", i - ninputs, args->args[i]); } } /** * rtas_call * @brief Perform the actual system call for the rtas call * * Variable argument list consists of inputs followed by * pointers to outputs. * * @param token * @param ninputs number of inputs * @param nret number of return variables * @return 0 on success, !0 otherwise */ static int _rtas_call(int delay_handling, int token, int ninputs, int nrets, va_list *ap) { struct rtas_args args; rtas_arg_t *rets[MAX_ARGS]; uint64_t elapsed = 0; int i, rc; args.token = htobe32(token); args.ninputs = htobe32(ninputs); args.nret = htobe32(nrets); for (i = 0; i < ninputs; i++) args.args[i] = (rtas_arg_t) va_arg(*ap, unsigned long); for (i = 0; i < nrets; i++) rets[i] = (rtas_arg_t *) va_arg(*ap, unsigned long); display_rtas_buf(&args, 0); do { #ifdef _syscall1 rc = rtas(&args); #else rc = syscall(__NR_rtas, &args); #endif if (!delay_handling || (rc < 0)) break; rc = handle_delay(be32toh(args.args[ninputs]), &elapsed); } while (rc == CALL_AGAIN); if (rc != 0) { dbg("RTAS syscall failure, errno=%d\n", errno); return RTAS_IO_ASSERT; } display_rtas_buf(&args, 1); /* Assign rets */ if (nrets) { /* All RTAS calls return a status in rets[0] */ *(rets[0]) = be32toh(args.args[ninputs]); for (i = 1; i < nrets; i++) *(rets[i]) = args.args[ninputs + i]; } return 0; } static int rtas_call_no_delay(const char *name, int ninputs, int nrets, ...) { va_list ap; int rc, token; token = rtas_token(name); if (token < 0) return token; va_start(ap, nrets); rc = _rtas_call(0, token, ninputs, nrets, &ap); va_end(ap); return rc; } static int rtas_call(const char *name, int ninputs, int nrets, ...) { va_list ap; int rc, token; token = rtas_token(name); if (token < 0) return token; va_start(ap, nrets); rc = _rtas_call(1, token, ninputs, nrets, &ap); va_end(ap); return rc; } /** * rtas_activate_firmware * @brief Interface for ibm,activate-firmware rtas call * * @return 0 on success, !0 on failure */ int rtas_activate_firmware() { int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_call("ibm,activate-firmware", 0, 1, &status); dbg("() = %d\n", rc ? rc : status); return rc ? rc : status; } #define CFG_RC_DONE 0 #define CFG_RC_MEM 5 /** * rtas_cfg_connector * @brief Interface for ibm,configure-connector rtas call * * @param workarea buffer containg args to ibm,configure-connector * @return 0 on success, !0 on failure */ int rtas_cfg_connector(char *workarea) { uint32_t workarea_pa; uint32_t extent_pa = 0; uint64_t elapsed = 0; void *kernbuf; void *extent; int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_get_rmo_buffer(PAGE_SIZE, &kernbuf, &workarea_pa); if (rc) return rc; memcpy(kernbuf, workarea, PAGE_SIZE); do { rc = rtas_call_no_delay("ibm,configure-connector", 2, 1, htobe32(workarea_pa), htobe32(extent_pa), &status); if (rc < 0) break; if ((rc == 0) && (status == CFG_RC_MEM)) { rc = rtas_get_rmo_buffer(PAGE_SIZE, &extent, &extent_pa); if (rc < 0) break; continue; } rc = handle_delay(status, &elapsed); } while (rc == CALL_AGAIN); if (rc == 0) memcpy(workarea, kernbuf, PAGE_SIZE); (void)rtas_free_rmo_buffer(kernbuf, workarea_pa, PAGE_SIZE); if (extent_pa) (void)rtas_free_rmo_buffer(extent, extent_pa, PAGE_SIZE); dbg("(%p) = %d\n", workarea, rc ? rc : status); return rc ? rc : status; } /** * rtas_delay_timeout * @brief Interface to retrieve the rtas timeout delay * * @param timeout_ms timeout in milli-seconds * @return delay time */ int rtas_delay_timeout(uint64_t timeout_ms) { int rc; rc = sanity_check(); if (rc) return rc; rtas_timeout_ms = timeout_ms; return 0; } /** * rtas_display_char * @brief Interface for display-character rtas call * * @param c character to display * @return 0 on success, !0 otherwise */ int rtas_display_char(char c) { int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_call("display-character", 1, 1, c, &status); dbg("(%d) = %d\n", c, rc ? rc : status); return rc ? rc : status; } /** * rtas_display_msg * @brief Interface for ibm,display-message rtas call * * @param buf message to display * @return 0 on success, !0 otherwise */ int rtas_display_msg(char *buf) { uint32_t kernbuf_pa; void *kernbuf; int str_len; int rc, status; rc = sanity_check(); if (rc) return rc; str_len = strlen(buf); rc = rtas_get_rmo_buffer(str_len, &kernbuf, &kernbuf_pa); if (rc) return rc; strcpy(kernbuf, buf); rc = rtas_call("ibm,display-message", 1, 1, htobe32(kernbuf_pa), &status); (void)rtas_free_rmo_buffer(kernbuf, kernbuf_pa, str_len); dbg("(%p) = %d\n", buf, rc ? rc : status); return rc ? rc : status; } #define ERRINJCT_BUF_SIZE 1024 /** * rtas_errinjct * @brief Interface to the ibm,errinjct rtas call * * @param etoken errinjct token * @param otoken errinjct open token * @param workarea additional args to ibm,errinjct * @return 0 on success, !0 otherwise */ int rtas_errinjct(int etoken, int otoken, char *workarea) { uint32_t kernbuf_pa; void *kernbuf; int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_get_rmo_buffer(ERRINJCT_BUF_SIZE, &kernbuf, &kernbuf_pa); if (rc) return rc; memcpy(kernbuf, workarea, ERRINJCT_BUF_SIZE); rc = rtas_call("ibm,errinjct", 3, 1, htobe32(etoken), htobe32(otoken), htobe32(kernbuf_pa), &status); if (rc == 0) memcpy(workarea, kernbuf, ERRINJCT_BUF_SIZE); (void)rtas_free_rmo_buffer(kernbuf, kernbuf_pa, ERRINJCT_BUF_SIZE); dbg("(%d, %d, %p) = %d\n", etoken, otoken, workarea, rc ? rc : status); return rc ? rc : status; } /** * rtas_errinjct_close * @brief Inerface to close the ibm,errinjct facility * * @param otoken errinjct open token * @return 0 on success, !0 otherwise */ int rtas_errinjct_close(int otoken) { int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_call("ibm,close-errinjct", 1, 1, htobe32(otoken), &status); dbg("(%d) = %d\n", otoken, rc ? rc : status); return rc ? rc : status; } /** * rtas_errinjct_open * @brief Interface to open the ibm,errinjct facility * * This call will set the value refrenced by otoken to the open token * for the ibm,errinjct facility * * @param otoken pointer to open token * @return 0 on success, !0 otherwise */ int rtas_errinjct_open(int *otoken) { __be32 be_otoken; int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_call("ibm,open-errinjct", 0, 2, &be_otoken, &status); *otoken = be32toh(be_otoken); dbg("(%p) = %d, %d\n", otoken, rc ? rc : status, *otoken); return rc ? rc : status; } /** * rtas_get_config_addr_info2 * @brief Interface to ibm,get-config-addr-info2 rtas call * * On successful completion the info value is returned. * * @param config_addr * @param phb_unit_id * @param func * @param info * @return 0 on success, !0 otherwise */ int rtas_get_config_addr_info2(uint32_t config_addr, uint64_t phb_id, uint32_t func, uint32_t *info) { __be32 be_info; int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_call("ibm,get-config-addr-info2", 4, 2, htobe32(config_addr), htobe32(BITS32_HI(phb_id)), htobe32(BITS32_LO(phb_id)), htobe32(func), &status, &be_info); *info = be32toh(be_info); dbg("(0x%x, 0x%lx, %d) = %d, 0x%x\n", config_addr, phb_id, func, rc ? rc : status, *info); return rc ? rc : status; } /** * rtas_get_dynamic_sensor * @brief Interface to ibm,get-dynamic-sensor-state rtas call * * On success the variable referenced by the state parameter will contain * the state of the sensor * * @param sensor sensor to retrieve * @param loc_code location code of the sensor * @param state reference to state variable * @return 0 on success, !0 otherwise */ int rtas_get_dynamic_sensor(int sensor, void *loc_code, int *state) { uint32_t loc_pa = 0; void *locbuf; uint32_t size; __be32 be_state; int rc, status; rc = sanity_check(); if (rc) return rc; size = be32toh(*(uint32_t *)loc_code) + sizeof(uint32_t); rc = rtas_get_rmo_buffer(size, &locbuf, &loc_pa); if (rc) return rc; memcpy(locbuf, loc_code, size); rc = rtas_call("ibm,get-dynamic-sensor-state", 2, 2, htobe32(sensor), htobe32(loc_pa), &status, &be_state); (void) rtas_free_rmo_buffer(locbuf, loc_pa, size); *state = be32toh(be_state); dbg("(%d, %s, %p) = %d, %d\n", sensor, (char *)loc_code, state, rc ? rc : status, *state); return rc ? rc : status; } /** * rtas_get_indices * @brief Interface to the ibm,get-indices rtas call * * @param is_sensor is this index a sensor? * @param type * @param workarea additional args to the rtas call * @param size * @param start * @param next * @return 0 on success, !0 otherwise */ int rtas_get_indices(int is_sensor, int type, char *workarea, size_t size, int start, int *next) { uint32_t kernbuf_pa; __be32 be_next; void *kernbuf; int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_get_rmo_buffer(size, &kernbuf, &kernbuf_pa); if (rc) return rc; rc = rtas_call("ibm,get-indices", 5, 2, htobe32(is_sensor), htobe32(type), htobe32(kernbuf_pa), htobe32(size), htobe32(start), &status, &be_next); if (rc == 0) memcpy(workarea, kernbuf, size); (void)rtas_free_rmo_buffer(kernbuf, kernbuf_pa, size); *next = be32toh(be_next); dbg("(%d, %d, %p, %zd, %d, %p) = %d, %d\n", is_sensor, type, workarea, size, start, next, rc ? rc : status, *next); return rc ? rc : status; } /** * rtas_get_power_level * @brief Interface to the get-power-level rtas call * * On success this routine will set the variable referenced by the level * parameter to the power level * * @param powerdomain * @param level reference to the power level variable * @return 0 on success, !0 otherwise */ int rtas_get_power_level(int powerdomain, int *level) { __be32 be_level; int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_call("get-power-level", 1, 2, htobe32(powerdomain), &status, &be_level); *level = be32toh(be_level); dbg("(%d, %p) = %d, %d\n", powerdomain, level, rc ? rc : status, *level); return rc ? rc : status; } /** * rtas_get_sensor * @brief Interface to the get-sensor-state rtas call * * On successful completion the state parameter will reference the current * state of the sensor * * @param sensor * @param index sensor index * @param state reference to state variable * @return 0 on success, !0 otherwise */ int rtas_get_sensor(int sensor, int index, int *state) { __be32 be_state; int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_call("get-sensor-state", 2, 2, htobe32(sensor), htobe32(index), &status, &be_state); *state = be32toh(be_state); dbg("(%d, %d, %p) = %d, %d\n", sensor, index, state, rc ? rc : status, *state); return rc ? rc : status; } /** * rtas_get_sysparm * @brief Interface to the ibm,get-system-parameter rtas call * * On successful completion the data parameter will contain the system * parameter results * * @param parameter system parameter to retrieve * @param length data buffer length * @param data reference to buffer to return parameter in * @return 0 on success, !0 otherwise */ int rtas_get_sysparm(unsigned int parameter, unsigned int length, char *data) { uint32_t kernbuf_pa; void *kernbuf; int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_get_rmo_buffer(length, &kernbuf, &kernbuf_pa); if (rc) return rc; rc = rtas_call("ibm,get-system-parameter", 3, 1, htobe32(parameter), htobe32(kernbuf_pa), htobe32(length), &status); if (rc == 0) memcpy(data, kernbuf, length); (void)rtas_free_rmo_buffer(kernbuf, kernbuf_pa, length); dbg("(%d, %d, %p) = %d\n", parameter, length, data, rc ? rc : status); return rc ? rc : status; } /** * rtas_get_time * @brief Interface to get-time-of-day rtas call * * On successful completion all of the parameters will be filled with * their respective values for the current time of day. * * @param year * @param month * @param day * @param hour * @param min * @param sec * @param nsec * @return 0 on success, !0 otherwise */ int rtas_get_time(uint32_t *year, uint32_t *month, uint32_t *day, uint32_t *hour, uint32_t *min, uint32_t *sec, uint32_t *nsec) { int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_call("get-time-of-day", 0, 8, &status, year, month, day, hour, min, sec, nsec); *year = be32toh(*year); *month = be32toh(*month); *day = be32toh(*day); *hour = be32toh(*hour); *min = be32toh(*min); *sec = be32toh(*sec); *nsec = be32toh(*nsec); dbg("() = %d, %d, %d, %d, %d, %d, %d, %d\n", rc ? rc : status, *year, *month, *day, *hour, *min, *sec, *nsec); return rc ? rc : status; } /** * rtas_get_vpd * @brief Interface to the ibm,get-vpd rtas call * * @param loc_code location code * @param workarea additional args to rtas call * @param size * @param sequence * @param seq_next * @param bytes_ret * @return 0 on success, !0 otherwise */ int rtas_get_vpd(char *loc_code, char *workarea, size_t size, unsigned int sequence, unsigned int *seq_next, unsigned int *bytes_ret) { uint32_t kernbuf_pa; uint32_t loc_pa = 0; uint32_t rmo_pa = 0; uint64_t elapsed = 0; void *kernbuf; void *rmobuf; void *locbuf; int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_get_rmo_buffer(size + PAGE_SIZE, &rmobuf, &rmo_pa); if (rc) return rc; kernbuf = rmobuf + PAGE_SIZE; kernbuf_pa = rmo_pa + PAGE_SIZE; locbuf = rmobuf; loc_pa = rmo_pa; /* If user didn't set loc_code, copy a NULL string */ strncpy(locbuf, loc_code ? loc_code : "", PAGE_SIZE); *seq_next = htobe32(sequence); do { sequence = *seq_next; rc = rtas_call_no_delay("ibm,get-vpd", 4, 3, htobe32(loc_pa), htobe32(kernbuf_pa), htobe32(size), sequence, &status, seq_next, bytes_ret); if (rc < 0) break; rc = handle_delay(status, &elapsed); } while (rc == CALL_AGAIN); if (rc == 0) memcpy(workarea, kernbuf, size); (void) rtas_free_rmo_buffer(rmobuf, rmo_pa, size + PAGE_SIZE); *seq_next = be32toh(*seq_next); *bytes_ret = be32toh(*bytes_ret); dbg("(%s, 0x%p, %zd, %d) = %d, %d, %d", loc_code ? loc_code : "NULL", workarea, size, sequence, status, *seq_next, *bytes_ret); return rc ? rc : status; } /** * rtas_lpar_perftools * @brief Interface to the ibm,lpa-perftools rtas call * * @param subfunc * @param workarea additional args to the rtas call * @param length * @param sequence * @param seq_next * @return 0 on success, !0 otherwise */ int rtas_lpar_perftools(int subfunc, char *workarea, unsigned int length, unsigned int sequence, unsigned int *seq_next) { uint64_t elapsed = 0; uint32_t kernbuf_pa; void *kernbuf; int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_get_rmo_buffer(length, &kernbuf, &kernbuf_pa); if (rc) return rc; memcpy(kernbuf, workarea, PAGE_SIZE); *seq_next = htobe32(sequence); do { sequence = *seq_next; rc = rtas_call_no_delay("ibm,lpar-perftools", 5, 2, htobe32(subfunc), 0, htobe32(kernbuf_pa), htobe32(length), sequence, &status, seq_next); if (rc < 0) break; rc = handle_delay(status, &elapsed); } while (rc == CALL_AGAIN); if (rc == 0) memcpy(workarea, kernbuf, length); (void)rtas_free_rmo_buffer(kernbuf, kernbuf_pa, length); *seq_next = be32toh(*seq_next); dbg("(%d, %p, %d, %d, %p) = %d, %d\n", subfunc, workarea, length, sequence, seq_next, rc ? rc : status, *seq_next); return rc ? rc : status; } /** * rtas_platform_dump * Interface to the ibm,platform-dump rtas call * * @param dump_tag * @param sequence * @param buffer buffer to write dump to * @param length buffer length * @param next_seq * @param bytes_ret * @return 0 on success, !0 othwerwise */ int rtas_platform_dump(uint64_t dump_tag, uint64_t sequence, void *buffer, size_t length, uint64_t *seq_next, uint64_t *bytes_ret) { uint64_t elapsed = 0; uint32_t kernbuf_pa = 0; uint32_t next_hi, next_lo; uint32_t bytes_hi, bytes_lo; uint32_t dump_tag_hi, dump_tag_lo; void *kernbuf; int rc, status; rc = sanity_check(); if (rc) return rc; if (buffer) { rc = rtas_get_rmo_buffer(length, &kernbuf, &kernbuf_pa); if (rc) return rc; } /* Converting a 64bit host value to 32bit BE, _hi and _lo * pair is tricky: we should convert the _hi and _lo 32bits * of the 64bit host value. */ dump_tag_hi = htobe32(BITS32_HI(dump_tag)); dump_tag_lo = htobe32(BITS32_LO(dump_tag)); next_hi = htobe32(BITS32_HI(sequence)); next_lo = htobe32(BITS32_LO(sequence)); do { rc = rtas_call_no_delay("ibm,platform-dump", 6, 5, dump_tag_hi, dump_tag_lo, next_hi, next_lo, htobe32(kernbuf_pa), htobe32(length), &status, &next_hi, &next_lo, &bytes_hi, &bytes_lo); if (rc < 0) break; sequence = BITS64(be32toh(next_hi), be32toh(next_lo)); dbg("%s: seq_next = 0x%" PRIx64 "\n", __FUNCTION__, sequence); rc = handle_delay(status, &elapsed); } while (rc == CALL_AGAIN); if (buffer && (rc == 0)) memcpy(buffer, kernbuf, length); if (kernbuf) (void)rtas_free_rmo_buffer(kernbuf, kernbuf_pa, length); *seq_next = sequence; bytes_hi = be32toh(bytes_hi); bytes_lo = be32toh(bytes_lo); *bytes_ret = BITS64(bytes_hi, bytes_lo); dbg("(0x%lx, 0x%lx, %p, %zd, %p, %p) = %d, 0x%lx, 0x%lx\n", dump_tag, sequence, buffer, length, seq_next, bytes_ret, rc ? rc : status, *seq_next, *bytes_ret); return rc ? rc : status; } /** * rtas_read_slot_reset * @brief Interface to the ibm,read-slot-reset-state rtas call * * @param cfg_addr configuration address of slot to read * @param phbid PHB ID of the slot to read * @param state reference to variable to return slot state in * @param eeh * @return 0 on success, !0 otherwise */ int rtas_read_slot_reset(uint32_t cfg_addr, uint64_t phbid, int *state, int *eeh) { int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_call("ibm,read-slot-reset-state", 3, 3, htobe32(cfg_addr), htobe32(BITS32_HI(phbid)), htobe32(BITS32_LO(phbid)), &status, state, eeh); *state = be32toh(*state); *eeh = be32toh(*eeh); dbg("(0x%x, 0x%lx, %p, %p) = %d, %d, %d\n", cfg_addr, phbid, state, eeh, rc ? rc : status, *state, *eeh); return rc ? rc : status; } /** * rtas_scan_log_dump * @brief Interface to the ibm,scan-log-dump rtas call * * @param buffer buffer to return scan log dump in * @param length size of buffer * @return 0 on success, !0 otherwise */ int rtas_scan_log_dump(void *buffer, size_t length) { uint32_t kernbuf_pa; void *kernbuf; int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_get_rmo_buffer(length, &kernbuf, &kernbuf_pa); if (rc) return rc; memcpy(kernbuf, buffer, length); rc = rtas_call("ibm,scan-log-dump", 2, 1, htobe32(kernbuf_pa), htobe32(length), &status); if (rc == 0) memcpy(buffer, kernbuf, length); (void)rtas_free_rmo_buffer(kernbuf, kernbuf_pa, length); dbg("(%p, %zd) = %d\n", buffer, length, rc ? rc : status); return rc ? rc : status; } /** * rtas_set_debug * @brief Interface to set librtas debug level * * @param level debug level to set to * @return 0 on success, !0 otherwise */ int rtas_set_debug(int level) { dbg_lvl = level; return 0; } /** * rtas_set_dynamic_indicator * @brief Interface to the ibm,set-dynamic-indicator rtas call * * @param indicator indicator to set * @param new_value value to set the indicator to * @param loc_code * @return 0 on success, !0 otherwise */ int rtas_set_dynamic_indicator(int indicator, int new_value, void *loc_code) { uint32_t loc_pa = 0; void *locbuf; uint32_t size; int rc, status; rc = sanity_check(); if (rc) return rc; size = be32toh(*(uint32_t *)loc_code) + sizeof(uint32_t); rc = rtas_get_rmo_buffer(size, &locbuf, &loc_pa); if (rc) return rc; memcpy(locbuf, loc_code, size); rc = rtas_call("ibm,set-dynamic-indicator", 3, 1, htobe32(indicator), htobe32(new_value), htobe32(loc_pa), &status); (void) rtas_free_rmo_buffer(locbuf, loc_pa, size); dbg("(%d, %d, %s) = %d\n", indicator, new_value, (char *)loc_code, rc ? rc : status); return rc ? rc : status; } /** * rtas_set_eeh_option * @brief Inerface to the ibm,set-eeh-option rtas call * * @param cfg_addr configuration address for slot to set eeh option on * @param phbid PHB ID for slot to set option on * @param function * @return 0 on success, !0 otherwise */ int rtas_set_eeh_option(uint32_t cfg_addr, uint64_t phbid, int function) { int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_call("ibm,set-eeh-option", 4, 1, htobe32(cfg_addr), htobe32(BITS32_HI(phbid)), htobe32(BITS32_LO(phbid)), htobe32(function), &status); dbg("(0x%x, 0x%lx, %d) = %d\n", cfg_addr, phbid, function, rc ? rc : status); return rc ? rc : status; } /** * rtas_set_indicator * @brief Interface to the set-indicator rtas call * * @param indicator indicator to set * @param index indicator index * @param new_value value to set the indicator to * @return 0 on success, !0 otherwise */ int rtas_set_indicator(int indicator, int index, int new_value) { int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_call("set-indicator", 3, 1, htobe32(indicator), htobe32(index), htobe32(new_value), &status); dbg("(%d, %d, %d) = %d\n", indicator, index, new_value, rc ? rc : status); return rc ? rc : status; } /** * rtas_set_power_level * @brief Interface to the set-power-level rtas call * * @param powerdomain * @param level power level to set to * @param setlevel * @return 0 on success, !0 otherwise */ int rtas_set_power_level(int powerdomain, int level, int *setlevel) { __be32 be_setlevel; int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_call("set-power-level", 2, 2, htobe32(powerdomain), htobe32(level), &status, &be_setlevel); *setlevel = be32toh(be_setlevel); dbg("(%d, %d, %p) = %d, %d\n", powerdomain, level, setlevel, rc ? rc : status, *setlevel); return rc ? rc : status; } /** * rtas_set_poweron_time * @brief interface to the set-time-for-power-on rtas call * * @param year year to power on * @param month month to power on * @param day day to power on * @param hour hour to power on * @param min minute to power on * @param sec second to power on * @param nsec nano-second top power on * @return 0 on success, !0 otherwise */ int rtas_set_poweron_time(uint32_t year, uint32_t month, uint32_t day, uint32_t hour, uint32_t min, uint32_t sec, uint32_t nsec) { int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_call("set-time-for-power-on", 7, 1, htobe32(year), htobe32(month), htobe32(day), htobe32(hour), htobe32(min), htobe32(sec), htobe32(nsec), &status); dbg("(%d, %d, %d, %d, %d, %d, %d) = %d\n", year, month, day, hour, min, sec, nsec, rc ? rc : status); return rc ? rc : status; } /** * rtas_set_sysparm * @brief Interface to the ibm,set-system-parameter rtas call * * @param parameter * @param data * @return 0 on success, !0 otherwise */ int rtas_set_sysparm(unsigned int parameter, char *data) { uint32_t kernbuf_pa; void *kernbuf; int rc, status; short size; rc = sanity_check(); if (rc) return rc; size = *(short *)data; rc = rtas_get_rmo_buffer(size + sizeof(short), &kernbuf, &kernbuf_pa); if (rc) return rc; memcpy(kernbuf, data, size + sizeof(short)); rc = rtas_call("ibm,set-system-parameter", 2, 1, htobe32(parameter), htobe32(kernbuf_pa), &status); (void)rtas_free_rmo_buffer(kernbuf, kernbuf_pa, size + sizeof(short)); dbg("(%d, %p) = %d\n", parameter, data, rc ? rc : status); return rc ? rc : status; } /** * rtas_set_time * @brief Interface to the set-time-of-day rtas call * * @param year year to set time to * @param month month to set time to * @param day day to set time to * @param hour hour to set time to * @param min minute to set time to * @param sec second to set time to * @param nsec nan-second to set time to * @return 0 on success, !0 otherwise */ int rtas_set_time(uint32_t year, uint32_t month, uint32_t day, uint32_t hour, uint32_t min, uint32_t sec, uint32_t nsec) { int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_call("set-time-of-day", 7, 1, htobe32(year), htobe32(month), htobe32(day), htobe32(hour), htobe32(min), htobe32(sec), htobe32(nsec), &status); dbg("(%d, %d, %d, %d, %d, %d, %d) = %d\n", year, month, day, hour, min, sec, nsec, rc ? rc : status); return rc ? rc : status; } /** * rtas_suspend_me * @brief Interface for ibm,suspend-me rtas call * * @return 0 on success, !0 on failure */ int rtas_suspend_me(uint64_t streamid) { int rc, status; rc = rtas_call("ibm,suspend-me", 2, 1, htobe32(BITS32_HI(streamid)), htobe32(BITS32_LO(streamid)), &status); dbg("() = %d\n", rc ? rc : status); return rc ? rc : status; } /** * rtas_update_nodes * @brief Interface for ibm,update-nodes rtas call * * @param workarea input output work area for the rtas call * @param scope of call * @return 0 on success, !0 on failure * * Note that the PAPR defines the work area as 4096 bytes (as * opposed to a page), thus we use that rather than PAGE_SIZE below. */ int rtas_update_nodes(char *workarea, unsigned int scope) { uint32_t workarea_pa; void *kernbuf; int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_get_rmo_buffer(4096, &kernbuf, &workarea_pa); if (rc) return rc; memcpy(kernbuf, workarea, 4096); rc = rtas_call("ibm,update-nodes", 2, 1, htobe32(workarea_pa), htobe32(scope), &status); if (rc == 0) memcpy(workarea, kernbuf, 4096); (void)rtas_free_rmo_buffer(kernbuf, workarea_pa, PAGE_SIZE); dbg("(%p) %d = %d\n", workarea, scope, rc ? rc : status); return rc ? rc : status; } /** * rtas_update_properties * @brief Interface for ibm,update-properties rtas call * * @param workarea input output work area for the rtas call * @param scope of call * @return 0 on success, !0 on failure * * Note that the PAPR defines the work area as 4096 bytes (as * opposed to a page), thus we use that rather than PAGE_SIZE below. */ int rtas_update_properties(char *workarea, unsigned int scope) { uint32_t workarea_pa; void *kernbuf; int rc, status; rc = sanity_check(); if (rc) return rc; rc = rtas_get_rmo_buffer(4096, &kernbuf, &workarea_pa); if (rc) return rc; memcpy(kernbuf, workarea, 4096); rc = rtas_call("ibm,update-properties", 2, 1, htobe32(workarea_pa), htobe32(scope), &status); if (rc == 0) memcpy(workarea, kernbuf, 4096); (void)rtas_free_rmo_buffer(kernbuf, workarea_pa, PAGE_SIZE); dbg("(%p) %d = %d\n", workarea, scope, rc ? rc : status); return rc ? rc : status; } librtas-2.0.0/librtas_src/syscall_rmo.c000066400000000000000000000237651270107623400201720ustar00rootroot00000000000000/** * @file syscall_rmo.c * * Copyright (C) 2005 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author John Rose */ #include #include #include #include #include #include #include "syscall.h" #include "librtas.h" #define MAX_PAGES 64 #define MAX_PATH_LEN 80 struct workarea_config { int init_done; int lockfile_fd; struct region kern_region; uint64_t pages_map; }; static const char *rmo_filename = "rmo_buffer"; static const char *devmem_path = "/dev/mem"; static const char *lockfile_path = "/var/lock/LCK..librtas"; static struct workarea_config wa_config = { .lockfile_fd = -1, .init_done = 0, .pages_map = 0ll, }; /** * open_proc_rtas_file * @brief Open the proc rtas file * * @param name filename to open * @param mode mode to open file in * @return results of open() call */ static int open_proc_rtas_file(const char *name, int mode) { const char *proc_rtas_paths[] = { "/proc/ppc64/rtas", "/proc/rtas" }; char full_name[MAX_PATH_LEN]; int npaths; int fd; int i; npaths = sizeof(proc_rtas_paths) / sizeof(char *); for (i = 0; i < npaths; i++) { sprintf(full_name, "%s/%s", proc_rtas_paths[i], name); fd = open(full_name, mode, S_IRUSR | S_IWUSR); if (fd >= 0) break; } if (fd < 0) dbg("Failed to open %s\n", full_name); return fd; } /** * read_kregion_bounds * @brief Read the kernel region bounds for RMO memory * * @param kregion * @return 0 on success, !0 otherwise */ static int read_kregion_bounds(struct region *kregion) { char *buf; int fd; int rc; fd = open_proc_rtas_file(rmo_filename, O_RDONLY); if (fd < 0) { dbg("Could not open workarea file\n"); return RTAS_IO_ASSERT; } rc = read_entire_file(fd, &buf, NULL); close(fd); if (rc) { free(buf); return rc; } sscanf(buf, "%" SCNx64 " %x", &kregion->addr, &kregion->size); free(buf); if (!(kregion->size && kregion->addr) || (kregion->size > (PAGE_SIZE * MAX_PAGES))) { dbg("Unexpected kregion bounds\n"); return RTAS_IO_ASSERT; } return 0; } /** * get_bits * * @param lobit * @param hibit * @param mask * @return 0 on success, !0 otherwise */ static inline uint64_t get_bits(short lobit, short hibit, uint64_t mask) { short num_bits = hibit - lobit + 1; uint64_t ones_mask = (1ll << (num_bits)) - 1; return ((mask >> lobit) & ones_mask); } /** * set_bits * * @param lobit * @param hibit * @param value * @param mask * @return 0 on success, !0 otherwise */ static inline void set_bits(short lobit, short hibit, uint64_t value, uint64_t *mask) { short num_bits = hibit - lobit + 1; uint64_t ones_mask = (1ll << (num_bits)) - 1; *mask &= ~(ones_mask << lobit); *mask |= value << lobit; } /** * acquire_file_lock * * @param start * @param size * @return 0 on success, !0 otherwise */ static int acquire_file_lock(off_t start, size_t size) { struct flock flock; int rc; /* Lazily open lock file */ if (wa_config.lockfile_fd < 0) { wa_config.lockfile_fd = open(lockfile_path, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); if (wa_config.lockfile_fd < 0) { dbg("could not open lockfile %s\n", lockfile_path); return RTAS_IO_ASSERT; } } flock.l_start = start; flock.l_type = F_WRLCK; flock.l_whence = SEEK_SET; flock.l_len = size; flock.l_pid = getpid(); rc = fcntl(wa_config.lockfile_fd, F_SETLKW, &flock); if (rc < 0) { /* Expected to fail for regions used by other processes */ dbg("fcntl failed for [0x%lx, 0x%zx]\n", start, size); return RTAS_IO_ASSERT; } return 0; } /** * release_file_lock * * @param start * @param size * @return 0 on success, !0 otherwise */ static int release_file_lock(off_t start, size_t size) { struct flock flock; int rc; flock.l_start = start; flock.l_type = F_UNLCK; flock.l_whence = SEEK_SET; flock.l_len = size; flock.l_pid = getpid(); rc = fcntl(wa_config.lockfile_fd, F_SETLK, &flock); if (rc < 0) { dbg("fcntl failed for [0x%lx, 0x%zx]\n", start, size); return RTAS_IO_ASSERT; } return 0; } /** * get_phys_region * * @param size * @param phys_addr * @return 0 on success, !0 otherwise */ static int get_phys_region(size_t size, uint32_t * phys_addr) { struct region *kregion = &wa_config.kern_region; uint32_t addr = 0; uint64_t bits; int n_pages; int i; if (size > kregion->size) { dbg("Invalid buffer size 0x%zx requested\n", size); return RTAS_IO_ASSERT; } n_pages = size / PAGE_SIZE; for (i = 0; i < MAX_PAGES; i++) { if ((i * PAGE_SIZE) >= kregion->size) break; bits = get_bits(i, i + n_pages - 1, wa_config.pages_map); if (bits == 0ll) { if (acquire_file_lock(i, n_pages) == 0) { set_bits(i, i + n_pages - 1, (1 << n_pages) - 1, &wa_config.pages_map); addr = kregion->addr + (i * PAGE_SIZE); break; } } } if (!addr) { dbg("Could not find available workarea space\n"); return RTAS_IO_ASSERT; } *phys_addr = addr; return 0; } /** * release_phys_region * * @param phys_addr * @param size * @return 0 on success, !0 otherwise */ static int release_phys_region(uint32_t phys_addr, size_t size) { struct region *kregion = &wa_config.kern_region; int first_page; int n_pages; uint64_t bits; int rc; if (size > kregion->size) { dbg("Invalid buffer size 0x%zx requested\n", size); return RTAS_IO_ASSERT; } first_page = (phys_addr - kregion->addr) / PAGE_SIZE; n_pages = size / PAGE_SIZE; bits = get_bits(first_page, first_page + n_pages - 1, wa_config.pages_map); if (bits != ((1 << n_pages) - 1)) { dbg("Invalid region [0x%x, 0x%zx]\n", phys_addr, size); return RTAS_IO_ASSERT; } set_bits(first_page, first_page + n_pages - 1, 0, &wa_config.pages_map); rc = release_file_lock(first_page, n_pages); return rc; } /** * init_workarea_config * * @return 0 on success, !0 otherwise */ static int init_workarea_config() { int rc; /* Read bounds of reserved kernel region */ rc = read_kregion_bounds(&wa_config.kern_region); if (rc) return rc; wa_config.init_done = 1; return 0; } /** * mmap_dev_mem * * @param phys_addr * @param size * @param buf * @return 0 on success, !0 otherwise */ static int mmap_dev_mem(uint32_t phys_addr, size_t size, void **buf) { void *newbuf; int fd; fd = open(devmem_path, O_RDWR); if (fd < 0) { dbg("Failed to open %s\n", devmem_path); return RTAS_IO_ASSERT; } newbuf = mmap((void *)0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, phys_addr); close(fd); if (newbuf == MAP_FAILED) { dbg("mmap failed\n"); return RTAS_IO_ASSERT; } *buf = newbuf; return 0; } /** * munmap_dev_mem * * @param buf * @param size * @return 0 on success, !0 otherwise */ static int munmap_dev_mem(void *buf, size_t size) { int rc; int fd; fd = open(devmem_path, O_RDWR); if (fd < 0) { dbg("Failed to open %s\n", devmem_path); return RTAS_IO_ASSERT; } rc = munmap(buf, size); close(fd); if (rc < 0) { dbg("munmap failed\n"); return RTAS_IO_ASSERT; } return 0; } /** * interface_exists * * @return 0 on success, !0 otherwise */ int interface_exists() { int fd = open_proc_rtas_file(rmo_filename, O_RDONLY); int exists; exists = (fd >= 0); if (exists) close(fd); return exists; } /** * rtas_free_rmo_buffer * @brief free the rmo buffer used by librtas * * @param buf virtual address of mmap()'ed buffer * @param phys_addr physical address of low mem buffer * @param size size of buffer * @return 0 on success, !0 otherwise * RTAS_FREE_ERR - Free called before get * RTAS_IO_ASSERT - Unexpected I/O Error */ int rtas_free_rmo_buffer(void *buf, uint32_t phys_addr, size_t size) { int n_pages; int rc; rc = sanity_check(); if (rc) return rc; n_pages = size / PAGE_SIZE; /* Check for multiple of page size */ if (size % PAGE_SIZE) { /* Round up to multiple of PAGE_SIZE */ n_pages++; size = n_pages * PAGE_SIZE; } if (!wa_config.init_done) { dbg("Attempting to free before calling get()\n"); return RTAS_FREE_ERR; } rc = munmap_dev_mem(buf, size); if (rc) { (void) release_phys_region(phys_addr, size); return rc; } rc = release_phys_region(phys_addr, size); return rc; } /** * rtas_get_rmo_buffer * @brief Retrive the RMO buffer used by librtas * * On successful completion the buf parameter will reference an allocated * area of RMO memory and the phys_addr parameter will refernce the * physical address of the RMO buffer. * * @param size Size of requested region. Must be a multiple of 4096. * @param buf Assigned to mmap'ed buffer of acquired region * @param phys_addr Assigned to physical address of acquired region * @return 0 on success, !0 otherwise * RTAS_NO_MEM - Out of heap memory * RTAS_NO_LOWMEM - Out of rmo memory * RTAS_IO_ASSERT - Unexpected I/O Error */ int rtas_get_rmo_buffer(size_t size, void **buf, uint32_t * phys_addr) { uint32_t addr; int n_pages; int rc; rc = sanity_check(); if (rc) return rc; dbg("RMO buffer request, size: %zd\n", size); n_pages = size / PAGE_SIZE; /* Check for multiple of page size */ if (size % PAGE_SIZE) { /* Round up to multiple of PAGE_SIZE */ n_pages++; size = n_pages * PAGE_SIZE; } if (!wa_config.init_done) { rc = init_workarea_config(); if (rc) return rc; } rc = get_phys_region(size, &addr); if (rc) return rc; rc = mmap_dev_mem(addr, size, buf); if (rc) { (void) release_phys_region(addr, size); return rc; } *phys_addr = addr; return 0; } librtas-2.0.0/librtasevent_src/000077500000000000000000000000001270107623400165245ustar00rootroot00000000000000librtas-2.0.0/librtasevent_src/Makefile000066400000000000000000000044401270107623400201660ustar00rootroot00000000000000# # Makefile for librtasevent_src # # Copyright (C) 2005 IBM Corporation # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library 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 # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA include ../rules.mk LIBRE_SONAME = librtasevent.so LIBRE_STATIC = librtasevent.a LIBRE = $(LIBRE_SONAME).$(VERSION) LIBRE_OBJS = get_rtas_event.o print_rtas_event.o rtas_cpu.o rtas_dump.o \ rtas_epow.o rtas_io.o rtas_lri.o rtas_mem.o rtas_post.o \ rtas_sp.o rtas_srcfru.o rtas_v6_misc.o rtas_vend.o rtas_hotplug.o LIBRE_HDRS = librtasevent.h librtasevent_v4.h librtasevent_v6.h HEADERS = $(LIBRE_HDRS) rtas_event.h CFLAGS += -fPIC -DPIC -I. LDFLAGS += -shared -Wl,-soname -Wl,$(LIBRE_SONAME).$(MAJOR_NO) all: libre_shared libre_static libre_shared: $(LIBRE_OBJS) $(HEADERS) @echo "LD librtasevent_src/$(LIBRE)..." @$(CC) $(LIBRE_OBJS) $(LDFLAGS) -o $(LIBRE) libre_static: $(LIBRE_OBJS) $(HEADERS) @echo "AR $(LIBRE_STATIC)..." @ar rcs $(LIBRE_STATIC) $(LIBRE_OBJS) install: @$(call install_lib,$(LIBRE),$(DESTDIR)) @$(call install_lib,$(LIBRE_STATIC),$(DESTDIR)) @$(call install_inc,$(LIBRE_HDRS),$(DESTDIR)) @ln -sf $(LIBRE) $(DESTDIR)/$(LIB_DIR)$(call is_lib64,$(LIBRE))/$(LIBRE_SONAME) @ln -sf $(LIBRE) $(DESTDIR)/$(LIB_DIR)$(call is_lib64,$(LIBRE))/$(LIBRE_SONAME).$(MAJOR_NO) uninstall: @$(call uninstall_lib,$(LIBRE),$(DESTDIR)) @$(call uninstall_lib,$(LIBRE_STATIC),$(DESTDIR)) @$(call uninstall_inc,$(LIBRE_HDRS),$(DESTDIR)) @rm -f $(DESTDIR)/$(LIB_DIR)$(call is_lib64,$(LIBRE))/$(LIBRE_SONAME) @rm -f $(DESTDIR)/$(LIB_DIR)$(call is_lib64,$(LIBRE))/$(LIBRE_SONAME).$(MAJOR_NO) clean: @echo "Cleaning up $(WORK_DIR) files..." @rm -f $(LIBRE_OBJS) $(LIBRE_SONAME) $(LIBRE) $(LIBRE_STATIC) librtas-2.0.0/librtasevent_src/get_rtas_event.c000066400000000000000000000300631270107623400217030ustar00rootroot00000000000000/** * @file get_rtas_event.c * @brief librtasevent routines to parse RTAS events * * Copyright (C) 2005 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author Nathan Fontenot */ #include #include #include #include #include "librtasevent.h" #include "rtas_event.h" /** * rtas_copy * @brief front end for common memcpy calls * * NOTE: This will chang the value of the rtas_event offset value * * @param to place to copy data to * @param re rtas_event pointer * @param size amount to copy */ void rtas_copy(void *to, struct rtas_event *re, uint32_t size) { memcpy(to, (re->buffer + re->offset), size); re->offset += size; } /** * cleanup_rtas_event * @brief free the structures related to a parsed rtas event * * @param re rtas_event pointer * @return 0 on success, !0 on failure */ int cleanup_rtas_event(struct rtas_event *re) { struct scn_header *scn; if (re == NULL) return 0; scn = re->event_scns; while (scn != NULL) { struct scn_header *tmpscn = scn->next; switch (scn->scn_id) { case RTAS_VEND_ERRLOG_SCN: { struct rtas_vend_errlog *ve = (struct rtas_vend_errlog *)scn; if (ve->vendor_data != NULL) free(ve->vendor_data); break; } case RTAS_PSRC_SCN: case RTAS_SSRC_SCN: { struct rtas_fru_hdr *fruhdr; struct rtas_fru_scn *fru; struct rtas_src_scn *src = (struct rtas_src_scn *)scn; fru = src->fru_scns; while (fru != NULL) { struct rtas_fru_scn *tmpfru = fru->next; fruhdr = fru->subscns; while (fruhdr != NULL) { struct rtas_fru_hdr *tmphdr = fruhdr->next; free(fruhdr); fruhdr = tmphdr; } free(fru); fru = tmpfru; } break; } case RTAS_GENERIC_SCN: { struct rtas_v6_generic *gen = (struct rtas_v6_generic *)scn; if (gen->data != NULL) free(gen->data); break; } } free(scn); scn = tmpscn; } free(re); return 0; } /** * add_re_scn * @brief Add a rtas event section to the section list * * @param re rtas_event pointer to add this section to * @param scn pointer to start of rtas event section * @param scn_id id of the section to be added * return pointer to newly created rtas_event_scn */ void add_re_scn(struct rtas_event *re, void *scn, int scn_id) { struct scn_header *shdr = (struct scn_header *)scn; shdr->next = NULL; shdr->re = re; shdr->scn_id = scn_id; if (re->event_scns == NULL) { re->event_scns = shdr; } else { struct scn_header *tmp_hdr = re->event_scns; while (tmp_hdr->next != NULL) tmp_hdr = tmp_hdr->next; tmp_hdr->next = shdr; } } /** * re_scn_id * @brief Convert the two character section id into an internal identifier * * @param shdr rtas_v6_hdr pointer * @return section identifier on success, -1 on failure */ int re_scn_id(struct rtas_v6_hdr_raw *v6hdr) { if (strncmp(v6hdr->id, RTAS_DUMP_SCN_ID, 2) == 0) return RTAS_DUMP_SCN; if (strncmp(v6hdr->id, RTAS_EPOW_SCN_ID, 2) == 0) return RTAS_EPOW_SCN; if (strncmp(v6hdr->id, RTAS_IO_SCN_ID, 2) == 0) return RTAS_IO_SCN; if (strncmp(v6hdr->id, RTAS_LRI_SCN_ID, 2) == 0) return RTAS_LRI_SCN; if (strncmp(v6hdr->id, RTAS_MTMS_SCN_ID, 2) == 0) return RTAS_MT_SCN; if (strncmp(v6hdr->id, RTAS_PSRC_SCN_ID, 2) == 0) return RTAS_PSRC_SCN; if (strncmp(v6hdr->id, RTAS_SSRC_SCN_ID, 2) == 0) return RTAS_SSRC_SCN; if (strncmp(v6hdr->id, RTAS_HP_SCN_ID, 2) == 0) return RTAS_HP_SCN; return -1; } /** * _get_re_scn * @brief the real work for retreiving rtas event sections * * @param res rtas_event_scn pointer at which to start search * @param scn_id section id to search for * @return rtas_event_scn on success, NULL on failure */ static struct scn_header * _get_re_scn(struct scn_header *scn_hdr, int scn_id) { for ( ; scn_hdr != NULL; scn_hdr = scn_hdr->next) { if (scn_hdr->scn_id == scn_id) return scn_hdr; } return NULL; } /** * get_re_scn * @brief find the specified section on the list of sections * * NOTE: this function has been split just so we can have common place * to check for NULL 're' pointers (no sense checking everywhere we * call this). * * @param re rtas_event pointer * @param scn_id id of the section to find * @return rtas_event_scn on success, NULL on failure */ struct scn_header * get_re_scn(struct rtas_event *re, int scn_id) { if (re == NULL) { errno = EFAULT; return NULL; } return _get_re_scn(re->event_scns, scn_id); } /** * parse_re_hdr */ static void parse_re_hdr(struct rtas_event *re, struct rtas_event_hdr *re_hdr) { struct rtas_event_hdr_raw *rawhdr; rawhdr = (struct rtas_event_hdr_raw *)(re->buffer + re->offset); re_hdr->version = rawhdr->version; re_hdr->severity = (rawhdr->data1 & 0xE0) >> 5; re_hdr->disposition = (rawhdr->data1 & 0x1C) >> 3; re_hdr->extended = (rawhdr->data1 & 0x04) >> 2; re_hdr->initiator = (rawhdr->data2 & 0xF0) >> 4; re_hdr->target = rawhdr->data2 & 0x0F; re_hdr->type = rawhdr->type; re_hdr->ext_log_length = be32toh(rawhdr->ext_log_length); re->offset += RE_EVENT_HDR_SZ; add_re_scn(re, re_hdr, RTAS_EVENT_HDR); } static void parse_re_exthdr(struct rtas_event *re, struct rtas_event_exthdr *rex_hdr) { struct rtas_event_exthdr_raw *rawhdr; rawhdr = (struct rtas_event_exthdr_raw *)(re->buffer + re->offset); rex_hdr->valid = (rawhdr->data1 & 0x80) >> 7; rex_hdr->unrecoverable = (rawhdr->data1 & 0x40) >> 6; rex_hdr->recoverable = (rawhdr->data1 & 0x20) >> 5; rex_hdr->unrecoverable_bypassed = (rawhdr->data1 & 0x10) >> 4; rex_hdr->predictive = (rawhdr->data1 & 0x08) >> 3; rex_hdr->newlog = (rawhdr->data1 & 0x04) >> 2; rex_hdr->bigendian = (rawhdr->data1 & 0x02) >> 1; rex_hdr->platform_specific = (rawhdr->data2 & 0x80) >> 7; rex_hdr->platform_value = rawhdr->data2 & 0x0F; rex_hdr->power_pc = (rawhdr->data3 & 0x80) >> 7; rex_hdr->addr_invalid = (rawhdr->data3 & 0x10) >> 4; rex_hdr->format_type = rawhdr->data3 & 0x0F; rex_hdr->non_hardware = (rawhdr->data4 & 0x80) >> 7; rex_hdr->hot_plug = (rawhdr->data4 & 0x40) >> 6; rex_hdr->group_failure = (rawhdr->data4 & 0x20) >> 5; rex_hdr->residual = (rawhdr->data4 & 0x08) >> 3; rex_hdr->boot = (rawhdr->data4 & 0x04) >> 2; rex_hdr->config_change = (rawhdr->data4 & 0x02) >> 1; rex_hdr->post = rawhdr->data4 & 0x01; parse_rtas_time(&rex_hdr->time, &rawhdr->time); parse_rtas_date(&rex_hdr->date, &rawhdr->date); re->offset += RE_EXT_HDR_SZ; add_re_scn(re, rex_hdr, RTAS_EVENT_EXT_HDR); } /** * parse_v6_rtas_event * @brief parse a version 6 RTAS event * * @param re rtas_event pointer * @return rtas_event pointer on success, NULL on failure */ struct rtas_event * parse_v6_rtas_event(struct rtas_event *re) { struct rtas_v6_hdr_raw *v6hdr; char *ibm; ibm = re->buffer + re->offset; /* Sanity Check for "IBM" string */ if (strncmp(ibm, "IBM", 3) != 0) { cleanup_rtas_event(re); errno = EFAULT; return NULL; } re->offset += 4; /* IBM + NULL */ if (parse_priv_hdr_scn(re) != 0) { cleanup_rtas_event(re); return NULL; } if (parse_usr_hdr_scn(re) != 0) { cleanup_rtas_event(re); return NULL; } while (re->offset < re->event_length) { int scn_id, rc; v6hdr = (struct rtas_v6_hdr_raw *)(re->buffer + re->offset); scn_id = re_scn_id(v6hdr); switch (scn_id) { case RTAS_EPOW_SCN: rc = parse_epow_scn(re); break; case RTAS_IO_SCN: rc = parse_io_scn(re); break; case RTAS_DUMP_SCN: rc = parse_dump_scn(re); break; case RTAS_LRI_SCN: rc = parse_lri_scn(re); break; case RTAS_MT_SCN: rc = parse_mt_scn(re); break; case RTAS_PSRC_SCN: case RTAS_SSRC_SCN: rc = parse_src_scn(re); break; case RTAS_HP_SCN: rc = parse_hotplug_scn(re); break; default: rc = parse_generic_v6_scn(re); break; } if (rc) { cleanup_rtas_event(re); re = NULL; break; } } return re; } /** * parse_rtas_event * @brief parse an rtas event creating a populated rtas_event structure * * @param buf buffer containing the binary RTAS event * @param buflen length of the buffer 'buf' * @return pointer to rtas_event */ struct rtas_event * parse_rtas_event(char *buf, int buflen) { struct rtas_event *re; struct rtas_event_hdr *re_hdr; struct rtas_event_exthdr *rex_hdr; int rc; re = malloc(sizeof(*re)); if (re == NULL) { errno = ENOMEM; return NULL; } memset(re, 0, sizeof(*re)); re->buffer = buf; re->event_no = -1; re_hdr = malloc(sizeof(*re_hdr)); if (re_hdr == NULL) { cleanup_rtas_event(re); errno = ENOMEM; return NULL; } parse_re_hdr(re, re_hdr); /* Validate the length of the buffer passed in. */ re->event_length = re_hdr->ext_log_length + RE_EVENT_HDR_SZ; if (re->event_length > buflen) { cleanup_rtas_event(re); return NULL; } re->version = re_hdr->version; if (re_hdr->extended == 0) return re; rex_hdr = malloc(sizeof(*rex_hdr)); if (rex_hdr == NULL) { cleanup_rtas_event(re); errno = ENOMEM; return NULL; } parse_re_exthdr(re, rex_hdr); if (re_hdr->version == 6) return parse_v6_rtas_event(re); switch (rex_hdr->format_type) { case RTAS_EXTHDR_FMT_CPU: rc = parse_cpu_scn(re); break; case RTAS_EXTHDR_FMT_EPOW: rc = parse_epow_scn(re); break; case RTAS_EXTHDR_FMT_IBM_DIAG: rc = parse_ibm_diag_scn(re); break; case RTAS_EXTHDR_FMT_IO: rc = parse_io_scn(re); break; case RTAS_EXTHDR_FMT_MEMORY: rc = parse_mem_scn(re); break; case RTAS_EXTHDR_FMT_POST: rc = parse_post_scn(re); break; case RTAS_EXTHDR_FMT_IBM_SP: rc = parse_sp_scn(re); break; case RTAS_EXTHDR_FMT_VEND_SPECIFIC_1: case RTAS_EXTHDR_FMT_VEND_SPECIFIC_2: rc = parse_vend_errlog_scn(re); break; default: errno = EFAULT; rc = -1; break; } if ((rc == 0) && (re->offset < re->event_length)) rc = parse_vend_errlog_scn(re); if (rc) { cleanup_rtas_event(re); re = NULL; } return re; } librtas-2.0.0/librtasevent_src/librtasevent.h000066400000000000000000000425071270107623400214070ustar00rootroot00000000000000/** * @file librtasevent.h * @brief Structure and Interface definitions for librtasevent * * This provides the structure and interface definitions for librtasevent. * Also see librtasevent_v4.h and librtasevent_v6.h for additional * structure definitions particular those event versions. * * librtasevent usage: * The librtasevent library is meant to place the structure definitions, * parsing and printing of RTAS events into a common place. The use of * librtasevent is easiest through the following interfaces: * * parse_rtas_event() - This takes a buffer containing an RTAS event in * binary form and returns a pointer to an rtas_event struct. This * struct has a list of rtas_event_scn objects hanging off of it * for each section of the rtas event. * * This presents the user with a broken down representation of the RTAS * event that can then be easily searched for any relevant information * or passed to either rtas_print_event() to print the entire RTAS event * or the rtas_print_event_scn() to print a particular section of the * RTAS event. * * When finished a call to rtas_cleanup_event() will free all of the data * structuires associated with the RTAS event. * * Copyright (C) 2005 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author Nathan Fontenot */ #ifndef _H_RTAS_EVENTS #define _H_RTAS_EVENTS #include #include struct rtas_event; /** * @struct rtas_event_scn * @brief Contains the data for a RTAS event section */ struct scn_header { struct scn_header *next; struct rtas_event *re; uint32_t raw_offset; int scn_id; }; #define RE_SHDR_SZ (sizeof(struct scn_header)) #define RE_SHDR_OFFSET(x) ((char *)(x) + RE_SHDR_SZ) /* definitions for struct rtas_event_scn scn_id */ #define RTAS_EVENT_HDR 1 #define RTAS_EVENT_EXT_HDR 2 #define RTAS_EPOW_SCN 3 #define RTAS_IO_SCN 4 #define RTAS_CPU_SCN 5 #define RTAS_IBM_DIAG_SCN 6 #define RTAS_MEM_SCN 7 #define RTAS_POST_SCN 8 #define RTAS_IBM_SP_SCN 9 #define RTAS_VEND_ERRLOG_SCN 10 #define RTAS_PRIV_HDR_SCN 11 #define RTAS_USR_HDR_SCN 12 #define RTAS_DUMP_SCN 13 #define RTAS_LRI_SCN 14 #define RTAS_MT_SCN 15 #define RTAS_PSRC_SCN 16 #define RTAS_SSRC_SCN 17 #define RTAS_GENERIC_SCN 18 #define RTAS_HP_SCN 19 #define RTAS_MAX_SCN_ID 20 /** * @struct rtas_event * @brief Anchor structure for parsed RTAS events */ struct rtas_event { int version; int event_no; char *buffer; uint32_t offset; uint32_t event_length; struct scn_header *event_scns; }; #define RE_EVENT_OFFSET(re) ((re)->buffer + (re)->offset) /** * @struct rtas_date * @brief definition of date format in rtas events */ struct rtas_date { uint32_t year; uint32_t month; uint32_t day; }; struct rtas_date_raw { uint32_t year:16; uint32_t month:8; uint32_t day:8; }; /** * @struct rtas_time * @brief definition of timestamp in rtas events */ struct rtas_time { uint32_t hour; uint32_t minutes; uint32_t seconds; uint32_t hundredths; }; struct rtas_time_raw { uint32_t hour:8; uint32_t minutes:8; uint32_t seconds:8; uint32_t hundredths:8; }; /* include version specific data */ #include "librtasevent_v4.h" #include "librtasevent_v6.h" /** * @struct rtas_event_hdr * @brief Fixed header at the beginning of all RTAS events */ struct rtas_event_hdr { struct scn_header shdr; uint32_t version; /**< Architectural version */ uint32_t severity; /**< Severity level of error */ #define RTAS_HDR_SEV_NO_ERROR 0 #define RTAS_HDR_SEV_EVENT 1 #define RTAS_HDR_SEV_WARNING 2 #define RTAS_HDR_SEV_ERROR_SYNC 3 #define RTAS_HDR_SEV_ERROR 4 #define RTAS_HDR_SEV_FATAL 5 #define RTAS_HDR_SEV_ALREADY_REPORTED 6 uint32_t disposition; /**< Degree of recovery */ #define RTAS_HDR_DISP_FULLY_RECOVERED 0 #define RTAS_HDR_DISP_LIMITED_RECOVERY 1 #define RTAS_HDR_DISP_NOT_RECOVERED 2 uint32_t extended; /**< extended log present? */ uint32_t initiator; /**< Initiator of event */ #define RTAS_HDR_INIT_UNKNOWN 0 #define RTAS_HDR_INIT_CPU 1 #define RTAS_HDR_INIT_PCI 2 #define RTAS_HDR_INIT_ISA 3 #define RTAS_HDR_INIT_MEMORY 4 #define RTAS_HDR_INIT_HOT_PLUG 5 uint32_t target; /**< Target of failed operation */ #define RTAS_HDR_TARGET_UNKNOWN 0 #define RTAS_HDR_TARGET_CPU 1 #define RTAS_HDR_TARGET_PCI 2 #define RTAS_HDR_TARGET_ISA 3 #define RTAS_HDR_TARGET_MEMORY 4 #define RTAS_HDR_TARGET_HOT_PLUG 5 uint32_t type; /**< General event or error*/ #define RTAS_HDR_TYPE_RETRY 1 #define RTAS_HDR_TYPE_TCE_ERR 2 #define RTAS_HDR_TYPE_INTERN_DEV_FAIL 3 #define RTAS_HDR_TYPE_TIMEOUT 4 #define RTAS_HDR_TYPE_DATA_PARITY 5 #define RTAS_HDR_TYPE_ADDR_PARITY 6 #define RTAS_HDR_TYPE_CACHE_PARITY 7 #define RTAS_HDR_TYPE_ADDR_INVALID 8 #define RTAS_HDR_TYPE_ECC_UNCORRECTED 9 #define RTAS_HDR_TYPE_ECC_CORRECTED 10 #define RTAS_HDR_TYPE_EPOW 64 #define RTAS_HDR_TYPE_PRRN 160 #define RTAS_HDR_TYPE_PLATFORM_ERROR 224 #define RTAS_HDR_TYPE_IBM_IO_EVENT 225 #define RTAS_HDR_TYPE_PLATFORM_INFO 226 #define RTAS_HDR_TYPE_RESOURCE_DEALLOC 227 #define RTAS_HDR_TYPE_DUMP_NOTIFICATION 228 #define RTAS_HDR_TYPE_HOTPLUG 229 uint32_t ext_log_length; /**< length in bytes */ }; struct rtas_event_hdr_raw { uint32_t version:8; uint32_t data1:8; uint32_t data2:8; uint32_t type:8; uint32_t ext_log_length; } __attribute__((__packed__)); #define RE_EVENT_HDR_SZ 8 /** * @struct rtas_event_exthdr * @brief RTAS optional extended error log header (12 bytes) */ struct rtas_event_exthdr { struct scn_header shdr; uint32_t valid; uint32_t unrecoverable; uint32_t recoverable; uint32_t unrecoverable_bypassed; uint32_t predictive; uint32_t newlog; uint32_t bigendian; uint32_t platform_specific; /**< only in version 3+ */ uint32_t platform_value; /**< valid iff platform_specific */ uint32_t power_pc; uint32_t addr_invalid; uint32_t format_type; #define RTAS_EXTHDR_FMT_CPU 1 #define RTAS_EXTHDR_FMT_MEMORY 2 #define RTAS_EXTHDR_FMT_IO 3 #define RTAS_EXTHDR_FMT_POST 4 #define RTAS_EXTHDR_FMT_EPOW 5 #define RTAS_EXTHDR_FMT_IBM_DIAG 12 #define RTAS_EXTHDR_FMT_IBM_SP 13 #define RTAS_EXTHDR_FMT_VEND_SPECIFIC_1 14 #define RTAS_EXTHDR_FMT_VEND_SPECIFIC_2 15 /* This group is in version 3+ only */ uint32_t non_hardware; /**< Firmware or software is suspect */ uint32_t hot_plug; uint32_t group_failure; uint32_t residual; /**< Residual error from previous boot */ uint32_t boot; /**< Error during boot */ uint32_t config_change; /**< Configuration chang since last boot */ uint32_t post; struct rtas_time time; /**< Time of error in BCD HHMMSS00 */ struct rtas_date date; /**< Time of error in BCD YYYYMMDD */ }; struct rtas_event_exthdr_raw { uint32_t data1:8; uint32_t data2:8; uint32_t data3:8; /* This group is in version 3+ only */ uint32_t data4:8; struct rtas_time_raw time; struct rtas_date_raw date; }__attribute__((__packed__)); #define RE_EXT_HDR_SZ 12 /** * @struct rtas_epow_scn * @brief Common RTAS EPOW section */ struct rtas_epow_scn { struct scn_header shdr; /* The following represent the fields of a pre-version 6 RTAS EPOW event */ uint32_t sensor_value:28; /**< EPOW sensor value */ uint32_t action_code:4; /**< EPOW action code */ #define RTAS_EPOW_ACTION_RESET 0x00 #define RTAS_EPOW_ACTION_WARN_COOLING 0x01 #define RTAS_EPOW_ACTION_WARN_POWER 0x02 #define RTAS_EPOW_ACTION_SYSTEM_SHUTDOWN 0x03 #define RTAS_EPOW_ACTION_SYSTEM_HALT 0x04 #define RTAS_EPOW_ACTION_MAIN_ENCLOSURE 0x05 #define RTAS_EPOW_ACTION_POWER_OFF 0x07 uint32_t sensor:1; /**< detected by a defined sensor */ uint32_t power_fault:1; /**< caused by a power fault */ uint32_t fan:1; /**< caused by a fan failure */ uint32_t temp:1; /**< caused by over-temperature condition */ uint32_t redundancy:1; /**< loss of redundancy */ uint32_t CUoD:1; /**< CUoD entitlement exceeded */ uint32_t /* reserved */ :2; uint32_t general:1; /**< general unspecified fault */ uint32_t power_loss:1; /**< fault due to loss of power source */ uint32_t power_supply:1; /**< fault due to internal power failure */ uint32_t power_switch:1; /**< manual activation of power-off switch */ uint32_t battery:1; /**< fault due to internal battery failure */ uint32_t /* reserved */ :3; uint32_t /* reserved */ :16; uint32_t sensor_token:32; /**< token for sensor causing the EPOW */ uint32_t sensor_index:32; /**< index number of sensor causing EPOW */ uint32_t sensor_value2:32; uint32_t sensor_status:32; uint32_t /* reserved */ :32; /* The following represent a version 6 RTAS EPOW event */ struct rtas_v6_hdr v6hdr; uint32_t event_modifier; /**< EPOW event modifier */ #define RTAS_EPOW_MOD_NA 0x00 #define RTAS_EPOW_MOD_NORMAL_SHUTDOWN 0x01 #define RTAS_EPOW_MOD_UTILITY_POWER_LOSS 0x02 #define RTAS_EPOW_MOD_CRIT_FUNC_LOSS 0x03 #define RTAS_EPOW_MOD_AMBIENT_TEMP 0x04 char reason_code[8]; /**< platform specific reason code */ }; struct rtas_v6_epow_scn_raw { struct rtas_v6_hdr_raw v6hdr; uint32_t data1:8; uint32_t event_modifier:8; char reason_code[8]; }__attribute__((__packed__)); /* defines used for copying in data from the RTAS event */ #define RE_EPOW_V6_SCN_SZ 20 /** * @struct rtas_io_scn * @brief RTAS i/o section */ struct rtas_io_scn { struct scn_header shdr; /* The following represents the pre-version 6 RTAS event */ uint32_t bus_addr_parity:1; /**< bus address parity error */ uint32_t bus_data_parity:1; /**< bus data pariy error */ uint32_t bus_timeout:1; /**< bus time-out */ uint32_t bridge_internal:1; /**< bridge/device internal error */ uint32_t non_pci:1; /**< i.e. secondary bus such as ISA */ uint32_t mezzanine_addr_parity:1; /**< Mezzanine/System address parity*/ uint32_t mezzanine_data_parity:1; /**< Mezzanine/System data parity */ uint32_t mezzanine_timeout:1; /**< Mezzanine/System bus time-out */ uint32_t bridge_via_sysbus:1; /**< bridge connected to System bus */ uint32_t bridge_via_mezzanine:1; /**< bridge is connected to memory controller via Mezzanine Bus */ uint32_t bridge_via_expbus:1; /**< bridge is connected to I/O expansion bus */ uint32_t detected_by_expbus:1; /**< detected by I/O Expansion bus */ uint32_t expbus_data_parity:1; /**< expansion bus (parity, CRC) error */ uint32_t expbus_timeout:1; /**< expansion bus time-out */ uint32_t expbus_connection_failure:1; uint32_t expbus_not_operating:1; /**< expansion bus not in an operating state */ /* PCI Bus Data of the IOA signalling the error */ uint32_t pci_sig_bus_id:8; /**< IOA signalling the error */ uint32_t pci_sig_busno:8; /**< PCI device ID */ uint32_t pci_sig_devfn:8; /**< PCI function ID */ uint32_t pci_sig_deviceid:16; /**< PCI "Device ID" from configuration register */ uint32_t pci_sig_vendorid:16; /**< PCI "Vendor ID" from configuration register */ uint32_t pci_sig_revisionid:8; /**< PCI "Revision ID" from configuration register */ uint32_t pci_sig_slot:8; /**< Slot identifier number 00=>system board, ff=>multiple */ /* PCI Bus Data of the IOA sending the the error */ uint32_t pci_send_bus_id:8; /**< IOA sending at time of error */ uint32_t pci_send_busno:8; /**< PCI device ID */ uint32_t pci_send_devfn:8; /**< PCI function ID */ uint32_t pci_send_deviceid:16; /**< PCI "Device ID" from configuration register */ uint32_t pci_send_vendorid:16; /**< PCI "Vendor ID" from configuration register */ uint32_t pci_send_revisionid:8; /**< PCI "REvision ID" from configuration register */ uint32_t pci_send_slot:8; /**< Slot identifier number 00=>system board, ff=>multiple */ uint32_t /* reserved */ :16; uint32_t /* reserved */ :32; uint32_t /* reserved */ :32; /* The following represents the version 6 rtas event */ struct rtas_v6_hdr v6hdr; uint32_t event_type; /**< I/O event type */ #define RTAS_IO_TYPE_DETECTED 0x01 #define RTAS_IO_TYPE_RECOVERED 0x02 #define RTAS_IO_TYPE_EVENT 0x03 #define RTAS_IO_TYPE_RPC_PASS_THRU 0x04 uint32_t rpc_length; /**< RPC field length. The RPC data is optional and appears after this structure in the event if present */ uint32_t scope; /**< event scope */ #define RTAS_IO_SCOPE_NA 0x00 #define RTAS_IO_SCOPE_RIO_HUB 0x36 #define RTAS_IO_SCOPE_RIO_BRIDGE 0x37 #define RTAS_IO_SCOPE_PHB 0x38 #define RTAS_IO_SCOPE_EADS_GLOBAL 0x39 #define RTAS_IO_SCOPE_EADS_SLOT 0x3A uint32_t subtype; /**< I/O event sub-type */ #define RTAS_IO_SUBTYPE_NA 0x00 #define RTAS_IO_SUBTYPE_REBALANCE 0x01 #define RTAS_IO_SUBTYPE_NODE_ONLINE 0x02 #define RTAS_IO_SUBTYPE_NODE_OFFLINE 0x04 #define RTAS_IO_SUBTYPE_PLAT_DUMP_SZ 0x05 uint32_t drc_index; /**< DRC index */ char rpc_data[216]; }; struct rtas_v6_io_scn_raw { struct rtas_v6_hdr_raw v6hdr; uint32_t event_type:8; uint32_t rpc_length:8; uint32_t scope:8; uint32_t subtype:8; uint32_t drc_index; char rpc_data[216]; }__attribute__((__packed__)); #define RE_IO_V6_SCN_OFFSET (RE_SCN_HDR_SZ + RE_V4_SCN_SZ) /* Retrieving and free'ing parsed RTAS events */ struct rtas_event * parse_rtas_event(char *, int); int cleanup_rtas_event(struct rtas_event *); /* Retrieving a particular section from a parsed RTAS event */ struct rtas_event_hdr * rtas_get_event_hdr_scn(struct rtas_event *); struct rtas_event_exthdr * rtas_get_event_exthdr_scn(struct rtas_event *); struct rtas_epow_scn * rtas_get_epow_scn(struct rtas_event *); struct rtas_io_scn * rtas_get_io_scn(struct rtas_event *); struct rtas_cpu_scn * rtas_get_cpu_scn(struct rtas_event *); struct rtas_ibm_diag_scn * rtas_get_ibmdiag_scn(struct rtas_event *); struct rtas_mem_scn * rtas_get_mem_scn(struct rtas_event *); struct rtas_post_scn * rtas_get_post_scn(struct rtas_event *); struct rtas_ibmsp_scn * rtas_get_ibm_sp_scn(struct rtas_event *); struct rtas_vend_errlog_scn * rtas_get_vend_errlog_scn(struct rtas_event *); struct rtas_priv_hdr_scn * rtas_get_priv_hdr_scn(struct rtas_event *); struct rtas_usr_hdr_scn * rtas_get_usr_hdr_scn(struct rtas_event *); struct rtas_dump_scn * rtas_get_dump_scn(struct rtas_event *); struct rtas_lri_scn * rtas_get_lri_scn(struct rtas_event *); struct rtas_mt_scn * rtas_get_mt_scn(struct rtas_event *); struct rtas_src_scn * rtas_get_src_scn(struct rtas_event *); struct rtas_hotplug_scn * rtas_get_hotplug_scn(struct rtas_event *); int update_os_id_scn(struct rtas_event *, const char *); /* Printing RTAS event data */ int rtas_print_scn(FILE *, struct scn_header *, int); int rtas_print_event(FILE *, struct rtas_event *, int); int rtas_print_raw_event(FILE *, struct rtas_event *); int rtas_set_print_width(int); #endif librtas-2.0.0/librtasevent_src/librtasevent_v4.h000066400000000000000000000222571270107623400220200ustar00rootroot00000000000000/** * @file librtasevent_v4.h * @brief Structure definitions for RTAS events pre-version 6 * * Copyright (C) IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author Nathan Fontenot */ #ifndef _H_RTAS_EVENT_HDRS #define _H_RTAS_EVENT_HDRS #include #include #define RE_V4_SCN_SZ 28 /** * @struct rtas_cpu_scn * @brief RTAS CPU section */ struct rtas_cpu_scn { struct scn_header shdr; uint32_t internal:1; /**< internal error, other than cache */ uint32_t intcache:1; /**< internal cache error */ uint32_t extcache_parity:1; /**< or multi-bit ECC */ uint32_t extcache_ecc:1; /**< single bit ecc error */ uint32_t sysbus_timeout:1; /**< timeout waiting for mem controller*/ uint32_t io_timeout:1; /**< timeout waiting for I/O */ uint32_t sysbus_parity:1; /**< Address/Data parity error */ uint32_t sysbus_protocol:1; /**< transfer error */ uint32_t id:8; /**< physical CPU id number */ uint32_t element:16; /**< id number of sender of parity error or element which timed out */ uint32_t failing_address_hi:32; uint32_t failing_address_lo:32; uint32_t try_reboot:1; /**< V4: 1 => reboot may fix fault */ uint32_t /* reserved */ :7; uint32_t /* reserved */ :24; uint32_t /* reserved */ :32; uint32_t /* reserved */ :32; uint32_t /* reserved */ :32; }; /** * @struct rtas_mem_scn * @brief RTAS memory controller section */ struct rtas_mem_scn { struct scn_header shdr; uint32_t uncorrectable:1; /**< uncorrectable memory error */ uint32_t ECC:1; /**< ECC correctable error */ uint32_t threshold_exceeded:1; /**< correctable error threshold exceeded */ uint32_t control_internal:1; /**< memory controller internal error */ uint32_t bad_address:1; /**< memory address error */ uint32_t bad_data:1; /**< memort data error */ uint32_t bus:1; /**< memory bus/switch internal error */ uint32_t timeout:1; /**< memory time-out error */ uint32_t sysbus_parity:1; /**< system bus parity error */ uint32_t sysbus_timeout:1; /**< system bus time-out error */ uint32_t sysbus_protocol:1; /**< system bus protocol/transfer error */ uint32_t hostbridge_timeout:1; /**< host bridge time-out error */ uint32_t hostbridge_parity:1; /**< host bridge address/data parity error */ uint32_t /* reserved */:1; uint32_t support:1; /**< system support function error */ uint32_t sysbus_internal:1; /**< system bus internal hardware/switch error */ uint32_t controller_detected:8; /**< physical memory controller number that detected the error */ uint32_t controller_faulted:8; /**< physical memory controller number that caused the error */ uint32_t failing_address_hi:32; uint32_t failing_address_lo:32; uint32_t ecc_syndrome:16; /**< syndrome bits */ uint32_t memory_card:8; /**< memory card number */ uint32_t /* reserved */:8; uint32_t sub_elements:32; /**< memory sub-elements implicated on this card */ uint32_t element:16; /**< id number of sender of address/data parity error */ uint32_t /* reserved */:16; uint32_t /* reserved */:32; }; /** * struct rtas_post_scn * @brief RTAS power-on self test section */ struct rtas_post_scn { struct scn_header shdr; uint32_t firmware:1; /**< firmware error */ uint32_t config:1; /**< configuration error */ uint32_t cpu:1; /**< CPU POST error */ uint32_t memory:1; /**< memory POST error */ uint32_t io:1; /**< I/O subsystem POST error */ uint32_t keyboard:1; /**< keyboard POST error */ uint32_t mouse:1; /**< mouse POST error */ uint32_t display:1; /**< Graphic IOA / Display POST error */ uint32_t ipl_floppy:1; /**< diskette IPL error */ uint32_t ipl_controller:1; /**< drive controller IPL error */ uint32_t ipl_cdrom:1; /**< cd-rom IPL error */ uint32_t ipl_disk:1; /**< hard disk IPL error */ uint32_t ipl_net:1; /**< network IPL error */ uint32_t ipl_other:1; /**< other device IPL error */ uint32_t /* reserved */ :1; uint32_t firmware_selftest:1; /**< sef-test error in firmware */ char devname[13]; /**< device name */ uint32_t err_code[5]; /**< POST error code */ uint32_t firmware_rev[3]; /**< firmware revision level */ uint32_t loc_code[9]; /**< location code of failing device */ }; /** * @struct rtas_ibmsp_scn * @brief RTAS event service processor section */ struct rtas_ibmsp_scn { struct scn_header shdr; char ibm[4]; /**< "IBM\0" */ uint32_t timeout:1; /**< service processor timeout */ uint32_t i2c_bus:1; /**< I/O (I2C) general bus error */ uint32_t i2c_secondary_bus:1; /**< secondary I/O (I2C) bus error */ uint32_t memory:1; /**< internal service processor memory error */ uint32_t registers:1; /**< erro accessing special registers */ uint32_t communication:1; /**< unknown communication error */ uint32_t firmware:1; /**< service processor firmware error or incorrect version */ uint32_t hardware:1; /**< other internal service processor hardware error */ uint32_t vpd_eeprom:1; /**< error accessing VPD EEPROM */ uint32_t op_panel:1; /**< error accessing operator panel */ uint32_t power_controller:1; /**< error accessing power controller */ uint32_t fan_sensor:1; /**< error accessing fan controller */ uint32_t thermal_sensor:1; /**< error accessing thernal sensor */ uint32_t voltage_sensor:1; /**< error accessing voltage sensor */ uint32_t /* reserved */ :2; uint32_t serial_port:1; /**< error accessing serial port */ uint32_t nvram:1; /**< NVRAM error */ uint32_t rtc:1; /**< error accessing real-time clock */ uint32_t jtag:1; /**< error accessing scan controller */ uint32_t tod_battery:1; /**< voltage loss from TOD battery backup */ uint32_t /* reserved */ :1; uint32_t heartbeat:1; /**< heartbeat loss from surveillance processor */ uint32_t surveillance:1; /**< surveillance timeout */ uint32_t pcn_connection:1; /**< power control network general connection failure */ uint32_t pcn_node:1; /**< power control network node failure */ uint32_t /* reserved */ :2; uint32_t pcn_access:1; /**< error accessing power control network */ uint32_t /* reserved */ :3; uint32_t sensor_token:32; uint32_t sensor_index:32; uint32_t /* reserved */:32; uint32_t /* reserved */:32; uint32_t /* reserved */:32; }; /** * @struct rtas_ibm_diag_scn * @brief RTAS IBM diagnostic section */ struct rtas_ibm_diag_scn { struct scn_header shdr; uint32_t event_id:32; }; /** * @struct rtas_vend_errlog * @brief Vendor Specific Error Log section */ struct rtas_vend_errlog { struct scn_header shdr; char vendor_id[4]; uint32_t vendor_data_sz; char *vendor_data; }; #endif librtas-2.0.0/librtasevent_src/librtasevent_v6.h000066400000000000000000000364561270107623400220300ustar00rootroot00000000000000/** * @file librtasevent_v6.h * @brief Structure definitions for RTAS event version 6 sections * * Copyright (C) 2005 IBM Corporation. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author Nathan Fontenot */ #ifndef _H_RE_V6_RTAS_EVENT #define _H_RE_V6_RTAS_EVENT #include #include /** * @struct rtas_v6_scn_hdr * @brief common header for RTAS version 6 sections * * Almost every version 6 section starts with the same data as defined * in this structure. This is provided to make further structure definitions * and manipulation. */ struct rtas_v6_hdr { char id[2]; /**< section id */ uint32_t length; /**< section length */ uint32_t version; /**< section version */ uint32_t subtype; /**< section sub-type id */ uint32_t creator_comp_id; /**< component id of section creator */ }; struct rtas_v6_hdr_raw { char id[2]; uint32_t length:16; uint32_t version:8; uint32_t subtype:8; uint32_t creator_comp_id:16; }__attribute__((__packed__)); #define RTAS_V6_HDR_SIZE 16 /* defines for the rtas_event_scn id */ #define RTAS_DUMP_SCN_ID "DH" #define RTAS_EPOW_SCN_ID "EP" #define RTAS_HMC_SCN_ID "HM" #define RTAS_IO_SCN_ID "IE" #define RTAS_IP_SCN_ID "LP" #define RTAS_LRI_SCN_ID "LR" #define RTAS_MI_SCN_ID "MI" #define RTAS_MTMS_SCN_ID "MT" #define RTAS_PSRC_SCN_ID "PS" #define RTAS_SSRC_SCN_ID "SS" #define RTAS_SW_SCN_ID "SW" #define RTAS_UDD_SCN_ID "UD" #define RTAS_HP_SCN_ID "HP" /** * @struct rtas_v6_main_ascn_ * @brief RTAS version 6 Main A Section */ struct rtas_priv_hdr_scn { struct scn_header shdr; struct rtas_v6_hdr v6hdr; struct rtas_date date; struct rtas_time time; char creator_id; /**< subsystem creator id */ #define RTAS_PH_CREAT_SERVICE_PROC 'E' #define RTAS_PH_CREAT_HYPERVISOR 'H' #define RTAS_PH_CREAT_POWER_CONTROL 'W' #define RTAS_PH_CREAT_PARTITION_FW 'L' uint32_t scn_count; /**< number of sections in log */ uint32_t creator_subid_hi; uint32_t creator_subid_lo; uint32_t plid; /**< platform log id */ uint32_t log_entry_id; /**< Unique log entry id */ char creator_subid_name[9]; }; struct rtas_priv_hdr_scn_raw { struct rtas_v6_hdr_raw v6hdr; struct rtas_date_raw date; struct rtas_time_raw time; uint32_t /* reserved */:32; uint32_t /* reserved */:32; char creator_id; uint32_t /* reserved */ :16; uint32_t scn_count:8; uint32_t /* reserved */ :32; uint32_t creator_subid_hi; uint32_t creator_subid_lo; uint32_t plid; uint32_t log_entry_id; char creator_subid_name[9]; }__attribute__((__packed__)); /** * @struct rtas_v6_main_b_scn * @brief RTAS version 6 Main B Section */ struct rtas_usr_hdr_scn { struct scn_header shdr; struct rtas_v6_hdr v6hdr; uint32_t subsystem_id; /**< subsystem id */ uint32_t event_data; uint32_t event_severity; uint32_t event_type; /**< error/event severity */ #define RTAS_UH_TYPE_NA 0x00 #define RTAS_UH_TYPE_INFO_ONLY 0x01 #define RTAS_UH_TYPE_DUMP_NOTIFICATION 0x08 #define RTAS_UH_TYPE_PREVIOUSLY_REPORTED 0x10 #define RTAS_UH_TYPE_DECONFIG_USER 0x20 #define RTAS_UH_TYPE_DECONFIG_SYSTEM 0x21 #define RTAS_UH_TYPE_DECONFIG_NOTICE 0x22 #define RTAS_UH_TYPE_RETURN_TO_NORMAL 0x30 #define RTAS_UH_TYPE_CONCURRENT_MAINT 0x40 #define RTAS_UH_TYPE_CAPACITY UPGRADE 0x60 #define RTAS_UH_TYPE_RESOURCE_SPARING 0x70 #define RTAS_UH_TYPE_DYNAMIC_RECONFIG 0x80 #define RTAS_UH_TYPE_NORMAL_SHUTDOWN 0xD0 #define RTAS_UH_TYPE_ABNORMAL_SHUTDOWN 0xE0 uint32_t action; /**< erro action code */ #define RTAS_UH_ACTION_SERVICE 0x8000 #define RTAS_UH_ACTION_HIDDEN 0x4000 #define RTAS_UH_ACTION_REPORT_EXTERNALLY 0x2000 #define RTAS_UH_ACTION_HMC_ONLY 0x1000 #define RTAS_UH_ACTION_CALL_HOME 0x0800 #define RTAS_UH_ACTION_ISO_INCOMPLETE 0x0400 }; struct rtas_usr_hdr_scn_raw { struct rtas_v6_hdr_raw v6hdr; uint32_t subsystem_id:8; uint32_t event_data:8; uint32_t event_severity:8; uint32_t event_type:8; uint32_t /* reserved */:32; uint32_t /* reserved */:16; uint32_t action:16; uint32_t /* reserved */ :32; }__attribute__((__packed__)); #define RE_USR_HDR_SCN_SZ 24 struct rtas_mtms { char model[9]; /**< machine type / model */ char serial_no[13]; /**< serial number */ }; /** * @struct rtas_v6_dump_hdr * @brief RTAS version 6 dump locator section */ struct rtas_dump_scn { struct scn_header shdr; struct rtas_v6_hdr v6hdr; /*These defines are for the v6hdr.subtype field in dump sections */ #define RTAS_DUMP_SUBTYPE_FSP 0x01 #define RTAS_DUMP_SUBTYPE_PLATFORM 0x02 #define RTAS_DUMP_SUBTYPE_SMA 0x03 #define RTAS_DUMP_SUBTYPE_POWER 0x04 #define RTAS_DUMP_SUBTYPE_LOG 0x05 #define RTAS_DUMP_SUBTYPE_PARTDUMP 0x06 #define RTAS_DUMP_SUBTYPE_PLATDUMP 0x07 uint32_t id; /**< dump id */ uint32_t location; /**< 0 => dump sent to HMC 1 => dump sent to partition */ uint32_t fname_type; /**< 0 => file name in ASCII 1 => file name in hex */ uint32_t size_valid; /**< dump size field valid */ uint32_t id_len; /**< OS assigned dump id length */ uint32_t size_hi; /**< dump size (hi-bits) */ uint32_t size_lo; /**< dump size (low bits) */ char os_id[40]; /**< OS assigned dump id */ }; struct rtas_dump_scn_raw { struct rtas_v6_hdr_raw v6hdr; uint32_t id; uint32_t data1:8; uint32_t /* reserved */ :16; uint32_t id_len:8; uint32_t size_hi; uint32_t size_lo; char os_id[40]; }__attribute__((__packed__)); #define RE_V6_DUMP_SCN_SZ 64 /** * @struct rtas_v6_lri_hdr * @brief RTAS v6 logical resource identification section */ struct rtas_lri_scn { struct scn_header shdr; struct rtas_v6_hdr v6hdr; uint32_t resource; /**< resource type */ #define RTAS_LRI_RES_PROC 0x10 #define RTAS_LRI_RES_SHARED_PROC 0x11 #define RTAS_LRI_RES_MEM_PAGE 0x40 #define RTAS_LRI_RES_MEM_LMB 0x41 uint32_t capacity; /**< entitled capacity */ union { uint32_t _lri_cpu_id; /**< logical CPU id (type = proc) */ uint32_t _lri_drc_index; /**< DRC index (type = mem LMB) */ uint32_t _lri_mem_addr_lo; /**< mem logical addr low bits (type = mem page) */ } _lri_u1; #define lri_cpu_id _lri_u1._lri_cpu_id #define lri_drc_index _lri_u1._lri_drc_index #define lri_mem_addr_lo _lri_u1._lri_mem_addr_lo uint32_t lri_mem_addr_hi; /**< mem logical addr high bits (type = mem page) */ }; struct rtas_lri_scn_raw { struct rtas_v6_hdr_raw v6hdr; uint32_t resource:8; uint32_t /* reserved */:8; uint32_t capacity:16; union { uint32_t _lri_cpu_id:32; uint32_t _lri_drc_index:32; uint32_t _lri_mem_addr_lo; } _lri_u1; uint32_t lri_mem_addr_hi; }__attribute__((__packed__)); #define RE_LRI_SCN_SZ 20 /** * @struct rtas_fru_hdr * @breif data that appears at the beginning of every FRU section */ struct rtas_fru_hdr { struct rtas_fru_hdr *next; char id[2]; uint32_t length; uint32_t flags; }; struct rtas_fru_hdr_raw { char id[2]; uint32_t length:8; uint32_t flags:8; }__attribute__((__packed__)); #define RE_FRU_HDR_SZ 4 #define RE_FRU_HDR_OFFSET(x) ((char *)(x) + sizeof(struct rtas_fru_hdr *)) /** * @struct rtas_fru_id_scn * @breif Contents of the FRU Identity Substructure */ struct rtas_fru_id_scn { struct rtas_fru_hdr fruhdr; #define RTAS_FRUID_COMP_MASK 0xF0 #define RTAS_FRUID_COMP_HARDWARE 0x10 #define RTAS_FRUID_COMP_CODE 0x20 #define RTAS_FRUID_COMP_CONFIG_ERROR 0x30 #define RTAS_FRUID_COMP_MAINT_REQUIRED 0x40 #define RTAS_FRUID_COMP_EXTERNAL 0x90 #define RTAS_FRUID_COMP_EXTERNAL_CODE 0xA0 #define RTAS_FRUID_COMP_TOOL 0xB0 #define RTAS_FRUID_COMP_SYMBOLIC 0xC0 #define RTAS_FRUID_HAS_PART_NO 0x08 #define RTAS_FRUID_HAS_CCIN 0x04 #define RTAS_FRUID_HAS_PROC_ID 0x02 #define RTAS_FRUID_HAS_SERIAL_NO 0x01 #define fruid_has_part_no(x) ((x)->fruhdr.flags & RTAS_FRUID_HAS_PART_NO) #define fruid_has_ccin(x) ((x)->fruhdr.flags & RTAS_FRUID_HAS_CCIN) #define fruid_has_proc_id(x) ((x)->fruhdr.flags & RTAS_FRUID_HAS_PROC_ID) #define fruid_has_serial_no(x) ((x)->fruhdr.flags & RTAS_FRUID_HAS_SERIAL_NO) char part_no[8]; char procedure_id[8]; char ccin[5]; char serial_no[13]; }; struct rtas_fru_id_scn_raw { struct rtas_fru_hdr_raw fruhdr; /* The following fields may not be present */ char part_no[8]; char procedure_id[8]; char ccin[5]; char serial_no[13]; }__attribute__((__packed__)); /** * @struct rtas_fru_pe_scn * @brief contents of the FRU Power Enclosure Substructure */ struct rtas_fru_pe_scn { struct rtas_fru_hdr fruhdr; struct rtas_mtms pce_mtms; char pce_name[32]; }; struct rtas_fru_pe_scn_raw { struct rtas_fru_hdr_raw fruhdr; struct rtas_mtms pce_mtms; char pce_name[32]; }__attribute__((__packed__)); /** * @struct fru_mru * @brief FRU MR Description structs */ struct fru_mru { char priority; uint32_t id; }; struct fru_mru_raw { uint32_t /* reserved */:24; char priority; uint32_t id; }; /** * @struct rtas_fru_mr_scn * @brief contents of the FRU Manufacturing Replacement Unit Substructure */ struct rtas_fru_mr_scn { struct rtas_fru_hdr fruhdr; #define frumr_num_callouts(x) ((x)->fruhdr.flags & 0x0F) uint32_t /* reserved */:32; struct fru_mru mrus[15]; }; struct rtas_fru_mr_scn_raw { struct rtas_fru_hdr_raw fruhdr; uint32_t /* reserved */:32; struct fru_mru_raw mrus[15]; }; /** * @struct rtas_v6_fru_scn * @brief RTAS version 6 FRU callout section */ struct rtas_fru_scn { uint32_t length; /**< call-out length */ uint32_t type; /**< callout type */ uint32_t fru_id_included; /**< fru id subsection included */ uint32_t fru_subscn_included; char priority; /**< fru priority */ #define RTAS_FRU_PRIORITY_HIGH 'H' #define RTAS_FRU_PRIORITY_MEDIUM 'M' #define RTAS_FRU_PRIORITY_MEDIUM_A 'A' #define RTAS_FRU_PRIORITY_MEDIUM_B 'B' #define RTAS_FRU_PRIORITY_MEDIUM_C 'C' #define RTAS_FRU_PRIORITY_LOW 'L' uint32_t loc_code_length; /**< location field length */ char loc_code[80]; /**< location code */ struct rtas_fru_scn *next; struct rtas_fru_hdr *subscns; }; struct rtas_fru_scn_raw { uint32_t length:8; uint32_t data1:8; char priority; uint32_t loc_code_length:8; char loc_code[80]; }; #define RE_FRU_SCN_SZ 4 /** * @struct rtas_v6_src_hdr * @brief RTAS version 6 SRC section */ struct rtas_src_scn { struct scn_header shdr; struct rtas_v6_hdr v6hdr; uint32_t version; /**< SRC version */ char src_platform_data[7]; /**< platform specific data */ #define src_subscns_included(src) ((src)->src_platform_data[0] & 0x01) uint32_t ext_refcode2; /**< extended reference code word 2 */ uint32_t ext_refcode3; /**< extended reference code word 3 */ uint32_t ext_refcode4; /**< extended reference code word 4 */ uint32_t ext_refcode5; /**< extended reference code word 5 */ uint32_t ext_refcode6; /**< extended reference code word 6 */ uint32_t ext_refcode7; /**< extended reference code word 7 */ uint32_t ext_refcode8; /**< extended reference code word 8 */ uint32_t ext_refcode9; /**< extended reference code word 9 */ char primary_refcode[36]; /**< primary reference code */ uint32_t subscn_id; /**< sub-section id (0xC0) */ uint32_t subscn_platform_data; /**< platform specific data */ uint32_t subscn_length; /**< sub-section length */ struct rtas_fru_scn *fru_scns; }; struct rtas_src_scn_raw { struct rtas_v6_hdr_raw v6hdr; uint32_t version:8; char src_platform_data[7]; uint32_t ext_refcode2:32; uint32_t ext_refcode3:32; uint32_t ext_refcode4:32; uint32_t ext_refcode5:32; uint32_t ext_refcode6:32; uint32_t ext_refcode7:32; uint32_t ext_refcode8:32; uint32_t ext_refcode9:32; char primary_refcode[36]; uint32_t subscn_id:8; uint32_t subscn_platform_data:8; uint32_t subscn_length:16; }; #define RE_SRC_SCN_SZ 80 #define RE_SRC_SUBSCN_SZ 4 /** * @struct rtas_v6_mt_scn * @brief RTAS version 6 Machine Type section */ struct rtas_mt_scn { struct scn_header shdr; struct rtas_v6_hdr_raw v6hdr; struct rtas_mtms mtms; }; /** * @struct rtas_v6_generic */ struct rtas_v6_generic { struct scn_header shdr; struct rtas_v6_hdr v6hdr; char *data; }; /** * @struct rtas_hotplug_scn * @brief RTAS version 6 Hotplug section */ struct rtas_hotplug_scn { struct scn_header shdr; struct rtas_v6_hdr v6hdr; uint32_t type:8; #define RTAS_HP_TYPE_CPU 1 #define RTAS_HP_TYPE_MEMORY 2 #define RTAS_HP_TYPE_SLOT 3 #define RTAS_HP_TYPE_PHB 4 #define RTAS_HP_TYPE_PCI 5 uint32_t action:8; #define RTAS_HP_ACTION_ADD 1 #define RTAS_HP_ACTION_REMOVE 2 uint32_t identifier:8; #define RTAS_HP_ID_DRC_NAME 1 #define RTAS_HP_ID_DRC_INDEX 2 #define RTAS_HP_ID_DRC_COUNT 3 uint32_t reserved:8; union { uint32_t drc_index:32; uint32_t count:32; char drc_name[1]; } u1; }; struct rtas_hotplug_scn_raw { struct rtas_v6_hdr_raw v6hdr; uint32_t type:8; uint32_t action:8; uint32_t identifier:8; uint32_t /* reserved */:8; union { uint32_t drc_index:32; uint32_t count:32; char drc_name[1]; } u1; }__attribute__((__packed__)); #define RE_HOTPLUG_SCN_SZ 16 #endif librtas-2.0.0/librtasevent_src/print_rtas_event.c000066400000000000000000000401071270107623400222600ustar00rootroot00000000000000/** * @file print_rtas_event.c * @brief generic routines to handle printing RTAS event sections * * Copyriht (C) 2005 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author Nathan Fontenot */ #include #include #include #include #include #include "librtasevent.h" #include "rtas_event.h" /** * rtas_print_width * @brief character width of the librtasevent output * * The default output of librtasevent is 80 characters wide. This can * be adjusted via the rtas_set_print_width() call. */ static int rtas_print_width = 80; /** * line_offset * @brief current character offset into the print line */ static int line_offset = 0; /** * ostream * @brief output stream for librtasevent printing */ static FILE *ostream; /** * re_print_fns * @brief arrary of function pointers for printing RTAS event sections * * NOTE: the index of these print functions corresponds to the * definitions for the rtas event sections from librtasevent.h. Changes * need to be made in both places to avoid breaking librtasevent. */ static int (*re_print_fns[])() = { NULL, print_re_hdr_scn, print_re_exthdr_scn, print_re_epow_scn, print_re_io_scn, print_re_cpu_scn, print_re_ibm_diag_scn, print_re_mem_scn, print_re_post_scn, print_re_ibmsp_scn, print_re_vend_errlog_scn, print_re_priv_hdr_scn, print_re_usr_hdr_scn, print_re_dump_scn, print_re_lri_scn, print_re_mt_scn, print_re_src_scn, print_re_src_scn, print_re_generic_scn, print_re_hotplug_scn }; /** * rtas_severity_names * @brief description of the RTAS severity levels */ static char *rtas_severity_names[] = { "No Error", "Event", "Warning", "Error Sync", "Error", "Fatal", "Already Reported", "(7)" }; /** * rtas_disposition_names * @brief description of the RTAS event disposition levels */ static char *rtas_disposition_names[] = { "Fully Recovered", "Limited Recovery", "Not Recoverd", "(4)" }; /** * rtas_entity_names * @brief description of the initiator and target names */ char *rtas_entity_names[] = { /* for initiator & targets */ "Unknown", "CPU", "PCI", "ISA", "Memory", "Power Management", "Hot Plug", "(7)", "(8)", "(9)", "(10)", "(11)", "(12)", "(13)", "(14)", "(15)" }; /** * rtas_error_type * @brief description of some of the RTAS error types * * Not all of the event types are covered in this array, please * bounds check before using. */ static char *rtas_event_error_type[] = { "Unknown", "Retry", "TCE Error", "Internal Device Failure", "Timeout", "Data Parity", "Address Parity", "Cache Parity", "Address Invalid", "ECC Uncorrected", "ECC Corrupted", }; /** * print_scn_title * @brief print the title of the RTAS event section * * @param fmt string format for section title * @param ... additional args a la printf() * @return number of characters printed */ int print_scn_title(char *fmt, ...) { va_list ap; int rspace; char buf[1024]; int i, len, offset; memset(buf, 0, sizeof(buf)); offset = snprintf(buf, sizeof(buf), "==== "); va_start(ap, fmt); offset += vsnprintf(buf + offset, sizeof(buf) - offset, fmt, ap); va_end(ap); offset += snprintf(buf + offset, sizeof(buf) - offset, " "); rspace = (rtas_print_width - (strlen(buf) + 2 + 9)); for (i = 0; i < rspace; i++) offset += snprintf(buf + offset, sizeof(buf) - offset, "="); offset += snprintf(buf + offset, sizeof(buf) - offset, "\n"); len = rtas_print(buf); return len; } /** * print_raw_data * @brief dump raw data * * @param data pointer to data to dump * @param data_len length of data to dump * @return number of bytes written */ int print_raw_data(char *data, int data_len) { unsigned char *h, *a; unsigned char *end = (unsigned char *)data + data_len; unsigned int offset = 0; int i,j; int len = 0; /* make sure we're starting on a new line */ if (line_offset != 0) len += rtas_print("\n"); h = a = (unsigned char *)data; while (h < end) { /* print offset */ len += fprintf(ostream, "0x%04x: ", offset); offset += 16; /* print hex */ for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { if (h < end) len += fprintf(ostream, "%02x", *h++); else len += fprintf(ostream, " "); } len += fprintf(ostream, " "); } /* print ascii */ len += fprintf(ostream, " ["); for (i = 0; i < 16; i++) { if (a <= end) { if ((*a >= ' ') && (*a <= '~')) len += fprintf(ostream, "%c", *a); else len += fprintf(ostream, "."); a++; } else len += fprintf(ostream, " "); } len += fprintf(ostream, "]\n"); } return len; } /** * rtas_print_raw_event * @brief Dump the entire rtas event in raw format * * @param stream ouput stream to write to * @param re rtas_event pointer * @return number of bytes written */ int rtas_print_raw_event(FILE *stream, struct rtas_event *re) { int len = 0; ostream = stream; len += print_scn_title("Raw RTAS Event Begin"); len += print_raw_data(re->buffer, re->event_length); len += print_scn_title("Raw RTAS Event End"); return len; } /** * rtas_error_type * @brief print a description of the RTAS error type * * @param type RTAS event type * @return pointer to description of RTAS type * @return NULL on unrecognized event type */ static char * rtas_error_type(int type) { if (type < 11) return rtas_event_error_type[type]; switch (type) { case 64: return "EPOW"; case 160: return "Platform Resource Reassignment"; case 224: return "Platform Error"; case 225: return "I/O Event"; case 226: return "Platform Information Event"; case 227: return "Resource Deallocation Event"; case 228: return "Dump Notification Event"; case 229: return "Hotplug Event"; } return rtas_event_error_type[0]; } /** * rtas_set_print_width * @brief set the output character width for librtasevent * * @param width character width of output * @return 0 on success, !0 on failure */ int rtas_set_print_width(int width) { if ((width > 0) && (width < 1024)) { rtas_print_width = width; return 0; } return 1; } /** * rtas_print * @brief routine to handle all librtas printing * * @param fmt string format a la printf() * @param ... additional args a la printf() * @return number of bytes written */ int rtas_print(char *fmt, ...) { va_list ap; char buf[1024]; char tmpbuf[1024]; int i; int buf_offset = 0, offset = 0; int tmpbuf_len; int width = 0; int prnt_len; char *newline = NULL; char *brkpt = NULL; memset(tmpbuf, 0, sizeof(tmpbuf)); memset(buf, 0, sizeof(buf)); va_start(ap, fmt); tmpbuf_len = vsnprintf(tmpbuf, sizeof(tmpbuf), fmt, ap); va_end(ap); i = 0; while (i < tmpbuf_len) { brkpt = NULL; newline = NULL; for (i = offset, width = line_offset; (width < rtas_print_width) && (i < tmpbuf_len); i++) { switch(tmpbuf[i]) { case ' ': case '-': width++; brkpt = &tmpbuf[i]; break; case '\n': newline = &tmpbuf[i]; width++; break; default: width++; break; } if (newline != NULL) { prnt_len = newline - &tmpbuf[offset] + 1; snprintf(buf + buf_offset, prnt_len, "%s",&tmpbuf[offset]); buf_offset = strlen(buf); buf_offset += snprintf(buf + buf_offset, sizeof(buf) - buf_offset, "\n"); offset += prnt_len; line_offset = 0; break; } } if (width >= rtas_print_width) { if (brkpt == NULL) { /* this won't fit on one line, break it across lines */ prnt_len = width - line_offset + 1; } else { prnt_len = (brkpt - &tmpbuf[offset]) + 1; } /* print up to the last brkpt */ snprintf(buf + buf_offset, prnt_len, "%s", &tmpbuf[offset]); buf_offset = strlen(buf); buf_offset += snprintf(buf + buf_offset, sizeof(buf) - buf_offset, "\n"); offset += prnt_len; line_offset = 0; } } prnt_len = snprintf(buf + buf_offset, sizeof(buf) - buf_offset, "%s", &tmpbuf[offset]); line_offset += prnt_len; return fprintf(ostream, "%s", buf); } /** * rtas_print_scn * @brief print the contents of the specified rtas event section * * @param stream output stream to write to * @param res rtas_event_scn pointer to print * @param verbosity verbose level for output * @return number of bytes written */ int rtas_print_scn(FILE *stream, struct scn_header *shdr, int verbosity) { int len; if ((stream == NULL) || (shdr == NULL)) { errno = EFAULT; return 0; } ostream = stream; /* validate the section id */ if (shdr->scn_id < 0) { errno = EFAULT; return 0; } len = re_print_fns[shdr->scn_id](shdr, verbosity); fflush(stream); return len; } /** * rtas_print_event * @brief print the contents of an entire rtas event * * @param stream output stream to print to * @param re rtas_event pointer to print out * @param verbosity verbose level of output * @return number of bytes written */ int rtas_print_event(FILE *stream, struct rtas_event *re, int verbosity) { struct scn_header *shdr; int len = 0; if ((stream == NULL) || (re == NULL)) { errno = EFAULT; return 0; } ostream = stream; if (re->event_no != -1) len += print_scn_title("RTAS Event Dump (%d) Begin", re->event_no); else len += print_scn_title("RTAS Event Dump Begin"); for (shdr = re->event_scns; shdr != NULL; shdr = shdr->next) len += rtas_print_scn(stream, shdr, verbosity); if (re->event_no != -1) len += print_scn_title("RTAS Event Dump (%d) End", re->event_no); else len += print_scn_title("RTAS Event Dump End"); return len; } /** * rtas_get_event_hdr_scn * @brief Retrieve the Main RTAS event header * * @param re rtas_event pointer * @return pointer to rtas_event_scn for main rtas event header */ struct rtas_event_hdr * rtas_get_event_hdr_scn(struct rtas_event *re) { return (struct rtas_event_hdr *)get_re_scn(re, RTAS_EVENT_HDR); } /** * print_re_hdr_scn * @brief Print the contents of an RTAS main event header * * @param res rtas_event_scn pointer for main RTAS event header * @param verbosity verbose level for output * @return number of bytes written */ int print_re_hdr_scn(struct scn_header *shdr, int verbosity) { struct rtas_event_hdr *re_hdr; int len = 0; if (shdr->scn_id != RTAS_EVENT_HDR) { errno = EFAULT; return 0; } re_hdr = (struct rtas_event_hdr *)shdr; len += rtas_print(PRNT_FMT" ", "Version:", re_hdr->version); len += rtas_print(PRNT_FMT" (%s)\n", "Severity:", re_hdr->severity, rtas_severity_names[re_hdr->severity]); if (re_hdr->disposition || (verbosity >= 2)) { len += rtas_print(PRNT_FMT" (%s)\n", "Disposition:", re_hdr->disposition, rtas_disposition_names[re_hdr->disposition]); } if (verbosity >= 2) { len += rtas_print(PRNT_FMT" ", "Extended:", re_hdr->extended); len += rtas_print(PRNT_FMT"\n", "Log Length:", re_hdr->ext_log_length); } if (re_hdr->initiator || verbosity >=2) { len += rtas_print(PRNT_FMT" (%s)\n", "Initiator", re_hdr->initiator, rtas_entity_names[re_hdr->initiator]); } if (re_hdr->target || (verbosity >= 2)) { len += rtas_print(PRNT_FMT" (%s)\n", "Target", re_hdr->target, rtas_entity_names[re_hdr->target]); } len += rtas_print(PRNT_FMT" (%s)\n", "Type", re_hdr->type, rtas_error_type(re_hdr->type)); return len; } /** * rtas_get_event_exthdr_scn * @brief Retrieve the RTAS Event extended header * * @param re rtas_event pointer * @return rtas_event_scn pointer for RTAS extended header section */ struct rtas_event_exthdr * rtas_get_event_exthdr_scn(struct rtas_event *re) { return (struct rtas_event_exthdr *)get_re_scn(re, RTAS_EVENT_EXT_HDR); } /** * print_re_exthdr_scn * @brief print the contents of the RTAS extended header section * * @param res rtas_event_scn pointer for the extended header * @param verbosity verbose level of output * @return number of bytes written */ int print_re_exthdr_scn(struct scn_header *shdr, int verbosity) { struct rtas_event_exthdr *rex_hdr; int len = 0; int version; if (shdr->scn_id != RTAS_EVENT_EXT_HDR) { errno = EFAULT; return 0; } rex_hdr = (struct rtas_event_exthdr *)shdr; version = shdr->re->version; if (!rex_hdr->valid) { if (rex_hdr->bigendian && rex_hdr->power_pc) len += rtas_print("Extended log data is not valid.\n\n"); else len += rtas_print("Extended log data can not be decoded.\n\n"); return len; } /* Dump useful stuff in the rex_hdr */ len += rtas_print("%-19s%s%s%s%s%s\n", "Status:", rex_hdr->unrecoverable ? " unrecoverable" : "", rex_hdr->recoverable ? " recoverable" : "", rex_hdr->unrecoverable_bypassed ? " bypassed" : "", rex_hdr->predictive ? " predictive" : "", rex_hdr->newlog ? " new" : ""); if (version < 6) { if (version >= 3) { if (rex_hdr->non_hardware) len += rtas_print("Error may be caused by defects in " "software or firmware.\n"); if (rex_hdr->hot_plug) len += rtas_print("Error is isolated to hot-pluggable unit.\n"); if (rex_hdr->group_failure) len += rtas_print("Error is isolated to a group of failing " "units.\n"); } if (rex_hdr->residual) len += rtas_print("Residual error from previous boot.\n"); if (rex_hdr->boot) len += rtas_print("Error detected during IPL process.\n"); if (rex_hdr->config_change) len += rtas_print("Configuration changed since last boot.\n"); if (rex_hdr->post) len += rtas_print("Error detected prior to IPL.\n"); len += rtas_print("%-20s%x/%x/%x %-20s%x:%x:%x:%x\n\n", "Date:", rex_hdr->date.year, rex_hdr->date.month, rex_hdr->date.day, "Time:", rex_hdr->time.hour, rex_hdr->time.minutes, rex_hdr->time.seconds, rex_hdr->time.hundredths); } else { rtas_print("\n"); } return len; } librtas-2.0.0/librtasevent_src/rtas_cpu.c000066400000000000000000000066311270107623400205160ustar00rootroot00000000000000/** * @file rtas_cpu.c * @brief RTAS error log detail for CPU-detected failures * * This provides the definition of RTAS CPU-detected error log * format and a print routine to dump the contents of a * cpu-detected error log. * * Copyright (C) 2005 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author Nathan Fontenot */ #include #include #include #include #include "librtasevent.h" #include "rtas_event.h" /** * parse_cpu_scn * */ int parse_cpu_scn(struct rtas_event *re) { struct rtas_cpu_scn *cpu_scn; cpu_scn = malloc(sizeof(*cpu_scn)); if (cpu_scn == NULL) { errno = ENOMEM; return -1; } cpu_scn->shdr.raw_offset = re->offset; rtas_copy(RE_SHDR_OFFSET(cpu_scn), re, RE_V4_SCN_SZ); add_re_scn(re, cpu_scn, RTAS_CPU_SCN); return 0; } /** * rtas_get_cpu_scn * @brief Retrieve the CPU section of the RTAS Event * * @param re rtas_event pointer * @return rtas_event_scn pointer for cpu section */ struct rtas_cpu_scn * rtas_get_cpu_scn(struct rtas_event *re) { return (struct rtas_cpu_scn *)get_re_scn(re, RTAS_CPU_SCN); } /** * print_cpu_failure * @brief Print the contents of a cpu section * * @param res rtas_event_scn pointer to cpu section * @param verbosity verbose level of output * @return number of bytes written */ int print_re_cpu_scn(struct scn_header *shdr, int verbosity) { struct rtas_cpu_scn *cpu; int len = 0; if (shdr->scn_id != RTAS_CPU_SCN) { errno = EFAULT; return 0; } cpu = (struct rtas_cpu_scn *)shdr; len += print_scn_title("CPU Section"); if (cpu->internal) len += rtas_print("Internal error (not cache).\n"); if (cpu->intcache) len += rtas_print("Internal cache.\n"); if (cpu->extcache_parity) len += rtas_print("External cache parity (or multi-bit).\n"); if (cpu->extcache_ecc) len += rtas_print("External cache ECC.\n"); if (cpu->sysbus_timeout) len += rtas_print("System bus timeout.\n"); if (cpu->io_timeout) len += rtas_print("I/O timeout.\n"); if (cpu->sysbus_parity) len += rtas_print("System bus parity.\n"); if (cpu->sysbus_protocol) len += rtas_print("System bus protocol/transfer.\n"); len += rtas_print(PRNT_FMT_2, "CPU id:", cpu->id, "Failing Element:", cpu->element); len += rtas_print(PRNT_FMT_ADDR, "Failing address:", cpu->failing_address_hi, cpu->failing_address_lo); if ((shdr->re->version >= 4) && (cpu->try_reboot)) len += rtas_print("A reboot of the system may correct the problem.\n"); len += rtas_print("\n"); return len; } librtas-2.0.0/librtasevent_src/rtas_dump.c000066400000000000000000000103711270107623400206700ustar00rootroot00000000000000/** * @file rtas_dump.c * @brief RTAS version 6 Dump Locator section routines * * Copyright (C) 2005 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author Nathan Fontenot */ #include #include #include #include #include "librtasevent.h" #include "rtas_event.h" /** * parse_rtas_dump_scn * */ int parse_dump_scn(struct rtas_event *re) { struct rtas_dump_scn *dump; struct rtas_dump_scn_raw *rawhdr; dump = malloc(sizeof(*dump)); if (dump == NULL) { errno = ENOMEM; return -1; } dump->shdr.raw_offset = re->offset; rawhdr = (struct rtas_dump_scn_raw *)(re->buffer + re->offset); parse_v6_hdr(&dump->v6hdr, &rawhdr->v6hdr); dump->id = be32toh(rawhdr->id); dump->location = (rawhdr->data1 & 0x80) >> 7; dump->fname_type = (rawhdr->data1 & 0x40) >> 6; dump->size_valid = (rawhdr->data1 & 0x20) >> 5; dump->id_len = rawhdr->id_len; dump->size_hi = be32toh(rawhdr->size_hi); dump->size_lo = be32toh(rawhdr->size_lo); memcpy(dump->os_id, rawhdr->os_id, 40); re->offset += RE_V6_DUMP_SCN_SZ; add_re_scn(re, dump, RTAS_DUMP_SCN); return 0; } /** * rtas_get_dump_scn * @brief Retrieve the Dump Locator section of the RTAS Event * * @param re rtas_event pointer * @return rtas_event_scn pointer to dump locator section */ struct rtas_dump_scn * rtas_get_dump_scn(struct rtas_event *re) { return (struct rtas_dump_scn *)get_re_scn(re, RTAS_DUMP_SCN); } /** * update_os_dump_id * */ int update_os_id_scn(struct rtas_event *re, const char *id) { struct rtas_dump_scn *dump_scn; struct rtas_dump_scn *raw_scn; int len; dump_scn = rtas_get_dump_scn(re); if (dump_scn == NULL) return -1; len = strlen(id); if (len > 40) return -1; /* Now we know it exist, get a pointer to the dump section * in the raw event. */ raw_scn = (struct rtas_dump_scn *)(re->buffer + dump_scn->shdr.raw_offset - RE_SHDR_SZ); memcpy(raw_scn->os_id, id, len); if ((len % 4) > 0) len += (4 - (len % 4)); raw_scn->id_len = len; return 0; } /** * print_v6_dump_scn * @brief Print the contents of a version 6 dump locator section * * @param res rtas_event_scn pointer for dump locator section * @param verbosity verbose level of output * @return number of bytes written */ int print_re_dump_scn(struct scn_header *shdr, int verbosity) { struct rtas_dump_scn *dump; int len = 0; if (shdr->scn_id != RTAS_DUMP_SCN) { errno = EFAULT; return 0; } dump = (struct rtas_dump_scn *)shdr; len += print_v6_hdr("Dump Locator section", &dump->v6hdr, verbosity); len += rtas_print(PRNT_FMT_L, "Dump ID:", dump->id); len += rtas_print("%-20s%8s\n", "Dump Field Format:", (dump->fname_type ? "hex" : "ascii")); len += rtas_print("%-20s%s\n", "Dump Location:", (dump->location ? "HMC" : "Partition")); len += rtas_print(PRNT_FMT_ADDR, "Dump Size:", dump->size_hi, dump->size_lo); if (verbosity >= 2) { len += rtas_print("%-20s%8s ", "Dump Size Valid:", (dump->size_valid ? "Yes" : "No")); len += rtas_print(PRNT_FMT_R, "Dump ID Length:", dump->id_len); if (dump->id_len) { len += rtas_print("Dump ID:"); if (dump->fname_type) len += print_raw_data(dump->os_id, dump->id_len); else len += rtas_print("%s\n", dump->os_id); } } len += rtas_print("\n"); return len; } librtas-2.0.0/librtasevent_src/rtas_epow.c000066400000000000000000000150401270107623400206730ustar00rootroot00000000000000/** * @file rtas_epow.c * @brief RTAS event EPOW section routines * * Copyright (C) 2005 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author Nathan Fontenot * @author Jake Moilanen */ #include #include #include #include #include "librtasevent.h" #include "rtas_event.h" /** * parse_epow_scn * */ int parse_epow_scn(struct rtas_event *re) { struct rtas_epow_scn *epow; struct rtas_v6_epow_scn_raw *rawhdr; epow = malloc(sizeof(*epow)); if (epow == NULL) { errno = ENOMEM; return -1; } memset(epow, 0, sizeof(*epow)); epow->shdr.raw_offset = re->offset; if (re->version < 6) { rtas_copy(RE_SHDR_OFFSET(epow), re, RE_V4_SCN_SZ); } else { rawhdr = (struct rtas_v6_epow_scn_raw *)(re->buffer + re->offset); parse_v6_hdr(&epow->v6hdr, &rawhdr->v6hdr); epow->sensor_value = (rawhdr->data1 & 0xF0) >> 4; epow->action_code = rawhdr->data1 & 0x0F; epow->event_modifier = rawhdr->event_modifier; memcpy(epow->reason_code, rawhdr->reason_code, 8); re->offset += RE_EPOW_V6_SCN_SZ; } add_re_scn(re, epow, RTAS_EPOW_SCN); return 0; } /** * rtas_get_epow_scn * @brief Retrieve the Environmental and Power Warning (EPOW) section * * @param re rtas_event pointer * @return rtas_event_scn pointer for the epow section */ struct rtas_epow_scn * rtas_get_epow_scn(struct rtas_event *re) { return (struct rtas_epow_scn *)get_re_scn(re, RTAS_EPOW_SCN); } /** * print_v4_epow * @brief print the contents of a pre-version 6 EPOW section * * @param res rtas_event_scn pointer for epow section * @param verbosity verbose level of output * @return number of bytes written */ static int print_v4_epow(struct scn_header *shdr, int verbosity) { struct rtas_epow_scn *epow = (struct rtas_epow_scn *)shdr; int version = shdr->re->version; int len = 0; len += print_scn_title("EPOW Warning"); len += rtas_print(PRNT_FMT_R, "EPOW Sensor Value:", epow->sensor_value); if (version >= 3) { if (epow->sensor) { len += rtas_print("EPOW detected by a sensor\n"); len += rtas_print(PRNT_FMT_2, "Sensor Token:", epow->sensor_token, "Sensor Index:", epow->sensor_index); len += rtas_print(PRNT_FMT_2, "Sensor Value:", epow->sensor_value, "Sensor Status:", epow->sensor_status); } if (epow->power_fault) len += rtas_print("EPOW caused by a power fault.\n"); if (epow->fan) len += rtas_print("EPOW caused by fan failure.\n"); if (epow->temp) len += rtas_print("EPOW caused by over-temperature condition.\n"); if (epow->redundancy) len += rtas_print("EPOW warning due to loss of redundancy.\n"); if (epow->CUoD) len += rtas_print("EPOW warning due to CUoD Entitlement " "Exceeded.\n"); if (epow->general) len += rtas_print("EPOW general power fault.\n"); if (epow->power_loss) len += rtas_print("EPOW power fault due to loss of power " "source.\n"); if (epow->power_supply) len += rtas_print("EPOW power fault due to internal power " "supply failure.\n"); if (epow->power_switch) len += rtas_print("EPOW power fault due to activation of " "power switch.\n"); } if ((version == 4) && (epow->battery)) len += rtas_print("EPOW power fault due to internal battery " "failure.\n"); len += rtas_print("\n"); return len; } /** * print_v6_epow * @brief print the contents of a RTAS version 6 EPOW section * * @param res rtas_event_scn pointer for epow section * @param verbosity verbose level of output * @return number of bytes written */ static int print_v6_epow(struct scn_header *shdr, int verbosity) { struct rtas_epow_scn *epow = (struct rtas_epow_scn *)shdr; int len = 0; len += print_v6_hdr("EPOW Warning", &epow->v6hdr, verbosity); len += rtas_print(PRNT_FMT_2, "Sensor Value:", epow->sensor_value, "Action Code:", epow->action_code); len += rtas_print(PRNT_FMT_R, "EPOW Event:", epow->event_modifier); switch (epow->event_modifier) { case RTAS_EPOW_MOD_NA: break; case RTAS_EPOW_MOD_NORMAL_SHUTDOWN: len += rtas_print(" - Normal System Shutdown with no " "additional delay.\n"); break; case RTAS_EPOW_MOD_UTILITY_POWER_LOSS: len += rtas_print(" - Loss of utility power, system is " "running on UPS/battery.\n"); break; case RTAS_EPOW_MOD_CRIT_FUNC_LOSS: len += rtas_print(" - Loss of system critical functions, " "system should be shutdown.\n"); break; case RTAS_EPOW_MOD_AMBIENT_TEMP: len += rtas_print(" - Ambient temperature too high, " "system should be shutdown.\n"); break; default: len += rtas_print(" - Unknown action code.\n"); } len += rtas_print("Platform specific reason code:"); len += print_raw_data(epow->reason_code, 8); len += rtas_print("\n"); return len; } /** * print_re_epow_scn * @brief print the contents of a RTAS EPOW section * * @param res rtas_event_scn pointer to epow section * @param verbosity verbose level of output * @return number of bytes written */ int print_re_epow_scn(struct scn_header *shdr, int verbosity) { if (shdr->scn_id != RTAS_EPOW_SCN) { errno = EFAULT; return 0; } if (shdr->re->version == 6) return print_v6_epow(shdr, verbosity); else return print_v4_epow(shdr, verbosity); } librtas-2.0.0/librtasevent_src/rtas_event.h000066400000000000000000000065001270107623400210500ustar00rootroot00000000000000/** * @file rtas_event.h * * Copyright (C) 2005 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author Nathan Fontenot */ #ifndef _H_RTAS_EVENT #define _H_RTAS_EVENT #define PRNT_FMT "%-20s%08x" #define PRNT_FMT_L PRNT_FMT" " #define PRNT_FMT_R PRNT_FMT"\n" #define PRNT_FMT_2 PRNT_FMT_L PRNT_FMT_R #define PRNT_FMT_ADDR "%-20s%08x%08x\n" void rtas_copy(void *, struct rtas_event *, uint32_t); /* parse routines */ void parse_rtas_date(struct rtas_date *, struct rtas_date_raw *); void parse_rtas_time(struct rtas_time *, struct rtas_time_raw *); void parse_v6_hdr(struct rtas_v6_hdr *, struct rtas_v6_hdr_raw *); int parse_priv_hdr_scn(struct rtas_event *); int parse_usr_hdr_scn(struct rtas_event *); int parse_epow_scn(struct rtas_event *); int parse_io_scn(struct rtas_event *); int parse_dump_scn(struct rtas_event *); int parse_lri_scn(struct rtas_event *); int parse_mt_scn(struct rtas_event *); int parse_src_scn(struct rtas_event *); int parse_cpu_scn(struct rtas_event *); int parse_ibm_diag_scn(struct rtas_event *); int parse_mem_scn(struct rtas_event *); int parse_post_scn(struct rtas_event *); int parse_sp_scn(struct rtas_event *); int parse_vend_errlog_scn(struct rtas_event *); int parse_generic_v6_scn(struct rtas_event *); void parse_mtms(struct rtas_event *, struct rtas_mtms *); int parse_hotplug_scn(struct rtas_event *); /* print routines */ int print_re_hdr_scn(struct scn_header *, int); int print_re_exthdr_scn(struct scn_header *, int); int print_re_epow_scn(struct scn_header *, int); int print_re_io_scn(struct scn_header *, int); int print_re_cpu_scn(struct scn_header *, int); int print_re_ibm_diag_scn(struct scn_header *, int); int print_re_mem_scn(struct scn_header *, int); int print_re_post_scn(struct scn_header *, int); int print_re_ibmsp_scn(struct scn_header *, int); int print_re_vend_errlog_scn(struct scn_header *, int); int print_re_priv_hdr_scn(struct scn_header *, int); int print_re_usr_hdr_scn(struct scn_header *, int); int print_re_dump_scn(struct scn_header *, int); int print_re_lri_scn(struct scn_header *, int); int print_re_mt_scn(struct scn_header *, int); int print_re_src_scn(struct scn_header *, int); int print_re_generic_scn(struct scn_header *, int); int print_re_hotplug_scn(struct scn_header *, int); int print_mtms(struct rtas_mtms *); int print_scn_title(char *, ...); int print_v6_hdr(char *, struct rtas_v6_hdr *, int); int print_raw_data(char *, int); int rtas_print(char *fmt, ...); struct scn_header * get_re_scn(struct rtas_event *, int); void add_re_scn(struct rtas_event *, void *, int); int re_scn_id(struct rtas_v6_hdr_raw *); #endif librtas-2.0.0/librtasevent_src/rtas_hotplug.c000066400000000000000000000075001270107623400214050ustar00rootroot00000000000000/** * @file rtas_hotplug.c * @brief RTAS version 6 Hotplug section routines * * Copyright (C) 2013 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author Tyrel Datwyler */ #include #include #include #include #include "librtasevent.h" #include "rtas_event.h" /** * parse_hotplug_scn * */ int parse_hotplug_scn(struct rtas_event *re) { struct rtas_hotplug_scn *hotplug; struct rtas_hotplug_scn_raw *rawhdr; hotplug = malloc(sizeof(*hotplug)); if (hotplug == NULL) { errno = ENOMEM; return -1; } hotplug->shdr.raw_offset = re->offset; rawhdr = (struct rtas_hotplug_scn_raw *)(re->buffer + re->offset); parse_v6_hdr(&hotplug->v6hdr, &rawhdr->v6hdr); hotplug->type = rawhdr->type; hotplug->action = rawhdr->action; hotplug->identifier = rawhdr->identifier; switch (hotplug->identifier) { case RTAS_HP_ID_DRC_NAME: /* Need to Fix up */ break; case RTAS_HP_ID_DRC_INDEX: hotplug->u1.drc_index = be32toh(rawhdr->u1.drc_index); break; case RTAS_HP_ID_DRC_COUNT: hotplug->u1.count = be32toh(rawhdr->u1.count); break; } /* TODO: Fixup scn size when drc_name is included */ re->offset += RE_HOTPLUG_SCN_SZ; add_re_scn(re, hotplug, RTAS_HP_SCN); return 0; } /** * rtas_get_hotplug_scn * @brief Retrieve the Hotplug section of the RTAS Event * * @param re rtas_event pointer * @return rtas_event_scn pointer to Hotplug section */ struct rtas_hotplug_scn * rtas_get_hotplug_scn(struct rtas_event *re) { return (struct rtas_hotplug_scn *)get_re_scn(re, RTAS_HP_SCN); } static char *hotplug_types[] = {"", "CPU", "Memory", "Slot", "PHB", "PCI"}; static char *hotplug_actions[] = {"", "Add", "Remove"}; static char *hotplug_ids[] = {"", "DRC Name", "DRC Index", "Count"}; /** * print_re_hotplug_scn * @brief Print the contents of a version 6 Hotplug section * * @param res rtas_event_scn pointer for Hotplug section * @param verbosity verbose level of output * @return number of bytes written */ int print_re_hotplug_scn(struct scn_header *shdr, int verbosity) { struct rtas_hotplug_scn *hotplug; int len = 0; if (shdr->scn_id != RTAS_HP_SCN) { errno = EFAULT; return 0; } hotplug = (struct rtas_hotplug_scn *)shdr; len += print_v6_hdr("Hotplug section", &hotplug->v6hdr, verbosity); len += rtas_print(PRNT_FMT" (%s)\n", "Hotplug Type:", hotplug->type, hotplug_types[hotplug->type]); len += rtas_print(PRNT_FMT" (%s)\n", "Hotplug Action:", hotplug->action, hotplug_actions[hotplug->action]); len += rtas_print(PRNT_FMT" (%s)\n", "Hotplug Identifier:", hotplug->identifier, hotplug_ids[hotplug->identifier]); if (hotplug->identifier == RTAS_HP_ID_DRC_NAME) { len += rtas_print("%-20s%s", "Hotplug drc_name:", hotplug->u1.drc_name); } else if (hotplug->identifier == RTAS_HP_ID_DRC_INDEX) { len += rtas_print(PRNT_FMT_R, "Hotplug drc_index:", hotplug->u1.drc_index); } else { len += rtas_print(PRNT_FMT_R, "Hotplug count:", hotplug->u1.count); } len += rtas_print("\n"); return len; } librtas-2.0.0/librtasevent_src/rtas_io.c000066400000000000000000000204441270107623400203340ustar00rootroot00000000000000/** * @file rtas_io.c * @brief RTAS I/O event section routines * * Copyright (C) 2005 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author Nathan Fontenot * @author Jake Moilanen */ #include #include #include #include #include "librtasevent.h" #include "rtas_event.h" /** * parse_io_scn * */ int parse_io_scn(struct rtas_event *re) { struct rtas_io_scn *io; io = malloc(sizeof(*io)); if (io == NULL) { errno = ENOMEM; return -1; } memset(io, 0, sizeof(*io)); io->shdr.raw_offset = re->offset; if (re->version < 6) { rtas_copy(RE_SHDR_OFFSET(io), re, RE_V4_SCN_SZ); } else { struct rtas_v6_io_scn_raw *rawhdr; rawhdr = (struct rtas_v6_io_scn_raw *)(re->buffer + re->offset); parse_v6_hdr(&io->v6hdr, &rawhdr->v6hdr); io->event_type = rawhdr->event_type; io->rpc_length = rawhdr->rpc_length; io->scope = rawhdr->scope; io->subtype = rawhdr->subtype; io->drc_index = be32toh(rawhdr->drc_index); memcpy(io->rpc_data, rawhdr->rpc_data, 216); re->offset += io->v6hdr.length; } add_re_scn(re, io, RTAS_IO_SCN); return 0; } /** * rtas_get_io_scn * @brief Retrieve the I/O section of the RTAS Event * * @param re rtas_event pointer * @return rtas_event_scn pointer for i/o section */ struct rtas_io_scn * rtas_get_io_scn(struct rtas_event *re) { return (struct rtas_io_scn *)get_re_scn(re, RTAS_IO_SCN); } /** * print_v4_io * @brief print the contents of a RTAS pre-version 6 I/O section * * @param res rtas_event_scn pointer to i/o section * @param verbosity verbose level of output * @return number of bytes written */ static int print_v4_io(struct scn_header *shdr, int verbosity) { struct rtas_io_scn *io = (struct rtas_io_scn *)shdr; int len = 0; len += print_scn_title("I/O Event Section"); if (io->bus_addr_parity) len += rtas_print("I/O bus address parity.\n"); if (io->bus_data_parity) len += rtas_print("I/O bus data parity.\n"); if (io->bus_timeout) len += rtas_print("I/O bus timeout, access or other.\n"); if (io->bridge_internal) len += rtas_print("I/O bus bridge/device internal.\n"); if (io->non_pci) len += rtas_print("Signaling IOA is a PCI to non-PCI bridge " "(e.g. ISA).\n"); if (io->mezzanine_addr_parity) len += rtas_print("Mezzanine/System bus address parity.\n"); if (io->mezzanine_data_parity) len += rtas_print("Mezzanine/System bus data parity.\n"); if (io->mezzanine_timeout) len += rtas_print("Mezzanine/System bus timeout, transfer " "or protocol.\n"); if (io->bridge_via_sysbus) len += rtas_print("Bridge is connected to system bus.\n"); if (io->bridge_via_mezzanine) len += rtas_print("Bridge is connected to memory controller " "via mezzanine bus.\n"); if (shdr->re->version >= 3) { if (io->bridge_via_expbus) len += rtas_print("Bridge is connected to I/O expansion bus.\n"); if (io->detected_by_expbus) len += rtas_print("Error on system bus detected by I/O " "expansion bus controller.\n"); if (io->expbus_data_parity) len += rtas_print("I/O expansion bus data error.\n"); if (io->expbus_timeout) len += rtas_print("I/O expansion bus timeout, access or other.\n"); if (io->expbus_connection_failure) len += rtas_print("I/O expansion bus connection failure.\n"); if (io->expbus_not_operating) len += rtas_print("I/O expansion unit not in an operating " "state (powered off, off-line).\n"); } len += rtas_print("IOA Signaling the error: %x:%x.%x\n vendor: %04x " "device: %04x rev: %02x slot: %x\n", io->pci_sig_busno, io->pci_sig_devfn >> 3, io->pci_sig_devfn & 0x7, io->pci_sig_vendorid, io->pci_sig_deviceid, io->pci_sig_revisionid, io->pci_sig_slot); len += rtas_print("IOA Sending during the error: %x:%x.%x\n" " vendor: %04x device: %04x rev: %02x slot: %x\n", io->pci_send_busno, io->pci_send_devfn >> 3, io->pci_send_devfn & 0x7, io->pci_send_vendorid, io->pci_send_deviceid, io->pci_send_revisionid, io->pci_send_slot); len += rtas_print("\n"); return len; } /** * print_v6_io * @brief print the contents of a version 6 RTAS I/O section * * @param res rtas_event_scn pointer to i/o section * @param verbosity verbose level of output * @return number of bytes written */ static int print_v6_io(struct scn_header *shdr, int verbosity) { struct rtas_io_scn *io = (struct rtas_io_scn *)shdr; int len = 0; int has_rpc_data = 0; len += print_v6_hdr("I/O Event Section", &io->v6hdr, verbosity); len += rtas_print(PRNT_FMT_L, "Event Type:", io->event_type); switch (io->event_type) { case 0x01: len += rtas_print(" - Error Detected.\n"); break; case 0x02: len += rtas_print(" - Error Recovered.\n"); break; case 0x03: len += rtas_print(" - Event (%x).\n", io->event_type); break; case 0x04: len += rtas_print(" - RPC Pass Through (%x).\n", io->event_type); has_rpc_data = 1; break; default: len += rtas_print(" - Unknown event type (%x).\n", io->event_type); break; } len += rtas_print(PRNT_FMT_L, "Error/Event Scope:", io->scope); switch (io->scope) { case 0x00: len += rtas_print(" - N/A.\n"); break; case 0x36: len += rtas_print(" - RIO-hub.\n"); break; case 0x37: len += rtas_print(" - RIO-bridge.\n"); break; case 0x38: len += rtas_print(" - PHB.\n"); break; case 0x39: len += rtas_print(" - EADS Global.\n"); break; case 0x3A: len += rtas_print(" - EADS Slot.\n"); break; default: len += rtas_print(" - Unknown error/event scope.\n"); break; } len += rtas_print(PRNT_FMT_L, "I/O Event Subtype:", io->subtype); switch (io->subtype) { case 0x00: len += rtas_print(" - N/A.\n"); break; case 0x01: len += rtas_print(" - Rebalance Request.\n"); break; case 0x03: len += rtas_print(" - Node online.\n"); break; case 0x04: len += rtas_print(" - Node off-line.\n"); break; case 0x05: len += rtas_print(" - Platform Dump maximum size change.\n"); break; default: len += rtas_print(" - Unknown subtype.\n"); break; } len += rtas_print(PRNT_FMT_L, "DRC Index:", io->drc_index); if (has_rpc_data) { len += rtas_print(PRNT_FMT_R, "RPC Field Length:", io->rpc_length); if (io->rpc_length != 0) len += print_raw_data(io->rpc_data, io->rpc_length); } else { len += rtas_print("\n"); } return len; } /** * print_re_io_scn * @brief print the contents of a RTAS event i/o section * * @param res rtas_event_scn pointer for i/o section * @param verbosity verbose level of output * @return number of bytes written */ int print_re_io_scn(struct scn_header *shdr, int verbosity) { if (shdr->scn_id != RTAS_IO_SCN) { errno = EFAULT; return 0; } if (shdr->re->version == 6) return print_v6_io(shdr, verbosity); else return print_v4_io(shdr, verbosity); } librtas-2.0.0/librtasevent_src/rtas_lri.c000066400000000000000000000067451270107623400205230ustar00rootroot00000000000000/** * @file rtas_lri.c * @brief RTAS Logical Resource Identification (LRI) Data routines * * Copyright (C) 2005 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author Nathan Fontenot */ #include #include #include #include #include "librtasevent.h" #include "rtas_event.h" /** * parse_lri_scn * */ int parse_lri_scn(struct rtas_event *re) { struct rtas_lri_scn *lri; struct rtas_lri_scn_raw *rawhdr; lri = malloc(sizeof(*lri)); if (lri == NULL) { errno = ENOMEM; return -1; } lri->shdr.raw_offset = re->offset; rawhdr = (struct rtas_lri_scn_raw *)(re->buffer + re->offset); parse_v6_hdr(&lri->v6hdr, &rawhdr->v6hdr); lri->resource = rawhdr->resource; lri->capacity = be16toh(rawhdr->capacity); lri->lri_mem_addr_lo = be32toh(rawhdr->lri_mem_addr_lo); lri->lri_mem_addr_hi = be32toh(rawhdr->lri_mem_addr_hi); re->offset += RE_LRI_SCN_SZ; add_re_scn(re, lri, RTAS_LRI_SCN); return 0; } /** * rtas_get_lri_scn * @brief Retrieve the Logical Resource ID (LRI) section of the RTAS Event * * @param re rtas_event pointer * @return rtas_event_scn pointer for lri section */ struct rtas_lri_scn * rtas_get_lri_scn(struct rtas_event *re) { return (struct rtas_lri_scn *)get_re_scn(re, RTAS_LRI_SCN); } /** * print_re_lriscn * @brief print the contents of a LRI section * * @param res rtas_event_scn pointer for lri section * @param verbosity verbose level of output * @return number of bytes written */ int print_re_lri_scn(struct scn_header *shdr, int verbosity) { struct rtas_lri_scn *lri; int len = 0; if (shdr->scn_id != RTAS_LRI_SCN) { errno = EFAULT; return 0; } lri = (struct rtas_lri_scn *)shdr; len += print_v6_hdr("Logical Resource Identification", &lri->v6hdr, verbosity); len += rtas_print(PRNT_FMT" ", "Resource Type:", lri->resource); switch (lri->resource) { case 0x10: len += rtas_print("(Processor)\n" PRNT_FMT_R, "CPU ID:", lri->lri_cpu_id); break; case 0x11: len += rtas_print("(Shared Processor)\n" PRNT_FMT_R, "Entitled Capacity:", lri->capacity); break; case 0x40: len += rtas_print("(Memory Page)\n" PRNT_FMT_ADDR, "Logical Address:", lri->lri_mem_addr_hi, lri->lri_mem_addr_lo); break; case 0x41: len += rtas_print("(Memory LMB)\n" PRNT_FMT_R, "DRC Index:", lri->lri_drc_index); break; default: len += rtas_print("(Unknown Resource)\n"); break; } len += rtas_print("\n"); return len; } librtas-2.0.0/librtasevent_src/rtas_mem.c000066400000000000000000000102101270107623400204710ustar00rootroot00000000000000/** * @file rtas_mem.c * @brief RTAS Memory Controller detected routines * * Copyright (C) 2005 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author Nathan Fontenot * @author Jake Moilanen */ #include #include #include #include #include "librtasevent.h" #include "rtas_event.h" /** * parse_mem_scn * */ int parse_mem_scn(struct rtas_event *re) { struct rtas_mem_scn *mem; mem = malloc(sizeof(*mem)); if (mem == NULL) { errno = ENOMEM; return -1; } mem->shdr.raw_offset = re->offset; rtas_copy(RE_SHDR_OFFSET(mem), re, RE_V4_SCN_SZ); add_re_scn(re, mem, RTAS_MEM_SCN); return 0; } /** * rtas_get_mem_scn * @brief Retrieve the Memory Detected failure section of the RTAS Event * * @param re rtas_event pointer * @return rtas_event_scn pointer for memory section */ struct rtas_mem_scn * rtas_get_mem_scn(struct rtas_event *re) { return (struct rtas_mem_scn *)get_re_scn(re, RTAS_MEM_SCN); } /** * print_re_mem_scn * @brief print the contents of a RTAS memory controller detected error section * * @param res rtas_event_scn pointer for memory section * @param verbosity verbose level of output * @return number of bytes written */ int print_re_mem_scn(struct scn_header *shdr, int verbosity) { struct rtas_mem_scn *mem = (struct rtas_mem_scn *)shdr; int len = 0; if (shdr->scn_id != RTAS_MEM_SCN) { errno = EFAULT; return 0; } len += print_scn_title("Memory Section"); if (mem->uncorrectable) len += rtas_print("Uncorrectable Memory error.\n"); if (mem->ECC) len += rtas_print("ECC Correctable error.\n"); if (mem->threshold_exceeded) len += rtas_print("Correctable threshold exceeded.\n"); if (mem->control_internal) len += rtas_print("Memory Controller internal error.\n"); if (mem->bad_address) len += rtas_print("Memory Address error.\n"); if (mem->bad_data) len += rtas_print("Memory Data error.\n"); if (mem->bus) len += rtas_print("Memory bus/switch internal error.\n"); if (mem->timeout) len += rtas_print("Memory timeout.\n"); if (mem->sysbus_parity) len += rtas_print("System bus parity.\n"); if (mem->sysbus_timeout) len += rtas_print("System bus timeout.\n"); if (mem->sysbus_protocol) len += rtas_print("System bus protocol/transfer.\n"); if (mem->hostbridge_timeout) len += rtas_print("I/O Host Bridge timeout.\n"); if (mem->hostbridge_parity) len += rtas_print("I/O Host Bridge parity.\n"); if (shdr->re->version >= 3) { if (mem->support) len += rtas_print("System support function error.\n"); if (mem->sysbus_internal) len += rtas_print("System bus internal hardware/switch error.\n"); } len += rtas_print("Memory Controller that detected failure: %x.\n", mem->controller_detected); len += rtas_print("Memory Controller that faulted: %x.\n", mem->controller_faulted); len += rtas_print(PRNT_FMT_ADDR, "Failing address:", mem->failing_address_hi, mem->failing_address_lo); len += rtas_print(PRNT_FMT_2, "ECC syndrome bits:", mem->ecc_syndrome, "Memory Card:", mem->memory_card); len += rtas_print(PRNT_FMT_2, "Failing element:", mem->element, "Sub element bits:", mem->sub_elements); len += rtas_print("\n"); return len; } librtas-2.0.0/librtasevent_src/rtas_post.c000066400000000000000000000100671270107623400207120ustar00rootroot00000000000000/** * @file rtas_post.c * @brief RTAS Power-On Self Test (POST) section routines * * Copyright (C) 2005 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author Nathan Fontenot * @author Jake Moilanen */ #include #include #include #include #include "librtasevent.h" #include "rtas_event.h" /** * parse_post_scn * */ int parse_post_scn(struct rtas_event *re) { struct rtas_post_scn *post; post = malloc(sizeof(*post)); if (post == NULL) { errno = ENOMEM; return -1; } post->shdr.raw_offset = re->offset; /* This memcpy will get us up through the devname... */ rtas_copy(RE_SHDR_OFFSET(post), re, 14); post->devname[12] = '\0'; /* Copy in the error code... */ rtas_copy(post->err_code, re, 4); post->err_code[4] = '\0'; /* Next the firmware revision level... */ rtas_copy(post->firmware_rev, re, 2); post->firmware_rev[2] = '\0'; /* and lastly, the location code */ rtas_copy(post->loc_code, re, 8); post->loc_code[8] = '\0'; add_re_scn(re, post, RTAS_CPU_SCN); return 0; } /** * rtas_get_post_ecn * @brief Retrieve the Power-On Self Test (POST) section of the RTAS Event * * @param re rtas_event pointer * @return rtas_event_scn pointer for post section */ struct rtas_post_scn * rtas_get_post_scn(struct rtas_event *re) { return (struct rtas_post_scn *)get_re_scn(re, RTAS_POST_SCN); } /** * print_re_post_scn * @brief print the contents of a POST section * * @param res rtas_event_scn pointer for post section * @param verbosity verbose level of output * @return number of bytes written */ int print_re_post_scn(struct scn_header *shdr, int verbosity) { struct rtas_post_scn *post = (struct rtas_post_scn *)shdr; int len = 0; if (shdr->scn_id != RTAS_POST_SCN) { errno = EFAULT; return 0; } len += print_scn_title("Power-On Self Test Section"); if (post->devname[0]) len += rtas_print("%-20s%s\n", "Failing Device:", post->devname); if (post->firmware) len += rtas_print("Firmware Error.\n"); if (post->config) len += rtas_print("Configuration Error.\n"); if (post->cpu) len += rtas_print("CPU POST Error.\n"); if (post->memory) len += rtas_print("Memory POST Error.\n"); if (post->io) len += rtas_print("I/O Subsystem POST Error.\n"); if (post->keyboard) len += rtas_print("Keyboard POST Error.\n"); if (post->mouse) len += rtas_print("Mouse POST Error.\n"); if (post->display) len += rtas_print("Display POST Error.\n"); if (post->ipl_floppy) len += rtas_print("Floppy IPL Error.\n"); if (post->ipl_controller) len += rtas_print("Drive Controller Error during IPL.\n"); if (post->ipl_cdrom) len += rtas_print("CDROM IPL Error.\n"); if (post->ipl_disk) len += rtas_print("Disk IPL Error.\n"); if (post->ipl_net) len += rtas_print("Network IPL Error.\n"); if (post->ipl_other) len += rtas_print("Other (tape,flash) IPL Error.\n"); if (post->firmware_selftest) len += rtas_print("Self-test error in firmware extended " "diagnostics.\n"); len += rtas_print("POST Error Code: %x\n", post->err_code); len += rtas_print("Firmware Revision Code: %x\n", post->firmware_rev); len += rtas_print("\n"); return len; } librtas-2.0.0/librtasevent_src/rtas_sp.c000066400000000000000000000125601270107623400203470ustar00rootroot00000000000000/** * @file rtas_sp.c * @brief RTAS Service Processor section routines * * Copyright (C) 2005 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author Nathan Fontenot * @author Jake Moilanen */ #include #include #include #include #include "librtasevent.h" #include "rtas_event.h" /** * parse_sp_scn * */ int parse_sp_scn(struct rtas_event *re) { struct rtas_ibmsp_scn *sp; sp = malloc(sizeof(*sp)); if (sp == NULL) { errno = ENOMEM; return 1; } sp->shdr.raw_offset = re->offset; rtas_copy(RE_SHDR_OFFSET(sp), re, RE_V4_SCN_SZ); add_re_scn(re, sp, RTAS_CPU_SCN); return 0; } /** * rtas_get_ibm_sp_scn * @brief Retrieve the IBM Service Processor Log section of the RTAS Event * * @param re rtas_event pointer * @return rtas_event_scn pointer for IBM SP section */ struct rtas_ibmsp_scn * rtas_get_ibm_sp_scn(struct rtas_event *re) { return (struct rtas_ibmsp_scn *)get_re_scn(re, RTAS_IBM_SP_SCN); } /** * print_re_ibmsp_scn * @brief print the contents of a RTAS Service Processor section * * @param res rtas_evnt_scn pointer for IBM SP section * @param verbosity verbose level of output * @return number of bytes written */ int print_re_ibmsp_scn(struct scn_header *shdr, int verbosity) { struct rtas_ibmsp_scn *sp; int len = 0; if (shdr->scn_id != RTAS_IBM_SP_SCN) { errno = EFAULT; return 0; } sp = (struct rtas_ibmsp_scn *)shdr; len += print_scn_title("Service Processor Section"); if (strcmp(sp->ibm, "IBM") != 0) len += rtas_print("This log entry may be corrupt (IBM " "signature malformed).\n"); if (sp->timeout) len += rtas_print("Timeout on communication response from " "service processor.\n"); if (sp->i2c_bus) len += rtas_print("I2C general bus error.\n"); if (sp->i2c_secondary_bus) len += rtas_print("I2C secondary bus error.\n"); if (sp->memory) len += rtas_print("Internal service processor memory error.\n"); if (sp->registers) len += rtas_print("Service processor error accessing special " "registers.\n"); if (sp->communication) len += rtas_print("Service processor reports unknown " "communcation error.\n"); if (sp->firmware) len += rtas_print("Internal service processor firmware error.\n"); if (sp->hardware) len += rtas_print("Other internal service processor hardware " "error.\n"); if (sp->vpd_eeprom) len += rtas_print("Service processor error accessing VPD EEPROM.\n"); if (sp->op_panel) len += rtas_print("Service processor error accessing Operator " "Panel.\n"); if (sp->power_controller) len += rtas_print("Service processor error accessing Power " "Controller.\n"); if (sp->fan_sensor) len += rtas_print("Service processor error accessing " "Fan Sensor.\n"); if (sp->thermal_sensor) len += rtas_print("Service processor error accessing " "Thermal Sensor.\n"); if (sp->voltage_sensor) len += rtas_print("Service processor error accessing " "Voltage Sensor.\n"); if (sp->serial_port) len += rtas_print("Service processor error accessing " "serial port.\n"); if (sp->nvram) len += rtas_print("Service processor detected NVRAM error.\n"); if (sp->rtc) len += rtas_print("Service processor error accessing real " "time clock.\n"); if (sp->jtag) len += rtas_print("Service processor error accessing JTAG/COP.\n"); if (sp->tod_battery) len += rtas_print("Service processor or RTAS detects loss of " "voltage \nfrom TOD battery.\n"); if (sp->heartbeat) len += rtas_print("Loss of heartbeat from Service processor.\n"); if (sp->surveillance) len += rtas_print("Service processor detected a surveillance " "timeout.\n"); if (sp->pcn_connection) len += rtas_print("Power Control Network general connection " "failure.\n"); if (sp->pcn_node) len += rtas_print("Power Control Network node failure.\n"); if (sp->pcn_access) len += rtas_print("Service processor error accessing Power " "Control Network.\n"); if (sp->sensor_token) len += rtas_print(PRNT_FMT_R, "Sensor Token:", sp->sensor_token); if (sp->sensor_index) len += rtas_print(PRNT_FMT_R, "Sensor Index:", sp->sensor_index); len += rtas_print("\n"); return len; } librtas-2.0.0/librtasevent_src/rtas_src_codes.c000066400000000000000000000233041270107623400216670ustar00rootroot00000000000000/** * @file rtas_src_codes.c * @brief SRC Section Codes * * Copyright (C) 2004 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author Nathan Fontenot */ /** * @struct src_code * @brief structure to hold src codes and their description */ struct src_code { char *id; char *desc; }; /** * src_codes * @brief List of known SRC codes */ static struct src_code src_codes[] = { /* B1xx Codes - Service Processor Early Termination */ {"B1517200", "Invalid boot request"}, {"B1517201", "Service processor failure"}, {"B1517202", "The permanent and temporary firmware sides are both marked invalid"}, {"B1517203", "Error setting boot parameters"}, {"B1517204", "Error reading boot parameters"}, {"B1517205", "Boot code error"}, {"B1517206", "Unit check timer was reset"}, {"B1817200", "Invalid boot request"}, {"B1817201", "Service processor failure"}, {"B1817202", "The permanent and temporary firmware sides are both marked invalid"}, {"B1817203", "Error setting boot parameters"}, {"B1817204", "Error reading boot parameters"}, {"B1817205", "Boot code error"}, {"B1817206", "Unit check timer was reset"}, {"B1817207", "Error reading from NVRAM"}, {"B1817208", "Error writing to NVRAM"}, /* BAxx Codes - Partition Firmware reference codes */ {"BA000010", "The device data structure is corrupted"}, {"BA000020", "Incompatible firmware levels were found"}, {"BA000030", "An lpevent communication failure occurred"}, {"BA000040", "The firmware was unable to obtain the RTAS code lid details"}, {"BA000050", "The firmware was unable to load the RTAS code lid"}, {"BA000060", "The firmware was unable to obtain the open firmware code lid details"}, {"BA000070", "The firmware was unable to load the open firmware code lid"}, {"BA010000", "There is insufficient information to boot the partition"}, {"BA010001", "The client IP address is already in use by another network device"}, {"BA010002", "Cannot get gateway IP address"}, {"BA010003", "Cannot get server hardware address"}, {"BA010004", "Bootp failed"}, {"BA010005", "File transmission (TFTP) failed"}, {"BA010006", "The boot image is too large"}, {"BA020001", "Partition firmware password entry error"}, {"BA020009", "Invalid password entered - system locked"}, {"BA030011", "RTAS attempt to allocate memory failed"}, {"BA04000F", "Self test failed on device; no error or location code information available"}, {"BA040010", "Self test failed on device; can't locate package"}, {"BA050001", "Failed to reboot a partition in logical partition mode"}, {"BA050004", "Failed to locate service processor device tree node"}, {"BA05000A", "Failed to send boot failed message to the service processor"}, {"BA060003", "IP parameter requires 3 period characters"}, {"BA060004", "Invalid IP parameter"}, {"BA060005", "Invalid IP parameter (>255)"}, {"BA060007", "A keyboard was not found"}, {"BA060008", "No configurable adapters found by the remote IPL menu in the SMS utilities"}, {"BA06000B", "The system was not able to find an operating system on the devices in the boot list"}, {"BA06000C", "A pointer to the operating system was found in non-volatile storage"}, {"BA060020", "The environment variable \"boot-device\" exceeded the allowed character limit"}, {"BA060021", "The environment variable \"boot-device\" contained more than five entries"}, {"BA060022", "The environment variable \"boot-device\" contained an entry that exceeded 255 characters in length"}, {"BA080001", "An IDE device remained busy for a longer period than the time out period"}, {"BA080010", "An IDE device is busy longer than specified time-out period"}, {"BA080011", "An IDE command timed out; command is exceeding the period allowed to complete"}, {"BA080012", "The ATA command failed"}, {"BA080013", "The media is not present in the tray"}, {"BA080014", "The media has been changed"}, {"BA080015", "The packet command failed; the media might not be readable"}, {"BA090001", "SCSI DASD: test unit ready failed; hardware error"}, {"BA090002", "SCSI DASD: test unit ready failed; sense data available"}, {"BA090003", "SCSI DASD: send diagnostic failed; sense data available"}, {"BA090004", "SCSI DASD: send diagnostic failed: devofl cmd"}, {"BA100001", "SCSI tape: test unit ready failed; hardware error"}, {"BA100002", "SCSI tape: test unit ready failed; sense data available"}, {"BA100003", "SCSI tape: send diagnostic failed; sense data available"}, {"BA100004", "SCSI tape: send diagnostic failed: devofl cmd"}, {"BA110001", "SCSI changer: test unit ready failed; hardware error"}, {"BA110002", "SCSI changer: test unit ready failed; sense data available"}, {"BA110003", "SCSI changer: send diagnostic failed; sense data available"}, {"BA110004", "SCSI changer: send diagnostic failed: devofl command"}, {"BA120001", "On an undetermined SCSI device, test unit ready failed; hardware error"}, {"BA120002", "On an undetermined SCSI device, test unit ready failed; sense data available"}, {"BA120003", "On an undetermined SCSI device, send diagnostic failed; sense data available"}, {"BA120004", "On an undetermined SCSI device, send diagnostic failed; devofl command"}, {"BA130001", "SCSI CD-ROM: test unit ready failed; hardware error"}, {"BA130002", "SCSI CD-ROM: test unit ready failed; sense data available"}, {"BA130003", "SCSI CD-ROM: send diagnostic failed; sense data available"}, {"BA130004", "SCSI CD-ROM: send diagnostic failed: devofl command"}, {"BA130010", "USB CD-ROM: device remained busy longer than the time-out period"}, {"BA130011", "USB CD-ROM: execution of ATA/ATAPI command was not completed with the allowed time"}, {"BA130012", "USB CD-ROM: execution of ATA/ATAPI command failed"}, {"BA130013", "USB CD-ROM: bootable media is missing from the drive"}, {"BA130014", "USB CD-ROM: the media in the USB CD-ROM drive has been changed"}, {"BA130015", "USB CD-ROM: ATA/ATAPI packet command execution failed"}, {"BA140001", "SCSI read/write optical: test unit ready failed; hardware error"}, {"BA140002", "SCSI read/write optical: test unit ready failed; sense data available"}, {"BA140003", "SCSI read/write optical: send diagnostic failed; sense data available"}, {"BA140004", "SCSI read/write optical: send diagnostic failed; devofl command"}, {"BA150001", "PCI Ethernet BNC/RJ-45 or PCI Ethernet AUI/RJ-45 adapter: internal wrap test failure"}, {"BA151001", "10/100 MBPS Ethernet PCI adapter: internal wrap test failure"}, {"BA151002", "10/100 MBPS Ethernet card"}, {"BA160001", "PCI auto LANstreamer token ring adapter: failed to complete hardware initialization"}, {"BA161001", "PCI token ring adapter: failed to complete hardware initialization"}, {"BA170000", "NVRAMRC initialization failed; device test failed"}, {"BA170100", "NVRAM data validation check failed"}, {"BA170201", "The firmware was unable to expand target partition - saving configuration variable"}, {"BA170202", "The firmware was unable to expand target partition - writing error log entry"}, {"BA170203", "The firmware was unable to expand target partition - writing VPD data"}, {"BA170210", "Setenv/$Setenv parameter error - name contains a null character"}, {"BA170211", "Setenv/$Setenv parameter error - value contains a null character"}, {"BA170998", "NVRAMRC script evaluation error - command line execution error"}, {"BA170999", "NVRAMRC script evaluation error - stack unbalanced on completion"}, {"BA180008", "PCI device Fcode evaluation error"}, {"BA180010", "PCI probe error, bridge in freeze state"}, {"BA180011", "PCI bridge probe error, bridge is not usable"}, {"BA180012", "PCI device runtime error, bridge in freeze state"}, {"BA180100", "FDDI adapter Fcode driver is not supported on this system"}, {"BA180101", "Stack underflow from fibre-channel adapter"}, {"BA188000", "An unsupported adapter was found in a PCI slot"}, {"BA188001", "EEH recovered a failing I/O adapter"}, {"BA188002", "EEH could not recover the failed I/O adapter"}, {"BA190001", "Firmware function to get/set time-of-day reported an error"}, {"BA210000", "Partition firmware reports a default catch"}, {"BA210001", "Partition firmware reports a stack underflow was caught"}, {"BA210002", "Partition firmware was ready before standout was ready"}, {"BA250010", "dlpar error in open firmware"}, {"BA278001", "Failed to flash firmware: invalid image file"}, {"BA278002", "Flash file is not designed for this eServer platform"}, {"BA278003", "Unable to lock the firmware update lid manager"}, {"BA278004", "An invalid firmware update lid was requested"}, {"BA278005", "Failed to flash a firmware update lid"}, {"BA278006", "Unable to unlock the firmware update lid manager"}, {"BA278007", "Failed to reboot the system after a firmware flash update"}, {NULL, NULL} }; librtas-2.0.0/librtasevent_src/rtas_srcfru.c000066400000000000000000000456701270107623400212410ustar00rootroot00000000000000/** * @file rtas_srcfru.c * @brief RTAS SRC/FRU sections routines * * Copyright (C) 2005 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author Nathan Fontenot */ #include #include #include #include #include "librtasevent.h" #include "rtas_event.h" /* rtas_src_codes contains data used by these routines */ #include "rtas_src_codes.c" /** * parse_fru_hdr * @brief Parse the ontents of a FRU header * * @param fru_hdr rtas_fru_hdr pointer * @param fru_hdr_raw rtas_fru_hdr_raw pointer */ static void parse_fru_hdr(struct rtas_fru_hdr *fru_hdr, struct rtas_fru_hdr_raw *fru_hdr_raw) { fru_hdr->id[0] = fru_hdr_raw->id[0]; fru_hdr->id[1] = fru_hdr_raw->id[1]; fru_hdr->length = fru_hdr_raw->length; fru_hdr->flags = fru_hdr_raw->flags; } /** * parse_fru_id_scn * @brief Parse a FRU Identity Substructure * * @param re rtas_event pointer * @returns pointer to parsed rtas_fru_id_scn, NULL on failure */ static struct rtas_fru_hdr * parse_fru_id_scn(struct rtas_event *re) { struct rtas_fru_id_scn *fru_id; struct rtas_fru_id_scn_raw *fru_id_raw; fru_id = malloc(sizeof(*fru_id)); if (fru_id == NULL) { errno = ENOMEM; return NULL; } memset(fru_id, 0, sizeof(*fru_id)); fru_id_raw = (struct rtas_fru_id_scn_raw *)(re->buffer + re->offset); parse_fru_hdr(&fru_id->fruhdr, &fru_id_raw->fruhdr); re->offset += RE_FRU_HDR_SZ; if (fruid_has_part_no(fru_id)) { strcpy(fru_id->part_no, RE_EVENT_OFFSET(re)); re->offset += 8; } if (fruid_has_proc_id(fru_id)) { strcpy(fru_id->procedure_id, RE_EVENT_OFFSET(re)); re->offset += 8; } if (fruid_has_ccin(fru_id)) { rtas_copy(fru_id->ccin, re, 4); fru_id->ccin[4] = '\0'; } if (fruid_has_serial_no(fru_id)) { rtas_copy(fru_id->serial_no, re, 12); fru_id->serial_no[12] = '\0'; } return (struct rtas_fru_hdr *)fru_id; } /** * parse_fru_pe_scn * @brief parse a FRU Power Enclosure Identity Substructure * * @param re rtas_event pointer * @returns pointer to parsed rtas_fru_pe_scn, NULL on failure */ static struct rtas_fru_hdr * parse_fru_pe_scn(struct rtas_event *re) { struct rtas_fru_pe_scn *fru_pe; struct rtas_fru_pe_scn_raw *fru_pe_raw; uint32_t scn_sz; char *data; fru_pe = malloc(sizeof(*fru_pe)); if (fru_pe == NULL) { errno = ENOMEM; return NULL; } memset(fru_pe, 0, sizeof(*fru_pe)); fru_pe_raw = (struct rtas_fru_pe_scn_raw *)(re->buffer + re->offset); parse_fru_hdr(&fru_pe->fruhdr, &fru_pe_raw->fruhdr); re->offset += RE_FRU_HDR_SZ; scn_sz = fru_pe->fruhdr.length; data = (char *)fru_pe + sizeof(fru_pe->fruhdr); rtas_copy(data, re, scn_sz - RE_FRU_HDR_SZ); return (struct rtas_fru_hdr *)fru_pe; } /** * parse_fru_mr_scn * @brief parse a FRU Manufacturing Replaceable Unit Substructure * * @param re rtas_event pointer * @returns pointer to parsed rtas_fru_mr_scn, NULL on failure */ static struct rtas_fru_hdr * parse_fru_mr_scn(struct rtas_event *re) { struct rtas_fru_mr_scn *fru_mr; struct rtas_fru_mr_scn_raw *fru_mr_raw; int i, mrus_sz, num_mrus; fru_mr = malloc(sizeof(*fru_mr)); if (fru_mr == NULL) { errno = ENOMEM; return NULL; } memset(fru_mr, 0, sizeof(*fru_mr)); fru_mr_raw = (struct rtas_fru_mr_scn_raw *)(re->buffer + re->offset); parse_fru_hdr(&fru_mr->fruhdr, &fru_mr_raw->fruhdr); re->offset += RE_FRU_HDR_SZ; mrus_sz = fru_mr->fruhdr.length - RE_FRU_HDR_SZ - sizeof(uint32_t); num_mrus = mrus_sz / sizeof(struct fru_mru_raw); for (i = 0; i < num_mrus; i++) { fru_mr->mrus[i].priority = fru_mr_raw->mrus[i].priority; fru_mr->mrus[i].id = be32toh(fru_mr_raw->mrus[i].id); } re->offset += mrus_sz + sizeof(uint32_t) /* reserved piece */; return (struct rtas_fru_hdr *)fru_mr; } void parse_fru_scn(struct rtas_event *re, struct rtas_fru_scn *fru, struct rtas_fru_scn_raw *rawfru) { fru->length = rawfru->length; fru->type = (rawfru->data1 & 0xf0) >> 4; fru->fru_id_included = (rawfru->data1 & 0x08) >> 3; fru->fru_subscn_included = rawfru->data1 & 0x07; fru->priority = rawfru->priority; fru->loc_code_length = rawfru->loc_code_length; re->offset += RE_FRU_SCN_SZ; memcpy(fru->loc_code, rawfru->loc_code, fru->loc_code_length); re->offset += fru->loc_code_length; } /** * parse_v6_src_scn * @brief parse a version 6 rtas SRC section * * @param re rtas_event pointer * @param src_start pointer to beginning of SRC section * @return 0 on success, !0 on failure */ int parse_src_scn(struct rtas_event *re) { struct rtas_src_scn *src; struct rtas_src_scn_raw *src_raw; struct rtas_fru_scn *fru, *last_fru; int total_len, srcsub_len; src = malloc(sizeof(*src)); if (src == NULL) { errno = ENOMEM; return 1; } src_raw = malloc(sizeof(*src_raw)); if (src_raw == NULL) { free(src); errno = ENOMEM; return 1; } memset(src, 0, sizeof(*src)); memset(src_raw, 0, sizeof(*src_raw)); src->shdr.raw_offset = re->offset; rtas_copy(src_raw, re, RE_SRC_SCN_SZ); parse_v6_hdr(&src->v6hdr, &src_raw->v6hdr); src->version = src_raw->version; memcpy(&src->src_platform_data, &src_raw->src_platform_data, sizeof(src->src_platform_data)); src->ext_refcode2 = be32toh(src_raw->ext_refcode2); src->ext_refcode3 = be32toh(src_raw->ext_refcode3); src->ext_refcode4 = be32toh(src_raw->ext_refcode4); src->ext_refcode5 = be32toh(src_raw->ext_refcode5); src->ext_refcode6 = be32toh(src_raw->ext_refcode6); src->ext_refcode7 = be32toh(src_raw->ext_refcode7); src->ext_refcode8 = be32toh(src_raw->ext_refcode8); src->ext_refcode9 = be32toh(src_raw->ext_refcode9); memcpy(&src->primary_refcode, &src_raw->primary_refcode, sizeof(src->primary_refcode)); add_re_scn(re, src, re_scn_id(&src_raw->v6hdr)); if (!src_subscns_included(src)) return 0; rtas_copy( (char *) src_raw + RE_SRC_SCN_SZ + 4, re, RE_SRC_SUBSCN_SZ); src->subscn_id = src_raw->subscn_id; src->subscn_platform_data = src_raw->subscn_platform_data; src->subscn_length = be16toh(src_raw->subscn_length); srcsub_len = src->subscn_length * 4; /*get number of bytes */ total_len = RE_SRC_SUBSCN_SZ; last_fru = NULL; do { uint32_t fru_len, fru_end; struct rtas_fru_hdr *last_fruhdr = NULL; struct rtas_fru_scn_raw *rawfru; fru = malloc(sizeof(*fru)); if (fru == NULL) { cleanup_rtas_event(re); errno = ENOMEM; return 1; } memset(fru, 0, sizeof(*fru)); rawfru = (struct rtas_fru_scn_raw *)(re->buffer + re->offset); parse_fru_scn(re, fru, rawfru); fru_len = RE_FRU_SCN_SZ + fru->loc_code_length; fru_end = re->offset + fru->length - fru_len; while (re->offset < fru_end) { struct rtas_fru_hdr *cur_fruhdr = NULL; char *id = re->buffer + re->offset; if (strncmp(id, "ID", 2) == 0) cur_fruhdr = parse_fru_id_scn(re); else if (strncmp(id, "PE", 2) == 0) cur_fruhdr = parse_fru_pe_scn(re); else if (strncmp(id, "MR", 2) == 0) cur_fruhdr = parse_fru_mr_scn(re); else { re->offset++; continue; } if (cur_fruhdr == NULL) { cleanup_rtas_event(re); return -1; } if (last_fruhdr == NULL) fru->subscns = cur_fruhdr; else last_fruhdr->next = cur_fruhdr; last_fruhdr = cur_fruhdr; } if (last_fru == NULL) src->fru_scns = fru; else last_fru->next = fru; last_fru = fru; total_len += fru->length; } while (total_len < srcsub_len); return 0; } /** * rtas_get_src_scn * @brief retrieve the RTAS src section for a RTAS event * * @param re rtas_event pointer * @return rtas_event_scn pointer for a SRC section */ struct rtas_src_scn * rtas_get_src_scn(struct rtas_event *re) { return (struct rtas_src_scn *)get_re_scn(re, RTAS_PSRC_SCN); } /** * print_fru_hdr * @brief print the contents of a FRU header * * @param fruhdr pointer to fru_hdr to print * @param verbosity verbose level * @returns the number of bytes printed */ static int print_fru_hdr(struct rtas_fru_hdr *fruhdr, int verbosity) { int len = 0; len += rtas_print("%-20s%c%c "PRNT_FMT_R, "ID:", fruhdr->id[0], fruhdr->id[1], "Flags:", fruhdr->flags); if (verbosity >= 2) len += rtas_print(PRNT_FMT_R, "Length:", fruhdr->length); return len; } /** * print_fru_priority * @brief decode the FRU prority level and print a description of it. * * @param priority * @returns the number of bytes printed */ static int print_fru_priority(char priority) { int len = 0; len = rtas_print("%-20s%c - ", "Priority:", priority); switch (priority) { case RTAS_FRU_PRIORITY_HIGH: len += rtas_print("High priority and mandatory call-out.\n"); break; case RTAS_FRU_PRIORITY_MEDIUM: len += rtas_print("Medium priority.\n"); break; case RTAS_FRU_PRIORITY_MEDIUM_A: len += rtas_print("Medium priority group A (1st group).\n"); break; case RTAS_FRU_PRIORITY_MEDIUM_B: len += rtas_print("Medium priority group B (2nd group).\n"); break; case RTAS_FRU_PRIORITY_MEDIUM_C: len += rtas_print("Medium priority group C (3rd group).\n"); break; case RTAS_FRU_PRIORITY_LOW: len += rtas_print("Low Priority.\n"); break; } return len; } /** * print_fru_id_scn * @bried print the contents of a FRU Identity substructure * * @param fruhdr pointer to the fru_hdr of the FRU ID section to print * @param verbosity verbose level * @returns the number of bytes printed */ static int print_fru_id_scn(struct rtas_fru_hdr *fruhdr, int verbosity) { struct rtas_fru_id_scn *fru_id = (struct rtas_fru_id_scn *)fruhdr; int len; uint32_t component; len = print_scn_title("FRU ID Section"); len += print_fru_hdr(fruhdr, verbosity); component = fru_id->fruhdr.flags & RTAS_FRUID_COMP_MASK; if (component) { len += rtas_print(PRNT_FMT" ", "Failing Component:", component); switch (component) { case RTAS_FRUID_COMP_HARDWARE: len += rtas_print("(\"normal\" hardware FRU)\n"); break; case RTAS_FRUID_COMP_CODE: len += rtas_print("(Code FRU)\n"); break; case RTAS_FRUID_COMP_CONFIG_ERROR: len += rtas_print("(Configuration error)\n"); break; case RTAS_FRUID_COMP_MAINT_REQUIRED: len += rtas_print("(Mainteneace procedure required)\n"); break; case RTAS_FRUID_COMP_EXTERNAL: len += rtas_print("(External FRU)\n"); break; case RTAS_FRUID_COMP_EXTERNAL_CODE: len += rtas_print("(External Code FRU)\n"); break; case RTAS_FRUID_COMP_TOOL: len += rtas_print("(Tool FRU)\n"); break; case RTAS_FRUID_COMP_SYMBOLIC: len += rtas_print("(Symbolic FRU)\n"); break; default: len += rtas_print("\n"); break; } } if (fruid_has_part_no(fru_id)) len += rtas_print("%-20s%s\n", "FRU Stocking Part:", fru_id->part_no); if (fruid_has_proc_id(fru_id)) len += rtas_print("%-20s%s\n", "Procedure ID:", fru_id->procedure_id); if (fruid_has_ccin(fru_id)) len += rtas_print("%-20s%s\n", "CCIN:", fru_id->ccin); if (fruid_has_serial_no(fru_id)) len += rtas_print("%-20s%s\n", "Serial Number:", fru_id->serial_no); len += rtas_print("\n"); return len; } /** * print_fru_pe_scn * @bried print the contents of a FRU Power Enclosure substructure * * @param fruhdr pointer to the fru_hdr of the FRU PE section to print * @param verbosity verbose level * @returns the number of bytes printed */ static int print_fru_pe_scn(struct rtas_fru_hdr *fruhdr, int verbosity) { struct rtas_fru_pe_scn *fru_pe = (struct rtas_fru_pe_scn *)fruhdr; int len; len = print_scn_title("FRU PE Section"); len += print_fru_hdr(fruhdr, verbosity); len += print_mtms(&fru_pe->pce_mtms); if (fru_pe->pce_name[0] != '\0') len += rtas_print("%-20s%s\n\n", "PCE Name:", fru_pe->pce_name); else len += rtas_print("\n\n"); return len; } /** * print_fru_mr_scn * @bried print the contents of a FRU Manufacturing Replaceable substructure * * @param fruhdr pointer to the fru_hdr of the FRU MR section to print * @param verbosity verbose level * @returns the number of bytes printed */ static int print_fru_mr_scn(struct rtas_fru_hdr *fruhdr, int verbosity) { struct rtas_fru_mr_scn *fru_mr = (struct rtas_fru_mr_scn *)fruhdr; int i, len; len = print_scn_title("FRU MR Section"); len += print_fru_hdr(fruhdr, verbosity); len += rtas_print("\nManufacturing Replaceable Unit Fields (%d):\n", frumr_num_callouts(fru_mr)); for (i = 0; i < frumr_num_callouts(fru_mr); i++) { struct fru_mru *mru = &fru_mr->mrus[i]; len += rtas_print("%-20s%c %-20s%08x\n", "MRU Priority:", mru->priority, "MRU ID:", mru->id); } len += rtas_print("\n"); return len; } /** * print_re_fru_scn * @brief print the contents of an FRU section * * @param res rtas_event_scn pointer for a fru section * @param verbosity verbose level of output * @param count current fru section number that we are printing * @return number of bytes written */ int print_re_fru_scn(struct rtas_fru_scn *fru, int verbosity, int count) { struct rtas_fru_hdr *fruhdr; int len = 0; len += print_scn_title("FRU Section (%d)", count); if (verbosity >= 2) { len += rtas_print(PRNT_FMT_2, "Length:", fru->length, "Call-Out Type:", fru->type); len += rtas_print("%-20s%-8s %-20s%-8s\n", "Fru ID Included:", (fru->fru_id_included) ? "Yes" : "No", "Fru Subscns:", (fru->fru_subscn_included) ? "Yes" : "No"); } len += print_fru_priority(fru->priority); if (fru->loc_code_length) { if (verbosity >= 2) len += rtas_print(PRNT_FMT_R, "Loc Code Length:", fru->loc_code_length); len += rtas_print("%-20s%s\n", "Location Code:", fru->loc_code); } len += rtas_print("\n"); for (fruhdr = fru->subscns; fruhdr != NULL; fruhdr = fruhdr->next) { if (strncmp(fruhdr->id, "ID", 2) == 0) len += print_fru_id_scn(fruhdr, verbosity); else if (strncmp(fruhdr->id, "PE", 2) == 0) len += print_fru_pe_scn(fruhdr, verbosity); else if (strncmp(fruhdr->id, "MR", 2) == 0) len += print_fru_mr_scn(fruhdr, verbosity); } return len; } /** * print_src_refcode * @brief print a detailed description of the SRC reference code * * @param src rtas_v6_src_scn pointer * @return number of bytes written */ int print_src_refcode(struct rtas_src_scn *src) { int i, len = 0; len += rtas_print("%s \"", "Primary Reference Code:"); for (i = 0; i < 32; i++) { if (src->primary_refcode[i] == '\0') break; len += rtas_print("%c", src->primary_refcode[i]); } len += rtas_print("\"\n"); i = 0; while (src_codes[i].desc != NULL) { if (strcmp(src->primary_refcode, src_codes[i].id) == 0) { len += rtas_print("%s\n", src_codes[i].desc); return len; } i++; } return len; } /** * print_re_src_scn * @brief print the contents of a SRC section * * @param res rtas_event_scn pointer for SRC section * @param verbosity verbose level of output * @return number of bytes written */ int print_re_src_scn(struct scn_header *shdr, int verbosity) { struct rtas_src_scn *src; struct rtas_fru_scn *fru; int len = 0; int count = 1; if ((shdr->scn_id != RTAS_PSRC_SCN) && (shdr->scn_id != RTAS_SSRC_SCN)) { errno = EFAULT; return 0; } src = (struct rtas_src_scn *)shdr; if (strncmp(src->v6hdr.id, RTAS_PSRC_SCN_ID, 2) == 0) len += print_v6_hdr("Primary SRC Section", (struct rtas_v6_hdr *)&src->v6hdr, verbosity); else len += print_v6_hdr("Secondary SRC Section", (struct rtas_v6_hdr *)&src->v6hdr, verbosity); if (verbosity >= 2) { len += rtas_print(PRNT_FMT_2"\n", "SRC Version:", src->version, "Subsections:", src_subscns_included(src)); } len += rtas_print("Platform Data:\n"); len += print_raw_data((char*)src->src_platform_data, sizeof(src->src_platform_data)); len += rtas_print("\n"); len += rtas_print("Extended Reference Codes:\n"); len += rtas_print("2: %08x 3: %08x 4: %08x 5: %08x\n", src->ext_refcode2, src->ext_refcode3, src->ext_refcode4, src->ext_refcode5); len += rtas_print("6: %08x 7: %08x 8: %08x 9: %08x\n\n", src->ext_refcode6, src->ext_refcode7, src->ext_refcode8, src->ext_refcode9); len += print_src_refcode(src); if (src_subscns_included(src)) { if (verbosity >= 2) { len += rtas_print(PRNT_FMT_2, "Sub-Section ID:", src->subscn_id, "Platform Data:", src->subscn_platform_data); len += rtas_print(PRNT_FMT_R, "Length:", src->subscn_length); } } len += rtas_print("\n"); for (fru = src->fru_scns; fru != NULL; fru = fru->next) { len += print_re_fru_scn(fru, verbosity, count); count++; } return len; } librtas-2.0.0/librtasevent_src/rtas_v6_misc.c000066400000000000000000000452611270107623400212770ustar00rootroot00000000000000/** * @file rtas_v6_misc.c * @brief Routines to print out various RTAS version 6 event sections * * Copyright (C) 2004 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author Nathan Fotenot */ #include #include #include #include #include "librtasevent.h" #include "rtas_event.h" /** * months * @brief array of month strings * * This array is indexed wih a hex value, thats what the extra blanks * are for so please leave them. */ static char *months[] = {"", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "", "", "", "", "", "", "Oct", "Nov", "Dec"}; void parse_rtas_date(struct rtas_date *rtas_date, struct rtas_date_raw *rawdate) { rtas_date->year = be16toh(rawdate->year); rtas_date->month = rawdate->month; rtas_date->day = rawdate->day; } void parse_rtas_time(struct rtas_time *rtas_time, struct rtas_time_raw *rawtime) { rtas_time->hour = rawtime->hour; rtas_time->minutes = rawtime->minutes; rtas_time->seconds = rawtime->seconds; rtas_time->hundredths = rawtime->hundredths; } void parse_v6_hdr(struct rtas_v6_hdr *v6hdr, struct rtas_v6_hdr_raw *rawv6) { v6hdr->id[0] = rawv6->id[0]; v6hdr->id[1] = rawv6->id[1]; v6hdr->length = be16toh(rawv6->length); v6hdr->version = rawv6->version; v6hdr->subtype = rawv6->subtype; v6hdr->creator_comp_id = be16toh(rawv6->creator_comp_id); } /** * print_v6_scn_hdr * @brief print the generic version 6 section header * * @param name section name * @param shdr rtas_v6_scn_hdr pointer * @param verbosity verbose level of output * @return number of bytes written */ int print_v6_hdr(char *name, struct rtas_v6_hdr *v6hdr, int verbosity) { int len; len = print_scn_title(name); if (verbosity > 1) { len += rtas_print("%-20s %c%c "PRNT_FMT_R, "Section ID:", v6hdr->id[0], v6hdr->id[1], "Section Length:", v6hdr->length); len += rtas_print(PRNT_FMT_2, "Version:", v6hdr->version, "Sub_type:", v6hdr->subtype); len += rtas_print(PRNT_FMT_R, "Component ID:", v6hdr->creator_comp_id); } return len; } /** * parse_main_a_scn * */ int parse_priv_hdr_scn(struct rtas_event *re) { struct rtas_priv_hdr_scn *privhdr; struct rtas_priv_hdr_scn_raw *rawhdr; privhdr = malloc(sizeof(*privhdr)); if (privhdr == NULL) { errno = ENOMEM; return -1; } memset(privhdr, 0, sizeof(*privhdr)); privhdr->shdr.raw_offset = re->offset; rawhdr = (struct rtas_priv_hdr_scn_raw *)(re->buffer + re->offset); parse_v6_hdr(&privhdr->v6hdr, &rawhdr->v6hdr); parse_rtas_date(&privhdr->date, &rawhdr->date); parse_rtas_time(&privhdr->time, &rawhdr->time); privhdr->creator_id = rawhdr->creator_id; privhdr->scn_count = rawhdr->scn_count; privhdr->creator_subid_hi = be32toh(rawhdr->creator_subid_hi); privhdr->creator_subid_lo = be32toh(rawhdr->creator_subid_lo); privhdr->plid = be32toh(rawhdr->plid); privhdr->log_entry_id = be32toh(rawhdr->log_entry_id); /* If the creator id is 'E', the the subsystem version is in ascii, * copy this info to a null terminated string. */ if (privhdr->creator_id == RTAS_PH_CREAT_SERVICE_PROC) { memcpy(privhdr->creator_subid_name, &privhdr->creator_subid_hi, 8); privhdr->creator_subid_name[8] = '\0'; } re->offset += 48; add_re_scn(re, privhdr, RTAS_PRIV_HDR_SCN); return 0; } /** * rtas_get_priv_hdr_scn * @brief retrieve the Private Header section of an RTAS Event * * @param re rtas_event pointer * @return pointer to rtas_event_scn on success, NULL on failure */ struct rtas_priv_hdr_scn * rtas_get_priv_hdr_scn(struct rtas_event *re) { return (struct rtas_priv_hdr_scn *)get_re_scn(re, RTAS_PRIV_HDR_SCN); } /** * print_re_priv_hdr_scn * @brief print the RTAS private header section * * @param res rtas_event_scn pointer to main a section * @param verbosity verbose level of output * @return number of bytes written */ int print_re_priv_hdr_scn(struct scn_header *shdr, int verbosity) { struct rtas_priv_hdr_scn *privhdr; int len = 0; if (shdr->scn_id != RTAS_PRIV_HDR_SCN) { errno = EFAULT; return 0; } privhdr = (struct rtas_priv_hdr_scn *)shdr; len += print_v6_hdr("Private Header", &privhdr->v6hdr, verbosity); len += rtas_print("%-20s%x %s %x\n", "Date:", privhdr->date.day, months[privhdr->date.month], privhdr->date.year); len += rtas_print("%-20s%x:%x:%x:%x\n", "Time:", privhdr->time.hour, privhdr->time.minutes, privhdr->time.seconds, privhdr->time.hundredths); len += rtas_print("%-20s", "Creator ID:"); switch(privhdr->creator_id) { case 'C': len += rtas_print("Hardware Management Console"); break; case 'E': len += rtas_print("Service Processor"); break; case 'H': len += rtas_print("PHyp"); break; case 'W': len += rtas_print("Power Control"); break; case 'L': len += rtas_print("Partition Firmware"); break; case 'S': len += rtas_print("SLIC"); break; default: len += rtas_print("Unknown"); break; } len += rtas_print(" (%c).\n", privhdr->creator_id); if (verbosity >= 2) len += rtas_print(PRNT_FMT_R, "Section Count:", privhdr->scn_count); if (privhdr->creator_id == 'E') len += rtas_print("Creator Subsystem Name: %s.\n", privhdr->creator_subid_name); else len += rtas_print("Creator Subsystem Version: %08x%08x.\n", privhdr->creator_subid_hi, privhdr->creator_subid_lo); len += rtas_print(PRNT_FMT_2, "Platform Log ID:", privhdr->plid, "Log Entry ID:", privhdr->log_entry_id); len += rtas_print("\n"); return len; } /** * parse_usr_hdr_scn * */ int parse_usr_hdr_scn(struct rtas_event *re) { struct rtas_usr_hdr_scn *usrhdr; struct rtas_usr_hdr_scn_raw *rawhdr; usrhdr = malloc(sizeof(*usrhdr)); if (usrhdr == NULL) { errno = ENOMEM; return -1; } memset(usrhdr, 0, sizeof(*usrhdr)); usrhdr->shdr.raw_offset = re->offset; rawhdr = (struct rtas_usr_hdr_scn_raw *)(re->buffer + re->offset); parse_v6_hdr(&usrhdr->v6hdr, &rawhdr->v6hdr); usrhdr->subsystem_id = rawhdr->subsystem_id; usrhdr->event_data = rawhdr->event_data; usrhdr->event_severity = rawhdr->event_severity; usrhdr->event_type = rawhdr->event_type; usrhdr->action = be16toh(rawhdr->action); re->offset += RE_USR_HDR_SCN_SZ; add_re_scn(re, usrhdr, RTAS_USR_HDR_SCN); return 0; } /** * rtas_rtas_usr_hdr_scn * @brief retrieve the User Header section for an RTAS event. * * @param re rtas_event pointer * @return rtas_event_scn pointer to User Header section, NULL on failure */ struct rtas_usr_hdr_scn * rtas_get_usr_hdr_scn(struct rtas_event *re) { return (struct rtas_usr_hdr_scn *)get_re_scn(re, RTAS_USR_HDR_SCN); } /** * print_usr_hdr_subsystem_id * @brief Print the subsystem id from the Main B section * * @param mainb rtas_v6_main_b_scn pointer * @return number of bytes written */ int print_usr_hdr_subsystem_id(struct rtas_usr_hdr_scn *usrhdr) { unsigned int id = usrhdr->subsystem_id; int len = 0; len += rtas_print(PRNT_FMT" ", "Subsystem ID:", id); if ((id >= 0x10) && (id <= 0x1F)) len += rtas_print("(Processor, including internal cache)\n"); else if ((id >= 0x20) && (id <= 0x2F)) len += rtas_print("(Memory, including external cache)\n"); else if ((id >= 0x30) && (id <= 0x3F)) len += rtas_print("(I/O (hub, bridge, bus))\n"); else if ((id >= 0x40) && (id <= 0x4F)) len += rtas_print("(I/O adapter, device and peripheral)\n"); else if ((id >= 0x50) && (id <= 0x5F)) len += rtas_print("(CEC Hardware)\n"); else if ((id >= 0x60) && (id <= 0x6F)) len += rtas_print("(Power/Cooling System)\n"); else if ((id >= 0x70) && (id <= 0x79)) len += rtas_print("(Other Subsystems)\n"); else if ((id >= 0x7A) && (id <= 0x7F)) len += rtas_print("(Surveillance Error)\n"); else if ((id >= 0x80) && (id <= 0x8F)) len += rtas_print("(Platform Firmware)\n"); else if ((id >= 0x90) && (id <= 0x9F)) len += rtas_print("(Software)\n"); else if ((id >= 0xA0) && (id <= 0xAF)) len += rtas_print("(External Environment)\n"); else len += rtas_print("\n"); return len; } /** * print_usr_hdr_event * @brief print the RTAS User Header section type data * * @param mainb rtas_usr_hdr_scn pointer * @return number of bytes written */ int print_usr_hdr_event_data(struct rtas_usr_hdr_scn *usrhdr) { int len = 0; len += rtas_print(PRNT_FMT_R, "Event Data", usrhdr->event_data); len += rtas_print("\n"PRNT_FMT_R, "Event Type:", usrhdr->event_type); switch (usrhdr->event_type) { case 0x01: len += rtas_print("Miscellaneous, informational only.\n"); break; case 0x08: len += rtas_print("Dump notification.\n"); break; case 0x10: len += rtas_print("Previously reported error has been " "corrected by system.\n"); break; case 0x20: len += rtas_print("System resources manually " "deconfigured by user.\n"); break; case 0x21: len += rtas_print("System resources deconfigured by system due" "to prior error event.\n"); break; case 0x22: len += rtas_print("Resource deallocation event notification.\n"); break; case 0x30: len += rtas_print("Customer environmental problem has " "returned to normal.\n"); break; case 0x40: len += rtas_print("Concurrent maintenance event.\n"); break; case 0x60: len += rtas_print("Capacity upgrade event.\n"); break; case 0x70: len += rtas_print("Resource sparing event.\n"); break; case 0x80: len += rtas_print("Dynamic reconfiguration event.\n"); break; case 0xD0: len += rtas_print("Normal system/platform shutdown " "or powered off.\n"); break; case 0xE0: len += rtas_print("Platform powered off by user without normal " "shutdown.\n"); break; default: len += rtas_print("Unknown event type (%d).\n", usrhdr->event_type); break; } len += rtas_print("\n"PRNT_FMT_R, "Event Severity:", usrhdr->event_severity); switch (usrhdr->event_severity) { case 0x00: len += rtas_print("Informational or non-error event,\n"); break; case 0x10: len += rtas_print("Recovered error, general.\n"); break; case 0x20: len += rtas_print("Predictive error, general.\n"); break; case 0x21: len += rtas_print("Predictive error, degraded performance.\n"); break; case 0x22: len += rtas_print("Predictive error, fault may be corrected " "after platform re-IPL.\n"); break; case 0x23: len += rtas_print("Predictive Error, fault may be corrected " "after IPL, degraded performance.\n"); break; case 0x24: len += rtas_print("Predictive error, loss of redundancy.\n"); break; case 0x40: len += rtas_print("Unrecoverable error, general.\n"); break; case 0x41: len += rtas_print("Unrecoverable error, bypassed with " "degraded performance.\n"); break; case 0x44: len += rtas_print("Unrecoverable error, bypassed with " "loss of redundancy.\n"); break; case 0x45: len += rtas_print("Unrecoverable error, bypassed with loss of\n" "redundancy and performance.\n"); break; case 0x48: len += rtas_print("Unrecoverable error, bypassed with " "loss of function.\n"); break; case 0x60: len += rtas_print("Error on diagnostic test, general.\n"); break; case 0x61: len += rtas_print("Error on diagnostic test, resource may " "produce incorrect results.\n"); break; default: len += rtas_print("Unknown event severity (%d).\n", usrhdr->event_type); break; } len += rtas_print("\n"); return len; } /** * print_usr_hdr_action * @brief print the RTAS User Header Section action data * * @param mainb rtas_v6_us_hdr_scn pointer * @return number of bytes written */ int print_usr_hdr_action(struct rtas_usr_hdr_scn *usrhdr) { int len = 0; len += rtas_print(PRNT_FMT" ", "Action Flag:", usrhdr->action); switch (usrhdr->action) { case 0x8000: len += rtas_print("Service Action "); if (usrhdr->action & 0x4000) len += rtas_print("(hidden error) "); if (usrhdr->action & 0x0800) len += rtas_print("call home) "); len += rtas_print("Required.\n"); break; case 0x2000: len += rtas_print("Report Externally, "); if (usrhdr->action & 0x1000) len += rtas_print("(HMC only).\n"); else len += rtas_print("(HMC and Hypervisor).\n"); break; case 0x0400: len += rtas_print("Error isolation incomplete,\n" " " "further analysis required.\n"); break; case 0x0000: break; default: len += rtas_print("Unknown action flag (0x%08x).\n", usrhdr->action); } return len; } /** * print_re_usr_hdr_scn * @brief print the contents of a RTAS User Header section * * @param res rtas_event_scn ponter * @param verbosity verbose level of ouput * @return number of bytes written */ int print_re_usr_hdr_scn(struct scn_header *shdr, int verbosity) { struct rtas_usr_hdr_scn *usrhdr; int len = 0; if (shdr->scn_id != RTAS_USR_HDR_SCN) { errno = EFAULT; return 0; } usrhdr = (struct rtas_usr_hdr_scn *)shdr; len += print_v6_hdr("User Header", &usrhdr->v6hdr, verbosity); len += print_usr_hdr_subsystem_id(usrhdr); len += print_usr_hdr_event_data(usrhdr); len += print_usr_hdr_action(usrhdr); len += rtas_print("\n"); return len; } /** * parse_mtms * */ void parse_mtms(struct rtas_event *re, struct rtas_mtms *mtms) { rtas_copy(mtms->model, re, 8); mtms->model[8] = '\0'; rtas_copy(mtms->serial_no, re, 12); mtms->serial_no[12] = '\0'; } /** * print_mtms * */ int print_mtms(struct rtas_mtms *mtms) { int len; len = rtas_print("%-20s%s (tttt-mmm)\n", "Model/Type:", mtms->model); len += rtas_print("%-20s%s\n", "Serial Number:", mtms->serial_no); return len; } /** * parse_mt_scn * */ int parse_mt_scn(struct rtas_event *re) { struct rtas_mt_scn *mt; mt = malloc(sizeof(*mt)); if (mt == NULL) { errno = ENOMEM; return -1; } memset(mt, 0, sizeof(*mt)); mt->shdr.raw_offset = re->offset; rtas_copy(RE_SHDR_OFFSET(mt), re, sizeof(struct rtas_v6_hdr_raw)); parse_mtms(re, &mt->mtms); add_re_scn(re, mt, RTAS_MT_SCN); return 0; } /** * rtas_get_mtms_scn * @brief retrieve the Failing Enclosure (MTMS) section of an RTAS Event * * @param re rtas_event pointer * @return pointer to rtas_event_scn on success, NULL on failure */ struct rtas_mt_scn * rtas_get_mt_scn(struct rtas_event *re) { return (struct rtas_mt_scn *)get_re_scn(re, RTAS_MT_SCN); } /** * print_re_mt_scn * @brief print the contents of a Machine Type section * * @param res rtas_event_scn pointer for mtms section * @param verbosity verbose level of output * @return number of bytes written */ int print_re_mt_scn(struct scn_header *shdr, int verbosity) { struct rtas_mt_scn *mt; int len = 0; if (shdr->scn_id != RTAS_MT_SCN) { errno = EFAULT; return 0; } mt = (struct rtas_mt_scn *)shdr; len += print_v6_hdr("Machine Type", (struct rtas_v6_hdr *)&mt->v6hdr, verbosity); len += print_mtms(&mt->mtms); len += rtas_print("\n"); return len; } /** * parse_generic_v6_scn * */ int parse_generic_v6_scn(struct rtas_event *re) { struct rtas_v6_generic *gen; struct rtas_v6_hdr_raw *rawhdr; gen = malloc(sizeof(*gen)); if (gen == NULL) { errno = ENOMEM; return -1; } memset(gen, 0, sizeof(*gen)); gen->shdr.raw_offset = re->offset; rawhdr = (struct rtas_v6_hdr_raw *)(re->buffer + re->offset); parse_v6_hdr(&gen->v6hdr, rawhdr); re->offset += RTAS_V6_HDR_SIZE; if (gen->v6hdr.length > RTAS_V6_HDR_SIZE) { uint32_t data_sz = gen->v6hdr.length - RTAS_V6_HDR_SIZE; gen->data = malloc(data_sz); if (gen->data == NULL) { free(gen); errno = ENOMEM; return -1; } memset(gen->data, 0, data_sz); rtas_copy(gen->data, re, data_sz); } add_re_scn(re, gen, RTAS_GENERIC_SCN); return 0; } /** * print_re_generic_scn * */ int print_re_generic_scn(struct scn_header *shdr, int verbosity) { struct rtas_v6_generic *gen; uint32_t len = 0; if (shdr->scn_id != RTAS_GENERIC_SCN) { errno = EFAULT; return 0; } gen = (struct rtas_v6_generic *)shdr; len += print_v6_hdr("Unknown Section", &gen->v6hdr, 2); len += rtas_print("\n"); if (gen->data != NULL) { len += rtas_print("Raw Section Data:\n"); len += print_raw_data(gen->data, gen->v6hdr.length - sizeof(struct rtas_v6_hdr_raw)); } len += rtas_print("\n"); return len; } librtas-2.0.0/librtasevent_src/rtas_vend.c000066400000000000000000000105171270107623400206610ustar00rootroot00000000000000/** * @file rtas_vend.c * @brief RTAS error log detial for vendor specific extensions * * Copyright (C) IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @author Nathan Fontenot */ #include #include #include #include #include "librtasevent.h" #include "rtas_event.h" /** * parse_ibm diag_scn * */ int parse_ibm_diag_scn(struct rtas_event *re) { struct rtas_ibm_diag_scn *ibmdiag; ibmdiag = malloc(sizeof(*ibmdiag)); if (ibmdiag == NULL) { errno = ENOMEM; return -1; } ibmdiag->shdr.raw_offset = re->offset; rtas_copy(RE_SHDR_OFFSET(ibmdiag), re, sizeof(uint32_t)); add_re_scn(re, ibmdiag, RTAS_IBM_DIAG_SCN); return 0; } /** * rtas_get_ibm_diag_scn * @brief Retrieve the IBM Diagnostic Log section of the RTAS Event * * @param re rtas_event pointer * @return rtas_event_scn pointer for diagnostics log section */ struct rtas_ibm_diag_scn * rtas_get_ibm_diag_scn(struct rtas_event *re) { return (struct rtas_ibm_diag_scn *)get_re_scn(re, RTAS_IBM_DIAG_SCN); } /** * print_re_ibm_diag_scn * @brief print the contents of an IBM diagnostics log section * * @param res rtas_event_scn pointer for IBM diagnostics log section * @param verbosity verbose level of output * @return number of bytes written */ int print_re_ibm_diag_scn(struct scn_header *shdr, int verbosity) { struct rtas_ibm_diag_scn *ibmdiag; int len = 0; if (shdr->scn_id != RTAS_IBM_DIAG_SCN) { errno = EFAULT; return -1; } ibmdiag = (struct rtas_ibm_diag_scn *)shdr; len += print_scn_title("IBM Diagnostics Section"); len += rtas_print(PRNT_FMT"\n", "Event ID:", ibmdiag->event_id); return len; } /** * parse_vend_specific_scn * */ int parse_vend_errlog_scn(struct rtas_event *re) { struct rtas_vend_errlog *ve; ve = malloc(sizeof(*ve)); if (ve == NULL) { errno = ENOMEM; return -1; } ve->shdr.raw_offset = re->offset; rtas_copy(RE_SHDR_OFFSET(ve), re, 4); /* See if there is additional data */ ve->vendor_data_sz = re->event_length - re->offset; if (ve->vendor_data_sz > 0) { ve->vendor_data = malloc(ve->vendor_data_sz); if (ve->vendor_data == NULL) { errno = ENOMEM; return -1; } rtas_copy(ve->vendor_data, re, ve->vendor_data_sz); } add_re_scn(re, ve, RTAS_VEND_ERRLOG_SCN); return 0; } /** * rtas_get_vend_specific * @brief retrive a vendor specific section of the RTAS event * * @param re parsed rtas event * @return reference to a rtas_event_scn on success, NULL on failure */ struct rtas_vend_errlog_scn * rtas_get_vend_errlog_scn(struct rtas_event *re) { return (struct rtas_vend_errlog_scn *)get_re_scn(re, RTAS_VEND_ERRLOG_SCN); } /** * print_re_vend_specific_scn * @brief print the contents of a vendor specific section * * @param res rtas_event_scn to print * @param verbosity verbose level * @return number of bytes written */ int print_re_vend_errlog_scn(struct scn_header *shdr, int verbosity) { struct rtas_vend_errlog *ve; int len = 0; if (shdr->scn_id != RTAS_VEND_ERRLOG_SCN) { errno = EFAULT; return -1; } ve = (struct rtas_vend_errlog *)shdr; len += print_scn_title("Vendor Error Log Section"); len += rtas_print("%-20s%c%c%c%c\n", "Vendor ID:", ve->vendor_id[0], ve->vendor_id[1], ve->vendor_id[2], ve->vendor_id[3]); if (ve->vendor_data != NULL) { len += rtas_print("Raw Vendor Error Log:\n"); len += print_raw_data(ve->vendor_data, ve->vendor_data_sz); } return len; } librtas-2.0.0/rules.mk000066400000000000000000000132161270107623400146410ustar00rootroot00000000000000# # Common Makefile definitions # PWD = $(shell echo `pwd`) INSTALL = /usr/bin/install DOXYGEN = `which doxygen` # Name of the rpm spec file SPECFILENAME = librtas.spec SPECFILENAME_IN = librtas.spec.in # resolves the root directory at which this build is occuring ROOT_DIR = \ $(shell \ while [ `pwd` != "/" ]; \ do \ if [ -f `pwd`/$(SPECFILENAME_IN) ]; \ then \ echo `pwd`; \ break; \ fi; \ cd ..; \ done;) # Full path to the rpm specfile SPECFILE = $(ROOT_DIR)/$(SPECFILENAME) SPECFILE_IN = $(ROOT_DIR)/$(SPECFILENAME_IN) # Find the correct command to build RPM's RPM = \ $(shell \ if [ -a /bin/rpmbuild ]; then \ echo "/bin/rpmbuild"; \ elif [ -a /usr/bin/rpmbuild ]; then \ echo "/usr/bin/rpmbuild"; \ elif [ -a /bin/rpm ]; then \ echo "/bin/rpm"; \ elif [ -a /usr/bin/rpm ]; then \ echo "/usr/bin/rpmbuild"; \ else \ echo "rpm seems to be non-existant"; \ fi;) # Pull the version, release and project name info from the spec file VERSION := $(shell echo `grep "define version" $(SPECFILE_IN) | cut -d' ' -f3`) RELEASE := $(shell echo `grep "define release" $(SPECFILE_IN) | cut -d' ' -f3`) PROJECT := $(shell echo `grep "define name" $(SPECFILE_IN) | cut -d' ' -f3`) # Generate the Major, Minor and Revision numbers from the version VERSION_LIST := $(subst ., ,$(VERSION)) MAJOR_NO := $(word 1,$(VERSION_LIST)) MINOR_NO := $(word 2,$(VERSION_LIST)) REVISION_NO := $(word 3,$(VERSION_LIST)) # Set this if you want to install to a base directory other than / DESTDIR ?= # Standard base directory names BIN_DIR = /usr/bin SBIN_DIR = /usr/sbin LIB_DIR = /usr/lib INC_DIR = /usr/include/ DOC_DIR = /usr/share/doc/packages/$(PROJECT) MAN_DIR = /usr/share/man/man8 # Shipdir is where we put all the files to build an rpm SHIPDIR = /tmp/$(PROJECT)-buildroot # Source tarball name and build directory TARBALL = $(PROJECT)-$(VERSION).tar.gz TARBALL_FILES = Makefile rules.mk $(SPECFILENAME_IN) TB_DIR = $(PROJECT)-$(VERSION) # Build a tarball of the source code BUILD_TARBALL = \ $(shell \ echo CVS > ./ignore; \ mkdir $(TB_DIR); \ cp -R $(SUBDIRS) $(TARBALL_FILES) $(TB_DIR); \ tar -zcf $(TARBALL) -X ./ignore $(TB_DIR); \ rm -rf ./ignore $(TB_DIR);) # Development snapshot builds DEVBALL = $(PROJECT)-$(VERSION)-`date +%Y%m%d`.tar.gz # Build a development snapshot of the source code BUILD_DEVBALL = \ $(shell \ echo CVS > ./ignore; \ mkdir $(TB_DIR); \ cp -R $(SUBDIRS) $(TARBALL_FILES) $(TB_DIR); \ tar -zcf $(DEVBALL) -X ./ignore $(TB_DIR); \ rm -rf ./ignore $(TB_DIR);) # Current build directory WORK_DIR = $(patsubst /%,%,$(subst $(ROOT_DIR),,$(PWD))) # You should always build with -Wall CFLAGS += -Wall # Uncomment this for debug builds CFLAGS += -g -DDEBUG # If you wish to have a log of installed files, define the file here INSTALL_LOG ?= $(ROOT_DIR)/install.log # # is_lib64 - determine if a library is 64-bit # # $1 library to examine define is_lib64 $(findstring 64,$(shell file $(firstword $1))) endef # # install_files - Install file(s) in the given location # # $1 - files to be installed # $2 - permissions to install file with # $3 - directory to install file to define install_files $(INSTALL) -d -m 755 $3; $(foreach f,$1, \ echo "Installing $(patsubst /%,%,$(WORK_DIR)/$f)"; \ $(INSTALL) -m $2 $f $3; \ $(if $(INSTALL_LOG),echo $3/$f >> $(INSTALL_LOG);,)) endef # # The following are wrappers for calls to install_files for # installing files in known locations (i.e. /usr/bin). The args # to each of the wrappers are the same. # # $1 - files to be installed # $2 - prefix to install path for the files # define install_bin $(call install_files,$1,755,$2/$(BIN_DIR)) endef define install_sbin $(call install_files,$1,744,$2/$(SBIN_DIR)) endef define install_lib $(call install_files,$1,755,$2/$(LIB_DIR)$(call is_lib64,$1)) endef define install_inc $(call install_files,$1,644,$2/$(INC_DIR)) endef define install_doc $(call install_files,$1,644,$2/$(DOC_DIR)) endef define install_man $(call install_files,$1,644,$2/$(MAN_DIR)) endef # # uninstall_files - Uninstall file(s) # # $1 - files to be uninstalled # $2 - the directory the files to uninstall live in define uninstall_files $(foreach f,$1, \ echo "Un-installing $(patsubst /%,%,$(WORK_DIR)/$f)"; \ rm -f $2/$f;) endef # # The following are wrappers for calls to uninstall_files for # removing files in known locations (i.e. /usr/bin). The args # to each of the wrappers are the same. # # $1 - files to be uninstalled # $2 - prefix to uninstall path for the files # define uninstall_bin $(call uninstall_files,$1,$2/$(BIN_DIR)) endef define uninstall_sbin $(call uninstall_files,$1,$2/$(SBIN_DIR)) endef define uninstall_lib $(call uninstall_files,$1,$2/$(LIB_DIR)$(call is_lib64,$1)) endef define uninstall_inc $(call uninstall_files,$1,$2/$(INC_DIR)) endef define uninstall_doc $(call uninstall_files,$1,$2/$(DOC_DIR)) endef define uninstall_man $(call uninstall_files,$1,$2/$(MAN_DIR)) endef # Define "CLEAN" as rm plus any files defined in this file that # the actual Makefile may not (or have to) know about CLEAN = /bin/rm -rf $(INSTALL_LOG) $(TB_DIR) *~ # Default target for building object files %.o: %.c @echo "CC $(WORK_DIR)/$@" @$(CC) -c $(CFLAGS) $<